Browse Source

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
pull/30/head
Finn Bock 20 years ago
parent
commit
1001667e6a

+ 13
- 2
src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java View File

@@ -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) {

+ 9
- 3
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java View File

@@ -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

Loading…
Cancel
Save