]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
set FO on lm as part of interface, simpler and more flexible
authorKeiron Liddle <keiron@apache.org>
Fri, 14 Feb 2003 04:15:08 +0000 (04:15 +0000)
committerKeiron Liddle <keiron@apache.org>
Fri, 14 Feb 2003 04:15:08 +0000 (04:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195947 13f79535-47bb-0310-9956-ffa450edef68

49 files changed:
src/org/apache/fop/fo/FOText.java
src/org/apache/fop/fo/FObjMixed.java
src/org/apache/fop/fo/Title.java
src/org/apache/fop/fo/flow/BasicLink.java
src/org/apache/fop/fo/flow/BidiOverride.java
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/flow/BlockContainer.java
src/org/apache/fop/fo/flow/Character.java
src/org/apache/fop/fo/flow/ExternalGraphic.java
src/org/apache/fop/fo/flow/Flow.java
src/org/apache/fop/fo/flow/InlineContainer.java
src/org/apache/fop/fo/flow/InstreamForeignObject.java
src/org/apache/fop/fo/flow/Leader.java
src/org/apache/fop/fo/flow/ListBlock.java
src/org/apache/fop/fo/flow/ListItem.java
src/org/apache/fop/fo/flow/ListItemBody.java
src/org/apache/fop/fo/flow/ListItemLabel.java
src/org/apache/fop/fo/flow/PageNumber.java
src/org/apache/fop/fo/flow/PageNumberCitation.java
src/org/apache/fop/fo/flow/StaticContent.java
src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableBody.java
src/org/apache/fop/fo/flow/TableCell.java
src/org/apache/fop/fo/flow/TableColumn.java
src/org/apache/fop/fo/flow/TableRow.java
src/org/apache/fop/fo/pagination/PageSequence.java
src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
src/org/apache/fop/layoutmgr/BlockLayoutManager.java
src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
src/org/apache/fop/layoutmgr/ContentLayoutManager.java
src/org/apache/fop/layoutmgr/FlowLayoutManager.java
src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
src/org/apache/fop/layoutmgr/LayoutManager.java
src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
src/org/apache/fop/layoutmgr/LineLayoutManager.java
src/org/apache/fop/layoutmgr/PageLayoutManager.java
src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
src/org/apache/fop/layoutmgr/TextLayoutManager.java
src/org/apache/fop/layoutmgr/list/Item.java
src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
src/org/apache/fop/layoutmgr/table/Body.java
src/org/apache/fop/layoutmgr/table/Caption.java
src/org/apache/fop/layoutmgr/table/Cell.java
src/org/apache/fop/layoutmgr/table/Column.java
src/org/apache/fop/layoutmgr/table/Row.java
src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
src/org/apache/fop/layoutmgr/table/TableLayoutManager.java

index 6393fdece3590f29b163d8a0949118eb2cc3bcbc..9a0ccf1e3e704ff1dcbe00a7d440444c3ea18737 100644 (file)
@@ -85,7 +85,9 @@ public class FOText extends FObj {
             ca = new char[length];
             System.arraycopy(tmp, 0, ca, 0, length);
         }
-        list.add(new TextLayoutManager(this, ca, textInfo));
+        LayoutManager lm = new TextLayoutManager(ca, textInfo);
+        lm.setFObj(this);
+        list.add(lm);
     }
 
     public CharIterator charIterator() {
index a3373e593d147066701a84dcfe76b97d719f33db..12b3580d71864ee9e063ad5649843e794ec6e253 100644 (file)
@@ -36,8 +36,12 @@ public class FObjMixed extends FObj {
 
     public void addLayoutManager(List lms) {
         if (children != null) {
-            lms.add(new InlineStackingLayoutManager(this,
-                     new LMiter(children.listIterator())));
+            InlineStackingLayoutManager lm;
+            lm = new InlineStackingLayoutManager();
+            lm.setUserAgent(getUserAgent());
+            lm.setFObj(this);
+            lm.setLMiter(new LMiter(children.listIterator()));
+            lms.add(lm);
         }
     }
 
index 9ee5d5c38612e2bde17713a676816576714a02a3..12bd99d951bac5ac6276ace444bc531811b33ed1 100644 (file)
@@ -33,9 +33,10 @@ public class Title extends FObjMixed {
         // use special layout manager to add the inline areas
         // to the Title.
         InlineStackingLayoutManager lm;
-        lm = new InlineStackingLayoutManager(this,
-                     new LMiter(children.listIterator()));
+        lm = new InlineStackingLayoutManager();
         lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
+        lm.setLMiter(new LMiter(children.listIterator()));
         lm.init();
 
         // get breaks then add areas to title
index 06cf9352766871590f45219e2f6992f2893a6dd6..701c7b3de93fe142cb3e062128bb89a6f752b632 100644 (file)
@@ -44,14 +44,18 @@ public class BasicLink extends Inline {
     // add start and end properties for the link
     public void addLayoutManager(List lms) {
         setup();
-        lms.add(new InlineStackingLayoutManager(this,
-                     new LMiter(children.listIterator())) {
+        InlineStackingLayoutManager lm;
+        lm = new InlineStackingLayoutManager() {
                     protected InlineParent createArea() {
                         InlineParent area = super.createArea();
                         setupLinkArea(parentLM, area);
                         return area;
                     }
-                });
+                };
+        lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
+        lm.setLMiter(new LMiter(children.listIterator()));
+        lms.add(lm);
     }
 
     protected void setupLinkArea(LayoutManager parentLM, InlineParent area) {
index e23403339428010e83e3bdffdc06cdf1a5535996..1a9d91af2e1d946babdb8784f3c5830f58b09231 100644 (file)
@@ -40,8 +40,9 @@ public class BidiOverride extends FObjMixed {
             for (int count = childList.size() - 1; count >= 0; count--) {
                 LayoutManager lm = (LayoutManager) childList.get(count);
                 if (lm.generatesInlineAreas()) {
-                    list.add( new BidiLayoutManager(this,
-                                                    (LeafNodeLayoutManager) lm));
+                    LayoutManager blm = new BidiLayoutManager((LeafNodeLayoutManager) lm);
+                    blm.setFObj(this);
+                    list.add(blm);
                 } else {
                     list.add(lm);
                 }
@@ -86,8 +87,7 @@ public class BidiOverride extends FObjMixed {
     class BidiLayoutManager extends LeafNodeLayoutManager {
         List childs;
 
-        BidiLayoutManager(FObj obj, LeafNodeLayoutManager cLM) {
-            super(obj);
+        BidiLayoutManager(LeafNodeLayoutManager cLM) {
             childs = new ArrayList();
 /*            for (int count = cLM.size() - 1; count >= 0; count--) {
                 InlineArea ia = cLM.get(count);
index a3c7f744469515f772afa0fd846e207ebef80c90..61ec961f9bf8474b6e32d2ca7b46f505905f11f3 100644 (file)
@@ -175,8 +175,9 @@ public class Block extends FObjMixed {
     }
 
     public void addLayoutManager(List list) {
-        BlockLayoutManager blm = new BlockLayoutManager(this);
+        BlockLayoutManager blm = new BlockLayoutManager();
         blm.setUserAgent(getUserAgent());
+        blm.setFObj(this);
         TextInfo ti = propMgr.getTextLayoutProps(fontInfo);
         blm.setBlockTextInfo(ti);
         list.add(blm);
index 5e5ee18ce83623e82202bc314c6de916a49313e3..0efc1d94743cf1e8504b256a9ec5eee5d27ecad4 100644 (file)
@@ -45,7 +45,9 @@ public class BlockContainer extends FObj {
     }
 
     public void addLayoutManager(List list) {
-        BlockContainerLayoutManager blm = new BlockContainerLayoutManager(this);
+        BlockContainerLayoutManager blm = new BlockContainerLayoutManager();
+        blm.setUserAgent(getUserAgent());
+        blm.setFObj(this);
         blm.setOverflow(properties.get("overflow").getEnum());
         list.add(blm);
     }
index 3058af9705e65eb07b2bca77c613141b826190b0..561e0cefe99318e4baf8e2c4e9cb521aee37f47c 100644 (file)
@@ -52,7 +52,9 @@ public class Character extends FObj {
     public void addLayoutManager(List list) {
         InlineArea inline = getInlineArea();
         if (inline != null) {
-            LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
+            LeafNodeLayoutManager lm = new LeafNodeLayoutManager();
+            lm.setUserAgent(getUserAgent());
+            lm.setFObj(this);
             lm.setCurrentArea(inline);
             list.add(lm);
         }
index ebbefcb1231be5798fcde477a93c47230e6cd639..b38dc1f1ba787f8110a5b4e3bd6eb409e630b736 100644 (file)
@@ -72,7 +72,9 @@ public class ExternalGraphic extends FObj {
         InlineArea area = getInlineArea();
         if (area != null) {
             setupID();
-            LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
+            LeafNodeLayoutManager lm = new LeafNodeLayoutManager();
+            lm.setUserAgent(getUserAgent());
+            lm.setFObj(this);
             lm.setCurrentArea(area);
             lm.setAlignment(properties.get("vertical-align").getEnum());
             lm.setLead(viewHeight);
index 4f786d0c05b686d576d83414c61cb43bbe235bbf..c1004e5cddf95160336683c494a940d0be2685ec 100644 (file)
@@ -111,8 +111,9 @@ public class Flow extends FObj {
     }
 
     public void addLayoutManager(List list) {
-        FlowLayoutManager lm = new FlowLayoutManager(this);
+        FlowLayoutManager lm = new FlowLayoutManager();
         lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
         list.add(lm);
     }
 
index 6959e3423aee6d42d5cd4d00c812393e96c56f0b..f94cbb897ddb415f47f0d9a4c4da40b92ef939b0 100644 (file)
@@ -13,6 +13,7 @@ import org.apache.fop.fo.flow.*;
 import org.apache.fop.fo.properties.*;
 import org.apache.fop.layout.*;
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
 import org.apache.fop.area.inline.InlineArea;
 
@@ -32,7 +33,10 @@ public class InlineContainer extends FObj {
     public void addLayoutManager(List lms) {
         ArrayList childList = new ArrayList();
         super.addLayoutManager(childList);
-        lms.add(new ICLayoutManager(this, childList));
+        LayoutManager lm = new ICLayoutManager(childList);
+        lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
+        lms.add(lm);
     }
 
     public void handleAttrs(Attributes attlist) throws FOPException {
@@ -81,8 +85,7 @@ public class InlineContainer extends FObj {
     class ICLayoutManager extends LeafNodeLayoutManager {
         List childrenLM;
 
-        ICLayoutManager(FObj obj, List childLM) {
-            super(obj);
+        ICLayoutManager(List childLM) {
             childrenLM = childLM;
         }
 
index db947752aa813f43c2f5538ab6028eac4331319c..a331d4ab3dc4ab6e3b4a92492748fb880639330f 100644 (file)
@@ -56,7 +56,9 @@ public class InstreamForeignObject extends FObj {
     public void addLayoutManager(List list) {
         areaCurrent = getInlineArea();
         if(areaCurrent != null) {
-            LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
+            LeafNodeLayoutManager lm = new LeafNodeLayoutManager();
+            lm.setUserAgent(getUserAgent());
+            lm.setFObj(this);
             lm.setCurrentArea(areaCurrent);
             lm.setAlignment(properties.get("vertical-align").getEnum());
             lm.setLead(areaCurrent.getHeight());
index 073c2175184d5e042613a729ef4cf61da56f9b2d..4846652a9f10be40f038105dcaebb70f50e5f910 100644 (file)
@@ -51,7 +51,7 @@ public class Leader extends FObjMixed {
     }
 
     public void addLayoutManager(List list) {
-        LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this) {
+        LeafNodeLayoutManager lm = new LeafNodeLayoutManager() {
                 public InlineArea get(LayoutContext context) {
                     return getInlineArea();
                 }
@@ -66,6 +66,8 @@ public class Leader extends FObjMixed {
                     }
                 }*/
             };
+        lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
         lm.setAlignment(properties.get("leader-alignment").getEnum());
         list.add(lm);
     }
@@ -121,9 +123,10 @@ public class Leader extends FObjMixed {
                 return;
             }
             InlineStackingLayoutManager lm;
-            lm = new InlineStackingLayoutManager(this,
-                     new LMiter(children.listIterator()));
+            lm = new InlineStackingLayoutManager();
             lm.setUserAgent(getUserAgent());
+            lm.setFObj(this);
+            lm.setLMiter(new LMiter(children.listIterator()));
             lm.init();
 
             // get breaks then add areas to FilledArea
index df2cdf865d45c1d2b2f66df90d2c8ab440b48bfc..a86db387047550b2bfd19f8c11e612293285211a 100644 (file)
@@ -39,7 +39,9 @@ public class ListBlock extends FObj {
     }
 
     public void addLayoutManager(List list) {
-        ListBlockLayoutManager blm = new ListBlockLayoutManager(this);
+        ListBlockLayoutManager blm = new ListBlockLayoutManager();
+        blm.setUserAgent(getUserAgent());
+        blm.setFObj(this);
         list.add(blm);
     }
 
index 78c4b40a6a59f15904b9760703cdd1d63301e012..f8e9a6ba2ff79290987f7b03f1e90e6462fc249e 100644 (file)
@@ -39,7 +39,9 @@ public class ListItem extends FObj {
 
     public void addLayoutManager(List list) {
         if(label != null && body != null) {
-            ListItemLayoutManager blm = new ListItemLayoutManager(this);
+            ListItemLayoutManager blm = new ListItemLayoutManager();
+            blm.setUserAgent(getUserAgent());
+            blm.setFObj(this);
             blm.setLabel(label.getItemLayoutManager());
             blm.setBody(body.getItemLayoutManager());
             list.add(blm);
index 682cad474b07e42477d41090201035dd71cd7582..db4552756785dc3a5b706a742cd7e1064b585b1c 100644 (file)
@@ -25,7 +25,9 @@ public class ListItemBody extends FObj {
     }
 
     public Item getItemLayoutManager() {
-        Item item = new Item(this);
+        Item item = new Item();
+        item.setUserAgent(getUserAgent());
+        item.setFObj(this);
         return item;
     }
 
index be673ed3c16eb3f5fb4110afa90f24e0a8c91de4..cc388963b4d8622b15ac66cf242212a0151b7e8f 100644 (file)
@@ -25,7 +25,9 @@ public class ListItemLabel extends FObj {
     }
 
     public Item getItemLayoutManager() {
-        Item itemLabel = new Item(this);
+        Item itemLabel = new Item();
+        itemLabel.setUserAgent(getUserAgent());
+        itemLabel.setFObj(this);
         return itemLabel;
     }
 
index 58654a866ad6af6ef7624cda42e618c18ea3e94c..70d4f636cf5c0b49eae64d5c119f1ad1baef1c4e 100644 (file)
@@ -18,6 +18,7 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.util.CharUtilities;
 
 import org.apache.fop.apps.StructureHandler;
+import org.apache.fop.layoutmgr.LayoutManager;
 import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.area.inline.InlineArea;
@@ -49,7 +50,8 @@ public class PageNumber extends FObj {
 
     public void addLayoutManager(List lms) {
         setup();
-        lms.add(new LeafNodeLayoutManager(this) {
+        LayoutManager lm;
+        lm = new LeafNodeLayoutManager() {
                     public InlineArea get(LayoutContext context) {
                         // get page string from parent, build area
                         Word inline = new Word();
@@ -76,8 +78,10 @@ public class PageNumber extends FObj {
                     protected void offsetArea(LayoutContext context) {
                         curArea.setOffset(context.getBaseline());
                     }
-                }
-               );
+                };
+        lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
+        lms.add(lm);
     }
 
     public void setup() {
index b6ac87fad9fbc012848dfe32f3e4971833659abd..c66977d0355e9cee1f3a4e11e42bfe16a3fb6266 100644 (file)
@@ -62,7 +62,8 @@ public class PageNumberCitation extends FObj {
 
     public void addLayoutManager(List lms) {
         setup();
-        lms.add(new LeafNodeLayoutManager(this) {
+        LayoutManager lm;
+        lm = new LeafNodeLayoutManager() {
                     public InlineArea get(LayoutContext context) {
                         return getInlineArea(parentLM);
                     }
@@ -79,8 +80,10 @@ public class PageNumberCitation extends FObj {
                     protected void offsetArea(LayoutContext context) {
                         curArea.setOffset(context.getBaseline());
                     }
-                }
-               );
+                };
+        lm.setUserAgent(getUserAgent());
+        lm.setFObj(this);
+        lms.add(lm);
     }
 
     // if id can be resolved then simply return a word, otherwise
index 0bf5f64a937f912ce24960e683fb4690ec2e98ad..3dc8732b7229e40adfcbd790268122729e08c639 100644 (file)
@@ -39,7 +39,9 @@ public class StaticContent extends Flow {
 
     public StaticContentLayoutManager getLayoutManager() {
         if (lm == null) {
-            lm = new StaticContentLayoutManager(this);
+            lm = new StaticContentLayoutManager();
+            lm.setUserAgent(getUserAgent());
+            lm.setFObj(this);
         }
         return lm;
     }
index 1e8db211c611cfb66b60e1d044265e1125e8e10c..3ec4077ba45e91f979adb4ed307210c85d2f5e51 100644 (file)
@@ -72,7 +72,9 @@ public class Table extends FObj {
      * Must override in subclasses if their content can be laid out.
      */
     public void addLayoutManager(List list) {
-        TableLayoutManager tlm = new TableLayoutManager(this);
+        TableLayoutManager tlm = new TableLayoutManager();
+        tlm.setUserAgent(getUserAgent());
+        tlm.setFObj(this);
         tlm.setColumns(columns);
         if(tableHeader != null) {
             tlm.setTableHeader(tableHeader.getLayoutManager());
index 860625a0927e21bfd28900ee2b1b8007eb858ce5..12ba2f0901bbb3ff8ecf23eb1a007ce60669478c 100644 (file)
@@ -40,7 +40,9 @@ public class TableBody extends FObj {
     }
 
     public Body getLayoutManager() {
-        Body blm = new Body(this);
+        Body blm = new Body();
+        blm.setUserAgent(getUserAgent());
+        blm.setFObj(this);
         return blm;
     }
 
index 8fbef7eba3acfa19811ee02322b7a48a851074fe..ee02d370f76448726693d7f71e3378ebf5990354 100644 (file)
@@ -99,7 +99,9 @@ public class TableCell extends FObj {
     /**
      */
     public void addLayoutManager(List list) {
-        Cell clm = new Cell(this);
+        Cell clm = new Cell();
+        clm.setUserAgent(getUserAgent());
+        clm.setFObj(this);
         list.add(clm);
     }
 
index 11fdb07b894202fcc64af026d054f50388a4cb09..59ca1264ec1ba022dd630e4cbd31b5383a679475 100644 (file)
@@ -36,7 +36,10 @@ public class TableColumn extends FObj {
 
     public LayoutManager getLayoutManager() {
         doSetup();
-        return new Column(this);
+        Column clm = new Column();
+        clm.setUserAgent(getUserAgent());
+        clm.setFObj(this);
+        return clm;
     }
 
     public Length getColumnWidthAsLength() {
index 430416f7372c49dc5d98e1e21bffc879ed5fdba7..1b762dd7f1e6c4db15da0ddf8fe0d804085fa7d1 100644 (file)
@@ -41,7 +41,9 @@ public class TableRow extends FObj {
     /**
      */
     public void addLayoutManager(List list) {
-        Row rlm = new Row(this);
+        Row rlm = new Row();
+        rlm.setUserAgent(getUserAgent());
+        rlm.setFObj(this);
         list.add(rlm);
     }
 
index 9e377eee09ca630dec58c469d690f19d0dbc2bc4..fc9498c3728a98f07f6a9c403be2178639170212 100644 (file)
@@ -340,6 +340,7 @@ public class PageSequence extends FObj {
         // This will layout pages and add them to the area tree
         PageLayoutManager pageLM = new PageLayoutManager(areaTree, this);
         pageLM.setUserAgent(getUserAgent());
+        pageLM.setFObj(this);
         pageLM.setPageCounting(currentPageNumber, pageNumberGenerator);
 
         // For now, skip the threading and just call run directly.
index 4099deff60b18082d09457dacdca5171bfa8d2e9..24165c597a3171e0853c1b09c32e0e2e79efe0a8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
@@ -27,7 +27,7 @@ import java.util.ListIterator;
  */
 public abstract class AbstractLayoutManager implements LayoutManager {
     protected FOUserAgent userAgent;
-    protected LayoutManager parentLM;
+    protected LayoutManager parentLM = null;
     protected FObj fobj;
     protected String foID = null;
 
@@ -37,22 +37,22 @@ public abstract class AbstractLayoutManager implements LayoutManager {
     protected ListIterator childLMiter;
     protected boolean bInited = false;
 
-    protected LayoutPos curPos = new LayoutPos();
 
-    static class LayoutPos {
-        int lmIndex = 0;
-        int subIndex = 0;
-    }
-
-    public AbstractLayoutManager(FObj fobj) {
-        this(fobj, new LMiter(fobj.getChildren()));
+    /**
+     * Abstract layout manager.
+     */
+    public AbstractLayoutManager() {
     }
 
-    public AbstractLayoutManager(FObj fobj, ListIterator lmIter) {
-        this.fobj = fobj;
+    /**
+     * Set the FO object for this layout manager
+     *
+     * @param fo the fo for this layout manager
+     */
+    public void setFObj(FObj fo) {
+        this.fobj = fo;
         foID = fobj.getID();
-        this.parentLM = null;
-        childLMiter = lmIter;
+        childLMiter = new LMiter(fobj.getChildren());
     }
 
     /**
index 49c2f1a4511593ee9c5a41b5485f1a468a4dfa09..47074efe482a5c2612ab3b44b6f8392b349603bc 100644 (file)
@@ -45,8 +45,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
     int overflow;
     PropertyManager propManager;
 
-    public BlockContainerLayoutManager(FObj fobj) {
-        super(fobj);
+    public BlockContainerLayoutManager() {
     }
 
     public void setOverflow(int of) {
index d7f92d6bec401d1907aff42c422e7c56dd68089a..080321b21f8855fdcfc7199c428ef1d177f80d62 100644 (file)
@@ -88,16 +88,26 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
                 }
             }
             LineLayoutManager child;
-            child = new LineLayoutManager(fobj, inlines, lineHeight,
+            child = new LineLayoutManager(lineHeight,
                                             lead, follow);
             child.setUserAgent(getUserAgent());
+            child.setFObj(fobj);
+            child.setLMiter(inlines.listIterator());
             return child;
 
         }
     }
 
-    public BlockLayoutManager(FObj fobj) {
-        super(fobj);
+    public BlockLayoutManager() {
+    }
+
+    /**
+     * Set the FO object for this layout manager
+     *
+     * @param fo the fo for this layout manager
+     */
+    public void setFObj(FObj fo) {
+        super.setFObj(fo);
         childLMiter = new BlockLMiter(childLMiter);
     }
 
index 323c6feb4151476a244717d4930bd61f1def190a..fd0b50e04d91c1b06dcabdd1b653c9322cff02cb 100644 (file)
@@ -26,8 +26,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
     protected LayoutManager curChildLM = null;
     protected BlockParent parentArea = null;
 
-    public BlockStackingLayoutManager(FObj fobj) {
-        super(fobj);
+    public BlockStackingLayoutManager() {
     }
 
     private BreakCost evaluateBreakCost(Area parent, Area child) {
index 01c339ffe1d2b46e9c2833dcf2014f6264eb201e..e41c15ca6507c162b7cf26c47bfb6e0c3c16bfa0 100644 (file)
@@ -6,6 +6,7 @@
  */
 package org.apache.fop.layoutmgr;
 
+import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.FOUserAgent;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Resolveable;
@@ -37,6 +38,14 @@ public class ContentLayoutManager implements LayoutManager {
         holder = area;
     }
 
+    /**
+     * Set the FO object for this layout manager
+     *
+     * @param fo the fo for this layout manager
+     */
+    public void setFObj(FObj fo) {
+    }
+
     public void fillArea(LayoutManager curLM) {
 
         List childBreaks = new ArrayList();
index 0da033a5b9635991ef1de65eb58eb683e1402873..7a6e24cf8e56bc66574bff92ed4607abe8c6b512 100644 (file)
@@ -32,8 +32,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
      * This is the top level layout manager.
      * It is created by the PageSequence FO.
      */
-    public FlowLayoutManager(FObj fobj) {
-        super(fobj);
+    public FlowLayoutManager() {
     }
 
     public BreakPoss getNextBreakPoss(LayoutContext context) {
index 6955de01f394b29158ad2954bee113c5127c1a3a..5377935d382cca60e9492739273b255ede2d5622 100644 (file)
@@ -79,9 +79,27 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
      * @param fobj the formatting object that creates the area
      * @param childLMiter the iterator for child areas
      */
-    public InlineStackingLayoutManager(FObj fobj,
-                                         ListIterator childLMiter) {
-        super(fobj, childLMiter);
+    public InlineStackingLayoutManager() {
+    }
+
+    /**
+     * Set the FO object for this layout manager
+     *
+     * @param fo the fo for this layout manager
+     */
+    public void setFObj(FObj fo) {
+        this.fobj = fo;
+        foID = fobj.getID();
+        childLMiter = null;
+    }
+
+    /**
+     * Set the iterator.
+     *
+     * @param iter the iterator for this LM
+     */
+    public void setLMiter(ListIterator iter) {
+        childLMiter = iter;
     }
 
     /**
index 82126380471360ed5083b5e578e64792757dc607..58a0adf73ff759c668ef701abed37016ee47a9b5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
@@ -8,6 +8,7 @@
 package org.apache.fop.layoutmgr;
 
 import org.apache.fop.fo.FOUserAgent;
+import org.apache.fop.fo.FObj;
 
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Resolveable;
@@ -18,6 +19,15 @@ import org.apache.fop.area.PageViewport;
  */
 public interface LayoutManager {
 
+    /**
+     * Set the FO object for this layout manager.
+     * For layout managers that are created without an FO
+     * this may not be called.
+     *
+     * @param obj the FO object for this layout manager
+     */
+    public void setFObj(FObj obj);
+
     /**
      * Set the user agent.
      *
index 2cad3131faf0d6ff4b410a38e089be3644119deb..2b7631e8e22d19a29d23be46e7b0cb16bf606660 100644 (file)
@@ -32,8 +32,7 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
      * Create a Leaf node layout mananger.
      * @param fobj the fo object that created this manager
      */
-    public LeafNodeLayoutManager(FObj fobj) {
-        super(fobj);
+    public LeafNodeLayoutManager() {
     }
 
     /**
index 9eb2683012114e1052afff5bc1528b92bdd8076a..bbcf29436621b8f4a8bf693b365e4dd13b41a3cc 100644 (file)
@@ -98,8 +98,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
      * @param l the default lead, from top to baseline
      * @param f the default follow, from baseline to bottom
      */
-    public LineLayoutManager(FObj fobj, List lms, int lh, int l, int f) {
-        super(fobj, lms.listIterator());
+    public LineLayoutManager(int lh, int l, int f) {
         lineHeight = lh;
         lead = l;
         follow = f;
index 5434ebb6a17894d189688e1d5efbb430b70616ce..b0c407d6b2c431295e812e6ab00d3975166e0fc1 100644 (file)
@@ -85,7 +85,6 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
      * @param pageseq the page sequence fo
      */
     public PageLayoutManager(AreaTree areaTree, PageSequence pageseq) {
-        super(pageseq);
         this.areaTree = areaTree;
         pageSequence = pageseq;
     }
index 56205a2d7171bdbad829fb41762859342025430f..afc1be872a21e0d927d2edede779ca692eff191d 100644 (file)
@@ -26,8 +26,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
     private RegionReference region;
     private List blockBreaks = new ArrayList();
 
-    public StaticContentLayoutManager(FObj fobj) {
-        super(fobj);
+    public StaticContentLayoutManager() {
     }
 
     public void setRegionReference(RegionReference region) {
index 44dd34453bf4b01ecdcea25f341e7f7c81a34997..acdf6715f8b98438aa15bdc91c9d36f1ffcce27b 100644 (file)
@@ -92,8 +92,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
      * @param chars the characters
      * @param textInfo the text information for doing layout
      */
-    public TextLayoutManager(FObj fobj, char[] chars, TextInfo textInfo) {
-        super(fobj);
+    public TextLayoutManager(char[] chars, TextInfo textInfo) {
         this.chars = chars;
         this.textInfo = textInfo;
         this.vecAreaInfo = new ArrayList();
index 381528f1321bd6180df5ff44c97f80ed7b905473..c4ef485d4258e1d7fd8d4e04debadbae83937e87 100644 (file)
@@ -46,8 +46,7 @@ public class Item extends BlockStackingLayoutManager {
      * Create a new Cell layout manager.
      * @param fobj the formatting object for the cell
      */
-    public Item(FObj fobj) {
-        super(fobj);
+    public Item() {
     }
 
     protected void initProperties(PropertyManager propMgr) {
index 6535d3e3272e59fd0107deae25cbbec5e3ce439d..818f085d8ca148a0c7525cedfd882fff933f72d7 100644 (file)
@@ -50,10 +50,8 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager {
     /**
      * Create a new table layout manager.
      *
-     * @param fobj the table formatting object
      */
-    public ListBlockLayoutManager(FObj fobj) {
-        super(fobj);
+    public ListBlockLayoutManager() {
     }
 
     protected void initProperties(PropertyManager propMgr) {
index cc834be37c7af170de4c268e4ae0d7831f10d1d2..b23455468747e7646459485cc589504a4a83b69f 100644 (file)
@@ -53,10 +53,8 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager {
     /**
      * Create a new list item layout manager.
      *
-     * @param fobj the list-item formatting object
      */
-    public ListItemLayoutManager(FObj fobj) {
-        super(fobj);
+    public ListItemLayoutManager() {
     }
 
     protected void initProperties(PropertyManager propMgr) {
index dba2597e86e4d552a48c35e0d855c52c85614ae4..f4094460c1c8c25e6800bd2c45bcd994bd93f282 100644 (file)
@@ -50,8 +50,7 @@ public class Body extends BlockStackingLayoutManager {
      *
      * @param fobj the formatting object that created this manager
      */
-    public Body(FObj fobj) {
-        super(fobj);
+    public Body() {
     }
 
     /**
index a39baa18493a02ea17e0bbf8308c435992666f81..0ddca6ac76bad228d8de38ade7647469665f0638 100644 (file)
@@ -37,10 +37,8 @@ public class Caption extends BlockStackingLayoutManager {
     /**
      * Create a new Caption layout manager.
      *
-     * @param fobj the formatting object that created this manager
      */
-    public Caption(FObj fobj) {
-        super(fobj);
+    public Caption() {
     }
 
     /**
index 57d0e31e3ea4c7320a6e1a6072db6d457a5c5ac6..09541ca839926700f77ae182617658abe16494f8 100644 (file)
@@ -46,10 +46,8 @@ public class Cell extends BlockStackingLayoutManager {
 
     /**
      * Create a new Cell layout manager.
-     * @param fobj the formatting object for the cell
      */
-    public Cell(FObj fobj) {
-        super(fobj);
+    public Cell() {
     }
 
     protected void initProperties(PropertyManager propMgr) {
index 487f55cc6dbfaf6dfb86e45d35c4d69c8a87502c..f49bf9de48203d915a54b83e5dd6eb0ffccc2513 100644 (file)
@@ -7,6 +7,7 @@
 
 package org.apache.fop.layoutmgr.table;
 
+import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyManager;
 import org.apache.fop.layoutmgr.AbstractLayoutManager;
 import org.apache.fop.layoutmgr.BreakPoss;
@@ -34,9 +35,12 @@ public class Column extends AbstractLayoutManager {
      *
      * @param fobj the table-column formatting object
      */
-    public Column(TableColumn fobj) {
-        super(fobj);
-        columnWidth = fobj.getColumnWidth();
+    public Column() {
+    }
+
+    public void setFObj(FObj fobj) {
+        super.setFObj(fobj);
+        columnWidth = ((TableColumn)fobj).getColumnWidth();
     }
 
     protected void initProperties(PropertyManager propMgr) {
index b520521735740fdb1eb2f810f480b9a0c0943ba9..a62b38654856eed8f9081e598bbf3d99a8c1694f 100644 (file)
@@ -54,10 +54,8 @@ public class Row extends BlockStackingLayoutManager {
     /**
      * Create a new row layout manager.
      *
-     * @param fobj the table-row formatting object
      */
-    public Row(FObj fobj) {
-        super(fobj);
+    public Row() {
     }
 
     /**
index 6471e8afcba0571b63a806664cf033e2e43e164c..2af0dea6b5abc36b8f517eb335a8c6ff6e9040ce 100644 (file)
@@ -39,10 +39,8 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager {
     /**
      * Create a new table and caption layout manager.
      *
-     * @param fobj the table-and-caption formatting object
      */
-    public TableAndCaptionLayoutManager(FObj fobj) {
-        super(fobj);
+    public TableAndCaptionLayoutManager() {
     }
 
     /**
index 3285b8954f0d89b55452fd4133ad785435c633ec..7322d90b9c2703d87ee2a5618262aa56aa5e7f97 100644 (file)
@@ -59,10 +59,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
     /**
      * Create a new table layout manager.
      *
-     * @param fobj the table formatting object
      */
-    public TableLayoutManager(FObj fobj) {
-        super(fobj);
+    public TableLayoutManager() {
     }
 
     protected void initProperties(PropertyManager propMgr) {