From: Keiron Liddle Date: Fri, 14 Feb 2003 04:15:08 +0000 (+0000) Subject: set FO on lm as part of interface, simpler and more flexible X-Git-Tag: Alt-Design-integration-base~111 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=77965315aae686c14ae4da62463deecb4cb091e2;p=xmlgraphics-fop.git set FO on lm as part of interface, simpler and more flexible git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195947 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/fo/FOText.java b/src/org/apache/fop/fo/FOText.java index 6393fdece..9a0ccf1e3 100644 --- a/src/org/apache/fop/fo/FOText.java +++ b/src/org/apache/fop/fo/FOText.java @@ -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() { diff --git a/src/org/apache/fop/fo/FObjMixed.java b/src/org/apache/fop/fo/FObjMixed.java index a3373e593..12b3580d7 100644 --- a/src/org/apache/fop/fo/FObjMixed.java +++ b/src/org/apache/fop/fo/FObjMixed.java @@ -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); } } diff --git a/src/org/apache/fop/fo/Title.java b/src/org/apache/fop/fo/Title.java index 9ee5d5c38..12bd99d95 100644 --- a/src/org/apache/fop/fo/Title.java +++ b/src/org/apache/fop/fo/Title.java @@ -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 diff --git a/src/org/apache/fop/fo/flow/BasicLink.java b/src/org/apache/fop/fo/flow/BasicLink.java index 06cf93527..701c7b3de 100644 --- a/src/org/apache/fop/fo/flow/BasicLink.java +++ b/src/org/apache/fop/fo/flow/BasicLink.java @@ -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) { diff --git a/src/org/apache/fop/fo/flow/BidiOverride.java b/src/org/apache/fop/fo/flow/BidiOverride.java index e23403339..1a9d91af2 100644 --- a/src/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/org/apache/fop/fo/flow/BidiOverride.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java index a3c7f7444..61ec961f9 100644 --- a/src/org/apache/fop/fo/flow/Block.java +++ b/src/org/apache/fop/fo/flow/Block.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/BlockContainer.java b/src/org/apache/fop/fo/flow/BlockContainer.java index 5e5ee18ce..0efc1d947 100644 --- a/src/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/org/apache/fop/fo/flow/BlockContainer.java @@ -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); } diff --git a/src/org/apache/fop/fo/flow/Character.java b/src/org/apache/fop/fo/flow/Character.java index 3058af970..561e0cefe 100644 --- a/src/org/apache/fop/fo/flow/Character.java +++ b/src/org/apache/fop/fo/flow/Character.java @@ -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); } diff --git a/src/org/apache/fop/fo/flow/ExternalGraphic.java b/src/org/apache/fop/fo/flow/ExternalGraphic.java index ebbefcb12..b38dc1f1b 100644 --- a/src/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/org/apache/fop/fo/flow/ExternalGraphic.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/Flow.java b/src/org/apache/fop/fo/flow/Flow.java index 4f786d0c0..c1004e5cd 100644 --- a/src/org/apache/fop/fo/flow/Flow.java +++ b/src/org/apache/fop/fo/flow/Flow.java @@ -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); } diff --git a/src/org/apache/fop/fo/flow/InlineContainer.java b/src/org/apache/fop/fo/flow/InlineContainer.java index 6959e3423..f94cbb897 100644 --- a/src/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/org/apache/fop/fo/flow/InlineContainer.java @@ -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; } diff --git a/src/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/org/apache/fop/fo/flow/InstreamForeignObject.java index db947752a..a331d4ab3 100644 --- a/src/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/Leader.java b/src/org/apache/fop/fo/flow/Leader.java index 073c21751..4846652a9 100644 --- a/src/org/apache/fop/fo/flow/Leader.java +++ b/src/org/apache/fop/fo/flow/Leader.java @@ -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 diff --git a/src/org/apache/fop/fo/flow/ListBlock.java b/src/org/apache/fop/fo/flow/ListBlock.java index df2cdf865..a86db3870 100644 --- a/src/org/apache/fop/fo/flow/ListBlock.java +++ b/src/org/apache/fop/fo/flow/ListBlock.java @@ -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); } diff --git a/src/org/apache/fop/fo/flow/ListItem.java b/src/org/apache/fop/fo/flow/ListItem.java index 78c4b40a6..f8e9a6ba2 100644 --- a/src/org/apache/fop/fo/flow/ListItem.java +++ b/src/org/apache/fop/fo/flow/ListItem.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/ListItemBody.java b/src/org/apache/fop/fo/flow/ListItemBody.java index 682cad474..db4552756 100644 --- a/src/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/org/apache/fop/fo/flow/ListItemBody.java @@ -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; } diff --git a/src/org/apache/fop/fo/flow/ListItemLabel.java b/src/org/apache/fop/fo/flow/ListItemLabel.java index be673ed3c..cc388963b 100644 --- a/src/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/org/apache/fop/fo/flow/ListItemLabel.java @@ -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; } diff --git a/src/org/apache/fop/fo/flow/PageNumber.java b/src/org/apache/fop/fo/flow/PageNumber.java index 58654a866..70d4f636c 100644 --- a/src/org/apache/fop/fo/flow/PageNumber.java +++ b/src/org/apache/fop/fo/flow/PageNumber.java @@ -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() { diff --git a/src/org/apache/fop/fo/flow/PageNumberCitation.java b/src/org/apache/fop/fo/flow/PageNumberCitation.java index b6ac87fad..c66977d03 100644 --- a/src/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/org/apache/fop/fo/flow/PageNumberCitation.java @@ -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 diff --git a/src/org/apache/fop/fo/flow/StaticContent.java b/src/org/apache/fop/fo/flow/StaticContent.java index 0bf5f64a9..3dc8732b7 100644 --- a/src/org/apache/fop/fo/flow/StaticContent.java +++ b/src/org/apache/fop/fo/flow/StaticContent.java @@ -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; } diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 1e8db211c..3ec4077ba 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index 860625a09..12ba2f090 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -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; } diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java index 8fbef7eba..ee02d370f 100644 --- a/src/org/apache/fop/fo/flow/TableCell.java +++ b/src/org/apache/fop/fo/flow/TableCell.java @@ -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); } diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java index 11fdb07b8..59ca1264e 100644 --- a/src/org/apache/fop/fo/flow/TableColumn.java +++ b/src/org/apache/fop/fo/flow/TableColumn.java @@ -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() { diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index 430416f73..1b762dd7f 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -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); } diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java index 9e377eee0..fc9498c37 100644 --- a/src/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/org/apache/fop/fo/pagination/PageSequence.java @@ -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. diff --git a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 4099deff6..24165c597 100644 --- a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -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()); } /** diff --git a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 49c2f1a45..47074efe4 100644 --- a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java index d7f92d6be..080321b21 100644 --- a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -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); } diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 323c6feb4..fd0b50e04 100644 --- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java index 01c339ffe..e41c15ca6 100644 --- a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java @@ -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(); diff --git a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java index 0da033a5b..7a6e24cf8 100644 --- a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java index 6955de01f..5377935d3 100644 --- a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java @@ -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; } /** diff --git a/src/org/apache/fop/layoutmgr/LayoutManager.java b/src/org/apache/fop/layoutmgr/LayoutManager.java index 821263804..58a0adf73 100644 --- a/src/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LayoutManager.java @@ -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. * diff --git a/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java b/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java index 2cad3131f..2b7631e8e 100644 --- a/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java @@ -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() { } /** diff --git a/src/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/org/apache/fop/layoutmgr/LineLayoutManager.java index 9eb268301..bbcf29436 100644 --- a/src/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -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; diff --git a/src/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/org/apache/fop/layoutmgr/PageLayoutManager.java index 5434ebb6a..b0c407d6b 100644 --- a/src/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -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; } diff --git a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index 56205a2d7..afc1be872 100644 --- a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/org/apache/fop/layoutmgr/TextLayoutManager.java index 44dd34453..acdf6715f 100644 --- a/src/org/apache/fop/layoutmgr/TextLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/TextLayoutManager.java @@ -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(); diff --git a/src/org/apache/fop/layoutmgr/list/Item.java b/src/org/apache/fop/layoutmgr/list/Item.java index 381528f13..c4ef485d4 100644 --- a/src/org/apache/fop/layoutmgr/list/Item.java +++ b/src/org/apache/fop/layoutmgr/list/Item.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index 6535d3e32..818f085d8 100644 --- a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index cc834be37..b23455468 100644 --- a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/table/Body.java b/src/org/apache/fop/layoutmgr/table/Body.java index dba2597e8..f4094460c 100644 --- a/src/org/apache/fop/layoutmgr/table/Body.java +++ b/src/org/apache/fop/layoutmgr/table/Body.java @@ -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() { } /** diff --git a/src/org/apache/fop/layoutmgr/table/Caption.java b/src/org/apache/fop/layoutmgr/table/Caption.java index a39baa184..0ddca6ac7 100644 --- a/src/org/apache/fop/layoutmgr/table/Caption.java +++ b/src/org/apache/fop/layoutmgr/table/Caption.java @@ -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() { } /** diff --git a/src/org/apache/fop/layoutmgr/table/Cell.java b/src/org/apache/fop/layoutmgr/table/Cell.java index 57d0e31e3..09541ca83 100644 --- a/src/org/apache/fop/layoutmgr/table/Cell.java +++ b/src/org/apache/fop/layoutmgr/table/Cell.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/table/Column.java b/src/org/apache/fop/layoutmgr/table/Column.java index 487f55cc6..f49bf9de4 100644 --- a/src/org/apache/fop/layoutmgr/table/Column.java +++ b/src/org/apache/fop/layoutmgr/table/Column.java @@ -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) { diff --git a/src/org/apache/fop/layoutmgr/table/Row.java b/src/org/apache/fop/layoutmgr/table/Row.java index b52052173..a62b38654 100644 --- a/src/org/apache/fop/layoutmgr/table/Row.java +++ b/src/org/apache/fop/layoutmgr/table/Row.java @@ -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() { } /** diff --git a/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java index 6471e8afc..2af0dea6b 100644 --- a/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java @@ -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() { } /** diff --git a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 3285b8954..7322d90b9 100644 --- a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -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) {