From: William Victor Mote Date: Tue, 19 Aug 2003 00:53:55 +0000 (+0000) Subject: 1. Remove fo/FOTreeExternal and layoutmgr/LMFOTreeExternal (in favor of Visitor conce... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1194 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=23c8e89aeb3e2e86cef67e4225b5e6991752c52c;p=xmlgraphics-fop.git 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 --- diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 198e6303e..dcd012206 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -321,7 +321,7 @@ public class Driver implements LogEnabled, FOTreeListener { * @return the logger * @see #enableLogging(Logger) */ - protected Logger getLogger() { + public Logger getLogger() { if (this.log == null) { // use ConsoleLogger as default when logger not explicitly set this.log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); diff --git a/src/java/org/apache/fop/area/LinkResolver.java b/src/java/org/apache/fop/area/LinkResolver.java new file mode 100644 index 000000000..4289bf599 --- /dev/null +++ b/src/java/org/apache/fop/area/LinkResolver.java @@ -0,0 +1,103 @@ +/* + * $Id$ + * ============================================================================ + * 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 + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.area; + +// Java +import java.util.List; +import java.io.Serializable; + +// FOP +import org.apache.fop.area.Trait; +import org.apache.fop.area.Resolveable; +import org.apache.fop.area.PageViewport; +import org.apache.fop.area.Area; + +/** + * Link resolving for resolving internal links. + */ +public 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[] getIDs() { + return new String[] {idRef}; + } + + /** + * 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()); + } + } +} diff --git a/src/java/org/apache/fop/extensions/Bookmarks.java b/src/java/org/apache/fop/extensions/Bookmarks.java index 9152b7a56..f383db27d 100644 --- a/src/java/org/apache/fop/extensions/Bookmarks.java +++ b/src/java/org/apache/fop/extensions/Bookmarks.java @@ -52,6 +52,7 @@ package org.apache.fop.extensions; import org.apache.fop.fo.FOTreeHandler; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.area.AreaTree; import java.util.ArrayList; @@ -114,5 +115,10 @@ public class Bookmarks extends ExtensionObj { data.setAreaTree(at); } } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/extensions/ExtensionObj.java b/src/java/org/apache/fop/extensions/ExtensionObj.java index 05d6a63e4..00e827a72 100644 --- a/src/java/org/apache/fop/extensions/ExtensionObj.java +++ b/src/java/org/apache/fop/extensions/ExtensionObj.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,16 +42,17 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.extensions; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; /** * Base class for pdf bookmark extension objects. @@ -67,5 +68,9 @@ public abstract class ExtensionObj extends FObj { super(parent); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/extensions/Label.java b/src/java/org/apache/fop/extensions/Label.java index da4068cf5..1ab3db92c 100644 --- a/src/java/org/apache/fop/extensions/Label.java +++ b/src/java/org/apache/fop/extensions/Label.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,15 +42,16 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.extensions; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; /** * Labal for PDF bookmark extension. @@ -89,4 +90,8 @@ public class Label extends ExtensionObj { return label; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/extensions/Outline.java b/src/java/org/apache/fop/extensions/Outline.java index 061d3705c..ff3b840fb 100644 --- a/src/java/org/apache/fop/extensions/Outline.java +++ b/src/java/org/apache/fop/extensions/Outline.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,15 +42,16 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.extensions; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; import java.util.ArrayList; @@ -140,5 +141,9 @@ public class Outline extends ExtensionObj { return label == null ? "" : label.toString(); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index e51744f67..0b20e6752 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -97,7 +97,7 @@ public abstract class FONode { * Returns the logger for the node. * @return the logger */ - protected Logger getLogger() { + public Logger getLogger() { return userAgent.getLogger(); } @@ -113,7 +113,7 @@ public abstract class FONode { * Returns the user agent for the node. * @return FOUserAgent */ - protected FOUserAgent getUserAgent() { + public FOUserAgent getUserAgent() { return userAgent; } @@ -211,9 +211,24 @@ public abstract class FONode { return false; } + /** + * Recursively goes up the FOTree hierarchy until the FONode is found, + * which returns the parent Document. + * @return the Document object that is the parent of this node. + */ public Document getDocument() { return parent.getDocument(); } + /** + * This is a hook for an FOTreeVisitor subclass to be able to access + * this object. + * @param fotv the FOTreeVisitor subclass that can access this object. + * @see org.apache.fop.fo.FOTreeVisitor + */ + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index da91da0b6..a7d066cdf 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -76,10 +76,10 @@ import org.apache.fop.fo.properties.TextTransform; */ public class FOText extends FObj { - private char[] ca; + public char[] ca; private int start; - private int length; - private TextInfo textInfo; + public int length; + public TextInfo textInfo; private TextState ts; /** @@ -165,22 +165,6 @@ public class FOText extends FObj { return false; } - public void addLayoutManager(List list) { - // if nothing left (length=0)? - if (length == 0) { - return; - } - - if (length < ca.length) { - char[] tmp = ca; - ca = new char[length]; - System.arraycopy(tmp, 0, ca, 0, length); - } - LayoutManager lm = new TextLayoutManager(ca, textInfo); - lm.setFObj(this); - list.add(lm); - } - /** * @return a new TextCharIterator */ @@ -503,4 +487,7 @@ public class FOText extends FObj { } } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } } diff --git a/src/java/org/apache/fop/fo/FOTreeExternal.java b/src/java/org/apache/fop/fo/FOTreeExternal.java index 5378f8fc1..f129f1bb0 100644 --- a/src/java/org/apache/fop/fo/FOTreeExternal.java +++ b/src/java/org/apache/fop/fo/FOTreeExternal.java @@ -50,6 +50,8 @@ */ package org.apache.fop.fo; +import org.apache.fop.fo.FONode; + /** * Default class for handling external calls as an FO Tree is being built. * "External calls" are processes that are not directly related to building @@ -64,5 +66,11 @@ package org.apache.fop.fo; public class FOTreeExternal { + public void extFONode(FONode foNode) { + } + + public void extFObj(FObj fobj) { + } + } diff --git a/src/java/org/apache/fop/fo/FOTreeVisitor.java b/src/java/org/apache/fop/fo/FOTreeVisitor.java new file mode 100644 index 000000000..e29afaede --- /dev/null +++ b/src/java/org/apache/fop/fo/FOTreeVisitor.java @@ -0,0 +1,673 @@ +/* + * $Id$ + * ============================================================================ + * 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 + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.fo; + +import org.apache.fop.fo.flow.BlockContainer; +import org.apache.fop.fo.flow.Character; +import org.apache.fop.fo.pagination.ColorProfile; +import org.apache.fop.fo.pagination.ConditionalPageMasterReference; +import org.apache.fop.fo.pagination.Declarations; +import org.apache.fop.extensions.ExtensionObj; +import org.apache.fop.extensions.Bookmarks; +import org.apache.fop.extensions.Label; +import org.apache.fop.extensions.Outline; +import org.apache.fop.fo.flow.ExternalGraphic; +import org.apache.fop.fo.pagination.Flow; +import org.apache.fop.fo.pagination.StaticContent; +import org.apache.fop.fo.flow.BidiOverride; +import org.apache.fop.fo.flow.Block; +import org.apache.fop.fo.flow.Inline; +import org.apache.fop.fo.flow.BasicLink; +import org.apache.fop.fo.flow.Leader; +import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.pagination.Title; +import org.apache.fop.fo.flow.Wrapper; +import org.apache.fop.fo.flow.Footnote; +import org.apache.fop.fo.flow.FootnoteBody; +import org.apache.fop.fo.flow.InlineContainer; +import org.apache.fop.fo.flow.InstreamForeignObject; +import org.apache.fop.fo.pagination.LayoutMasterSet; +import org.apache.fop.fo.flow.ListBlock; +import org.apache.fop.fo.flow.ListItem; +import org.apache.fop.fo.flow.ListItemBody; +import org.apache.fop.fo.flow.ListItemLabel; +import org.apache.fop.fo.pagination.PageMasterReference; +import org.apache.fop.fo.pagination.RepeatablePageMasterReference; +import org.apache.fop.fo.pagination.SinglePageMasterReference; +import org.apache.fop.fo.flow.PageNumber; +import org.apache.fop.fo.flow.PageNumberCitation; +import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.PageSequenceMaster; +import org.apache.fop.fo.pagination.Region; +import org.apache.fop.fo.pagination.RegionBASE; +import org.apache.fop.fo.pagination.RegionBA; +import org.apache.fop.fo.pagination.RegionAfter; +import org.apache.fop.fo.pagination.RegionBefore; +import org.apache.fop.fo.pagination.RegionSE; +import org.apache.fop.fo.pagination.RegionEnd; +import org.apache.fop.fo.pagination.RegionStart; +import org.apache.fop.fo.pagination.RegionBody; +import org.apache.fop.fo.pagination.RepeatablePageMasterAlternatives; +import org.apache.fop.fo.pagination.Root; +import org.apache.fop.fo.pagination.SimplePageMaster; +import org.apache.fop.fo.flow.Table; +import org.apache.fop.fo.flow.TableBody; +import org.apache.fop.fo.flow.TableFooter; +import org.apache.fop.fo.flow.TableHeader; +import org.apache.fop.fo.flow.TableCell; +import org.apache.fop.fo.flow.TableColumn; +import org.apache.fop.fo.flow.TableRow; +import org.apache.fop.fo.flow.Float; +import org.apache.fop.fo.flow.InitialPropertySet; +import org.apache.fop.fo.flow.MultiCase; +import org.apache.fop.fo.flow.MultiProperties; +import org.apache.fop.fo.flow.MultiPropertySet; +import org.apache.fop.fo.flow.MultiSwitch; +import org.apache.fop.fo.flow.MultiToggle; +import org.apache.fop.fo.flow.TableAndCaption; +import org.apache.fop.fo.flow.TableCaption; +import org.apache.fop.svg.SVGObj; +import org.apache.fop.svg.SVGElement; + +/** + *

Implements the GoF Visitor design pattern to allow access to the FOTree + * hierarchy without knowing what subclass of FONode is being accessed. + * To preserve inheritance, and simulate the polymorphism that would exist if + * the subclass methods were embedded in the visited hierarchy, the default for + * each method (except serveVisitor(FONode)) is to run the the visitXXXX method + * that corresponds to the superclass of the FOTree child element. Thus, any + * method that is overridden in a subclass of FOTreeVisitor will affect not only + * FOTree elements of the class that method was written for, but also all + * subclasses of that class.

+ *

Caveat: Because there appears to be no way for one + * object to cast objects from another class to their superclass, this + * superclass logic has been hard-coded into FOTreeVisitor. So, for example, + * serveVisitor(FObj) runs the following:

+ *
    serveVisitor((FONode)node);
+ *

If FObj ceases to be a direct subclass of FONode, then the above may cause + * problems.

+ */ +public abstract class FOTreeVisitor { + + /** + * @param node FONode object to process + */ + public void serveVisitor(FONode node) { + } + + /** + * @param node FObj object to process + */ + public void serveVisitor(FObj node) { + serveVisitor((FONode)node); + } + + /** + * @param node BlockContainer object to process + */ + public void serveVisitor(BlockContainer node) { + serveVisitor((FObj)node); + } + + /** + * @param node Character object to process + */ + public void serveVisitor(Character node) { + serveVisitor((FObj)node); + } + + /** + * @param node ColorProfile object to process + */ + public void serveVisitor(ColorProfile node) { + serveVisitor((FObj)node); + } + + /** + * @param node ConditionalPageMasterReference object to process + */ + public void serveVisitor(ConditionalPageMasterReference node) { + serveVisitor((FObj)node); + } + + /** + * @param node Declarations object to process + */ + public void serveVisitor(Declarations node) { + serveVisitor((FObj)node); + } + + /** + * @param node ExtensionObj object to process + */ + public void serveVisitor(ExtensionObj node) { + serveVisitor((FObj)node); + } + + /** + * @param node Bookmarks object to process + */ + public void serveVisitor(Bookmarks node) { + serveVisitor((ExtensionObj)node); + } + + /** + * @param node Label object to process + */ + public void serveVisitor(Label node) { + serveVisitor((ExtensionObj)node); + } + + /** + * @param node Outline object to process + */ + public void serveVisitor(Outline node) { + serveVisitor((ExtensionObj)node); + } + + /** + * @param node ExternalGraphic object to process + */ + public void serveVisitor(ExternalGraphic node) { + serveVisitor((FObj)node); + } + + /** + * @param node Flow object to process + */ + public void serveVisitor(Flow node) { + serveVisitor((FObj)node); + } + + /** + * @param node StaticContent object to process + */ + public void serveVisitor(StaticContent node) { + serveVisitor((Flow)node); + } + + /** + * @param node FObjMixed object to process + */ + public void serveVisitor(FObjMixed node) { + serveVisitor((FObj)node); + } + + /** + * @param node BidiOverride object to process + */ + public void serveVisitor(BidiOverride node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node Block object to process + */ + public void serveVisitor(Block node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node Inline object to process + */ + public void serveVisitor(Inline node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node BasicLink object to process + */ + public void serveVisitor(BasicLink node) { + serveVisitor((Inline)node); + } + + /** + * @param node Leader object to process + */ + public void serveVisitor(Leader node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node Marker object to process + */ + public void serveVisitor(Marker node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node RetrieveMarker object to process + */ + public void serveVisitor(RetrieveMarker node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node Title object to process + */ + public void serveVisitor(Title node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node Wrapper object to process + */ + public void serveVisitor(Wrapper node) { + serveVisitor((FObjMixed)node); + } + + /** + * @param node Footnote object to process + */ + public void serveVisitor(Footnote node) { + serveVisitor((FObj)node); + } + + /** + * @param node FootnoteBody object to process + */ + public void serveVisitor(FootnoteBody node) { + serveVisitor((FObj)node); + } + + /** + * @param node FOText object to process + */ + public void serveVisitor(FOText node) { + serveVisitor((FObj)node); + } + + /** + * @param node InlineContainer object to process + */ + public void serveVisitor(InlineContainer node) { + serveVisitor((FObj)node); + } + + /** + * @param node InstreamForeignObject object to process + */ + public void serveVisitor(InstreamForeignObject node) { + serveVisitor((FObj)node); + } + + /** + * @param node LayoutMasterSet object to process + */ + public void serveVisitor(LayoutMasterSet node) { + serveVisitor((FObj)node); + } + + /** + * @param node ListBlock object to process + */ + public void serveVisitor(ListBlock node) { + serveVisitor((FObj)node); + } + + /** + * @param node ListItem object to process + */ + public void serveVisitor(ListItem node) { + serveVisitor((FObj)node); + } + + /** + * @param node ListItemBody object to process + */ + public void serveVisitor(ListItemBody node) { + serveVisitor((FObj)node); + } + + /** + * @param node ListItemLabel object to process + */ + public void serveVisitor(ListItemLabel node) { + serveVisitor((FObj)node); + } + + /** + * @param node PageMasterReference object to process + */ + public void serveVisitor(PageMasterReference node) { + serveVisitor((FObj)node); + } + + /** + * @param node RepeatablePageMasterReference object to process + */ + public void serveVisitor(RepeatablePageMasterReference node) { + serveVisitor((PageMasterReference)node); + } + + /** + * @param node SinglePageMasterReference object to process + */ + public void serveVisitor(SinglePageMasterReference node) { + serveVisitor((PageMasterReference)node); + } + + /** + * @param node PageNumber object to process + */ + public void serveVisitor(PageNumber node) { + serveVisitor((FObj)node); + } + + /** + * @param node PageNumberCitation object to process + */ + public void serveVisitor(PageNumberCitation node) { + serveVisitor((FObj)node); + } + + /** + * @param node PageSequence object to process + */ + public void serveVisitor(PageSequence node) { + serveVisitor((FObj)node); + } + + /** + * @param node PageSequenceMaster object to process + */ + public void serveVisitor(PageSequenceMaster node) { + serveVisitor((FObj)node); + } + + /** + * @param node Region object to process + */ + public void serveVisitor(Region node) { + serveVisitor((FObj)node); + } + + /** + * @param node RegionBASE object to process + */ + public void serveVisitor(RegionBASE node) { + serveVisitor((Region)node); + } + + /** + * @param node RegionBA object to process + */ + public void serveVisitor(RegionBA node) { + serveVisitor((RegionBASE)node); + } + + /** + * @param node RegionAfter object to process + */ + public void serveVisitor(RegionAfter node) { + serveVisitor((RegionBA)node); + } + + /** + * @param node RegionBefore object to process + */ + public void serveVisitor(RegionBefore node) { + serveVisitor((RegionBA)node); + } + + /** + * @param node RegionSE object to process + */ + public void serveVisitor(RegionSE node) { + serveVisitor((RegionBASE)node); + } + + /** + * @param node RegionEnd object to process + */ + public void serveVisitor(RegionEnd node) { + serveVisitor((RegionSE)node); + } + + /** + * @param node RegionStart object to process + */ + public void serveVisitor(RegionStart node) { + serveVisitor((RegionSE)node); + } + + /** + * @param node RegionBody object to process + */ + public void serveVisitor(RegionBody node) { + serveVisitor((Region)node); + } + + /** + * @param node RepeatablePageMasterAlternatives object to process + */ + public void serveVisitor(RepeatablePageMasterAlternatives node) { + serveVisitor((FObj)node); + } + + /** + * @param node Root object to process + */ + public void serveVisitor(Root node) { + serveVisitor((FObj)node); + } + + /** + * @param node SimplePageMaster object to process + */ + public void serveVisitor(SimplePageMaster node) { + serveVisitor((FObj)node); + } + + /** + * @param node Table object to process + */ + public void serveVisitor(Table node) { + serveVisitor((FObj)node); + } + + /** + * @param node TableBody object to process + */ + public void serveVisitor(TableBody node) { + serveVisitor((FObj)node); + } + + /** + * @param node TableFooter object to process + */ + public void serveVisitor(TableFooter node) { + serveVisitor((TableBody)node); + } + + /** + * @param node TableHeader object to process + */ + public void serveVisitor(TableHeader node) { + serveVisitor((TableBody)node); + } + + /** + * @param node TableCell object to process + */ + public void serveVisitor(TableCell node) { + serveVisitor((FObj)node); + } + + /** + * @param node TableColumn object to process + */ + public void serveVisitor(TableColumn node) { + serveVisitor((FObj)node); + } + + /** + * @param node TableRow object to process + */ + public void serveVisitor(TableRow node) { + serveVisitor((FObj)node); + } + + /** + * @param node ToBeImplementedElement object to process + */ + public void serveVisitor(ToBeImplementedElement node) { + serveVisitor((FObj)node); + } + + /** + * @param node Float object to process + */ + public void serveVisitor(Float node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node InitialPropertySet object to process + */ + public void serveVisitor(InitialPropertySet node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node MultiCase object to process + */ + public void serveVisitor(MultiCase node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node MultiProperties object to process + */ + public void serveVisitor(MultiProperties node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node MultiPropertySet object to process + */ + public void serveVisitor(MultiPropertySet node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node MultiSwitch object to process + */ + public void serveVisitor(MultiSwitch node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node MultiToggle object to process + */ + public void serveVisitor(MultiToggle node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node TableAndCaption object to process + */ + public void serveVisitor(TableAndCaption node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node TableCaption object to process + */ + public void serveVisitor(TableCaption node) { + serveVisitor((ToBeImplementedElement)node); + } + + /** + * @param node Unknown object to process + */ + public void serveVisitor(Unknown node) { + serveVisitor((FONode)node); + } + + /** + * @param node XMLObj object to process + */ + public void serveVisitor(XMLObj node) { + serveVisitor((FONode)node); + } + + /** + * @param node SVGObj object to process + */ + public void serveVisitor(SVGObj node) { + serveVisitor((XMLObj)node); + } + + /** + * @param node SVGElement object to process + */ + public void serveVisitor(SVGElement node) { + serveVisitor((SVGObj)node); + } + + /** + * @param node UnknownXMLObj object to process + */ + public void serveVisitor(UnknownXMLObj node) { + serveVisitor((XMLObj)node); + } + + /** + * @param node XMLElement object to process + */ + public void serveVisitor(XMLElement node) { + serveVisitor((XMLObj)node); + } + +} + diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 6f5199591..c95bfec10 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -276,7 +276,7 @@ public class FObj extends FONode { * This methods checks that the id isn't already used by another * fo and sets the id attribute of this object. */ - protected void setupID() { + public void setupID() { Property prop = this.properties.get("id"); if (prop != null) { String str = prop.getString(); @@ -340,14 +340,6 @@ public class FObj extends FONode { p.getProperty("writing-mode").getEnum()); } - /** - * 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) { - } - /** * Return an iterator over all the children of this FObj. * @return A ListIterator. @@ -436,5 +428,8 @@ public class FObj extends FONode { return this.propMgr; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } } diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java index 58ba11288..d0320b6cc 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/java/org/apache/fop/fo/FObjMixed.java @@ -81,20 +81,6 @@ public class FObjMixed extends FObj { fontInfo = foih.getFontInfo(); } - /** - * @param lms the list to which the layout manager(s) should be added - */ - public void addLayoutManager(List lms) { - if (children != null) { - InlineStackingLayoutManager lm; - lm = new InlineStackingLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setLMiter(new LMiter(children.listIterator())); - lms.add(lm); - } - } - /** * @param data array of characters containing text to be added * @param start starting array element to add @@ -127,5 +113,8 @@ public class FObjMixed extends FObj { return new RecursiveCharIterator(this); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } } diff --git a/src/java/org/apache/fop/fo/ToBeImplementedElement.java b/src/java/org/apache/fop/fo/ToBeImplementedElement.java index e36f0afeb..2db857bda 100644 --- a/src/java/org/apache/fop/fo/ToBeImplementedElement.java +++ b/src/java/org/apache/fop/fo/ToBeImplementedElement.java @@ -67,4 +67,8 @@ public class ToBeImplementedElement extends FObj { + "\" is not yet implemented."); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/Unknown.java b/src/java/org/apache/fop/fo/Unknown.java index b40dd4ec6..fd6e0b4b2 100644 --- a/src/java/org/apache/fop/fo/Unknown.java +++ b/src/java/org/apache/fop/fo/Unknown.java @@ -83,4 +83,9 @@ public class Unknown extends FONode { private void setup() { getLogger().debug("Layout Unknown element"); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/UnknownXMLObj.java b/src/java/org/apache/fop/fo/UnknownXMLObj.java index 02a8b87a1..7e6577fc8 100644 --- a/src/java/org/apache/fop/fo/UnknownXMLObj.java +++ b/src/java/org/apache/fop/fo/UnknownXMLObj.java @@ -118,5 +118,9 @@ public class UnknownXMLObj extends XMLObj { super.addCharacters(data, start, length); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/XMLElement.java b/src/java/org/apache/fop/fo/XMLElement.java index 3a2db0196..08c91c2d3 100644 --- a/src/java/org/apache/fop/fo/XMLElement.java +++ b/src/java/org/apache/fop/fo/XMLElement.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo; // XML @@ -85,4 +85,9 @@ public class XMLElement extends XMLObj { public String getNameSpace() { return namespace; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/XMLObj.java b/src/java/org/apache/fop/fo/XMLObj.java index b1e1b5b9b..c499748a6 100644 --- a/src/java/org/apache/fop/fo/XMLObj.java +++ b/src/java/org/apache/fop/fo/XMLObj.java @@ -231,5 +231,9 @@ public abstract class XMLObj extends FONode { element.appendChild(text); } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } 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; @@ -243,18 +244,6 @@ public class Block extends FObjMixed { return this.span; } - /** - * @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) */ @@ -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; @@ -100,34 +101,13 @@ public class ExternalGraphic extends FObj { super(parent); } - /** - * 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 @@ -73,18 +74,6 @@ public class Footnote extends FObj { super(parent); } - /** - * @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 */ @@ -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; @@ -82,18 +83,6 @@ public class InlineContainer extends FObj { super(parent); } - /** - * @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 */ @@ -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). @@ -86,29 +87,12 @@ public class InstreamForeignObject extends FObj { super(parent); } - /** - * 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 . For more information on the Apache * Software Foundation, please see . - */ + */ 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 . For more information on the Apache * Software Foundation, please see . - */ + */ 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; @@ -164,16 +165,6 @@ public class TableCell extends FObj { doSetup(); // init some basic property values } - /** - * @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?) */ @@ -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; @@ -92,16 +93,6 @@ public class TableRow extends FObj { super(parent); } - /** - * @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 */ @@ -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); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java index 6bc2c6a77..c315f20b8 100644 --- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java +++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java @@ -61,6 +61,7 @@ import java.io.InputStream; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; /** * The fo:color-profile formatting object. @@ -129,4 +130,9 @@ public class ColorProfile extends FObj { getLogger().error("Color Profile src not an ICC Profile", iae); } } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index acc1f72fe..37db54438 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // XML @@ -56,6 +56,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.fo.properties.BlankOrNotBlank; import org.apache.fop.fo.properties.OddOrEven; import org.apache.fop.fo.properties.PagePosition; @@ -127,7 +128,7 @@ public class ConditionalPageMasterReference extends FObj { * @param isBlankPage True if page is blank * @return True if the conditions for this reference are met */ - protected boolean isValid(boolean isOddPage, + protected boolean isValid(boolean isOddPage, boolean isFirstPage, boolean isBlankPage) { // page-position @@ -197,4 +198,8 @@ public class ConditionalPageMasterReference extends FObj { } } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java index 54ec1dea9..397609f83 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -58,6 +58,7 @@ import java.util.Iterator; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.XMLObj; @@ -113,4 +114,9 @@ public class Declarations extends FObj { } children = null; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 7ad6637a7..3f5f5e798 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.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.layoutmgr.FlowLayoutManager; @@ -178,14 +179,7 @@ public class Flow extends FObj { return true; } - /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List list) { - FlowLayoutManager lm = new FlowLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - list.add(lm); + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); } - } diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 980bf51ea..0c819b484 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // 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; /** @@ -72,7 +73,7 @@ import org.apache.fop.apps.FOPException; * information for a page sequence. */ public class LayoutMasterSet extends FObj { - + private Map simplePageMasters; private Map pageSequenceMasters; @@ -138,7 +139,7 @@ public class LayoutMasterSet extends FObj { * @param pageSequenceMaster PageSequenceMaster instance * @throws FOPException if there's a problem with name uniqueness */ - protected void addPageSequenceMaster(String masterName, + protected void addPageSequenceMaster(String masterName, PageSequenceMaster pageSequenceMaster) throws FOPException { // check against duplication of master-name @@ -218,5 +219,10 @@ public class LayoutMasterSet extends FObj { } return false; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/PageMasterReference.java b/src/java/org/apache/fop/fo/pagination/PageMasterReference.java index bb61e279d..30150b3fb 100644 --- a/src/java/org/apache/fop/fo/pagination/PageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/PageMasterReference.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // SAX @@ -57,6 +57,7 @@ import org.xml.sax.Attributes; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FOTreeVisitor; /** * Base PageMasterReference class. Provides implementation for handling the @@ -117,4 +118,8 @@ public abstract class PageMasterReference extends FObj } } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 3014426c4..8ee2a86c5 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.layout.PageMaster; import org.apache.fop.area.AreaTree; import org.apache.fop.area.PageViewport; @@ -821,5 +822,9 @@ public class PageSequence extends FObj { return titleFO; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 86624ef1f..1d1cc004b 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -59,6 +59,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; /** @@ -67,7 +68,7 @@ import org.apache.fop.apps.FOPException; * which are simple or complex references to page-masters. */ public class PageSequenceMaster extends FObj { - + private LayoutMasterSet layoutMasterSet; private List subSequenceSpecifiers; private SubSequenceSpecifier currentSubSequence; @@ -80,7 +81,7 @@ public class PageSequenceMaster extends FObj { // references to page-masters. So the methods use the former // terminology ('sub-sequence-specifiers', or SSS), // but the actual FO's are MasterReferences. - + /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -196,5 +197,9 @@ public class PageSequenceMaster extends FObj { return pageMaster; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 766877183..a75c793ae 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -58,6 +58,7 @@ import java.awt.geom.Rectangle2D; import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.apps.FOPException; @@ -286,4 +287,9 @@ public abstract class Region extends FObj { public int getExtent() { return 0; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java index 55003c139..133e14e89 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -55,6 +55,7 @@ import java.awt.Rectangle; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.datatypes.FODimension; import org.apache.fop.area.RegionReference; @@ -108,5 +109,10 @@ public class RegionAfter extends RegionBA { public String getRegionClass() { return Region.AFTER; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java index 6023be995..891efa594 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -57,6 +57,7 @@ import java.awt.Rectangle; import org.apache.fop.fo.FONode; import org.apache.fop.fo.properties.Precedence; import org.apache.fop.fo.properties.WritingMode; +import org.apache.fop.fo.FOTreeVisitor; /** * Abstract base class for fo:region-before and fo:region-after. @@ -116,5 +117,10 @@ public abstract class RegionBA extends RegionBASE { } } } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBASE.java b/src/java/org/apache/fop/fo/pagination/RegionBASE.java index 550f55e9e..bd25148d6 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBASE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBASE.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,16 +42,17 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; /** * Base class for Before, After, Start and End regions (BASE). @@ -82,5 +83,10 @@ public abstract class RegionBASE extends Region { public int getExtent() { return this.extent; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java index 258cffb67..dae61c0f9 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.area.RegionReference; // Java @@ -113,5 +114,10 @@ public class RegionBefore extends RegionBA { } return vpRect; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index f3c65ceb6..6c56b964e 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -57,6 +57,7 @@ import java.awt.geom.Rectangle2D; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.Property; import org.apache.fop.fo.properties.Overflow; @@ -103,7 +104,7 @@ public class RegionBody extends Region { } else { vpRect = new Rectangle(start, mProps.spaceBefore, reldims.bpd - mProps.spaceBefore - mProps.spaceAfter, - reldims.ipd - start + reldims.ipd - start - getRelMargin(PropertyList.END, "end-indent")); } return vpRect; @@ -115,7 +116,7 @@ public class RegionBody extends Region { */ private int getRelMargin(int reldir, String sRelPropName) { FObj parent = (FObj) getParent(); - String sPropName = "margin-" + String sPropName = "margin-" + parent.properties.wmRelToAbs(reldir); Property prop = properties.getExplicitBaseProp(sPropName); if (prop == null) { @@ -170,4 +171,8 @@ public class RegionBody extends Region { return body; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/java/org/apache/fop/fo/pagination/RegionEnd.java index d7039e59c..6034ec3c6 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -55,6 +55,7 @@ import java.awt.Rectangle; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.datatypes.FODimension; import org.apache.fop.area.RegionReference; @@ -109,5 +110,10 @@ public class RegionEnd extends RegionSE { public int getRegionAreaClass() { return RegionReference.END; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java index b137a5d86..98bdcc870 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionSE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionSE.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -55,6 +55,7 @@ import java.awt.Rectangle; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.WritingMode; /** @@ -98,5 +99,10 @@ public abstract class RegionSE extends RegionBASE { } } } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java index 665e522c8..a8cf4d89d 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java @@ -55,6 +55,7 @@ import java.awt.Rectangle; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.datatypes.FODimension; import org.apache.fop.area.RegionReference; @@ -108,5 +109,10 @@ public class RegionStart extends RegionSE { public int getRegionAreaClass() { return RegionReference.START; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index e976590b5..51cee83f8 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -59,6 +59,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; /** @@ -165,4 +166,8 @@ public class RepeatablePageMasterAlternatives extends FObj this.numberConsumed = 0; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index 3dcc76728..ffe0ba7e6 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // XML @@ -55,6 +55,7 @@ import org.xml.sax.Attributes; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; /** @@ -126,4 +127,8 @@ public class RepeatablePageMasterReference extends PageMasterReference this.numberConsumed = 0; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index 2726372f1..75654ad76 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -57,6 +57,7 @@ import java.util.List; import org.apache.fop.control.Document; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; /** * The fo:root formatting object. Contains page masters, page-sequences. @@ -161,4 +162,8 @@ public class Root extends FObj { return document; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 6b3c52097..fcbb659c5 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; // Java @@ -64,6 +64,7 @@ import org.apache.fop.area.CTM; import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.area.PageViewport; import org.apache.fop.area.Page; import org.apache.fop.area.RegionViewport; @@ -216,7 +217,7 @@ public class SimplePageMaster extends FObj { if (child instanceof Region) { addRegion((Region)child); } else { - getLogger().error("SimplePageMaster cannot have child of type " + getLogger().error("SimplePageMaster cannot have child of type " + child.getName()); } } @@ -254,7 +255,7 @@ public class SimplePageMaster extends FObj { } /** - * Indicates if a region with a given name exists in this + * Indicates if a region with a given name exists in this * simple-page-master. * @param regionName name of the region to lookup * @return True if a region with this name exists @@ -269,5 +270,9 @@ public class SimplePageMaster extends FObj { } return false; } -} + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + +} diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 2f10a102f..203a32ba8 100644 --- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.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,15 +42,16 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fo.pagination; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; /** * A single-page-master-reference formatting object. @@ -93,5 +94,10 @@ public class SinglePageMasterReference extends PageMasterReference public void reset() { this.state = FIRST; } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java index d18d6d798..af5e59bf3 100644 --- a/src/java/org/apache/fop/fo/pagination/StaticContent.java +++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; import org.apache.fop.layoutmgr.StaticContentLayoutManager; @@ -100,4 +101,8 @@ public class StaticContent extends Flow { return lm; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java index a4daf6138..917f30ac6 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -58,6 +58,7 @@ import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.FONode; import org.apache.fop.fo.LengthProperty; import org.apache.fop.fo.Property; +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; @@ -140,5 +141,10 @@ public class Title extends FObjMixed { Length zIndex = this.properties.get("z-index").getLength(); } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/fonts/type1/PFMFile.java b/src/java/org/apache/fop/fonts/type1/PFMFile.java index f32c0d151..58a7cceb5 100644 --- a/src/java/org/apache/fop/fonts/type1/PFMFile.java +++ b/src/java/org/apache/fop/fonts/type1/PFMFile.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.fonts.type1; // Java @@ -93,7 +93,7 @@ public class PFMFile extends AbstractLogEnabled { private int[] extentTable; private Map kerningTab = new java.util.HashMap(); - + /** * Parses a PFM file * @@ -233,7 +233,7 @@ public class PFMFile extends AbstractLogEnabled { getLogger().warn("Size of extension block was expected to be " + "52 bytes, but was " + size + " bytes."); } - inStream.skip(12); //Skip etmPointSize, etmOrientation, etmMasterHeight, + inStream.skip(12); //Skip etmPointSize, etmOrientation, etmMasterHeight, //etmMinScale, etmMaxScale, emtMasterUnits etmCapHeight = inStream.readShort(); etmXHeight = inStream.readShort(); @@ -271,7 +271,7 @@ public class PFMFile extends AbstractLogEnabled { * Return the kerning table. The kerning table is a Map with * strings with glyphnames as keys, containing Maps as value. * The value map contains a glyph name string key and an Integer value - * + * * @return A Map containing the kerning table */ public Map getKerning() { diff --git a/src/java/org/apache/fop/layout/LayoutStrategy.java b/src/java/org/apache/fop/layout/LayoutStrategy.java index 90a70926a..1d31cd300 100644 --- a/src/java/org/apache/fop/layout/LayoutStrategy.java +++ b/src/java/org/apache/fop/layout/LayoutStrategy.java @@ -51,8 +51,6 @@ package org.apache.fop.layout; -import org.apache.fop.fo.FOTreeExternal; - /** * Abstract class defining the highest-level information for a layout strategy. * Subclasses implement a layout strategy that converts an FO Tree into an @@ -61,7 +59,6 @@ import org.apache.fop.fo.FOTreeExternal; public abstract class LayoutStrategy { private String name = "undefined"; - private FOTreeExternal fote = null; /** * Returns the name of this LayoutStrategy. @@ -71,14 +68,4 @@ public abstract class LayoutStrategy { return name; } - /** - * - * @return the FOTreeExternal object for this LayoutStrategy - */ - public FOTreeExternal getFOTreeExternal() { - if (fote == null) { - fote = new FOTreeExternal(); - } - return fote; - } } diff --git a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java new file mode 100644 index 000000000..8afca744f --- /dev/null +++ b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java @@ -0,0 +1,553 @@ +/* + * $Id$ + * ============================================================================ + * 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 + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 . For more information on the Apache + * Software Foundation, please see . + */ + +package org.apache.fop.layoutmgr; + +import org.apache.fop.area.LinkResolver; +import org.apache.fop.area.PageViewport; +import org.apache.fop.area.Resolveable; +import org.apache.fop.area.Trait; +import org.apache.fop.area.inline.InlineArea; +import org.apache.fop.area.inline.InlineParent; +import org.apache.fop.area.inline.FilledArea; +import org.apache.fop.area.inline.Space; +import org.apache.fop.area.inline.Word; + +import org.apache.fop.fo.FOTreeVisitor; +import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.FOText; +import org.apache.fop.fo.TextInfo; +import org.apache.fop.fo.flow.BidiOverride; +import org.apache.fop.fo.flow.Inline; +import org.apache.fop.fo.flow.BasicLink; +import org.apache.fop.fo.flow.Block; +import org.apache.fop.fo.flow.Leader; +import org.apache.fop.fo.flow.RetrieveMarker; +import org.apache.fop.fo.flow.Character; +import org.apache.fop.fo.flow.ExternalGraphic; +import org.apache.fop.fo.flow.BlockContainer; +import org.apache.fop.fo.flow.Footnote; +import org.apache.fop.fo.flow.ListBlock; +import org.apache.fop.fo.flow.InstreamForeignObject; +import org.apache.fop.fo.flow.InlineContainer; +import org.apache.fop.fo.flow.ListItem; +import org.apache.fop.fo.flow.PageNumber; +import org.apache.fop.fo.flow.PageNumberCitation; +import org.apache.fop.fo.flow.Table; +import org.apache.fop.fo.flow.TableBody; +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.properties.LeaderPattern; + +import org.apache.fop.layoutmgr.BidiLayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; +import org.apache.fop.layoutmgr.LMiter; +import org.apache.fop.layoutmgr.table.Cell; +import org.apache.fop.layoutmgr.table.Body; +import org.apache.fop.layoutmgr.table.Row; +import org.apache.fop.layoutmgr.table.TableLayoutManager; +import org.apache.fop.layoutmgr.list.ListBlockLayoutManager; +import org.apache.fop.layoutmgr.list.ListItemLayoutManager; +import org.apache.fop.util.CharUtilities; + +import java.util.List; +import java.util.ListIterator; +import java.util.ArrayList; + +/** + * Concrete implementation of FOTreeVisitor for the purpose of adding + * Layout Managers for nodes in the FOTree. + * Each method is responsible to return a LayoutManager responsible for laying + * out this FObj's content. + * @see org.apache.fop.fo.FOTreeVisitor + */ + +public class AddLMVisitor extends FOTreeVisitor { + + /** The List object to which methods in this class should add Layout + * Managers */ + private List currentLMList; + + /** A List object which can be used to save and restore the currentLMList if + * another List should temporarily be used */ + private List saveLMList; + + /** + * + * @param fobj the FObj object for which a layout manager should be created + * @param lmList the list to which the newly created layout manager(s) + * should be added + */ + public void addLayoutManager(FObj fobj, List lmList) { + /* Store the List in a global variable so that it can be accessed by the + Visitor methods */ + currentLMList = lmList; + fobj.acceptVisitor(this); + } + + public void serveVisitor(FOText node) { + if (node.length == 0) { + return; + } + if (node.length < node.ca.length) { + char[] tmp = node.ca; + node.ca = new char[node.length]; + System.arraycopy(tmp, 0, node.ca, 0, node.length); + } + LayoutManager lm = new TextLayoutManager(node.ca, node.textInfo); + lm.setFObj(node); + currentLMList.add(lm); + } + + public void serveVisitor(FObjMixed node) { + if (node.getChildren() != null) { + InlineStackingLayoutManager lm; + lm = new InlineStackingLayoutManager(); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setLMiter(new LMiter(node.getChildren())); + currentLMList.add(lm); + } + } + + public void serveVisitor(BidiOverride node) { + if (false) { + serveVisitor((FObjMixed)node); + } else { + ArrayList childList = new ArrayList(); + saveLMList = currentLMList; + currentLMList = childList; + serveVisitor((FObjMixed)node); + currentLMList = saveLMList; + 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(node); + currentLMList.add(blm); + } else { + currentLMList.add(lm); + } + } + } + } + + /** + * @param node Inline object to process + */ + public void serveVisitor(Inline node) { + serveVisitor((FObjMixed)node); + } + + public void serveVisitor(Footnote node) { + if (node.getInlineFO() == null) { + node.getLogger().error("inline required in footnote"); + return; + } + serveVisitor(node.getInlineFO()); + } + + public void serveVisitor(InlineContainer node) { + ArrayList childList = new ArrayList(); + saveLMList = currentLMList; + currentLMList = childList; + serveVisitor((FObj)node); + currentLMList = saveLMList; + LayoutManager lm = new ICLayoutManager(childList); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + currentLMList.add(lm); + } + + /** + * Add start and end properties for the link + */ + public void serveVisitor(BasicLink node) { + node.setup(); + InlineStackingLayoutManager lm; + lm = new InlineStackingLayoutManager() { + protected InlineParent createArea(BasicLink node) { + InlineParent area = super.createArea(); + setupBasicLinkArea(node, parentLM, area); + return area; + } + }; + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setLMiter(new LMiter(node.getChildren())); + currentLMList.add(lm); + } + + protected void setupBasicLinkArea(BasicLink node, LayoutProcessor parentLM, + InlineParent area) { + if (node.getLink() == null) { + return; + } + if (node.getExternal()) { + area.addTrait(Trait.EXTERNAL_LINK, node.getLink()); + } else { + PageViewport page = parentLM.resolveRefID(node.getLink()); + if (page != null) { + area.addTrait(Trait.INTERNAL_LINK, page.getKey()); + } else { + LinkResolver res = new LinkResolver(node.getLink(), area); + parentLM.addUnresolvedArea(node.getLink(), res); + } + } + } + + public void serveVisitor(Block node) { + BlockLayoutManager blm = new BlockLayoutManager(); + blm.setUserAgent(node.getUserAgent()); + blm.setFObj(node); + TextInfo ti = node.getPropertyManager().getTextLayoutProps(node.getDocument()); + blm.setBlockTextInfo(ti); + currentLMList.add(blm); + } + + public void serveVisitor(final Leader node) { + LeafNodeLayoutManager lm = new LeafNodeLayoutManager() { + public InlineArea get(LayoutContext context) { + return getLeaderInlineArea(node); + } + + protected MinOptMax getAllocationIPD(int refIPD) { + return node.getAllocIPD(refIPD); + } + + /*protected void offsetArea(LayoutContext context) { + if(leaderPattern == LeaderPattern.DOTS) { + curArea.setOffset(context.getBaseline()); + } + }*/ + }; + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setAlignment(node.properties.get("leader-alignment").getEnum()); + currentLMList.add(lm); + } + + private InlineArea getLeaderInlineArea(Leader node) { + if (node.leaderArea == null) { + createLeaderArea(node); + } + return node.leaderArea; + } + + protected void createLeaderArea(Leader node) { + node.setup(); + + if (node.getLeaderPattern() == LeaderPattern.RULE) { + org.apache.fop.area.inline.Leader leader = new org.apache.fop.area.inline.Leader(); + + leader.setRuleStyle(node.getRuleStyle()); + leader.setRuleThickness(node.getRuleThickness()); + + node.leaderArea = leader; + } else if (node.getLeaderPattern() == LeaderPattern.SPACE) { + node.leaderArea = new Space(); + } else if (node.getLeaderPattern() == LeaderPattern.DOTS) { + Word w = new Word(); + char dot = '.'; // userAgent.getLeaderDotCharacter(); + + w.setWord("" + dot); + w.addTrait(Trait.FONT_NAME, node.getFontState().getFontName()); + w.addTrait(Trait.FONT_SIZE, + new Integer(node.getFontState().getFontSize())); + // set offset of dot within inline parent + w.setOffset(node.getFontState().getAscender()); + int width = CharUtilities.getCharWidth(dot, node.getFontState()); + Space spacer = null; + if (node.getPatternWidth() > width) { + spacer = new Space(); + spacer.setWidth(node.getPatternWidth() - width); + width = node.getPatternWidth(); + } + FilledArea fa = new FilledArea(); + fa.setUnitWidth(width); + fa.addChild(w); + if (spacer != null) { + fa.addChild(spacer); + } + fa.setHeight(node.getFontState().getAscender()); + + node.leaderArea = fa; + } else if (node.getLeaderPattern() == LeaderPattern.USECONTENT) { + if (node.getChildren() == null) { + node.getLogger().error("Leader use-content with no content"); + return; + } + InlineStackingLayoutManager lm; + lm = new InlineStackingLayoutManager(); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setLMiter(new LMiter(node.getChildren())); + lm.init(); + + // get breaks then add areas to FilledArea + FilledArea fa = new FilledArea(); + + ContentLayoutManager clm = new ContentLayoutManager(fa); + clm.setUserAgent(node.getUserAgent()); + lm.setParent(clm); + + clm.fillArea(lm); + int width = clm.getStackingSize(); + Space spacer = null; + if (node.getPatternWidth() > width) { + spacer = new Space(); + spacer.setWidth(node.getPatternWidth() - width); + width = node.getPatternWidth(); + } + fa.setUnitWidth(width); + if (spacer != null) { + fa.addChild(spacer); + } + node.leaderArea = fa; + } + } + + public void serveVisitor(RetrieveMarker node) { + RetrieveMarkerLayoutManager rmlm; + rmlm = new RetrieveMarkerLayoutManager(node.getRetrieveClassName(), + node.getRetrievePosition(), + node.getRetrieveBoundary()); + rmlm.setUserAgent(node.getUserAgent()); + rmlm.setFObj(node); + currentLMList.add(rmlm); + } + + public void serveVisitor(Character node) { + InlineArea inline = node.getInlineArea(); + if (inline != null) { + LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setCurrentArea(inline); + currentLMList.add(lm); + } + } + + /** + * This adds a leafnode layout manager that deals with the + * created viewport/image area. + */ + public void serveVisitor(ExternalGraphic node) { + InlineArea area = node.getInlineArea(); + if (area != null) { + node.setupID(); + LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setCurrentArea(area); + lm.setAlignment(node.properties.get("vertical-align").getEnum()); + lm.setLead(node.getViewHeight()); + currentLMList.add(lm); + } + } + + public void serveVisitor(BlockContainer node) { + BlockContainerLayoutManager blm = new BlockContainerLayoutManager(); + blm.setUserAgent(node.getUserAgent()); + blm.setFObj(node); + blm.setOverflow(node.properties.get("overflow").getEnum()); + currentLMList.add(blm); + } + + public void serveVisitor(ListBlock node) { + ListBlockLayoutManager blm = new ListBlockLayoutManager(); + blm.setUserAgent(node.getUserAgent()); + blm.setFObj(node); + currentLMList.add(blm); + } + + public void serveVisitor(InstreamForeignObject node) { + node.areaCurrent = node.getInlineArea(); + if (node.areaCurrent != null) { + LeafNodeLayoutManager lm = new LeafNodeLayoutManager(); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + lm.setCurrentArea(node.areaCurrent); + lm.setAlignment(node.properties.get("vertical-align").getEnum()); + lm.setLead(node.areaCurrent.getHeight()); + currentLMList.add(lm); + } + } + + public void serveVisitor(ListItem node) { + if (node.getLabel() != null && node.getBody() != null) { + ListItemLayoutManager blm = new ListItemLayoutManager(); + blm.setUserAgent(node.getUserAgent()); + blm.setFObj(node); + blm.setLabel(node.getLabel().getItemLayoutManager()); + blm.setBody(node.getBody().getItemLayoutManager()); + currentLMList.add(blm); + } else { + node.getLogger().error("list-item requires list-item-label and list-item-body"); + } + } + + /** + * Overridden from FObj + * @param lms the list to which the layout manager(s) should be added + */ + public void serveVisitor(final PageNumber node) { + node.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), node.getFontState()); + } + inline.setWord(str); + inline.setIPD(width); + inline.setHeight(node.getFontState().getAscender() + - node.getFontState().getDescender()); + inline.setOffset(node.getFontState().getAscender()); + + inline.addTrait(Trait.FONT_NAME, + node.getFontState().getFontName()); + inline.addTrait(Trait.FONT_SIZE, + new Integer(node.getFontState().getFontSize())); + + return inline; + } + + protected void offsetArea(LayoutContext context) { + curArea.setOffset(context.getBaseline()); + } + }; + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + currentLMList.add(lm); + } + + public void serveVisitor(final PageNumberCitation node) { + node.setup(); + LayoutManager lm; + lm = new LeafNodeLayoutManager() { + public InlineArea get(LayoutContext context) { + return node.getInlineArea(parentLM); + } + + public void addAreas(PositionIterator posIter, + LayoutContext context) { + super.addAreas(posIter, context); + if (node.getUnresolved()) { + parentLM.addUnresolvedArea(node.getRefId(), + (Resolveable) node.getInline()); + } + } + + protected void offsetArea(LayoutContext context) { + curArea.setOffset(context.getBaseline()); + } + }; + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + currentLMList.add(lm); + } + + public void serveVisitor(Table node) { + TableLayoutManager tlm = new TableLayoutManager(); + tlm.setUserAgent(node.getUserAgent()); + tlm.setFObj(node); + tlm.setColumns(node.getColumns()); + if (node.getTableHeader() != null) { + tlm.setTableHeader(getTableBodyLayoutManager(node.getTableHeader())); + } + if (node.getTableFooter() != null) { + tlm.setTableFooter(getTableBodyLayoutManager(node.getTableFooter())); + } + currentLMList.add(tlm); + } + + public void serveVisitor(TableBody node) { + currentLMList.add(getTableBodyLayoutManager(node)); + } + + public Body getTableBodyLayoutManager(TableBody node) { + Body blm = new Body(); + blm.setUserAgent(node.getUserAgent()); + blm.setFObj(node); + return blm; + } + + public void serveVisitor(TableCell node) { + Cell clm = new Cell(); + clm.setUserAgent(node.getUserAgent()); + clm.setFObj(node); + currentLMList.add(clm); + } + + public void serveVisitor(TableRow node) { + Row rlm = new Row(); + rlm.setUserAgent(node.getUserAgent()); + rlm.setFObj(node); + currentLMList.add(rlm); + } + + public void serveVisitor(Flow node) { + FlowLayoutManager lm = new FlowLayoutManager(); + lm.setUserAgent(node.getUserAgent()); + lm.setFObj(node); + currentLMList.add(lm); + } + +} diff --git a/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java new file mode 100644 index 000000000..13b7613c0 --- /dev/null +++ b/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java @@ -0,0 +1,100 @@ +/* + * $Id$ + * ============================================================================ + * 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 + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.layoutmgr; + +// FOP +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonRelativePosition; + +import org.apache.fop.layoutmgr.LeafNodeLayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; +import org.apache.fop.area.inline.InlineArea; + +import java.util.List; +import java.util.ArrayList; + + +/** + * 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); + } + +} diff --git a/src/java/org/apache/fop/layoutmgr/ICLayoutManager.java b/src/java/org/apache/fop/layoutmgr/ICLayoutManager.java new file mode 100644 index 000000000..a938d0766 --- /dev/null +++ b/src/java/org/apache/fop/layoutmgr/ICLayoutManager.java @@ -0,0 +1,76 @@ +/* + * $Id$ + * ============================================================================ + * 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 + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.layoutmgr; + +// Java +import java.util.List; + +// FOP +import org.apache.fop.area.inline.InlineArea; + +/** + * 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. + */ +public class ICLayoutManager extends LeafNodeLayoutManager { + + private List childrenLM; + + ICLayoutManager(List childLM) { + childrenLM = childLM; + } + + public InlineArea get(int index) { + return null; + } + +} diff --git a/src/java/org/apache/fop/layoutmgr/LMFOTreeExternal.java b/src/java/org/apache/fop/layoutmgr/LMFOTreeExternal.java deleted file mode 100644 index 51c68cb6c..000000000 --- a/src/java/org/apache/fop/layoutmgr/LMFOTreeExternal.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Id$ - * ============================================================================ - * 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 - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (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 . For more information on the Apache - * Software Foundation, please see . - */ - -package org.apache.fop.layoutmgr; - -import org.apache.fop.fo.FOTreeExternal; -/** - * Implementation of FOTreeExternal for LayoutStrategy-specific calls while the - * FO Tree is being built. - * @see org.apache.fop.fo.FOTreeExternal - */ - -public class LMFOTreeExternal extends FOTreeExternal { - -} - diff --git a/src/java/org/apache/fop/layoutmgr/LMiter.java b/src/java/org/apache/fop/layoutmgr/LMiter.java index abda1ecb8..0fee8cdf7 100644 --- a/src/java/org/apache/fop/layoutmgr/LMiter.java +++ b/src/java/org/apache/fop/layoutmgr/LMiter.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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.layoutmgr; import org.apache.fop.fo.FObj; @@ -64,6 +64,7 @@ public class LMiter implements ListIterator { private FObj curFO; protected List listLMs; protected int curPos = 0; + private AddLMVisitor addLMVisitor = new AddLMVisitor(); public LMiter(ListIterator bIter) { baseIter = bIter; @@ -81,7 +82,7 @@ public class LMiter implements ListIterator { if (theobj instanceof FObj) { FObj fobj = (FObj) theobj; //listLMs.add(fobj.getLayoutManager()); - fobj.addLayoutManager(listLMs); + addLMVisitor.addLayoutManager(fobj, listLMs); if (curPos < listLMs.size()) { return true; } diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java index 911d9586a..9f177a4c5 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java @@ -50,7 +50,6 @@ */ package org.apache.fop.layoutmgr; -import org.apache.fop.fo.FOTreeExternal; import org.apache.fop.layout.LayoutStrategy; /** @@ -60,13 +59,5 @@ import org.apache.fop.layout.LayoutStrategy; public class LayoutManagerLS extends LayoutStrategy { private static String name = "layoutmgr"; - private FOTreeExternal fote = null; - - public FOTreeExternal getFOTreeExternal() { - if (fote == null) { - fote = new LMFOTreeExternal(); - } - return fote; - } } diff --git a/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java index 4b1c18616..a17cf047a 100644 --- a/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java @@ -65,6 +65,7 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { private String name; private int position; private int boundary; + private AddLMVisitor addLMVisitor = new AddLMVisitor(); /** * Create a new block container layout manager. @@ -123,7 +124,7 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { List list = new ArrayList(); Marker marker = retrieveMarker(name, position, boundary); if (marker != null) { - marker.addLayoutManager(list); + addLMVisitor.addLayoutManager(marker, list); if (list.size() > 0) { replaceLM = (LayoutProcessor)list.get(0); replaceLM.setParent(this); diff --git a/src/java/org/apache/fop/svg/SVGElement.java b/src/java/org/apache/fop/svg/SVGElement.java index 24708d3db..685563514 100644 --- a/src/java/org/apache/fop/svg/SVGElement.java +++ b/src/java/org/apache/fop/svg/SVGElement.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,16 +42,17 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.svg; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; import org.apache.batik.dom.svg.SVGOMDocument; @@ -140,15 +141,15 @@ public class SVGElement extends SVGObj { public AffineTransform getScreenTransform() { throw new UnsupportedOperationException("NYI"); } - + /** - * Sets the transform to be used from the global transform space + * Sets the transform to be used from the global transform space * to pixels. */ public void setScreenTransform(AffineTransform at) { throw new UnsupportedOperationException("NYI"); } - + public AffineTransform getCTM() { return new AffineTransform(); } @@ -310,5 +311,10 @@ public class SVGElement extends SVGObj { return 100; } } + + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + } diff --git a/src/java/org/apache/fop/svg/SVGObj.java b/src/java/org/apache/fop/svg/SVGObj.java index 07019acd4..8016821f0 100644 --- a/src/java/org/apache/fop/svg/SVGObj.java +++ b/src/java/org/apache/fop/svg/SVGObj.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,16 +42,17 @@ * (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 . For more information on the Apache * Software Foundation, please see . - */ + */ package org.apache.fop.svg; import org.apache.fop.fo.FONode; import org.apache.fop.fo.XMLObj; +import org.apache.fop.fo.FOTreeVisitor; /** * Class for SVG element objects. @@ -75,5 +76,9 @@ public class SVGObj extends XMLObj { return "http://www.w3.org/2000/svg"; } + public void acceptVisitor(FOTreeVisitor fotv) { + fotv.serveVisitor(this); + } + }