aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-10-19 21:48:17 +0000
committerFinn Bock <bckfnn@apache.org>2004-10-19 21:48:17 +0000
commitb3ba1251971aa4485a76c3273dd0ddff3f7864e7 (patch)
tree431dce0646de8445a4f39925e8c34809f7ec9d43
parent523c5c32e39ad118f2bd72379d797cda8a81e9b8 (diff)
downloadxmlgraphics-fop-b3ba1251971aa4485a76c3273dd0ddff3f7864e7.tar.gz
xmlgraphics-fop-b3ba1251971aa4485a76c3273dd0ddff3f7864e7.zip
Third phase of performance improvement.
- Use CommonBorderPaddingBackground. PR: 31699 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198072 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCell.java3
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java70
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java16
-rw-r--r--src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java8
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java8
-rw-r--r--src/java/org/apache/fop/layoutmgr/TraitSetter.java63
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/Item.java34
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java30
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java14
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Body.java26
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Cell.java29
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Column.java26
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Row.java26
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java32
14 files changed, 130 insertions, 255 deletions
diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java
index 8ca7ca2ed..e8c92613d 100644
--- a/src/java/org/apache/fop/fo/flow/TableCell.java
+++ b/src/java/org/apache/fop/fo/flow/TableCell.java
@@ -38,7 +38,6 @@ import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.LengthPairProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.table.Cell;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
/**
* Class modelling the fo:table-cell object.
@@ -193,7 +192,7 @@ public class TableCell extends FObj {
* Calculate cell border and padding, including offset of content
* rectangle from the theoretical grid position.
*/
- private void calcBorders(CommonBorderAndPadding bp) {
+ private void calcBorders(CommonBorderPaddingBackground bp) {
if (this.borderCollapse == BorderCollapse.SEPARATE) {
/*
* Easy case.
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index f0e2fd844..6e360bbe2 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -24,11 +24,8 @@ import java.awt.geom.Rectangle2D;
import org.apache.fop.area.Area;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.Block;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.BlockContainer;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.area.CTM;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.datatypes.Length;
@@ -39,20 +36,17 @@ import org.apache.fop.traits.MinOptMax;
* LayoutManager for a block FO.
*/
public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
-
+ private BlockContainer fobj;
+
private BlockViewport viewportBlockArea;
private Block curBlockArea;
private List childBreaks = new java.util.ArrayList();
private CommonAbsolutePosition abProps;
- private CommonBorderAndPadding borderProps;
- private CommonMarginBlock marginProps;
private FODimension relDims;
private CTM absoluteCTM;
private boolean clip = false;
- private int overflow;
- private PropertyManager propManager;
private Length width;
private Length height;
@@ -62,41 +56,31 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
/**
* Create a new block container layout manager.
*/
- public BlockContainerLayoutManager(FObj node) {
+ public BlockContainerLayoutManager(BlockContainer node) {
super(node);
+ fobj = node;
}
/**
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
- propManager = fobj.getPropertyManager();
-
- abProps = propManager.getAbsolutePositionProps();
+ abProps = fobj.getCommonAbsolutePosition();
if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
- Rectangle2D rect = new Rectangle2D.Double(abProps.left,
- abProps.top, abProps.right - abProps.left,
- abProps.bottom - abProps.top);
+ Rectangle2D rect = new Rectangle2D.Double(abProps.left.getValue(),
+ abProps.top.getValue(), abProps.right.getValue() - abProps.left.getValue(),
+ abProps.bottom.getValue() - abProps.top.getValue());
relDims = new FODimension(0, 0);
- absoluteCTM = CTM.getCTMandRelDims(propManager.getAbsRefOrient(),
- propManager.getWritingMode(), rect, relDims);
+ absoluteCTM = CTM.getCTMandRelDims(fobj.getReferenceOrientation(),
+ fobj.getWritingMode(), rect, relDims);
}
-
- marginProps = propManager.getMarginProps();
- borderProps = propManager.getBorderAndPadding();
- height = fobj.getPropertyList().get(
- PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange().getOptimum().getLength();
- width = fobj.getPropertyList().get(
- PR_INLINE_PROGRESSION_DIMENSION).getLengthRange().getOptimum().getLength();
- }
-
- public void setOverflow(int of) {
- overflow = of;
+
+ height = fobj.getBlockProgressionDimension().getOptimum().getLength();
+ width = fobj.getInlineProgressionDimension().getOptimum().getLength();
}
protected int getRotatedIPD() {
- return fobj.getPropLength(PR_INLINE_PROGRESSION_DIMENSION
- | CP_OPTIMUM);
+ return fobj.getInlineProgressionDimension().getOptimum().getLength().getValue();
}
public BreakPoss getNextBreakPoss(LayoutContext context) {
@@ -115,8 +99,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
}
Rectangle2D rect = new Rectangle2D.Double(0, 0, ipd, bpd);
relDims = new FODimension(0, 0);
- absoluteCTM = CTM.getCTMandRelDims(propManager.getAbsRefOrient(),
- propManager.getWritingMode(), rect, relDims);
+ absoluteCTM = CTM.getCTMandRelDims(fobj.getReferenceOrientation(),
+ fobj.getWritingMode(), rect, relDims);
double[] vals = absoluteCTM.toArray();
MinOptMax stackLimit;
@@ -241,9 +225,9 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
breakPoss.setStackingSize(new MinOptMax(0));
if (stackSize.opt > relDims.bpd) {
- if (overflow == Overflow.HIDDEN) {
+ if (fobj.getOverflow() == Overflow.HIDDEN) {
clip = true;
- } else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
+ } else if (fobj.getOverflow() == Overflow.ERROR_IF_OVERFLOW) {
log.error("contents overflows block-container viewport: clipping");
clip = true;
}
@@ -256,7 +240,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
LayoutContext layoutContext) {
getParentArea(null);
- addID();
+ addID(fobj.getId());
addMarkers(true, true);
LayoutManager childLM;
@@ -292,16 +276,14 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
public Area getParentArea(Area childArea) {
if (curBlockArea == null) {
viewportBlockArea = new BlockViewport();
- TraitSetter.addBorders(viewportBlockArea,
- propManager.getBorderAndPadding());
- TraitSetter.addBackground(viewportBlockArea,
- propManager.getBackgroundProps());
+ TraitSetter.addBorders(viewportBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(viewportBlockArea, fobj.getCommonBorderPaddingBackground());
if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
- viewportBlockArea.setXOffset(abProps.left);
- viewportBlockArea.setYOffset(abProps.top);
- viewportBlockArea.setIPD(abProps.right - abProps.left);
- viewportBlockArea.setBPD(abProps.bottom - abProps.top);
+ viewportBlockArea.setXOffset(abProps.left.getValue());
+ viewportBlockArea.setYOffset(abProps.top.getValue());
+ viewportBlockArea.setIPD(abProps.right.getValue() - abProps.left.getValue());
+ viewportBlockArea.setBPD(abProps.bottom.getValue() - abProps.top.getValue());
viewportBlockArea.setCTM(absoluteCTM);
viewportBlockArea.setClip(clip);
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index f5b6d5f47..3894144c6 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -30,8 +30,6 @@ import org.apache.fop.area.Block;
import org.apache.fop.area.BlockParent;
import org.apache.fop.area.LineArea;
import org.apache.fop.traits.LayoutProps;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.traits.MinOptMax;
@@ -46,8 +44,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
protected ListIterator proxyLMiter;
private LayoutProps layoutProps;
- private CommonBorderAndPadding borderProps;
- private CommonBackground backgroundProps;
private CommonMarginBlock marginProps;
/* holds the (one-time use) fo:block space-before
@@ -91,8 +87,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
protected void initProperties() {
PropertyManager pm = fobj.getPropertyManager();
layoutProps = pm.getLayoutProps();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
marginProps = pm.getMarginProps();
foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
prevFoBlockSpaceAfter = foBlockSpaceAfter;
@@ -177,7 +171,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
int ipd = context.getRefIPD();
int iIndents = marginProps.startIndent + marginProps.endIndent;
- int bIndents = borderProps.getBPPaddingAndBorder(false);
+ int bIndents = fobj.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
ipd -= iIndents;
MinOptMax stackSize = new MinOptMax();
@@ -303,7 +297,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
}
- int bIndents = borderProps.getBPPaddingAndBorder(false);
+ int bIndents = fobj.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
addMarkers(false, true);
@@ -331,9 +325,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
curBlockArea = new Block();
// set traits
- TraitSetter.addBorders(curBlockArea, borderProps);
- TraitSetter.addBackground(curBlockArea, backgroundProps);
- TraitSetter.addMargins(curBlockArea, borderProps, marginProps);
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addMargins(curBlockArea, fobj.getCommonBorderPaddingBackground(), marginProps);
TraitSetter.addBreaks(curBlockArea, layoutProps);
// Set up dimensions
diff --git a/src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java b/src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java
index dc833607f..adc96e1c1 100644
--- a/src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java
@@ -27,8 +27,6 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.flow.ExternalGraphic;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.ImageFactory;
@@ -224,10 +222,8 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager {
vp.setOffset(0);
// Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = graphic.getPropertyManager().getBorderAndPadding();
- CommonBackground bProps = graphic.getPropertyManager().getBackgroundProps();
- TraitSetter.addBorders(vp, bap);
- TraitSetter.addBackground(vp, bProps);
+ TraitSetter.addBorders(vp, graphic.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(vp, graphic.getCommonBorderPaddingBackground());
return vp;
}
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index 007c83157..4d9497beb 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -50,8 +50,6 @@ import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
-import org.apache.fop.fo.properties.CommonBackground;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import java.util.ArrayList;
@@ -846,10 +844,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements
*/
private void setRegionViewportTraits(Region r, RegionViewport rv) {
// Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = r.getPropertyManager().getBorderAndPadding();
- CommonBackground bProps = r.getPropertyManager().getBackgroundProps();
- TraitSetter.addBorders(rv, bap);
- TraitSetter.addBackground(rv, bProps);
+ TraitSetter.addBorders(rv, r.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground());
}
private RegionReference makeRegionBodyReferenceArea(Region r,
diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java
index 005e00b7b..f4e3b6004 100644
--- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java
+++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java
@@ -18,13 +18,12 @@
package org.apache.fop.layoutmgr;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.traits.BorderProps;
import org.apache.fop.traits.LayoutProps;
import org.apache.fop.area.Area;
import org.apache.fop.area.Trait;
-import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonMarginBlock;
+import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* This is a helper class used for setting common traits on areas.
@@ -37,39 +36,39 @@ public class TraitSetter {
* @param bpProps border and padding properties
*/
public static void setBorderPaddingTraits(Area area,
- CommonBorderAndPadding bpProps, boolean bNotFirst, boolean bNotLast) {
+ CommonBorderPaddingBackground bpProps, boolean bNotFirst, boolean bNotLast) {
int iBP;
- iBP = bpProps.getPadding(CommonBorderAndPadding.START, bNotFirst);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.START, bNotFirst);
if (iBP > 0) {
//area.addTrait(new Trait(Trait.PADDING_START, new Integer(iBP)));
area.addTrait(Trait.PADDING_START, new Integer(iBP));
}
- iBP = bpProps.getPadding(CommonBorderAndPadding.END, bNotLast);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.END, bNotLast);
if (iBP > 0) {
//area.addTrait(new Trait(Trait.PADDING_END, new Integer(iBP)));
area.addTrait(Trait.PADDING_END, new Integer(iBP));
}
- iBP = bpProps.getPadding(CommonBorderAndPadding.BEFORE, false);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
if (iBP > 0) {
// area.addTrait(new Trait(Trait.PADDING_BEFORE, new Integer(iBP)));
area.addTrait(Trait.PADDING_BEFORE, new Integer(iBP));
}
- iBP = bpProps.getPadding(CommonBorderAndPadding.AFTER, false);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
if (iBP > 0) {
//area.addTrait(new Trait(Trait.PADDING_AFTER, new Integer(iBP)));
area.addTrait(Trait.PADDING_AFTER, new Integer(iBP));
}
addBorderTrait(area, bpProps, bNotFirst,
- CommonBorderAndPadding.START, Trait.BORDER_START);
+ CommonBorderPaddingBackground.START, Trait.BORDER_START);
- addBorderTrait(area, bpProps, bNotLast, CommonBorderAndPadding.END,
+ addBorderTrait(area, bpProps, bNotLast, CommonBorderPaddingBackground.END,
Trait.BORDER_END);
- addBorderTrait(area, bpProps, false, CommonBorderAndPadding.BEFORE,
+ addBorderTrait(area, bpProps, false, CommonBorderPaddingBackground.BEFORE,
Trait.BORDER_BEFORE);
- addBorderTrait(area, bpProps, false, CommonBorderAndPadding.AFTER,
+ addBorderTrait(area, bpProps, false, CommonBorderPaddingBackground.AFTER,
Trait.BORDER_AFTER);
}
@@ -79,7 +78,7 @@ public class TraitSetter {
* @param bpProps border and padding properties
*/
private static void addBorderTrait(Area area,
- CommonBorderAndPadding bpProps,
+ CommonBorderPaddingBackground bpProps,
boolean bDiscard, int iSide,
Object oTrait) {
int iBP = bpProps.getBorderWidth(iSide, bDiscard);
@@ -101,46 +100,46 @@ public class TraitSetter {
* @param curBlock area to set the traits on
* @param bordProps border properties
*/
- public static void addBorders(Area curBlock, CommonBorderAndPadding bordProps) {
- BorderProps bps = getBorderProps(bordProps, CommonBorderAndPadding.BEFORE);
+ public static void addBorders(Area curBlock, CommonBorderPaddingBackground bordProps) {
+ BorderProps bps = getBorderProps(bordProps, CommonBorderPaddingBackground.BEFORE);
if (bps.width != 0) {
curBlock.addTrait(Trait.BORDER_BEFORE, bps);
}
- bps = getBorderProps(bordProps, CommonBorderAndPadding.AFTER);
+ bps = getBorderProps(bordProps, CommonBorderPaddingBackground.AFTER);
if (bps.width != 0) {
curBlock.addTrait(Trait.BORDER_AFTER, bps);
}
- bps = getBorderProps(bordProps, CommonBorderAndPadding.START);
+ bps = getBorderProps(bordProps, CommonBorderPaddingBackground.START);
if (bps.width != 0) {
curBlock.addTrait(Trait.BORDER_START, bps);
}
- bps = getBorderProps(bordProps, CommonBorderAndPadding.END);
+ bps = getBorderProps(bordProps, CommonBorderPaddingBackground.END);
if (bps.width != 0) {
curBlock.addTrait(Trait.BORDER_END, bps);
}
- int padding = bordProps.getPadding(CommonBorderAndPadding.START, false);
+ int padding = bordProps.getPadding(CommonBorderPaddingBackground.START, false);
if (padding != 0) {
curBlock.addTrait(Trait.PADDING_START, new java.lang.Integer(padding));
}
- padding = bordProps.getPadding(CommonBorderAndPadding.END, false);
+ padding = bordProps.getPadding(CommonBorderPaddingBackground.END, false);
if (padding != 0) {
curBlock.addTrait(Trait.PADDING_END, new java.lang.Integer(padding));
}
- padding = bordProps.getPadding(CommonBorderAndPadding.BEFORE, false);
+ padding = bordProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
if (padding != 0) {
curBlock.addTrait(Trait.PADDING_BEFORE, new java.lang.Integer(padding));
}
- padding = bordProps.getPadding(CommonBorderAndPadding.AFTER, false);
+ padding = bordProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
if (padding != 0) {
curBlock.addTrait(Trait.PADDING_AFTER, new java.lang.Integer(padding));
}
}
- private static BorderProps getBorderProps(CommonBorderAndPadding bordProps, int side) {
+ private static BorderProps getBorderProps(CommonBorderPaddingBackground bordProps, int side) {
BorderProps bps;
bps = new BorderProps(bordProps.getBorderStyle(side),
bordProps.getBorderWidth(side, false),
@@ -155,18 +154,18 @@ public class TraitSetter {
* @param curBlock the current block
* @param backProps the background properties
*/
- public static void addBackground(Area curBlock, CommonBackground backProps) {
+ public static void addBackground(Area curBlock, CommonBorderPaddingBackground backProps) {
Trait.Background back = new Trait.Background();
- back.setColor(backProps.backColor);
+ back.setColor(backProps.backgroundColor);
- if (backProps.backImage != null) {
- back.setURL(backProps.backImage);
- back.setRepeat(backProps.backRepeat);
- if (backProps.backPosHorizontal != null) {
- back.setHoriz(backProps.backPosHorizontal.getValue());
+ if (backProps.backgroundImage != null) {
+ back.setURL(backProps.backgroundImage);
+ back.setRepeat(backProps.backgroundRepeat);
+ if (backProps.backgroundPositionHorizontal != null) {
+ back.setHoriz(backProps.backgroundPositionHorizontal.getValue());
}
- if (backProps.backPosVertical != null) {
- back.setVertical(backProps.backPosVertical.getValue());
+ if (backProps.backgroundPositionVertical != null) {
+ back.setVertical(backProps.backgroundPositionVertical.getValue());
}
}
@@ -183,7 +182,7 @@ public class TraitSetter {
* @param marginProps the margin properties.
*/
public static void addMargins(Area curBlock,
- CommonBorderAndPadding bpProps,
+ CommonBorderPaddingBackground bpProps,
CommonMarginBlock marginProps) {
int spaceStart = marginProps.startIndent
- bpProps.getBorderStartWidth(false)
diff --git a/src/java/org/apache/fop/layoutmgr/list/Item.java b/src/java/org/apache/fop/layoutmgr/list/Item.java
index 46ead4045..da35dd383 100644
--- a/src/java/org/apache/fop/layoutmgr/list/Item.java
+++ b/src/java/org/apache/fop/layoutmgr/list/Item.java
@@ -18,8 +18,8 @@
package org.apache.fop.layoutmgr.list;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.ListItemBody;
+import org.apache.fop.fo.flow.ListItemLabel;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
@@ -28,12 +28,9 @@ import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.BreakPossPosIter;
import org.apache.fop.layoutmgr.Position;
-import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.ArrayList;
import java.util.List;
@@ -44,9 +41,6 @@ import java.util.List;
*/
public class Item extends BlockStackingLayoutManager {
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
-
private Block curBlockArea;
private List childBreaks = new ArrayList();
@@ -57,17 +51,23 @@ public class Item extends BlockStackingLayoutManager {
/**
* Create a new Cell layout manager.
*/
- public Item(FObj node) {
+ public Item(ListItemLabel node) {
+ super(node);
+ fobj = node;
+ }
+
+ /**
+ * Create a new Cell layout manager.
+ */
+ public Item(ListItemBody node) {
super(node);
+ fobj = node;
}
/**
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
}
/**
@@ -167,7 +167,13 @@ public class Item extends BlockStackingLayoutManager {
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
- addID();
+
+ int nameId = fobj.getNameId();
+ if (nameId == FO_LIST_ITEM_LABEL) {
+ addID(((ListItemLabel) fobj).getId());
+ } else if (nameId == FO_LIST_ITEM_BODY) {
+ addID(((ListItemBody) fobj).getId());
+ }
LayoutManager childLM;
int iStartPos = 0;
@@ -184,12 +190,14 @@ public class Item extends BlockStackingLayoutManager {
}
}
+ /*
if (borderProps != null) {
TraitSetter.addBorders(curBlockArea, borderProps);
}
if (backgroundProps != null) {
TraitSetter.addBackground(curBlockArea, backgroundProps);
}
+ */
flush();
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
index a2f519c9a..06669a316 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
@@ -18,8 +18,7 @@
package org.apache.fop.layoutmgr.list;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.ListBlock;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
@@ -32,8 +31,6 @@ import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.ArrayList;
import java.util.List;
@@ -44,9 +41,8 @@ import java.util.List;
* the list block area..
*/
public class ListBlockLayoutManager extends BlockStackingLayoutManager {
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
-
+ private ListBlock fobj;
+
private Block curBlockArea;
private List bodyBreaks = new ArrayList();
@@ -63,17 +59,9 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager {
* Create a new table layout manager.
*
*/
- public ListBlockLayoutManager(FObj node) {
+ public ListBlockLayoutManager(ListBlock node) {
super(node);
- }
-
- /**
- * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
- */
- protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
+ fobj = node;
}
/**
@@ -178,12 +166,8 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager {
}
}
- if (borderProps != null) {
- TraitSetter.addBorders(curBlockArea, borderProps);
- }
- if (backgroundProps != null) {
- TraitSetter.addBackground(curBlockArea, backgroundProps);
- }
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
flush();
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
index 0e508adf0..3e600cad8 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
@@ -21,7 +21,6 @@ package org.apache.fop.layoutmgr.list;
import org.apache.fop.fo.flow.ListItem;
import org.apache.fop.fo.flow.ListItemBody;
import org.apache.fop.fo.flow.ListItemLabel;
-import org.apache.fop.fo.PropertyManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
@@ -33,8 +32,6 @@ import org.apache.fop.layoutmgr.Position;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.Iterator;
import java.util.ArrayList;
@@ -52,8 +49,6 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager {
private List cellList = null;
private int listItemHeight;
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
private class ItemPosition extends LeafPosition {
protected List cellBreaks;
@@ -74,15 +69,6 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager {
}
/**
- * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
- */
- protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
- }
-
- /**
* Create a LM for the fo:list-item-label object
* @param node the fo:list-item-label FO
*/
diff --git a/src/java/org/apache/fop/layoutmgr/table/Body.java b/src/java/org/apache/fop/layoutmgr/table/Body.java
index c2c781eb7..44f95f893 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Body.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Body.java
@@ -18,8 +18,7 @@
package org.apache.fop.layoutmgr.table;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.TableBody;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
@@ -32,8 +31,6 @@ import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.ArrayList;
import java.util.List;
@@ -44,9 +41,8 @@ import java.util.List;
* Cells are organised into rows.
*/
public class Body extends BlockStackingLayoutManager {
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
-
+ private TableBody fobj;
+
private boolean rows = true;
private List columns;
@@ -60,17 +56,9 @@ public class Body extends BlockStackingLayoutManager {
/**
* Create a new body layout manager.
*/
- public Body(FObj node) {
+ public Body(TableBody node) {
super(node);
- }
-
- /**
- * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
- */
- protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
+ fobj = node;
}
/**
@@ -266,9 +254,7 @@ public class Body extends BlockStackingLayoutManager {
public Area createColumnArea() {
Area curBlockArea = new Block();
- if (backgroundProps != null) {
- TraitSetter.addBackground(curBlockArea, backgroundProps);
- }
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
return curBlockArea;
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/Cell.java b/src/java/org/apache/fop/layoutmgr/table/Cell.java
index 93e1412f4..62008fcd4 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Cell.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Cell.java
@@ -18,8 +18,7 @@
package org.apache.fop.layoutmgr.table;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.TableCell;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
@@ -32,8 +31,6 @@ import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.ArrayList;
import java.util.List;
@@ -43,10 +40,8 @@ import java.util.List;
* A cell contains blocks. These blocks fill the cell.
*/
public class Cell extends BlockStackingLayoutManager {
-
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
-
+ private TableCell fobj;
+
private Block curBlockArea;
private List childBreaks = new ArrayList();
@@ -59,17 +54,15 @@ public class Cell extends BlockStackingLayoutManager {
/**
* Create a new Cell layout manager.
*/
- public Cell(FObj node) {
+ public Cell(TableCell node) {
super(node);
+ fobj = node;
}
/**
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
}
/**
@@ -187,7 +180,7 @@ public class Cell extends BlockStackingLayoutManager {
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
- addID();
+ addID(fobj.getId());
LayoutManager childLM;
int iStartPos = 0;
@@ -204,13 +197,9 @@ public class Cell extends BlockStackingLayoutManager {
}
}
- if (borderProps != null) {
- TraitSetter.addBorders(curBlockArea, borderProps);
- }
- if (backgroundProps != null) {
- TraitSetter.addBackground(curBlockArea, backgroundProps);
- }
-
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+
curBlockArea.setBPD(height);
flush();
diff --git a/src/java/org/apache/fop/layoutmgr/table/Column.java b/src/java/org/apache/fop/layoutmgr/table/Column.java
index b8d214f21..2ca5df071 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Column.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Column.java
@@ -19,8 +19,6 @@
package org.apache.fop.layoutmgr.table;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
import org.apache.fop.layoutmgr.AbstractLayoutManager;
import org.apache.fop.layoutmgr.BreakPoss;
import org.apache.fop.layoutmgr.LayoutContext;
@@ -29,8 +27,6 @@ import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.fo.flow.TableColumn;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
/**
* LayoutManager for a table-column FO.
@@ -39,23 +35,15 @@ import org.apache.fop.fo.properties.CommonBackground;
* column properties.
*/
public class Column extends AbstractLayoutManager {
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
+ private TableColumn fobj;
+
/**
* Create a new column layout manager.
*/
- public Column(FObj node) {
+ public Column(TableColumn node) {
super(node);
- }
-
- /**
- * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
- */
- protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
+ fobj = node;
}
/**
@@ -99,7 +87,7 @@ public class Column extends AbstractLayoutManager {
* @return the width of the column
*/
public Length getWidth() {
- return ((TableColumn)fobj).getColumnWidth();
+ return fobj.getColumnWidth();
}
/**
@@ -112,9 +100,7 @@ public class Column extends AbstractLayoutManager {
public Area createColumnArea() {
Area curBlockArea = new Block();
- if (backgroundProps != null) {
- TraitSetter.addBackground(curBlockArea, backgroundProps);
- }
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
return curBlockArea;
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/Row.java b/src/java/org/apache/fop/layoutmgr/table/Row.java
index efb3dba80..ba24a77f3 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Row.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Row.java
@@ -18,8 +18,7 @@
package org.apache.fop.layoutmgr.table;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
@@ -32,8 +31,6 @@ import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.Iterator;
import java.util.ArrayList;
@@ -47,13 +44,12 @@ import java.util.List;
* but effect the occupied columns of future rows.
*/
public class Row extends BlockStackingLayoutManager {
-
+ private TableRow fobj;
+
private List cellList = null;
private List columns = null;
private int rowHeight;
private int yoffset;
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
private class RowPosition extends LeafPosition {
protected List cellBreaks;
@@ -67,17 +63,9 @@ public class Row extends BlockStackingLayoutManager {
* Create a new row layout manager.
*
*/
- public Row(FObj node) {
+ public Row(TableRow node) {
super(node);
- }
-
- /**
- * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
- */
- protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
+ fobj = node;
}
/**
@@ -376,9 +364,7 @@ public class Row extends BlockStackingLayoutManager {
*/
public Area getRowArea() {
Area block = new Block();
- if (backgroundProps != null) {
- TraitSetter.addBackground(block, backgroundProps);
- }
+ TraitSetter.addBackground(block, fobj.getCommonBorderPaddingBackground());
return block;
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index b0768856b..af299f39a 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -20,8 +20,7 @@ package org.apache.fop.layoutmgr.table;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.PercentBase;
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyManager;
+import org.apache.fop.fo.flow.Table;
import org.apache.fop.fo.properties.TableColLength;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
@@ -35,8 +34,6 @@ import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.fo.properties.CommonBorderAndPadding;
-import org.apache.fop.fo.properties.CommonBackground;
import java.util.ArrayList;
import java.util.Iterator;
@@ -51,13 +48,12 @@ import java.util.List;
* the render background.
*/
public class TableLayoutManager extends BlockStackingLayoutManager {
+ private Table fobj;
+
private List columns = null;
private Body tableHeader = null;
private Body tableFooter = null;
- private CommonBorderAndPadding borderProps = null;
- private CommonBackground backgroundProps;
-
private Block curBlockArea;
private List bodyBreaks = new ArrayList();
@@ -76,17 +72,9 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
* Create a new table layout manager.
*
*/
- public TableLayoutManager(FObj node) {
+ public TableLayoutManager(Table node) {
super(node);
- }
-
- /**
- * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
- */
- protected void initProperties() {
- PropertyManager pm = fobj.getPropertyManager();
- borderProps = pm.getBorderAndPadding();
- backgroundProps = pm.getBackgroundProps();
+ fobj = node;
}
/**
@@ -284,7 +272,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
- addID();
+ addID(fobj.getId());
// add column, body then row areas
@@ -332,12 +320,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
curBlockArea.setBPD(tableHeight);
- if (borderProps != null) {
- TraitSetter.addBorders(curBlockArea, borderProps);
- }
- if (backgroundProps != null) {
- TraitSetter.addBackground(curBlockArea, backgroundProps);
- }
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
flush();