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
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);
- }
-
/**
* Helper function to standardize the names of all namespace URI - local
* name pairs in text messages.
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.
}
/**
- * 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));
+ }
}
}
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
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
}
/**
- * 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);
+ }
}
+
}
--- /dev/null
+/*
+ * 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$ */
+
+package org.apache.fop.fo;
+
+import org.apache.fop.layoutmgr.AddLMVisitor;
+
+public interface LMVisited {
+ public void acceptVisitor(AddLMVisitor aLMV);
+}
+
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;
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;
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.
*/
* 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);
+ }
+ }
+ }
}
+
+
}
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
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;
}
/**
- * 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";
}
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;
}
/**
- * 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() {
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
* 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;
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;
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
// FOP
import org.apache.fop.fo.FONode;
-import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.FObj;
/**
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";
}
return new InlineCharIterator(this, propMgr.getBorderAndPadding());
}
- public void acceptVisitor(AddLMVisitor aLMV) {
- aLMV.serveInline(this);
- }
-
public String getName() {
return "fo:inline";
}
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;
}
/**
- * 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() {
// 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;
* 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;
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;
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
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;
}
/**
- * 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";
}
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;
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;
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;
/**
* 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;
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;
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 */
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;
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
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;
}
/**
- * 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);
}
// 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
// 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
package org.apache.fop.fo.flow;
+// Java
+import java.util.List;
+
// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
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;
}
/**
- * 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);
}
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.
* 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
// Java
import java.util.ArrayList;
+import java.util.List;
// XML
import org.xml.sax.Attributes;
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.
}
/**
- * 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";
}
// 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
}
- /**
- * 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() {
return "fo:static-content";
}
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;
}
- /**
- * 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() {
return "fo:title";
}
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;
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
/* 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);
+ }
}
/**
return saveLMList;
}
- /**
- * @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 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) {
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) {
currentLMList.add(lm);
}
}
-
/**
* Get the inline area created by this element.
*
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
*/
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);
+ }
+ }
+ }
}
* 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--) {
private List childrenLM;
- ICLayoutManager(FObj node, List childLM) {
+ public ICLayoutManager(FObj node, List childLM) {
super(node);
childrenLM = childLM;
}