diff options
author | William Victor Mote <vmote@apache.org> | 2003-08-19 00:53:55 +0000 |
---|---|---|
committer | William Victor Mote <vmote@apache.org> | 2003-08-19 00:53:55 +0000 |
commit | 23c8e89aeb3e2e86cef67e4225b5e6991752c52c (patch) | |
tree | 718acaaac82891959adfc71001e1a4ac64687b3a /src/java/org/apache/fop/fo/flow | |
parent | 47daa474f7f92a928541f809058637d8cc4de499 (diff) | |
download | xmlgraphics-fop-23c8e89aeb3e2e86cef67e4225b5e6991752c52c.tar.gz xmlgraphics-fop-23c8e89aeb3e2e86cef67e4225b5e6991752c52c.zip |
1. Remove fo/FOTreeExternal and layoutmgr/LMFOTreeExternal (in favor of Visitor concept, see item 2)
2. Add fo/FOTreeVisitor and layoutmgr/AddLMVisitor
3. Remove all occurrences of addLayoutManager in fo/FObj subclasses, replacing them with equivalent methods in AddLMVisitor
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196809 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow')
37 files changed, 306 insertions, 547 deletions
diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index 3e75e3c6b..477674f12 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -56,6 +56,7 @@ import java.io.Serializable; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBorderAndPadding; @@ -88,44 +89,7 @@ public class BasicLink extends Inline { super(parent); } - /** - * Add start and end properties for the link - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List lms) { - setup(); - 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(LayoutProcessor parentLM, InlineParent area) { - if (link == null) { - return; - } - if (external) { - area.addTrait(Trait.EXTERNAL_LINK, link); - } else { - PageViewport page = parentLM.resolveRefID(link); - if (page != null) { - area.addTrait(Trait.INTERNAL_LINK, page.getKey()); - } else { - LinkResolver res = new LinkResolver(link, area); - parentLM.addUnresolvedArea(link, res); - } - } - } - - private void setup() { + public void setup() { String destination; int linkType; @@ -181,48 +145,16 @@ public class BasicLink extends Inline { return true; } - /** - * Link resolving for resolving internal links. - * This is static since it is independant of the link fo. - */ - protected static class LinkResolver implements Resolveable, Serializable { - private boolean resolved = false; - private String idRef; - private Area area; - - /** - * Create a new link resolver. - * - * @param id the id to resolve - * @param a the area that will have the link attribute - */ - public LinkResolver(String id, Area a) { - idRef = id; - area = a; - } - - /** - * @return true if this link is resolved - */ - public boolean isResolved() { - return resolved; - } + public String getLink() { + return link; + } - public String[] getIDs() { - return new String[] {idRef}; - } + public boolean getExternal() { + return external; + } - /** - * Resolve by adding an internal link. - */ - public void resolve(String id, List pages) { - resolved = true; - if (idRef.equals(id) && pages != null) { - PageViewport page = (PageViewport)pages.get(0); - area.addTrait(Trait.INTERNAL_LINK, page.getKey()); - } - } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); } } - diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/java/org/apache/fop/fo/flow/BidiOverride.java index 886472cd9..a037d5a58 100644 --- a/src/java/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/java/org/apache/fop/fo/flow/BidiOverride.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonRelativePosition; @@ -75,28 +76,6 @@ public class BidiOverride extends FObjMixed { super(parent); } - /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List list) { - if (false) { - super.addLayoutManager(list); - } else { - ArrayList childList = new ArrayList(); - super.addLayoutManager(childList); - for (int count = childList.size() - 1; count >= 0; count--) { - LayoutProcessor lm = (LayoutProcessor) childList.get(count); - if (lm.generatesInlineAreas()) { - LayoutProcessor blm = new BidiLayoutManager((LeafNodeLayoutManager) lm); - blm.setFObj(this); - list.add(blm); - } else { - list.add(lm); - } - } - } - } - private void setup() { // Common Aural Properties @@ -129,35 +108,8 @@ public class BidiOverride extends FObjMixed { return true; } - /** - * If this bidi has a different writing mode direction - * ltr or rtl than its parent writing mode then this - * reverses the inline areas (at the character level). - */ - class BidiLayoutManager extends LeafNodeLayoutManager { - - private List children; - - BidiLayoutManager(LeafNodeLayoutManager cLM) { - children = new ArrayList(); -/* for (int count = cLM.size() - 1; count >= 0; count--) { - InlineArea ia = cLM.get(count); - if (ia instanceof Word) { - // reverse word - Word word = (Word) ia; - StringBuffer sb = new StringBuffer(word.getWord()); - word.setWord(sb.reverse().toString()); - } - children.add(ia); - } -*/ } - - public int size() { - return children.size(); - } - - public InlineArea get(int index) { - return (InlineArea) children.get(index); - } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); } + } diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index ad7872dcb..7019889e6 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -65,6 +65,7 @@ import org.apache.fop.fo.FObj; import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.RecursiveCharIterator; import org.apache.fop.fo.TextInfo; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.Constants; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -244,18 +245,6 @@ public class Block extends FObjMixed { } /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List list) { - BlockLayoutManager blm = new BlockLayoutManager(); - blm.setUserAgent(getUserAgent()); - blm.setFObj(this); - TextInfo ti = propMgr.getTextLayoutProps(fontInfo); - blm.setBlockTextInfo(ti); - list.add(blm); - } - - /** * @return false (Block cannot generate inline areas) */ public boolean generatesInlineAreas() { @@ -408,5 +397,9 @@ public class Block extends FObjMixed { bNextIsLF = false; } } -} + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + +} diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index e67142f46..4b2a83639 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -55,6 +55,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAbsolutePosition; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; @@ -99,17 +100,6 @@ public class BlockContainer extends FObj { setupID(); } - /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List list) { - BlockContainerLayoutManager blm = new BlockContainerLayoutManager(); - blm.setUserAgent(getUserAgent()); - blm.setFObj(this); - blm.setOverflow(properties.get("overflow").getEnum()); - list.add(blm); - } - private void setup() { // Common Accessibility Properties @@ -175,5 +165,9 @@ public class BlockContainer extends FObj { return this.span; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java index 147c9823f..02bf291e1 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/java/org/apache/fop/fo/flow/Character.java @@ -58,6 +58,7 @@ import org.apache.fop.fo.CharIterator; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.OneCharIterator; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonBackground; @@ -97,21 +98,7 @@ public class Character extends FObj { super(parent); } - /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List list) { - InlineArea inline = getInlineArea(); - if (inline != null) { - LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setCurrentArea(inline); - list.add(lm); - } - } - - protected InlineArea getInlineArea() { + public InlineArea getInlineArea() { String str = this.properties.get("character").getString(); if (str.length() == 1) { org.apache.fop.area.inline.Character ch = @@ -177,5 +164,8 @@ public class Character extends FObj { // But what it the character is ignored due to white space handling? } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } } diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index 699388e36..668fc794e 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.TextAlign; @@ -101,33 +102,12 @@ public class ExternalGraphic extends FObj { } /** - * Add the layout manager for this to the list. - * This adds a leafnode layout manager that deals with the - * created viewport/image area. - * - * @param list the list to add the layout manager to - */ - public void addLayoutManager(List list) { - InlineArea area = getInlineArea(); - if (area != null) { - setupID(); - LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setCurrentArea(area); - lm.setAlignment(properties.get("vertical-align").getEnum()); - lm.setLead(viewHeight); - list.add(lm); - } - } - - /** * Get the inline area for this external grpahic. * This creates the image area and puts it inside a viewport. * * @return the viewport containing the image area */ - protected InlineArea getInlineArea() { + public InlineArea getInlineArea() { setup(); if (url == null) { return null; @@ -290,5 +270,13 @@ public class ExternalGraphic extends FObj { placement = new Rectangle2D.Float(xoffset, yoffset, cwidth, cheight); } + public int getViewHeight() { + return viewHeight; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java index 35d2d5bf4..0087b78e7 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/java/org/apache/fop/fo/flow/Float.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.ToBeImplementedElement; +import org.apache.fop.fo.FOTreeVisitor; /** * fo:float element. @@ -73,4 +74,9 @@ public class Float extends ToBeImplementedElement { // this.properties.get("clear"); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index cfe8bd7fb..494e927a8 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -56,6 +56,7 @@ import java.util.List; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; /** * Class modelling the fo:footnote object. See Sec. 6.10.3 of the XSL-FO @@ -74,18 +75,6 @@ public class Footnote extends FObj { } /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List lms) { - // add inlines layout manager - if (inlineFO == null) { - getLogger().error("inline required in footnote"); - return; - } - inlineFO.addLayoutManager(lms); - } - - /** * @param child child FONode to be added to this object */ public void addChild(FONode child) { @@ -98,5 +87,18 @@ public class Footnote extends FObj { getLogger().error("invalid child of footnote: " + name); } } + + /** + * Public accessor for inline FO + * @return the Inline object stored as inline FO + */ + public Inline getInlineFO() { + return inlineFO; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index a768cafbd..6d7acd359 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; /** * Class modelling the fo:footnote-body object. See Sec. 6.10.4 of the XSL-FO @@ -74,4 +75,8 @@ public class FootnoteBody extends FObj { super(parent); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java index 2f44e2b5f..46892e91b 100644 --- a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -102,4 +103,9 @@ public class InitialPropertySet extends ToBeImplementedElement { // this.properties.get("word-spacing"); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index 00f521d14..c8e9517bc 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -58,6 +58,7 @@ import org.apache.fop.fo.CharIterator; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.InlineCharIterator; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.TextDecoration; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -161,4 +162,8 @@ public class Inline extends FObjMixed { return new InlineCharIterator(this, propMgr.getBorderAndPadding()); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java index a6938932f..8ee72fd61 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java @@ -60,6 +60,7 @@ import org.xml.sax.Attributes; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; @@ -83,18 +84,6 @@ public class InlineContainer extends FObj { } /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List lms) { - ArrayList childList = new ArrayList(); - super.addLayoutManager(childList); - LayoutManager lm = new ICLayoutManager(childList); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lms.add(lm); - } - - /** * @see org.apache.fop.fo.FObj#handleAttrs */ public void handleAttrs(Attributes attlist) throws FOPException { @@ -138,21 +127,8 @@ public class InlineContainer extends FObj { return true; } - /** - * This creates a single inline container area after - * laying out the child block areas. All footnotes, floats - * and id areas are maintained for later retrieval. - */ - class ICLayoutManager extends LeafNodeLayoutManager { - - private List childrenLM; - - ICLayoutManager(List childLM) { - childrenLM = childLM; - } - - public InlineArea get(int index) { - return null; - } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); } + } diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 62a9b5c4a..e04c1abdc 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -60,6 +60,7 @@ import org.apache.fop.area.inline.Viewport; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.XMLObj; import org.apache.fop.fo.properties.DisplayAlign; import org.apache.fop.fo.properties.Overflow; @@ -75,7 +76,7 @@ import org.w3c.dom.Document; */ public class InstreamForeignObject extends FObj { - private Viewport areaCurrent; + public Viewport areaCurrent; /** * constructs an instream-foreign-object object (called by Maker). @@ -87,28 +88,11 @@ public class InstreamForeignObject extends FObj { } /** - * Add the layout manager for this into the list. - * @see org.apache.fop.fo.FObj#addLayoutManager(List) - */ - public void addLayoutManager(List list) { - areaCurrent = getInlineArea(); - if (areaCurrent != null) { - LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setCurrentArea(areaCurrent); - lm.setAlignment(properties.get("vertical-align").getEnum()); - lm.setLead(areaCurrent.getHeight()); - list.add(lm); - } - } - - /** * Get the inline area created by this element. * * @return the viewport inline area */ - protected Viewport getInlineArea() { + public Viewport getInlineArea() { if (children == null) { return areaCurrent; } @@ -372,4 +356,9 @@ public class InstreamForeignObject extends FObj { this.scaling = this.properties.get("scaling").getEnum(); */ + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index 9f59b44e8..a7e7de293 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -65,6 +65,7 @@ import org.apache.fop.datatypes.PercentLength; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.FOInputHandler; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.LeaderPattern; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -97,7 +98,7 @@ public class Leader extends FObjMixed { protected Document fontInfo = null; /** FontState for this object */ protected Font fontState; - protected InlineArea leaderArea = null; + public InlineArea leaderArea = null; /** * @param parent FONode that is the parent of this object @@ -106,111 +107,6 @@ public class Leader extends FObjMixed { super(parent); } - /** - * - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - LeafNodeLayoutManager lm = new LeafNodeLayoutManager() { - public InlineArea get(LayoutContext context) { - return getInlineArea(); - } - - protected MinOptMax getAllocationIPD(int refIPD) { - return getAllocIPD(refIPD); - } - - /*protected void offsetArea(LayoutContext context) { - if(leaderPattern == LeaderPattern.DOTS) { - curArea.setOffset(context.getBaseline()); - } - }*/ - }; - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setAlignment(properties.get("leader-alignment").getEnum()); - list.add(lm); - } - - protected InlineArea getInlineArea() { - if (leaderArea == null) { - createLeaderArea(); - } - return leaderArea; - } - - protected void createLeaderArea() { - setup(); - - if (leaderPattern == LeaderPattern.RULE) { - org.apache.fop.area.inline.Leader leader = new org.apache.fop.area.inline.Leader(); - - leader.setRuleStyle(ruleStyle); - leader.setRuleThickness(ruleThickness); - - leaderArea = leader; - } else if (leaderPattern == LeaderPattern.SPACE) { - leaderArea = new Space(); - } else if (leaderPattern == LeaderPattern.DOTS) { - Word w = new Word(); - char dot = '.'; // userAgent.getLeaderDotCharacter(); - - w.setWord("" + dot); - w.addTrait(Trait.FONT_NAME, fontState.getFontName()); - w.addTrait(Trait.FONT_SIZE, - new Integer(fontState.getFontSize())); - // set offset of dot within inline parent - w.setOffset(fontState.getAscender()); - int width = CharUtilities.getCharWidth(dot, fontState); - Space spacer = null; - if (patternWidth > width) { - spacer = new Space(); - spacer.setWidth(patternWidth - width); - width = patternWidth; - } - FilledArea fa = new FilledArea(); - fa.setUnitWidth(width); - fa.addChild(w); - if (spacer != null) { - fa.addChild(spacer); - } - fa.setHeight(fontState.getAscender()); - - leaderArea = fa; - } else if (leaderPattern == LeaderPattern.USECONTENT) { - if (children == null) { - getLogger().error("Leader use-content with no content"); - return; - } - InlineStackingLayoutManager lm; - lm = new InlineStackingLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setLMiter(new LMiter(children.listIterator())); - lm.init(); - - // get breaks then add areas to FilledArea - FilledArea fa = new FilledArea(); - - ContentLayoutManager clm = new ContentLayoutManager(fa); - clm.setUserAgent(getUserAgent()); - lm.setParent(clm); - - clm.fillArea(lm); - int width = clm.getStackingSize(); - Space spacer = null; - if (patternWidth > width) { - spacer = new Space(); - spacer.setWidth(patternWidth - width); - width = patternWidth; - } - fa.setUnitWidth(width); - if (spacer != null) { - fa.addChild(spacer); - } - leaderArea = fa; - } - } /** * @param foih FOInputHandler to set @@ -220,7 +116,7 @@ public class Leader extends FObjMixed { fontInfo = foih.getFontInfo(); } - private void setup() { + public void setup() { // Common Accessibility Properties CommonAccessibility mAccProps = propMgr.getAccessibilityProps(); @@ -297,7 +193,7 @@ public class Leader extends FObjMixed { } - protected MinOptMax getAllocIPD(int ipd) { + public MinOptMax getAllocIPD(int ipd) { // length of the leader int opt = getLength("leader-length.optimum", ipd); int min = getLength("leader-length.minimum", ipd); @@ -317,5 +213,28 @@ public class Leader extends FObjMixed { } return length; } -} + public int getRuleStyle() { + return ruleStyle; + } + + public int getRuleThickness() { + return ruleThickness; + } + + public int getLeaderPattern() { + return leaderPattern; + } + + public Font getFontState() { + return fontState; + } + + public int getPatternWidth() { + return patternWidth; + } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + +} diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 1f0bf77fb..c33b1ae88 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -58,6 +58,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; @@ -91,17 +92,6 @@ public class ListBlock extends FObj { super(parent); } - /** - * - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - ListBlockLayoutManager blm = new ListBlockLayoutManager(); - blm.setUserAgent(getUserAgent()); - blm.setFObj(this); - list.add(blm); - } - private void setup() throws FOPException { // Common Accessibility Properties @@ -161,5 +151,9 @@ public class ListBlock extends FObj { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index 2779fb178..d059f86c7 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -56,6 +56,7 @@ import java.util.List; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; @@ -90,22 +91,6 @@ public class ListItem extends FObj { super(parent); } - /** - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - if (label != null && body != null) { - ListItemLayoutManager blm = new ListItemLayoutManager(); - blm.setUserAgent(getUserAgent()); - blm.setFObj(this); - blm.setLabel(label.getItemLayoutManager()); - blm.setBody(body.getItemLayoutManager()); - list.add(blm); - } else { - getLogger().error("list-item requires list-item-label and list-item-body"); - } - } - private void setup() { // Common Accessibility Properties @@ -173,5 +158,17 @@ public class ListItem extends FObj { return true; } + public ListItemLabel getLabel() { + return label; + } + + public ListItemBody getBody() { + return body; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java index bd62a7e92..29998730a 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.layoutmgr.list.Item; @@ -103,5 +104,9 @@ public class ListItemBody extends FObj { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index 9596f5055..e3bfb1cfa 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.layoutmgr.list.Item; @@ -103,5 +104,9 @@ public class ListItemLabel extends FObj { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index 06405e792..253491d69 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -3,34 +3,34 @@ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ - * + * * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. - * + * * 4. The names "FOP" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * apache@apache.org. - * + * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -42,12 +42,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ============================================================================ - * + * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation and was originally created by * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. - */ + */ package org.apache.fop.fo.flow; // XML @@ -57,6 +57,7 @@ import org.xml.sax.Attributes; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.FOTreeVisitor; /** * Marker formatting object. @@ -107,5 +108,8 @@ public class Marker extends FObjMixed { return markerClassName; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } } diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/java/org/apache/fop/fo/flow/MultiCase.java index f3151b0cc..ee415953b 100644 --- a/src/java/org/apache/fop/fo/flow/MultiCase.java +++ b/src/java/org/apache/fop/fo/flow/MultiCase.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; @@ -79,4 +80,9 @@ public class MultiCase extends ToBeImplementedElement { // this.properties.get("case-title"); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java index 76e3fd959..dcb9666ee 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; @@ -76,4 +77,9 @@ public class MultiProperties extends ToBeImplementedElement { setupID(); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java index 84797508c..0c08a64f9 100644 --- a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; /** @@ -73,4 +74,9 @@ public class MultiPropertySet extends ToBeImplementedElement { // this.properties.get("active-state"); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java index 5ae8cc335..18a8714db 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; @@ -77,4 +78,9 @@ public class MultiSwitch extends ToBeImplementedElement { setupID(); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/MultiToggle.java b/src/java/org/apache/fop/fo/flow/MultiToggle.java index d088f6591..942c3642e 100644 --- a/src/java/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/java/org/apache/fop/fo/flow/MultiToggle.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; @@ -77,4 +78,9 @@ public class MultiToggle extends ToBeImplementedElement { // this.properties.get("switch-to"); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 8f9fd7d8f..9fd6cee92 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -54,6 +54,7 @@ package org.apache.fop.fo.flow; import java.util.List; // FOP +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; @@ -107,47 +108,7 @@ public class PageNumber extends FObj { fontInfo = foih.getFontInfo(); } - /** - * Overridden from FObj - * @param lms the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List lms) { - setup(); - LayoutManager lm; - lm = new LeafNodeLayoutManager() { - public InlineArea get(LayoutContext context) { - // get page string from parent, build area - Word inline = new Word(); - String str = parentLM.getCurrentPageNumber(); - int width = 0; - for (int count = 0; count < str.length(); count++) { - width += CharUtilities.getCharWidth( - str.charAt(count), fontState); - } - inline.setWord(str); - inline.setIPD(width); - inline.setHeight(fontState.getAscender() - - fontState.getDescender()); - inline.setOffset(fontState.getAscender()); - - inline.addTrait(Trait.FONT_NAME, - fontState.getFontName()); - inline.addTrait(Trait.FONT_SIZE, - new Integer(fontState.getFontSize())); - - return inline; - } - - protected void offsetArea(LayoutContext context) { - curArea.setOffset(context.getBaseline()); - } - }; - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lms.add(lm); - } - - private void setup() { + public void setup() { // Common Accessibility Properties CommonAccessibility mAccProps = propMgr.getAccessibilityProps(); @@ -195,4 +156,12 @@ public class PageNumber extends FObj { } + public Font getFontState() { + return fontState; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index a83665d9d..dfb4631cf 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -61,6 +61,7 @@ import org.apache.fop.area.inline.InlineArea; import org.apache.fop.area.inline.UnresolvedPageNumber; import org.apache.fop.area.inline.Word; import org.apache.fop.datatypes.ColorType; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOInputHandler; @@ -118,39 +119,9 @@ public class PageNumberCitation extends FObj { fontInfo = foih.getFontInfo(); } - /** - * Overridden from FObj - * @param lms the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List lms) { - setup(); - LayoutManager lm; - lm = new LeafNodeLayoutManager() { - public InlineArea get(LayoutContext context) { - return getInlineArea(parentLM); - } - - public void addAreas(PositionIterator posIter, - LayoutContext context) { - super.addAreas(posIter, context); - if (unresolved) { - parentLM.addUnresolvedArea(refId, - (Resolveable) inline); - } - } - - 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 // return a resolveable area - private InlineArea getInlineArea(LayoutProcessor parentLM) { + public InlineArea getInlineArea(LayoutProcessor parentLM) { if (refId.equals("")) { getLogger().error("page-number-citation must contain \"ref-id\""); return null; @@ -202,7 +173,7 @@ public class PageNumberCitation extends FObj { return width; } - private void setup() { + public void setup() { // Common Accessibility Properties CommonAccessibility mAccProps = propMgr.getAccessibilityProps(); @@ -255,5 +226,20 @@ public class PageNumberCitation extends FObj { } -} + public String getRefId() { + return refId; + } + public InlineArea getInline() { + return inline; + } + + public boolean getUnresolved() { + return unresolved; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + +} diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index 3abc308d5..5a3c65d5f 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -3,34 +3,34 @@ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ - * + * * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. - * + * * 4. The names "FOP" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * apache@apache.org. - * + * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -42,18 +42,19 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ============================================================================ - * + * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation and was originally created by * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. - */ + */ package org.apache.fop.fo.flow; // FOP import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.layoutmgr.RetrieveMarkerLayoutManager; import org.xml.sax.Attributes; @@ -94,16 +95,20 @@ public class RetrieveMarker extends FObjMixed { this.properties.get("retrieve-boundary").getEnum(); } - /** - * @see org.apache.fop.fo.FObj#addLayoutManager(List) - */ - public void addLayoutManager(List lms) { - RetrieveMarkerLayoutManager rmlm; - rmlm = new RetrieveMarkerLayoutManager(retrieveClassName, - retrievePosition, - retrieveBoundary); - rmlm.setUserAgent(getUserAgent()); - rmlm.setFObj(this); - lms.add(rmlm); + public String getRetrieveClassName() { + return retrieveClassName; + } + + public int getRetrievePosition() { + return retrievePosition; } + + public int getRetrieveBoundary() { + return retrieveBoundary; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 5e2797bac..d1a658504 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -59,6 +59,7 @@ import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.LengthRange; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.TableLayout; import org.apache.fop.fo.properties.TableOmitFooterAtBreak; import org.apache.fop.fo.properties.TableOmitHeaderAtBreak; @@ -127,25 +128,6 @@ public class Table extends FObj { } } - /** - * Return a LayoutManager responsible for laying out this FObj's content. - * Must override in subclasses if their content can be laid out. - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - TableLayoutManager tlm = new TableLayoutManager(); - tlm.setUserAgent(getUserAgent()); - tlm.setFObj(this); - tlm.setColumns(columns); - if (tableHeader != null) { - tlm.setTableHeader(tableHeader.getLayoutManager()); - } - if (tableFooter != null) { - tlm.setTableFooter(tableFooter.getLayoutManager()); - } - list.add(tlm); - } - private void setup() { // Common Accessibility Properties CommonAccessibility mAccProps = propMgr.getAccessibilityProps(); @@ -222,5 +204,21 @@ public class Table extends FObj { return true; } + public ArrayList getColumns() { + return columns; + } + + public TableBody getTableHeader() { + return tableHeader; + } + + public TableBody getTableFooter() { + return tableFooter; + } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/TableAndCaption.java index eda3afa31..b94ca9a1b 100644 --- a/src/java/org/apache/fop/fo/flow/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/TableAndCaption.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -113,5 +114,9 @@ public class TableAndCaption extends ToBeImplementedElement { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index fc364cb8a..af9d0a379 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -58,6 +58,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -83,22 +84,6 @@ public class TableBody extends FObj { super(parent); } - /** - * Return a LayoutManager responsible for laying out this FObj's content. - * Must override in subclasses if their content can be laid out. - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - list.add(getLayoutManager()); - } - - public Body getLayoutManager() { - Body blm = new Body(); - blm.setUserAgent(getUserAgent()); - blm.setFObj(this); - return blm; - } - private void setup() throws FOPException { // Common Accessibility Properties CommonAccessibility mAccProps = propMgr.getAccessibilityProps(); @@ -132,5 +117,9 @@ public class TableBody extends FObj { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableCaption.java b/src/java/org/apache/fop/fo/flow/TableCaption.java index 8d4d00bcc..105202c65 100644 --- a/src/java/org/apache/fop/fo/flow/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/TableCaption.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -106,5 +107,9 @@ public class TableCaption extends ToBeImplementedElement { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index aa15a9807..df32f212a 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -61,6 +61,7 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.BorderCollapse; import org.apache.fop.fo.properties.DisplayAlign; @@ -165,16 +166,6 @@ public class TableCell extends FObj { } /** - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - Cell clm = new Cell(); - clm.setUserAgent(getUserAgent()); - clm.setFObj(this); - list.add(clm); - } - - /** * Set position relative to table (set by body?) */ public void setStartOffset(int offset) { @@ -389,5 +380,8 @@ public class TableCell extends FObj { return true; } -} + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } +} diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index 3236912a5..39d573441 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -55,6 +55,7 @@ import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.Property; import org.apache.fop.fo.properties.CommonBackground; @@ -167,5 +168,9 @@ public class TableColumn extends FObj { setup = true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableFooter.java b/src/java/org/apache/fop/fo/flow/TableFooter.java index 7761e33e8..0d5076699 100644 --- a/src/java/org/apache/fop/fo/flow/TableFooter.java +++ b/src/java/org/apache/fop/fo/flow/TableFooter.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; /** * Class modelling the fo:table-footer object. See Sec. 6.7.7 of the XSL-FO @@ -66,4 +67,8 @@ public class TableFooter extends TableBody { super(parent); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableHeader.java b/src/java/org/apache/fop/fo/flow/TableHeader.java index 91d8c149a..28345e8d6 100644 --- a/src/java/org/apache/fop/fo/flow/TableHeader.java +++ b/src/java/org/apache/fop/fo/flow/TableHeader.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; /** * Class modelling the fo:table-header object. See Sec. 6.7.6 of the XSL-FO @@ -66,4 +67,8 @@ public class TableHeader extends TableBody { super(parent); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index 42ee9c2e9..f8c9fc0d8 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -59,6 +59,7 @@ import org.apache.fop.datatypes.KeepValue; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.Property; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.Constants; import org.apache.fop.fo.properties.CommonAccessibility; @@ -93,16 +94,6 @@ public class TableRow extends FObj { } /** - * @param list the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List list) { - Row rlm = new Row(); - rlm.setUserAgent(getUserAgent()); - rlm.setFObj(this); - list.add(rlm); - } - - /** * @return keepWithPrevious */ public KeepValue getKeepWithPrevious() { @@ -164,5 +155,10 @@ public class TableRow extends FObj { return new KeepValue(KeepValue.KEEP_WITH_AUTO, 0); } } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index a3bd5d75f..1d6d88902 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.FOTreeVisitor; /** * Implementation for fo:wrapper formatting object. @@ -78,5 +79,9 @@ public class Wrapper extends FObjMixed { return true; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } |