gmazza 2004/08/05 21:22:18 Modified: src/java/org/apache/fop/fo FONode.java FOText.java FObj.java FObjMixed.java src/java/org/apache/fop/fo/flow BasicLink.java BidiOverride.java Block.java BlockContainer.java Character.java ExternalGraphic.java Footnote.java Inline.java InlineContainer.java InstreamForeignObject.java Leader.java ListBlock.java ListItem.java PageNumber.java PageNumberCitation.java RetrieveMarker.java Table.java TableBody.java TableCell.java TableFooter.java TableHeader.java TableRow.java Wrapper.java src/java/org/apache/fop/fo/pagination Flow.java StaticContent.java Title.java src/java/org/apache/fop/layoutmgr AddLMVisitor.java BidiLayoutManager.java ICLayoutManager.java Added: src/java/org/apache/fop/fo LMVisited.java Log: 1.) Continued conversion/deprecation of AddLMVisitor. About 16 FO's remaining. 2.) Created a *temporary* LMVisited interface to mark those FO's still needing conversion. This will be dropped once the process is complete. Revision Changes Path 1.37 +0 -12 xml-fop/src/java/org/apache/fop/fo/FONode.java Index: FONode.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- FONode.java 1 Aug 2004 16:46:46 -0000 1.36 +++ FONode.java 6 Aug 2004 04:22:14 -0000 1.37 @@ -33,9 +33,6 @@ import org.apache.fop.util.CharUtilities; import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.fo.extensions.svg.SVGElementMapping; -import org.apache.fop.layoutmgr.AddLMVisitor; - - /** * base class for nodes in the XML tree @@ -195,15 +192,6 @@ */ public CharIterator charIterator() { return new OneCharIterator(CharUtilities.CODE_EOT); - } - - /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. - */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveFONode(this); } /** 1.22 +7 -6 xml-fop/src/java/org/apache/fop/fo/FOText.java Index: FOText.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOText.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- FOText.java 31 Jul 2004 00:44:21 -0000 1.21 +++ FOText.java 6 Aug 2004 04:22:15 -0000 1.22 @@ -19,12 +19,13 @@ package org.apache.fop.fo; // Java +import java.util.List; import java.util.NoSuchElementException; // FOP import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.pagination.Root; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.TextLayoutManager; /** * A text node in the formatting object tree. @@ -492,11 +493,11 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveFOText(this); + public void addLayoutManager(List list) { + if (endIndex - startIndex > 0) { + list.add(new TextLayoutManager(this)); + } } } 1.61 +0 -9 xml-fop/src/java/org/apache/fop/fo/FObj.java Index: FObj.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- FObj.java 4 Aug 2004 22:21:02 -0000 1.60 +++ FObj.java 6 Aug 2004 04:22:15 -0000 1.61 @@ -442,15 +442,6 @@ public void addLayoutManager(List list) { } - /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. - */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveFObj(this); - } - /* * Return a string representation of the fo element. * Deactivated in order to see precise ID of each fo element created 1.30 +12 -6 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java Index: FObjMixed.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- FObjMixed.java 31 Jul 2004 00:44:21 -0000 1.29 +++ FObjMixed.java 6 Aug 2004 04:22:15 -0000 1.30 @@ -18,8 +18,10 @@ package org.apache.fop.fo; +import java.util.List; import org.xml.sax.Locator; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.LMiter; +import org.apache.fop.layoutmgr.InlineStackingLayoutManager; /** * Base class for representation of mixed content formatting objects @@ -74,12 +76,16 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveFObjMixed(this); + public void addLayoutManager(List list) { + if (getChildNodes() != null) { + InlineStackingLayoutManager lm; + lm = new InlineStackingLayoutManager(this); + lm.setLMiter(new LMiter(lm, getChildNodes())); + list.add(lm); + } } + } 1.1 xml-fop/src/java/org/apache/fop/fo/LMVisited.java Index: LMVisited.java =================================================================== /* * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* $Id: LMVisited.java,v 1.1 2004/08/06 04:22:15 gmazza Exp $ */ package org.apache.fop.fo; import org.apache.fop.layoutmgr.AddLMVisitor; public interface LMVisited { public void acceptVisitor(AddLMVisitor aLMV); } 1.21 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java Index: BasicLink.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BasicLink.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- BasicLink.java 1 Aug 2004 04:20:48 -0000 1.20 +++ BasicLink.java 6 Aug 2004 04:22:15 -0000 1.21 @@ -33,13 +33,14 @@ import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.LMVisited; /** * The basic link. * This sets the basic link trait on the inline parent areas * that are created by the fo element. */ -public class BasicLink extends Inline { +public class BasicLink extends Inline implements LMVisited { private String link = null; private boolean external = false; 1.12 +27 -3 xml-fop/src/java/org/apache/fop/fo/flow/BidiOverride.java Index: BidiOverride.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BidiOverride.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- BidiOverride.java 3 Aug 2004 05:22:43 -0000 1.11 +++ BidiOverride.java 6 Aug 2004 04:22:15 -0000 1.12 @@ -18,6 +18,10 @@ package org.apache.fop.fo.flow; +// Java +import java.util.ArrayList; +import java.util.List; + // XML import org.xml.sax.Attributes; import org.xml.sax.Locator; @@ -27,10 +31,13 @@ import org.apache.fop.fo.FOElementMapping; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.BidiLayoutManager; +import org.apache.fop.layoutmgr.InlineStackingLayoutManager; +import org.apache.fop.layoutmgr.LayoutManager; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonRelativePosition; + /** * fo:bidi-override element. */ @@ -116,7 +123,24 @@ * this object. * @param aLMV the AddLMVisitor object that can access this object. */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveBidiOverride(this); + public void addLayoutManager(List list) { + if (false) { + super.addLayoutManager(list); + } else { + ArrayList childList = new ArrayList(); + super.addLayoutManager(list); + for (int count = childList.size() - 1; count >= 0; count--) { + LayoutManager lm = (LayoutManager) childList.get(count); + if (lm.generatesInlineAreas()) { + LayoutManager blm = new BidiLayoutManager((InlineStackingLayoutManager) lm); + blm.setFObj(this); + list.add(blm); + } else { + list.add(lm); + } + } + } } + + } 1.27 +10 -8 xml-fop/src/java/org/apache/fop/fo/flow/Block.java Index: Block.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- Block.java 1 Aug 2004 04:20:48 -0000 1.26 +++ Block.java 6 Aug 2004 04:22:15 -0000 1.27 @@ -18,6 +18,9 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; + // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -30,7 +33,7 @@ import org.apache.fop.fo.FObj; import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.RecursiveCharIterator; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.BlockLayoutManager; import org.apache.fop.fo.Constants; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -337,15 +340,14 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveBlock(this); + public void addLayoutManager(List list) { + BlockLayoutManager blm = new BlockLayoutManager(this); + list.add(blm); } - - public String getName() { + + public String getName() { return "fo:block"; } 1.14 +9 -6 xml-fop/src/java/org/apache/fop/fo/flow/BlockContainer.java Index: BlockContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BlockContainer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- BlockContainer.java 1 Aug 2004 04:20:48 -0000 1.13 +++ BlockContainer.java 6 Aug 2004 04:22:15 -0000 1.14 @@ -18,15 +18,18 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; + // FOP import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; -import org.apache.fop.layoutmgr.AddLMVisitor; import org.apache.fop.fo.properties.CommonAbsolutePosition; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.layoutmgr.BlockContainerLayoutManager; import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; @@ -131,12 +134,12 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveBlockContainer(this); + public void addLayoutManager(List list) { + BlockContainerLayoutManager blm = new BlockContainerLayoutManager(this); + blm.setOverflow(getProperty(PR_OVERFLOW).getEnum()); + list.add(blm); } public String getName() { 1.14 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/Character.java Index: Character.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Character.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Character.java 27 Jul 2004 23:57:12 -0000 1.13 +++ Character.java 6 Aug 2004 04:22:15 -0000 1.14 @@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.LMVisited; /** * This class represents the flow object 'fo:character'. Its use is defined by @@ -50,7 +51,7 @@ * Overrides may be specified in an implementation-specific manner." (6.6.3) * */ -public class Character extends FObj { +public class Character extends FObj implements LMVisited { /** constant indicating that the character is OK */ public static final int OK = 0; 1.32 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/ExternalGraphic.java Index: ExternalGraphic.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ExternalGraphic.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- ExternalGraphic.java 1 Aug 2004 04:20:48 -0000 1.31 +++ ExternalGraphic.java 6 Aug 2004 04:22:15 -0000 1.32 @@ -33,13 +33,14 @@ import org.apache.fop.image.FopImage; import org.apache.fop.image.ImageFactory; import org.xml.sax.Attributes; +import org.apache.fop.fo.LMVisited; /** * External graphic formatting object. * This FO node handles the external graphic. It creates an image * inline area that can be added to the area tree. */ -public class ExternalGraphic extends FObj { +public class ExternalGraphic extends FObj implements LMVisited { private String url; private int breakAfter; private int breakBefore; 1.18 +14 -5 xml-fop/src/java/org/apache/fop/fo/flow/Footnote.java Index: Footnote.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Footnote.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Footnote.java 1 Aug 2004 04:20:48 -0000 1.17 +++ Footnote.java 6 Aug 2004 04:22:15 -0000 1.18 @@ -18,6 +18,9 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; + // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -25,7 +28,6 @@ // FOP import org.apache.fop.fo.FONode; -import org.apache.fop.layoutmgr.AddLMVisitor; import org.apache.fop.fo.FObj; /** @@ -74,15 +76,22 @@ return inlineFO; } - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveFootnote(this); - } - protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endFootnote(this); } + /** + * @param list the list to which the layout manager(s) should be added + */ + public void addLayoutManager(List list) { + if (getInlineFO() == null) { + getLogger().error("inline required in footnote"); + return; + } + getInlineFO().addLayoutManager(list); + } + public String getName() { return "fo:footnote"; } 1.21 +0 -4 xml-fop/src/java/org/apache/fop/fo/flow/Inline.java Index: Inline.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Inline.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- Inline.java 3 Aug 2004 05:22:43 -0000 1.20 +++ Inline.java 6 Aug 2004 04:22:15 -0000 1.21 @@ -107,10 +107,6 @@ return new InlineCharIterator(this, propMgr.getBorderAndPadding()); } - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveInline(this); - } - public String getName() { return "fo:inline"; } 1.13 +12 -6 xml-fop/src/java/org/apache/fop/fo/flow/InlineContainer.java Index: InlineContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/InlineContainer.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- InlineContainer.java 1 Aug 2004 04:20:48 -0000 1.12 +++ InlineContainer.java 6 Aug 2004 04:22:16 -0000 1.13 @@ -18,14 +18,19 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; +import java.util.ArrayList; + // XML import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.ICLayoutManager; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; -import org.apache.fop.layoutmgr.AddLMVisitor; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonMarginInline; @@ -89,12 +94,13 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveInlineContainer(this); + public void addLayoutManager(List list) { + ArrayList childList = new ArrayList(); + super.addLayoutManager(childList); + LayoutManager lm = new ICLayoutManager(this, childList); + list.add(lm); } public String getName() { 1.17 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java Index: InstreamForeignObject.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- InstreamForeignObject.java 1 Aug 2004 16:46:46 -0000 1.16 +++ InstreamForeignObject.java 6 Aug 2004 04:22:16 -0000 1.17 @@ -25,6 +25,7 @@ // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.LMVisited; import org.apache.fop.fo.FOElementMapping; import org.apache.fop.layoutmgr.AddLMVisitor; import org.apache.fop.fo.FObj; @@ -34,7 +35,7 @@ * This is an atomic inline object that contains * xml data. */ -public class InstreamForeignObject extends FObj { +public class InstreamForeignObject extends FObj implements LMVisited { boolean hasNonXSLNamespaceElement = false; 1.30 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/Leader.java Index: Leader.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Leader.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- Leader.java 31 Jul 2004 00:44:22 -0000 1.29 +++ Leader.java 6 Aug 2004 04:22:16 -0000 1.30 @@ -31,13 +31,14 @@ import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.fo.properties.PercentLength; import org.apache.fop.fonts.Font; +import org.apache.fop.fo.LMVisited; /** * Class modelling fo:leader object. See Sec. 6.6.9 of the XSL-FO Standard. * The main property of fo:leader is leader-pattern. * The following patterns are treated: rule, space, dots and use-content. */ -public class Leader extends FObjMixed { +public class Leader extends FObjMixed implements LMVisited { private int ruleStyle; private int ruleThickness; 1.19 +9 -7 xml-fop/src/java/org/apache/fop/fo/flow/ListBlock.java Index: ListBlock.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListBlock.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ListBlock.java 1 Aug 2004 04:20:48 -0000 1.18 +++ ListBlock.java 6 Aug 2004 04:22:16 -0000 1.19 @@ -18,6 +18,9 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; + // XML import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; @@ -26,7 +29,7 @@ import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.list.ListBlockLayoutManager; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; @@ -99,19 +102,18 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveListBlock(this); + public void addLayoutManager(List list) { + ListBlockLayoutManager lm = new ListBlockLayoutManager(this); + list.add(lm); } protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endList(this); } - + public String getName() { return "fo:list-block"; } 1.21 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/ListItem.java Index: ListItem.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItem.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ListItem.java 1 Aug 2004 04:20:48 -0000 1.20 +++ ListItem.java 6 Aug 2004 04:22:16 -0000 1.21 @@ -33,12 +33,13 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonMarginBlock; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.LMVisited; /** * Class modelling the fo:list-item object. See Sec. 6.8.3 of the XSL-FO * Standard. */ -public class ListItem extends FObj { +public class ListItem extends FObj implements LMVisited { private ListItemLabel label = null; private ListItemBody body = null; 1.31 +3 -1 xml-fop/src/java/org/apache/fop/fo/flow/PageNumber.java Index: PageNumber.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/PageNumber.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- PageNumber.java 1 Aug 2004 04:20:49 -0000 1.30 +++ PageNumber.java 6 Aug 2004 04:22:16 -0000 1.31 @@ -35,12 +35,14 @@ import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.fonts.Font; +import org.apache.fop.fo.LMVisited; + /** * Class modelling the fo:page-number object. See Sec. 6.6.10 of the XSL-FO * Standard. */ -public class PageNumber extends FObj { +public class PageNumber extends FObj implements LMVisited { /** FontState for this object */ protected Font fontState; 1.28 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/PageNumberCitation.java Index: PageNumberCitation.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/PageNumberCitation.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- PageNumberCitation.java 31 Jul 2004 00:44:22 -0000 1.27 +++ PageNumberCitation.java 6 Aug 2004 04:22:16 -0000 1.28 @@ -34,6 +34,7 @@ import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.fonts.Font; +import org.apache.fop.fo.LMVisited; /** @@ -43,7 +44,7 @@ * The page number used is the page that contains the start of the * block referenced with the ref-id attribute. */ -public class PageNumberCitation extends FObj { +public class PageNumberCitation extends FObj implements LMVisited { /** Fontstate for this object **/ protected Font fontState; 1.13 +3 -1 xml-fop/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Index: RetrieveMarker.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/RetrieveMarker.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- RetrieveMarker.java 1 Aug 2004 04:20:49 -0000 1.12 +++ RetrieveMarker.java 6 Aug 2004 04:22:16 -0000 1.13 @@ -27,13 +27,15 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.fo.LMVisited; + /** * The retrieve-marker formatting object. * This will create a layout manager that will retrieve * a marker based on the information. */ -public class RetrieveMarker extends FObjMixed { +public class RetrieveMarker extends FObjMixed implements LMVisited { private String retrieveClassName; private int retrievePosition; 1.24 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/Table.java Index: Table.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Table.java 1 Aug 2004 04:20:49 -0000 1.23 +++ Table.java 6 Aug 2004 04:22:16 -0000 1.24 @@ -37,11 +37,12 @@ import org.apache.fop.fo.properties.CommonMarginBlock; import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.fo.properties.LengthRangeProperty; +import org.apache.fop.fo.LMVisited; /** * Class modelling the fo:table object. See Sec. 6.7.3 of the XSL-FO Standard. */ -public class Table extends FObj { +public class Table extends FObj implements LMVisited { private static final int MINCOLWIDTH = 10000; // 10pt /** collection of columns in this table */ 1.20 +3 -1 xml-fop/src/java/org/apache/fop/fo/flow/TableBody.java Index: TableBody.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableBody.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- TableBody.java 1 Aug 2004 04:20:49 -0000 1.19 +++ TableBody.java 6 Aug 2004 04:22:16 -0000 1.20 @@ -34,12 +34,14 @@ import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.LMVisited; + /** * Class modelling the fo:table-body object. See Sec. 6.7.8 of the XSL-FO * Standard. */ -public class TableBody extends FObj { +public class TableBody extends FObj implements LMVisited { private int spaceBefore; private int spaceAfter; 1.22 +10 -8 xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java Index: TableCell.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- TableCell.java 1 Aug 2004 04:20:49 -0000 1.21 +++ TableCell.java 6 Aug 2004 04:22:16 -0000 1.22 @@ -18,6 +18,9 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; + // XML import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -27,7 +30,7 @@ import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.table.Cell; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; @@ -339,15 +342,14 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveTableCell(this); + public void addLayoutManager(List list) { + Cell clm = new Cell(this); + list.add(clm); } - - protected void endOfNode() throws SAXParseException { + + protected void endOfNode() throws SAXParseException { getFOInputHandler().endCell(this); } 1.8 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/TableFooter.java Index: TableFooter.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableFooter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TableFooter.java 27 Jul 2004 23:57:12 -0000 1.7 +++ TableFooter.java 6 Aug 2004 04:22:16 -0000 1.8 @@ -21,12 +21,13 @@ // FOP import org.apache.fop.fo.FONode; import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.fo.LMVisited; /** * Class modelling the fo:table-footer object. See Sec. 6.7.7 of the XSL-FO * Standard. */ -public class TableFooter extends TableBody { +public class TableFooter extends TableBody implements LMVisited { /** * @param parent FONode that is the parent of this object 1.8 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/TableHeader.java Index: TableHeader.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableHeader.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TableHeader.java 27 Jul 2004 23:57:12 -0000 1.7 +++ TableHeader.java 6 Aug 2004 04:22:16 -0000 1.8 @@ -21,12 +21,13 @@ // FOP import org.apache.fop.fo.FONode; import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.fo.LMVisited; /** * Class modelling the fo:table-header object. See Sec. 6.7.6 of the XSL-FO * Standard. */ -public class TableHeader extends TableBody { +public class TableHeader extends TableBody implements LMVisited { /** * @param parent FONode that is the parent of this object 1.24 +9 -7 xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java Index: TableRow.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- TableRow.java 1 Aug 2004 04:20:49 -0000 1.23 +++ TableRow.java 6 Aug 2004 04:22:16 -0000 1.24 @@ -18,6 +18,9 @@ package org.apache.fop.fo.flow; +// Java +import java.util.List; + // XML import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; @@ -27,7 +30,7 @@ import org.apache.fop.datatypes.KeepValue; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.table.Row; import org.apache.fop.fo.Constants; import org.apache.fop.fo.properties.CommonAccessibility; @@ -135,15 +138,14 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveTableRow(this); + public void addLayoutManager(List list) { + Row rlm = new Row(this); + list.add(rlm); } - protected void endOfNode() throws SAXParseException { + protected void endOfNode() throws SAXParseException { getFOInputHandler().endRow(this); } 1.9 +2 -1 xml-fop/src/java/org/apache/fop/fo/flow/Wrapper.java Index: Wrapper.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Wrapper.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Wrapper.java 27 Jul 2004 23:57:13 -0000 1.8 +++ Wrapper.java 6 Aug 2004 04:22:16 -0000 1.9 @@ -22,6 +22,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.fo.LMVisited; /** * Implementation for fo:wrapper formatting object. @@ -31,7 +32,7 @@ * Content: (#PCDATA|%inline;|%block;)* * Properties: id */ -public class Wrapper extends FObjMixed { +public class Wrapper extends FObjMixed implements LMVisited { /** * @param parent FONode that is the parent of this object 1.23 +8 -8 xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java Index: Flow.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Flow.java 1 Aug 2004 04:20:50 -0000 1.22 +++ Flow.java 6 Aug 2004 04:22:18 -0000 1.23 @@ -20,6 +20,7 @@ // Java import java.util.ArrayList; +import java.util.List; // XML import org.xml.sax.Attributes; @@ -30,7 +31,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOElementMapping; -import org.apache.fop.layoutmgr.AddLMVisitor; +import org.apache.fop.layoutmgr.FlowLayoutManager; /** * Class modelling the fo:flow object. See Sec. 6.4.18 in the XSL-FO Standard. @@ -171,14 +172,13 @@ } /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. + * @param list the list to which the layout manager(s) should be added */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveFlow(this); + public void addLayoutManager(List list) { + FlowLayoutManager lm = new FlowLayoutManager(this); + list.add(lm); } - + public String getName() { return "fo:flow"; } 1.18 +1 -11 xml-fop/src/java/org/apache/fop/fo/pagination/StaticContent.java Index: StaticContent.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/StaticContent.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- StaticContent.java 1 Aug 2004 04:20:50 -0000 1.17 +++ StaticContent.java 6 Aug 2004 04:22:18 -0000 1.18 @@ -26,7 +26,6 @@ // FOP import org.apache.fop.fo.FOElementMapping; import org.apache.fop.fo.FONode; -import org.apache.fop.layoutmgr.AddLMVisitor; /** * Class modelling the fo:static-content object. See Sec. 6.4.19 of the XSL-FO @@ -80,15 +79,6 @@ super.setFlowName(name); } - } - - /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. - */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveStaticContent(this); } public String getName() { 1.23 +1 -11 xml-fop/src/java/org/apache/fop/fo/pagination/Title.java Index: Title.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Title.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Title.java 27 Jul 2004 23:57:16 -0000 1.22 +++ Title.java 6 Aug 2004 04:22:18 -0000 1.23 @@ -28,7 +28,6 @@ import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.FONode; -import org.apache.fop.layoutmgr.AddLMVisitor; import org.apache.fop.fo.properties.CommonAccessibility; import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; @@ -94,15 +93,6 @@ int vis = this.propertyList.get(PR_VISIBILITY).getEnum(); Length zIndex = this.propertyList.get(PR_Z_INDEX).getLength(); - } - - /** - * This is a hook for the AddLMVisitor class to be able to access - * this object. - * @param aLMV the AddLMVisitor object that can access this object. - */ - public void acceptVisitor(AddLMVisitor aLMV) { - aLMV.serveTitle(this); } public String getName() { 1.48 +24 -150 xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java Index: AddLMVisitor.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- AddLMVisitor.java 4 Aug 2004 22:50:59 -0000 1.47 +++ AddLMVisitor.java 6 Aug 2004 04:22:18 -0000 1.48 @@ -41,24 +41,15 @@ import org.apache.fop.datatypes.Length; import org.apache.fop.fo.Constants; import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FOText; import org.apache.fop.fo.FObj; -import org.apache.fop.fo.FObjMixed; -import org.apache.fop.fo.TextInfo; -import org.apache.fop.fo.ToBeImplementedElement; import org.apache.fop.fo.XMLObj; import org.apache.fop.fo.flow.BasicLink; -import org.apache.fop.fo.flow.BidiOverride; import org.apache.fop.fo.flow.Block; -import org.apache.fop.fo.flow.BlockContainer; import org.apache.fop.fo.flow.Character; import org.apache.fop.fo.flow.ExternalGraphic; -import org.apache.fop.fo.flow.Footnote; import org.apache.fop.fo.flow.Inline; -import org.apache.fop.fo.flow.InlineContainer; import org.apache.fop.fo.flow.InstreamForeignObject; import org.apache.fop.fo.flow.Leader; -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; @@ -74,20 +65,16 @@ import org.apache.fop.fo.flow.TableHeader; import org.apache.fop.fo.flow.TableRow; import org.apache.fop.fo.flow.Wrapper; -import org.apache.fop.fo.pagination.Flow; -import org.apache.fop.fo.pagination.StaticContent; import org.apache.fop.fo.pagination.Title; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.layoutmgr.list.Item; -import org.apache.fop.layoutmgr.list.ListBlockLayoutManager; import org.apache.fop.layoutmgr.list.ListItemLayoutManager; import org.apache.fop.layoutmgr.table.Body; -import org.apache.fop.layoutmgr.table.Cell; import org.apache.fop.layoutmgr.table.Column; -import org.apache.fop.layoutmgr.table.Row; import org.apache.fop.layoutmgr.table.TableLayoutManager; import org.apache.fop.traits.MinOptMax; +import org.apache.fop.fo.LMVisited; /** * Visitor pattern for the purpose of adding @@ -115,7 +102,11 @@ /* Store the List in a global variable so that it can be accessed by the Visitor methods */ currentLMList = lmList; - fobj.acceptVisitor(this); + if (fobj instanceof LMVisited) { + ((LMVisited) fobj).acceptVisitor(this); + } else { + fobj.addLayoutManager(currentLMList); + } } /** @@ -135,81 +126,6 @@ } /** - * @param node FONode object to process - */ - public void serveFONode(FONode node) { - } - - /** - * @param node FObj object to process - */ - public void serveFObj(FObj node) { - serveFONode((FONode)node); - } - - public void serveFOText(FOText foText) { - if (foText.endIndex - foText.startIndex > 0) { - currentLMList.add(new TextLayoutManager(foText)); - } - } - - public void serveFObjMixed(FObjMixed node) { - if (node.getChildNodes() != null) { - InlineStackingLayoutManager lm; - lm = new InlineStackingLayoutManager(node); - lm.setLMiter(new LMiter(lm, node.getChildNodes())); - currentLMList.add(lm); - } - } - - public void serveBidiOverride(BidiOverride node) { - if (false) { - serveFObjMixed((FObjMixed)node); - } else { - ArrayList childList = new ArrayList(); - saveLMList = currentLMList; - currentLMList = childList; - serveFObjMixed((FObjMixed)node); - currentLMList = saveLMList; - for (int count = childList.size() - 1; count >= 0; count--) { - LayoutManager lm = (LayoutManager) childList.get(count); - if (lm.generatesInlineAreas()) { - LayoutManager blm = new BidiLayoutManager((InlineStackingLayoutManager) lm); - blm.setFObj(node); - currentLMList.add(blm); - } else { - currentLMList.add(lm); - } - } - } - } - - /** - * @param node Inline object to process - */ - public void serveInline(Inline node) { - serveFObjMixed((FObjMixed)node); - } - - public void serveFootnote(Footnote node) { - if (node.getInlineFO() == null) { - node.getLogger().error("inline required in footnote"); - return; - } - serveInline(node.getInlineFO()); - } - - public void serveInlineContainer(InlineContainer node) { - ArrayList childList = new ArrayList(); - saveLMList = currentLMList; - currentLMList = childList; - serveFObj((FObj)node); - currentLMList = saveLMList; - LayoutManager lm = new ICLayoutManager(node, childList); - currentLMList.add(lm); - } - - /** * Add start and end properties for the link */ public void serveBasicLink(final BasicLink node) { @@ -243,11 +159,6 @@ } } - public void serveBlock(Block node) { - BlockLayoutManager blm = new BlockLayoutManager(node); - currentLMList.add(blm); - } - public void serveLeader(final Leader node) { LeafNodeLayoutManager lm = new LeafNodeLayoutManager(node) { public InlineArea get(LayoutContext context) { @@ -417,17 +328,6 @@ return vp; } - public void serveBlockContainer(BlockContainer node) { - BlockContainerLayoutManager blm = new BlockContainerLayoutManager(node); - blm.setOverflow(node.getProperty(Constants.PR_OVERFLOW).getEnum()); - currentLMList.add(blm); - } - - public void serveListBlock(ListBlock node) { - ListBlockLayoutManager blm = new ListBlockLayoutManager(node); - currentLMList.add(blm); - } - public void serveInstreamForeignObject(InstreamForeignObject node) { Viewport areaCurrent = getInstreamForeignObjectInlineArea(node); if (areaCurrent != null) { @@ -438,7 +338,6 @@ currentLMList.add(lm); } } - /** * Get the inline area created by this element. * @@ -755,48 +654,6 @@ return blm; } - public void serveTableCell(TableCell node) { - Cell clm = new Cell(node); - currentLMList.add(clm); - } - - public void serveTableRow(TableRow node) { - Row rlm = new Row(node); - currentLMList.add(rlm); - } - - public void serveFlow(Flow node) { - FlowLayoutManager lm = new FlowLayoutManager(node); - currentLMList.add(lm); - } - - /** - * @param node Wrapper object to process - */ - public void serveWrapper(Wrapper node) { - ListIterator baseIter; - baseIter = node.getChildNodes(); - if (baseIter == null) return; - while (baseIter.hasNext()) { - FObj child = (FObj) baseIter.next(); - child.acceptVisitor(this); - } - } - - /** - * @param node StaticContent object to process - */ - public void serveStaticContent(StaticContent node) { - serveFlow((Flow)node); - } - - /** - * @param node Title object to process - */ - public void serveTitle(Title node) { - serveFObjMixed((FObjMixed)node); - } - /** * @param node TableFooter object to process */ @@ -809,5 +666,22 @@ */ public void serveTableHeader(TableHeader node) { serveTableBody((TableBody)node); + } + + /** + * @param node Wrapper object to process + */ + public void serveWrapper(Wrapper node) { + ListIterator baseIter; + baseIter = node.getChildNodes(); + if (baseIter == null) return; + while (baseIter.hasNext()) { + FObj child = (FObj) baseIter.next(); + if (child instanceof LMVisited) { + ((LMVisited) child).acceptVisitor(this); + } else { + child.addLayoutManager(currentLMList); + } + } } } 1.5 +3 -3 xml-fop/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java Index: BidiLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- BidiLayoutManager.java 27 Feb 2004 17:49:25 -0000 1.4 +++ BidiLayoutManager.java 6 Aug 2004 04:22:18 -0000 1.5 @@ -29,11 +29,11 @@ * ltr or rtl than its parent writing mode then this * reverses the inline areas (at the character level). */ -class BidiLayoutManager extends LeafNodeLayoutManager { +public class BidiLayoutManager extends LeafNodeLayoutManager { private List children; - BidiLayoutManager(InlineStackingLayoutManager cLM) { + public BidiLayoutManager(InlineStackingLayoutManager cLM) { children = new ArrayList(); /* for (int count = cLM.size() - 1; count >= 0; count--) { 1.4 +2 -2 xml-fop/src/java/org/apache/fop/layoutmgr/ICLayoutManager.java Index: ICLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/ICLayoutManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ICLayoutManager.java 15 May 2004 21:52:00 -0000 1.3 +++ ICLayoutManager.java 6 Aug 2004 04:22:18 -0000 1.4 @@ -34,7 +34,7 @@ private List childrenLM; - ICLayoutManager(FObj node, List childLM) { + public ICLayoutManager(FObj node, List childLM) { super(node); childrenLM = childLM; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]