aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-01-29 19:43:05 +0000
committerFinn Bock <bckfnn@apache.org>2004-01-29 19:43:05 +0000
commit6c6419951e289d733de1a6a7337c844856444550 (patch)
tree9790fe49a55e216d0b21f6fe44088a32ce2f2c6d /src
parent411c78ffa31608842ef7ecae845cb9cf3b854e41 (diff)
downloadxmlgraphics-fop-6c6419951e289d733de1a6a7337c844856444550.tar.gz
xmlgraphics-fop-6c6419951e289d733de1a6a7337c844856444550.zip
Set the SPACE_START and SPACE_END traits and adjust the height to take
border and padding into account. PR: 25802. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197294 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java15
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java12
2 files changed, 22 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index d63f67c6c..1588c7139 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -58,6 +58,8 @@ import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.Block;
import org.apache.fop.fo.PropertyManager;
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.fo.PropertyList;
import org.apache.fop.area.CTM;
import org.apache.fop.datatypes.FODimension;
@@ -75,6 +77,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
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;
@@ -105,6 +109,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
absoluteCTM = CTM.getCTMandRelDims(pm.getAbsRefOrient(),
pm.getWritingMode(), rect, relDims);
}
+ marginProps = pm.getMarginProps();
+ borderProps = pm.getBorderAndPadding();
height = pm.getPropertyList().get(PR_HEIGHT).getLength();
width = pm.getPropertyList().get(PR_WIDTH).getLength();
}
@@ -123,13 +129,16 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
return getAbsoluteBreakPoss(context);
}
+ int bIndents = borderProps.getBPPaddingAndBorder(false);
+ int iIndents = marginProps.startIndent + marginProps.endIndent;
+
int ipd = context.getRefIPD();
int bpd = context.getStackLimit().opt;
if (!width.isAuto()) {
- ipd = width.getValue();
+ ipd = width.getValue() + iIndents;
}
if (!height.isAuto()) {
- bpd = height.getValue();
+ bpd = height.getValue() + bIndents;
}
Rectangle2D rect = new Rectangle2D.Double(0, 0, ipd, bpd);
relDims = new FODimension(0, 0);
@@ -137,6 +146,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
propManager.getWritingMode(), rect, relDims);
double[] vals = absoluteCTM.toArray();
+ ipd -= iIndents;
+
MinOptMax stackLimit;
boolean rotated = vals[0] == 0.0;
if (rotated) {
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 2579c0a27..396cba7db 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -63,6 +63,7 @@ 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;
/**
@@ -75,6 +76,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
private LayoutProps layoutProps;
private CommonBorderAndPadding borderProps;
private CommonBackground backgroundProps;
+ private CommonMarginBlock marginProps;
/* holds the (one-time use) fo:block space-before
and -after properties. Large fo:blocks are split
@@ -182,6 +184,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
layoutProps = pm.getLayoutProps();
borderProps = pm.getBorderAndPadding();
backgroundProps = pm.getBackgroundProps();
+ marginProps = pm.getMarginProps();
foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
prevFoBlockSpaceAfter = foBlockSpaceAfter;
}
@@ -190,8 +193,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
LayoutProcessor curLM; // currently active LM
int ipd = context.getRefIPD();
- int iIndents = borderProps.getPaddingStart(false)
- + borderProps.getPaddingEnd(false);
+ int iIndents = marginProps.startIndent + marginProps.endIndent;
+ int bIndents = borderProps.getBPPaddingAndBorder(false);
ipd -= iIndents;
MinOptMax stackSize = new MinOptMax();
@@ -206,7 +209,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
// resetting foBlockSpaceBefore = null in addAreas()
stackSize.add(foBlockSpaceBefore);
}
-
+
BreakPoss lastPos = null;
while ((curLM = getChildLM()) != null) {
@@ -313,6 +316,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
}
+ int bIndents = borderProps.getBPPaddingAndBorder(false);
+ curBlockArea.setHeight(curBlockArea.getHeight() + bIndents);
addMarkers(false, true);
@@ -342,6 +347,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
// set traits
TraitSetter.addBorders(curBlockArea, borderProps);
TraitSetter.addBackground(curBlockArea, backgroundProps);
+ TraitSetter.addMargins(curBlockArea, borderProps, marginProps);
// Set up dimensions
// Must get dimensions from parent area