diff options
author | Keiron Liddle <keiron@apache.org> | 2003-02-14 04:15:08 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2003-02-14 04:15:08 +0000 |
commit | 77965315aae686c14ae4da62463deecb4cb091e2 (patch) | |
tree | 6e181b88d09148dafc891d72931786db920c51a6 /src/org/apache/fop/fo/flow | |
parent | 2225023448fc23e22607228130b618a10ec63c2f (diff) | |
download | xmlgraphics-fop-77965315aae686c14ae4da62463deecb4cb091e2.tar.gz xmlgraphics-fop-77965315aae686c14ae4da62463deecb4cb091e2.zip |
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
Diffstat (limited to 'src/org/apache/fop/fo/flow')
22 files changed, 83 insertions, 35 deletions
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); } |