aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2003-11-11 04:40:12 +0000
committerGlen Mazza <gmazza@apache.org>2003-11-11 04:40:12 +0000
commited0e5a7849dac9b78b1b8f3058a9ce212326a85a (patch)
tree30b87a497e6d870157991a2e79b942bf94c47da1 /src/java/org/apache/fop/layoutmgr
parent79e31b059db22b84330ef22a91261f2b8baffbaa (diff)
downloadxmlgraphics-fop-ed0e5a7849dac9b78b1b8f3058a9ce212326a85a.tar.gz
xmlgraphics-fop-ed0e5a7849dac9b78b1b8f3058a9ce212326a85a.zip
fo:block space-before property now activated only on the first Area.Block object used
in rendering the fo:block. (Previous implementation repeated space-before at the top of every page.) Suggestion from Chris Bowditch. (Space-after property still needs work: renders at the correct places but results in subsequent text overrunning region borders.) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197003 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java25
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java3
2 files changed, 24 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 0681fdb27..bc82ca467 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -76,6 +76,17 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
private CommonBorderAndPadding borderProps;
private CommonBackground backgroundProps;
+ /* holds the (one-time use) fo:block space-before
+ and -after properties. Large fo:blocks are split
+ into multiple Area.Blocks to accomodate the subsequent
+ regions (pages) they are placed on. space-before
+ is applied at the beginning of the first
+ Block and space-after at the end of the last Block
+ used in rendering the fo:block.
+ */
+ private MinOptMax foBlockSpaceBefore = null;
+ private MinOptMax foBlockSpaceAfter = null; // not currently implemented
+
private int lead = 12000;
private int lineHeight = 14000;
private int follow = 2000;
@@ -169,6 +180,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
layoutProps = pm.getLayoutProps();
borderProps = pm.getBorderAndPadding();
backgroundProps = pm.getBackgroundProps();
+ foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
}
public BreakPoss getNextBreakPoss(LayoutContext context) {
@@ -177,9 +189,13 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
int ipd = context.getRefIPD();
MinOptMax stackSize = new MinOptMax();
- // if starting add space before
- stackSize.add(layoutProps.spaceBefore.getSpace());
+ if (foBlockSpaceBefore != null) {
+ // this function called before addAreas(), so
+ // setting foBlockSpaceBefore = null *in* addAreas()
+ stackSize.add(foBlockSpaceBefore);
+ }
+
BreakPoss lastPos = null;
while ((curLM = getChildLM()) != null) {
@@ -261,8 +277,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
// if adjusted space before
double adjust = layoutContext.getSpaceAdjust();
- addBlockSpacing(adjust, layoutProps.spaceBefore.getSpace());
-
+ addBlockSpacing(adjust, foBlockSpaceBefore);
+ foBlockSpaceBefore = null;
+
addID();
addMarkers(true, true);
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index d712b52f0..3eb468492 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -106,6 +106,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
* @param minoptmax the min/opt/max value of the spacing
*/
public void addBlockSpacing(double adjust, MinOptMax minoptmax) {
+ if (minoptmax == null) {
+ return;
+ }
int sp = minoptmax.opt;
if (adjust > 0) {
sp = sp + (int)(adjust * (minoptmax.max - minoptmax.opt));