]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Constructor for FLM now takes parent as parameter,
authorGlen Mazza <gmazza@apache.org>
Wed, 1 Jun 2005 22:41:17 +0000 (22:41 +0000)
committerGlen Mazza <gmazza@apache.org>
Wed, 1 Jun 2005 22:41:17 +0000 (22:41 +0000)
also setting of Reference Area dimensions moved to
FLM.

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

src/java/org/apache/fop/fo/pagination/PageSequence.java
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java
src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java

index 399bcd43f81f70112d588b0c350e2580e0f5f2a1..dec8676d2d9960a797fdc16710ce4e606b586718 100644 (file)
@@ -200,7 +200,6 @@ public class PageSequence extends FObj {
         } else if (childId == FO_FLOW) {
             this.mainFlow = (Flow) child;
             addFlow(mainFlow);
-            super.addChildNode(child); // For getChildren
         } else if (childId == FO_STATIC_CONTENT) {
             addFlow((StaticContent) child);
             String flowName = ((StaticContent) child).getFlowName();
index 423c8e98d82622deb5374e709adcab5605d15be8..a309ac91e54d7c6b1142483a34cec7d8bde625a3 100644 (file)
@@ -50,16 +50,23 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
     /**
      * This is the top level layout manager.
      * It is created by the PageSequence FO.
+     * @param pslm parent PageSequenceLayoutManager object
      * @param node Flow object
      */
-    public FlowLayoutManager(Flow node) {
+    public FlowLayoutManager(PageSequenceLayoutManager pslm, Flow node) {
         super(node);
         fobj = node;
+        setParent(pslm);
     }
 
     /** @see org.apache.fop.layoutmgr.LayoutManager */
     public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+
         // set layout dimensions
+        int flowIPD = getCurrentPV().getCurrentSpan().getColumnWidth();
+        int flowBPD = (int) getCurrentPV().getBodyRegion().getBPD();
+        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD);
+        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD);
         fobj.setLayoutDimension(PercentBase.BLOCK_IPD, context.getRefIPD());
         fobj.setLayoutDimension(PercentBase.BLOCK_BPD, context.getStackLimit().opt);
 
index bfd08599f5d2c09b006e031137b17686684cf4fe..2d88aeff570e34e9f2c3b7f5c1074702dfeabb5d 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.fop.layoutmgr;
 
 import java.util.List;
 import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.pagination.SideRegion;
 import org.apache.fop.fo.pagination.StaticContent;
@@ -57,6 +58,15 @@ public interface LayoutManagerMaker {
     public PageSequenceLayoutManager makePageSequenceLayoutManager(
         AreaTreeHandler ath, PageSequence ps);
 
+    /**
+     * Make a FlowLayoutManager object.
+     * @param pslm the parent PageSequenceLayoutManager object
+     * @param flow the fo:flow object this FLM will process
+     * @return The created FlowLayoutManager object
+     */
+    public FlowLayoutManager makeFlowLayoutManager(
+        PageSequenceLayoutManager pslm, Flow flow);
+
     /**
      * Make a StaticContentLayoutManager object.
      * @param pslm the parent PageSequenceLayoutManager object
index 03b5511a0db11efd174b2fcab6a87a70d51ee1eb..85a2e6cc080e59c7275557f94a700717ed58c8f5 100644 (file)
@@ -114,7 +114,6 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
         makers.put(TableCell.class, new Maker());
         makers.put(TableFooter.class, new Maker());
         makers.put(TableHeader.class, new Maker());
-        makers.put(Flow.class, new FlowLayoutManagerMaker());
         makers.put(Wrapper.class, new WrapperLayoutManagerMaker());
         makers.put(Title.class, new InlineLayoutManagerMaker());
     }
@@ -155,7 +154,15 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
     }
 
     /*
-     * @see org.apache.fop.layoutmgr.LayoutManagerMaker#makeStaticContentLayoutManager(org.apache.fop.layoutmgr.PageSequenceLayoutManager, org.apache.fop.fo.pagination.StaticContent, org.apache.fop.fo.pagination.Region)
+     * @see org.apache.fop.layoutmgr.LayoutManagerMaker#makeFlowLayoutManager(PageSequenceLayoutManager, Flow)
+     */
+    public FlowLayoutManager makeFlowLayoutManager(
+            PageSequenceLayoutManager pslm, Flow flow) {
+        return new FlowLayoutManager(pslm, flow);
+    }
+    
+    /*
+     * @see org.apache.fop.layoutmgr.LayoutManagerMaker#makeStaticContentLayoutManager(PageSequenceLayoutManager, StaticContent, Region)
      */
     public StaticContentLayoutManager makeStaticContentLayoutManager(
             PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg) {
@@ -163,7 +170,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
     }
     
     /*
-     * @see org.apache.fop.layoutmgr.LayoutManagerMaker#makeStaticContentLayoutManager(org.apache.fop.layoutmgr.PageSequenceLayoutManager, org.apache.fop.fo.pagination.StaticContent, org.apache.fop.area.Block)
+     * @see org.apache.fop.layoutmgr.LayoutManagerMaker#makeStaticContentLayoutManager(PageSequenceLayoutManager, StaticContent, Block)
      */
     public StaticContentLayoutManager makeStaticContentLayoutManager(
         PageSequenceLayoutManager pslm, StaticContent sc, org.apache.fop.area.Block block) {
@@ -323,12 +330,6 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
         }
     }
      
-    public static class FlowLayoutManagerMaker extends Maker {
-         public void make(FONode node, List lms) {
-             lms.add(new FlowLayoutManager((Flow) node));
-         }
-    }
-
     public class WrapperLayoutManagerMaker extends Maker {
         public void make(FONode node, List lms) {
             Iterator baseIter;
index 369c0664eadc5a2ea6c22a3ef1f5dfceb5b5b0ab..36d3398faa0cec20b2c565e73eafdcce8f853d20 100644 (file)
@@ -28,8 +28,6 @@ import org.apache.fop.area.PageViewport;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.Resolvable;
 
-import org.apache.fop.datatypes.PercentBase;
-
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.flow.Marker;
 import org.apache.fop.fo.flow.RetrieveMarker;
@@ -131,9 +129,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
         curPV = makeNewPage(false, true, false);
 
         Flow mainFlow = pageSeq.getMainFlow();
-        childFLM = (FlowLayoutManager) 
-            getLayoutManagerMaker().makeLayoutManager(mainFlow);
-        childFLM.setParent(this);
+        childFLM = getLayoutManagerMaker().
+            makeFlowLayoutManager(this, mainFlow);
 
         PageBreaker breaker = new PageBreaker(this);
         int flowBPD = (int) curPV.getBodyRegion().getBPD();
@@ -325,11 +322,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
             LayoutContext childLC = new LayoutContext(0);
             childLC.setStackLimit(context.getStackLimit());
             childLC.setRefIPD(context.getRefIPD());
-
-            int flowIPD = curPV.getCurrentSpan().getColumnWidth();
-            int flowBPD = (int) curPV.getBodyRegion().getBPD();
-            pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD);
-            pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD);
             returnedList = childFLM.getNextKnuthElements(childLC, alignment);
 
             if (returnedList != null) {