]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Partial implementation of space-after functionality--mostly working, but
authorGlen Mazza <gmazza@apache.org>
Tue, 11 Nov 2003 13:50:00 +0000 (13:50 +0000)
committerGlen Mazza <gmazza@apache.org>
Tue, 11 Nov 2003 13:50:00 +0000 (13:50 +0000)
some remaining problems:

1.) relying on a static variable to carry space-after value from previous
block to current.  (BlockLayoutManager is be instantiated for each block
instead of being in memory for all blocks--bad design?)

2.) The space-after of a block ending at the bottom of the page is not
currently being added to the beginning of the subsequent page.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197004 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java

index bc82ca467b4240bf8a4e4d14ec579e65c55023f0..24f1efee6b23c07d17164853e4b2cef35cfe980d 100644 (file)
@@ -85,7 +85,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
        used in rendering the fo:block.
     */
     private MinOptMax foBlockSpaceBefore = null;
-    private MinOptMax foBlockSpaceAfter = null;  // not currently implemented
+    // need to retain foBlockSpaceAfter from previous instantiation
+    private static MinOptMax foBlockSpaceAfter = null;
+    private MinOptMax prevFoBlockSpaceAfter = null;
 
     private int lead = 12000;
     private int lineHeight = 14000;
@@ -181,6 +183,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
         borderProps = pm.getBorderAndPadding();
         backgroundProps = pm.getBackgroundProps();
         foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
+        prevFoBlockSpaceAfter = foBlockSpaceAfter;
     }
 
     public BreakPoss getNextBreakPoss(LayoutContext context) {
@@ -190,9 +193,14 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
 
         MinOptMax stackSize = new MinOptMax();
 
+        if (prevFoBlockSpaceAfter != null) {
+            stackSize.add(prevFoBlockSpaceAfter);
+            prevFoBlockSpaceAfter = null;
+        }
+
         if (foBlockSpaceBefore != null) {
             // this function called before addAreas(), so
-            // setting foBlockSpaceBefore = null *in* addAreas()
+            // resetting foBlockSpaceBefore = null in addAreas()
             stackSize.add(foBlockSpaceBefore);
         }
         
@@ -308,7 +316,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
         flush();
 
         // if adjusted space after
-        addBlockSpacing(adjust, layoutProps.spaceAfter.getSpace());
+        foBlockSpaceAfter = layoutProps.spaceAfter.getSpace();
+        addBlockSpacing(adjust, foBlockSpaceAfter);
 
         curBlockArea = null;
     }