From 26c9d1c1292fd63bcb4a3c261ac2285dbfe13c11 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sun, 13 Jun 2004 01:11:49 +0000 Subject: [PATCH] Moved AddLMVisitor accessors into FOTreeHandler. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197704 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/Document.java | 27 ------------------ src/java/org/apache/fop/fo/FOTreeHandler.java | 28 ++++++++++++++++++- .../fop/layoutmgr/AbstractLayoutManager.java | 8 +++--- .../fop/layoutmgr/ContentLayoutManager.java | 6 ++-- src/java/org/apache/fop/layoutmgr/LMiter.java | 2 +- .../apache/fop/layoutmgr/LayoutManager.java | 7 +++-- .../fop/layoutmgr/PageLayoutManager.java | 14 +++++----- 7 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/java/org/apache/fop/apps/Document.java b/src/java/org/apache/fop/apps/Document.java index 68c82cc73..68118a576 100644 --- a/src/java/org/apache/fop/apps/Document.java +++ b/src/java/org/apache/fop/apps/Document.java @@ -32,8 +32,6 @@ import org.apache.fop.fo.FOInputHandler; import org.apache.fop.fo.FOTreeControl; import org.apache.fop.fo.extensions.Bookmarks; import org.apache.fop.fonts.FontInfo; -import org.apache.fop.layoutmgr.AddLMVisitor; - import org.apache.commons.logging.Log; @@ -60,10 +58,6 @@ public class Document implements FOTreeControl, AreaTreeControl { private Bookmarks bookmarks = null; - /** Useful only for allowing subclasses of AddLMVisitor to be set by those - extending FOP **/ - private AddLMVisitor addLMVisitor = null; - /** * The current set of id's in the FO tree. * This is used so we know if the FO tree contains duplicates. @@ -142,25 +136,4 @@ public class Document implements FOTreeControl, AreaTreeControl { return foInputHandler; } - /** - * Public accessor to set the AddLMVisitor object that should be used. - * This allows subclasses of AddLMVisitor to be used, which can be useful - * for extensions to the FO Tree. - * @param addLMVisitor the AddLMVisitor object that should be used. - */ - public void setAddLMVisitor(AddLMVisitor addLMVisitor) { - this.addLMVisitor = addLMVisitor; - } - - /** - * Public accessor to get the AddLMVisitor object that should be used. - * @return the AddLMVisitor object that should be used. - */ - public AddLMVisitor getAddLMVisitor() { - if (this.addLMVisitor == null) { - this.addLMVisitor = new AddLMVisitor(); - } - return this.addLMVisitor; - } - } diff --git a/src/java/org/apache/fop/fo/FOTreeHandler.java b/src/java/org/apache/fop/fo/FOTreeHandler.java index a5b03e422..7cf13d324 100644 --- a/src/java/org/apache/fop/fo/FOTreeHandler.java +++ b/src/java/org/apache/fop/fo/FOTreeHandler.java @@ -50,6 +50,7 @@ import org.apache.fop.fo.flow.TableCell; import org.apache.fop.fo.flow.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.layoutmgr.AddLMVisitor; import org.apache.fop.layoutmgr.ContentLayoutManager; import org.apache.fop.layoutmgr.InlineStackingLayoutManager; import org.apache.fop.layoutmgr.LMiter; @@ -90,6 +91,10 @@ public class FOTreeHandler extends FOInputHandler { */ private long startTime; + /** Useful only for allowing subclasses of AddLMVisitor to be set by those + extending FOP **/ + private AddLMVisitor addLMVisitor = null; + /** * Main constructor * @param foTreeControl the FOTreeControl implementation that governs this @@ -504,7 +509,7 @@ public class FOTreeHandler extends FOInputHandler { // This will layout pages and add them to the area tree PageLayoutManager pageLM = new PageLayoutManager(areaTree, pageSeq, - getDocument()); + this); pageLM.setPageCounting(pageSeq.getCurrentPageNumber(), pageSeq.getPageNumberGenerator()); @@ -552,6 +557,27 @@ public class FOTreeHandler extends FOInputHandler { return title; } + /** + * Public accessor to set the AddLMVisitor object that should be used. + * This allows subclasses of AddLMVisitor to be used, which can be useful + * for extensions to the FO Tree. + * @param addLMVisitor the AddLMVisitor object that should be used. + */ + public void setAddLMVisitor(AddLMVisitor addLMVisitor) { + this.addLMVisitor = addLMVisitor; + } + + /** + * Public accessor to get the AddLMVisitor object that should be used. + * @return the AddLMVisitor object that should be used. + */ + public AddLMVisitor getAddLMVisitor() { + if (this.addLMVisitor == null) { + this.addLMVisitor = new AddLMVisitor(); + } + return this.addLMVisitor; + } + /** * * @param pagenum PageNumber that is starting. diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index b4b7a08f1..575c2df8c 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -20,12 +20,12 @@ package org.apache.fop.layoutmgr; import org.apache.fop.fo.FObj; import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.apps.Document; -import org.apache.fop.fo.flow.Marker; import org.apache.fop.area.Area; import org.apache.fop.area.Resolveable; import org.apache.fop.area.PageViewport; import org.apache.fop.fo.Constants; +import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.FOTreeHandler; import org.apache.fop.fo.PropertyManager; import org.apache.commons.logging.Log; @@ -108,8 +108,8 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants return this.parentLM; } - public Document getDocument() { - return getParent().getDocument(); + public FOTreeHandler getFOTreeHandler() { + return getParent().getFOTreeHandler(); } // /** diff --git a/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java index c1ee57b46..bad20c2fe 100644 --- a/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java @@ -19,7 +19,7 @@ package org.apache.fop.layoutmgr; import org.apache.fop.fo.FObj; -import org.apache.fop.apps.Document; +import org.apache.fop.fo.FOTreeHandler; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.flow.Marker; import org.apache.fop.area.Area; @@ -171,8 +171,8 @@ public class ContentLayoutManager implements LayoutManager { return this.parentLM; } - public Document getDocument() { - return getParent().getDocument(); + public FOTreeHandler getFOTreeHandler() { + return getParent().getFOTreeHandler(); } /** @see org.apache.fop.layoutmgr.LayoutManager */ diff --git a/src/java/org/apache/fop/layoutmgr/LMiter.java b/src/java/org/apache/fop/layoutmgr/LMiter.java index 774e03351..6243faf41 100644 --- a/src/java/org/apache/fop/layoutmgr/LMiter.java +++ b/src/java/org/apache/fop/layoutmgr/LMiter.java @@ -46,7 +46,7 @@ public class LMiter implements ListIterator { } protected boolean preLoadNext() { - AddLMVisitor addLMVisitor = lp.getDocument().getAddLMVisitor(); + AddLMVisitor addLMVisitor = lp.getFOTreeHandler().getAddLMVisitor(); // skip over child FObj's that don't add lms while (baseIter != null && baseIter.hasNext()) { Object theobj = baseIter.next(); diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/java/org/apache/fop/layoutmgr/LayoutManager.java index 102c89978..f11491067 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManager.java @@ -27,6 +27,7 @@ import org.apache.fop.area.Resolveable; import org.apache.fop.area.PageViewport; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeHandler; /** * The interface for all LayoutManagers. @@ -57,10 +58,10 @@ public interface LayoutManager { LayoutManager getParent(); /** - * Get the Document object that is at the top of the LM Tree - * @return the Document object that is at the top of the LM Tree + * Get the FOTreeHandler object that is activating the LM Tree + * @return the FOTreeHandler object */ - org.apache.fop.apps.Document getDocument(); + FOTreeHandler getFOTreeHandler(); /** * Initialize this layout manager. diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java index 4c4015521..08832ae0b 100644 --- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -18,7 +18,6 @@ package org.apache.fop.layoutmgr; -import org.apache.fop.apps.Document; import org.apache.fop.apps.FOPException; import org.apache.fop.area.CTM; @@ -42,6 +41,7 @@ import org.apache.fop.datatypes.PercentBase; import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeHandler; import org.apache.fop.fo.Constants; import org.apache.fop.fo.flow.Marker; import org.apache.fop.fo.pagination.PageNumberGenerator; @@ -110,7 +110,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable */ private AreaTree areaTree; private PageSequence pageSequence; - private Document doc; + private FOTreeHandler foTreeHandler; /** * This is the SimplePageMaster that should be used to create the page. It @@ -134,11 +134,11 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable * @param pageseq the page sequence fo */ public PageLayoutManager(AreaTree areaTree, PageSequence pageseq, - Document doc) { + FOTreeHandler foTreeHandler) { super(pageseq); this.areaTree = areaTree; pageSequence = pageseq; - this.doc = doc; + this.foTreeHandler = foTreeHandler; } /** @@ -899,9 +899,9 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable } /** - * @return the apps.Document object controlling this generation + * @return the apps.FOTreeHandler object controlling this generation */ - public Document getDocument() { - return doc; + public FOTreeHandler getFOTreeHandler() { + return foTreeHandler; } } -- 2.39.5