]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Some code clean up. Not everything about space resolution is purged, yet.
authorJeremias Maerki <jeremias@apache.org>
Wed, 19 Oct 2005 13:59:50 +0000 (13:59 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 19 Oct 2005 13:59:50 +0000 (13:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_SpaceResolution@326562 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java

index a215ed6edbd129c739d2769d72068ee686aaac4b..d8183bcb81975c24b784876ef3ffe2d9c6822d73 100644 (file)
@@ -85,6 +85,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
         super(node);
     }
     
+    /** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
     public void initialize() {
         abProps = getBlockContainerFO().getCommonAbsolutePosition();
         foBlockSpaceBefore = new SpaceVal(getBlockContainerFO().getCommonMarginBlock()
@@ -445,7 +446,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
         contentRectOffsetX += getBlockContainerFO()
                 .getCommonMarginBlock().startIndent.getValue(this);
         double contentRectOffsetY = offset.getY();
-        contentRectOffsetY += getSpaceBefore();
+        contentRectOffsetY += getSpaceBefore(); //TODO Uhm, is that necessary?
         contentRectOffsetY += getBlockContainerFO()
                 .getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
         contentRectOffsetY += getBlockContainerFO()
@@ -628,9 +629,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
         return new Point(x, y);
     }
     
-    /**
-     * @see org.apache.fop.layoutmgr.LayoutManager#addAreas(org.apache.fop.layoutmgr.PositionIterator, org.apache.fop.layoutmgr.LayoutContext)
-     */
+    /** @see org.apache.fop.layoutmgr.LayoutManager */
     public void addAreas(PositionIterator parentIter,
             LayoutContext layoutContext) {
         getParentArea(null);
@@ -789,12 +788,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
                 //}
             }
     
-            // if adjusted space before
-//            if (bSpaceBefore) {
-//                addBlockSpacing(0, new MinOptMax(adjustedSpaceBefore));
-//            }
-            //addBlockSpacing(0, effSpaceBefore);
-    
             while ((childLM = childPosIter.getNextChildLM()) != null) {
                 // set last area flag
                 lc.setFlags(LayoutContext.LAST_AREA,
@@ -804,18 +797,10 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
                 childLM.addAreas(childPosIter, lc);
             }
         } else {
-            // if adjusted space before
-//            if (bSpaceBefore) {
-//                addBlockSpacing(0, new MinOptMax(adjustedSpaceBefore));
-//            }
-            //addBlockSpacing(0, effSpaceBefore);
             //Add child areas inside the reference area
             bcpos.getBreaker().addContainedAreas();
         }
 
-        //int bIndents = getBlockContainerFO().getCommonBorderPaddingBackground()
-        //    .getBPPaddingAndBorder(false);
-
         if (markers != null) {
             getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
         }
@@ -824,12 +809,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
                 effSpaceBefore, effSpaceAfter);
         flush();
 
-        // if adjusted space after
-//        if (bSpaceAfter) {
-//            addBlockSpacing(0, new MinOptMax(adjustedSpaceAfter));
-//        }
-        //addBlockSpacing(0, effSpaceAfter);
-
         viewportBlockArea = null;
         referenceArea = null;
         resetSpaces();
@@ -951,17 +930,13 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
         }
     }
 
-    /**
-     * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#negotiateBPDAdjustment(int, org.apache.fop.layoutmgr.KnuthElement)
-     */
+    /** @see org.apache.fop.layoutmgr.BlockLevelLayoutManager */
     public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
         // TODO Auto-generated method stub
         return 0;
     }
 
-    /**
-     * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#discardSpace(org.apache.fop.layoutmgr.KnuthGlue)
-     */
+    /** @see org.apache.fop.layoutmgr.BlockLevelLayoutManager */
     public void discardSpace(KnuthGlue spaceGlue) {
         // TODO Auto-generated method stub
         
index 11ca67d03ceb45b65d547bcfc149d56139c9bbb2..838e23cfb15f778b8c16d6c9edcb2447f5062417 100644 (file)
@@ -300,12 +300,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
         }
 
         getPSLM().addIDToPage(getBlockFO().getId());
-        /* TODO remove when markers are really ok
-        log.debug("Checking on " + this);
-        log.debug("Checking first=" + firstPos);
-        log.debug("Checking last=" + lastPos);
-        log.debug("->" + isFirst(firstPos) + "/" + isLast(lastPos));
-        */
         if (markers != null) {
             getCurrentPV().addMarkers(markers, true, isFirst(firstPos), isLast(lastPos));
         }
@@ -384,15 +378,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
             //}
         }
 
-        // if adjusted space before
-        //double adjust = layoutContext.getSpaceAdjust();
-        //addBlockSpacing(adjust, foSpaceBefore);
-        //addBlockSpacing(adjust, effSpaceBefore);
-        foSpaceBefore = null;
-        //if (bSpaceBefore) {
-        //    addBlockSpacing(0, new MinOptMax(adjustedSpaceBefore));
-        //}
-
         while ((childLM = childPosIter.getNextChildLM()) != null) {
             // set last area flag
             lc.setFlags(LayoutContext.LAST_AREA,
@@ -402,9 +387,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
             childLM.addAreas(childPosIter, lc);
         }
 
-        //int bIndents = getBlockFO().getCommonBorderPaddingBackground()
-        //                        .getBPPaddingAndBorder(false);
-
         if (markers != null) {
             getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
         }
@@ -413,13 +395,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
                 effSpaceBefore, effSpaceAfter);
         flush();
 
-        // if adjusted space after
-        //addBlockSpacing(adjust, foSpaceAfter);
-        //addBlockSpacing(adjust, effSpaceAfter);
-        //if (bSpaceAfter) {
-        //    addBlockSpacing(0, new MinOptMax(adjustedSpaceAfter));
-        //}
-
         curBlockArea = null;
         resetSpaces();
     }
@@ -464,24 +439,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
                     getBlockFO().getCommonMarginBlock(),
                     this);
 
-            // Set up dimensions
-            // Get reference IPD from parentArea
-            //int referenceIPD = parentArea.getIPD();
-            //curBlockArea.setIPD(referenceIPD);
-
-            // Set the width of the block based on the parent block
-            // Need to be careful though, if parent is BC then width may not be set
-            /* TODO remove if really not used anymore
-            int parentwidth = 0;
-            if (parentArea instanceof BlockParent) {
-                parentwidth = ((BlockParent) parentArea).getIPD();
-            }
-            if (parentwidth == 0) {
-                parentwidth = referenceIPD;
-            }
-            parentwidth -= getIPIndents();
-            */
-
             setCurrentArea(curBlockArea); // ??? for generic operations
         }
         return curBlockArea;
index a6446ca512691e071fc80531e9011195e7b8e03f..76291a81e1e79812ce744c3bd6e7a781208741fd 100644 (file)
@@ -53,8 +53,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
     protected int adjustedSpaceAfter = 0;
     /** Only used to store the original list when createUnitElements is called */
     protected LinkedList storedList = null;
-    /** FO node */
-    protected FObj fobj;
     /** Indicates whether break before has been served or not */
     protected boolean bBreakBeforeServed = false;
     /** Indicates whether space before has been served or not */
@@ -84,7 +82,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
     public BlockStackingLayoutManager(FObj node) {
         super(node);
         setGeneratesBlockArea(true);
-        fobj = node;
     }
 
     /** 
@@ -103,16 +100,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
         this.parentArea = parentArea;
     }
 
-    protected MinOptMax resolveSpaceSpecifier(Area nextArea) {
-        SpaceSpecifier spaceSpec = new SpaceSpecifier(false);
-        // Area prevArea = getCurrentArea().getLast();
-        // if (prevArea != null) {
-        //     spaceSpec.addSpace(prevArea.getSpaceAfter());
-        // }
-        // spaceSpec.addSpace(nextArea.getSpaceBefore());
-        return spaceSpec.resolve(false);
-    }
-
     /**
      * Add a block spacer for space before and space after a block.
      * This adds an empty Block area that acts as a block space.
@@ -145,7 +132,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
             //log.error("Child not a Block in BlockStackingLM!");
         }
 
-        MinOptMax spaceBefore = resolveSpaceSpecifier(childArea);
         parentArea.addBlock((Block) childArea);
         flush(); // hand off current area to parent
     }
index fc52ce0663a3c14acc2ca1e8839e0de1d988f105..62f5e2af6b2eeb4c574f64833b687ad05707a6f2 100644 (file)
@@ -36,7 +36,6 @@ import java.util.ListIterator;
  */
 public class FlowLayoutManager extends BlockStackingLayoutManager
                                implements BlockLevelLayoutManager {
-    private Flow fobj;
     
     /** Array of areas currently being filled stored by area class */
     private BlockParent[] currentAreas = new BlockParent[Area.CLASS_MAX];
@@ -51,7 +50,6 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
      */
     public FlowLayoutManager(PageSequenceLayoutManager pslm, Flow node) {
         super(node);
-        fobj = node;
         setParent(pslm);
     }
 
index 9ba98048e3eb8089a86e3600bf7a8d61e64295a7..51868f4e9c453c090bbf285939b05d2e1ba6af2f 100644 (file)
@@ -23,12 +23,20 @@ import org.apache.fop.fo.flow.FootnoteBody;
 
 import java.util.LinkedList;
 
+/**
+ * Layout manager for footnote bodies.
+ */
 public class FootnoteBodyLayoutManager extends BlockStackingLayoutManager {
 
+    /**
+     * Creates a new FootnoteBodyLayoutManager.
+     * @param body the footnote-body element
+     */
     public FootnoteBodyLayoutManager(FootnoteBody body) {
         super(body);
     }
 
+    /** @see org.apache.fop.layoutmgr.LayoutManager */
     public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
         LayoutManager childLM = null;
         LayoutManager lastLM = null;
@@ -38,8 +46,6 @@ public class FootnoteBodyLayoutManager extends BlockStackingLayoutManager {
         // and put them in a new list;
         LinkedList positionList = new LinkedList();
         Position pos;
-        boolean bSpaceBefore = false;
-        boolean bSpaceAfter = false;
         while (parentIter.hasNext()) {
             pos = (Position) parentIter.next();
             //log.trace("pos = " + pos.getClass().getName() + "; " + pos);
@@ -73,14 +79,13 @@ public class FootnoteBodyLayoutManager extends BlockStackingLayoutManager {
         }
     }
 
+    /** @see org.apache.fop.layoutmgr.LayoutManager#addChildArea(org.apache.fop.area.Area) */
     public void addChildArea(Area childArea) {
         childArea.setAreaClass(Area.CLASS_FOOTNOTE);
         parentLM.addChildArea(childArea);
     }
 
-    /**
-     * convenience method that returns the FootnoteBody node
-     */
+    /** @return the FootnoteBody node */
     protected FootnoteBody getFootnodeBodyFO() {
         return (FootnoteBody) fobj;
     }
index e2334819d063c6efdae4582cf42da77a5f5c5213..d1f88c717679636dfab80c23381a2586a81c03d2 100644 (file)
@@ -147,11 +147,6 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager
             addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
         }
 
-        // if adjusted space before
-        //double adjust = layoutContext.getSpaceAdjust();
-        //addBlockSpacing(adjust, foSpaceBefore);
-        foSpaceBefore = null;
-        
         getPSLM().addIDToPage(getListBlockFO().getId());
 
         // the list block contains areas stacked from each list item
@@ -215,9 +210,6 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager
 
         flush();
 
-        // if adjusted space after
-        //addBlockSpacing(adjust, foSpaceAfter);
-        
         curBlockArea = null;
         resetSpaces();
     }
index e8c2057ca5bf9c741192dc8ea005cb740b4ef543..e7478fe7538bb431d0c8c698d6b8417f5c039068 100644 (file)
@@ -430,12 +430,6 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
                          LayoutContext layoutContext) {
         getParentArea(null);
 
-        // if adjusted space before
-        //double adjust = layoutContext.getSpaceAdjust();
-        //addBlockSpacing(adjust, foSpaceBefore);
-        //addBlockSpacing(adjust, effSpaceBefore);
-        //foSpaceBefore = null;
-
         getPSLM().addIDToPage(getListItemFO().getId());
 
         LayoutContext lc = new LayoutContext(0);
@@ -547,10 +541,6 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
 
         flush();
 
-        // if adjusted space after
-        //addBlockSpacing(adjust, foSpaceAfter);
-        //addBlockSpacing(adjust, effSpaceAfter);
-        
         curBlockArea = null;
         resetSpaces();
     }
index 8a280880f01f91c65637fdcf1c4a9c6111c1a3de..ff1c52987294f24792831de56cd72a5bab2842d4 100644 (file)
@@ -66,10 +66,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
     private double tableUnits;
     private boolean autoLayout = true;
 
-    //TODO space-before|after: handle space-resolution rules
-    private MinOptMax spaceBefore;
-    private MinOptMax spaceAfter;
-    
     private boolean discardBorderBefore;
     private boolean discardBorderAfter;
     private boolean discardPaddingBefore;
@@ -101,8 +97,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager
     
     /** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
     public void initialize() {
-        spaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
-        spaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
+        foSpaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
+        foSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
         
         if (!fobj.isAutoLayout() 
                 && fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
@@ -160,16 +156,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
             log.warn("Allocated IPD exceeds available reference IPD");
         }
 
-        //MinOptMax stackSize = new MinOptMax();
-        //Add spacing
-        /*
-        if (spaceAfter != null) {
-            stackSize.add(spaceAfter);
-        }
-        if (spaceBefore != null) {
-            stackSize.add(spaceBefore);
-        }*/
-
         // either works out table of column widths or if proportional-column-width function
         // is used works out total factor, so that value of single unit can be computed.
         int sumCols = 0;
@@ -318,11 +304,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
         getParentArea(null);
         getPSLM().addIDToPage(fobj.getId());
 
-        // if adjusted space before
-        //double adjust = layoutContext.getSpaceAdjust();
-        //addBlockSpacing(adjust, spaceBefore);
-        //spaceBefore = null;
-
         int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
         
         // add column, body then row areas
@@ -361,10 +342,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
 
         flush();
 
-        // if adjusted space after
-        //addBlockSpacing(adjust, spaceAfter);
-
-        //bodyBreaks.clear();
         resetSpaces();
         curBlockArea = null;
     }