]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Minor simplifications.
authorGlen Mazza <gmazza@apache.org>
Mon, 25 Apr 2005 02:54:24 +0000 (02:54 +0000)
committerGlen Mazza <gmazza@apache.org>
Mon, 25 Apr 2005 02:54:24 +0000 (02:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_KnuthStylePageBreaking@198592 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java

index 71967aff07d8e949f2e5baf7163907e05c7fd6f4..2506eebea0276e88571d278e217a0e6f47337bab 100644 (file)
@@ -44,7 +44,6 @@ import org.apache.fop.fo.pagination.StaticContent;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import org.apache.fop.traits.MinOptMax;
 
 /**
  * LayoutManager for a PageSequence.
@@ -82,13 +81,17 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
     private AreaTreeModel areaTreeModel;
 
     /**
-     * The collection of StaticContentLayoutManager objects that are associated
-     * with this Page Sequence, keyed by flow-name.
+     * The single FlowLayoutManager object, which processes
+     * the single fo:flow of the fo:page-sequence
      */
-    //private HashMap staticContentLMs = new HashMap(4);
-
     private FlowLayoutManager childFLM = null;
     
+    /**
+     * The collection of StaticContentLayoutManager objects that
+     * are associated with this Page Sequence, keyed by flow-name.
+     */
+    //private HashMap staticContentLMs = new HashMap(4);
+
     /**
      * Constructor - activated by AreaTreeHandler for each
      * fo:page-sequence in the input FO stream
@@ -434,6 +437,9 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
         return curPage;
     }
 
+    /* TODO: See if can initialize the SCLM's just once for
+     * the page sequence, instead of after every page.
+     */
     private void layoutSideRegion(int regionID) {
         SideRegion reg = (SideRegion)curPage.getSPM().getRegion(regionID);
         if (reg == null) {
@@ -449,7 +455,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
         lm = (StaticContentLayoutManager)
             areaTreeHandler.getLayoutManagerMaker().makeLayoutManager(sc);
         lm.initialize();
-        lm.setRegionReference(rv.getRegionReference());
+        lm.setTargetRegion(rv.getRegionReference());
         lm.setParent(this);
         /*
         LayoutContext childLC = new LayoutContext(0);
@@ -457,8 +463,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
         childLC.setRefIPD(rv.getRegion().getIPD());
         */
         
-        MinOptMax range = new MinOptMax(rv.getRegionReference().getIPD());
-        lm.doLayout(reg, lm, range);
+        lm.doLayout(reg);
         
         /*
         while (!lm.isFinished()) {
index 5b07501c83ed98252218648a6c7b28a304e11d83..aaed403d4cb7f34a685018d590cfffa8abbeda46 100644 (file)
@@ -39,8 +39,7 @@ import java.util.ListIterator;
  * and filling them with block-level areas generated by its children.
  */
 public class StaticContentLayoutManager extends BlockStackingLayoutManager {
-
-    private RegionReference region;
+    private RegionReference targetRegion;
     private List blockBreaks = new ArrayList();
 
     public StaticContentLayoutManager(StaticContent node) {
@@ -51,13 +50,16 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
      * Sets the region reference
      * @param region region reference
      */
-    public void setRegionReference(RegionReference region) {
-        this.region = region;
+    public void setTargetRegion(RegionReference targetRegion) {
+        this.targetRegion = targetRegion;
     }
 
-    /** @return the region reference */
-    public RegionReference getRegionReference() {
-        return this.region;
+    /** 
+     * @return the region-reference-area that this 
+     * static content is directed to.  
+     */
+    public RegionReference getTargetRegion() {
+        return targetRegion;
     }
     
     /**
@@ -205,7 +207,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
         blockBreaks.clear();
         */
         flush();
-        region = null;
+        targetRegion = null;
     }
 
 
@@ -216,19 +218,20 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
      * @see org.apache.fop.layoutmgr.LayoutManager#addChildArea(Area)
      */
     public void addChildArea(Area childArea) {
-        region.addBlock((Block)childArea);
+        targetRegion.addBlock((Block)childArea);
     }
 
     /**
      * @see org.apache.fop.layoutmgr.LayoutManager#getParentArea(Area)
      */
     public Area getParentArea(Area childArea) {
-        return region;
+        return targetRegion;
     }
 
-    public void doLayout(SideRegion region, StaticContentLayoutManager lm, MinOptMax ipd) {
-        StaticContentBreaker breaker = new StaticContentBreaker(region, lm, ipd);
-        breaker.doLayout(lm.getRegionReference().getBPD());
+    public void doLayout(SideRegion region) {
+        MinOptMax range = new MinOptMax(targetRegion.getIPD());
+        StaticContentBreaker breaker = new StaticContentBreaker(region, this, range);
+        breaker.doLayout(targetRegion.getBPD());
         if (breaker.isOverflow()) {
             if (region.getOverflow() == EN_ERROR_IF_OVERFLOW) {
                 //TODO throw layout exception