keiron 2002/11/15 03:56:29 Modified: src/org/apache/fop/apps StructureHandler.java src/org/apache/fop/datatypes LengthBase.java src/org/apache/fop/fo FONode.java FOText.java FObj.java FObjMixed.java RecursiveCharIterator.java src/org/apache/fop/fo/flow BasicLink.java BidiOverride.java Block.java BlockContainer.java Inline.java InlineContainer.java Leader.java ListBlock.java ListItem.java ListItemBody.java ListItemLabel.java Marker.java Table.java TableAndCaption.java TableBody.java TableCaption.java TableCell.java Wrapper.java src/org/apache/fop/layoutmgr LMiter.java Log: added support for markers in fo tree bit of a cleanup Revision Changes Path 1.6 +4 -3 xml-fop/src/org/apache/fop/apps/StructureHandler.java Index: StructureHandler.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/StructureHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- StructureHandler.java 13 Sep 2002 08:21:53 -0000 1.5 +++ StructureHandler.java 15 Nov 2002 11:56:27 -0000 1.6 @@ -8,6 +8,7 @@ package org.apache.fop.apps; // Java +import java.util.Set; import java.util.HashSet; // Avalon @@ -31,12 +32,12 @@ The current set of id's in the FO tree This is used so we know if the FO tree contains duplicates */ - private HashSet idReferences = new HashSet(); + private Set idReferences = new HashSet(); public StructureHandler() { } - public HashSet getIDReferences() { + public Set getIDReferences() { return idReferences; } 1.8 +3 -3 xml-fop/src/org/apache/fop/datatypes/LengthBase.java Index: LengthBase.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/LengthBase.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- LengthBase.java 22 Nov 2001 07:11:38 -0000 1.7 +++ LengthBase.java 15 Nov 2002 11:56:27 -0000 1.8 @@ -70,9 +70,9 @@ return propertyList.get("font-size").getLength().mvalue(); case INH_FONTSIZE: return propertyList.getInherited("font-size").getLength().mvalue(); - case CONTAINING_BOX: + //case CONTAINING_BOX: // depends on property?? inline-progression vs block-progression - return parentFO.getContentWidth(); + //return parentFO.getContentWidth(); case CONTAINING_REFAREA: // example: start-indent, end-indent { //FONode fo; 1.32 +14 -3 xml-fop/src/org/apache/fop/fo/FONode.java Index: FONode.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FONode.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- FONode.java 25 Oct 2002 09:29:40 -0000 1.31 +++ FONode.java 15 Nov 2002 11:56:27 -0000 1.32 @@ -106,11 +106,22 @@ * this FObj. */ public ListIterator getChildren(FONode childNode) { - return null; + return null; } public CharIterator charIterator() { - return new OneCharIterator(CharUtilities.CODE_EOT); + return new OneCharIterator(CharUtilities.CODE_EOT); } + /** + * This is a quick check to see if it is a marker. + * This is needed since there is no other quick way of checking + * for a marker and not adding to the child list. + * + * @return true if this is a marker + */ + protected boolean isMarker() { + return false; + } } + 1.41 +10 -1 xml-fop/src/org/apache/fop/fo/FOText.java Index: FOText.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOText.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- FOText.java 25 Oct 2002 09:29:41 -0000 1.40 +++ FOText.java 15 Nov 2002 11:56:27 -0000 1.41 @@ -51,6 +51,15 @@ structHandler.characters(ca, start, length); } + /** + * Check if this text node will create an area. + * This means either there is non-whitespace or it is + * preserved whitespace. + * Maybe this just needs to check length > 0, since char iterators + * handle whitespace. + * + * @return true if this will create an area in the output + */ public boolean willCreateArea() { if (textInfo.whiteSpaceCollapse == WhiteSpaceCollapse.FALSE && length > 0) { 1.39 +125 -175 xml-fop/src/org/apache/fop/fo/FObj.java Index: FObj.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FObj.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- FObj.java 25 Oct 2002 09:29:41 -0000 1.38 +++ FObj.java 15 Nov 2002 11:56:27 -0000 1.39 @@ -24,65 +24,73 @@ import java.util.ArrayList; import java.util.List; import java.util.HashMap; -import java.util.HashSet; +import java.util.Set; +import java.util.Map; /** * base class for representation of formatting objects and their processing */ public class FObj extends FONode { - protected StructureHandler structHandler; - public PropertyList properties; - protected PropertyManager propMgr; - protected String areaClass = AreaClass.UNASSIGNED; - protected String id = null; + private final static String FO_URI = "http://www.w3.org/1999/XSL/Format"; /** - * value of marker before layout begins + * Static property list builder that converts xml attributes + * into fo properties. This is static since the underlying + * property mappings for fo are also static. */ - public static final int START = -1000; + protected static PropertyListBuilder plb = null; /** - * value of marker after break-after + * Structure handler used to notify structure events + * such as start end element. */ - public static final int BREAK_AFTER = -1001; + protected StructureHandler structHandler; /** - * where the layout was up to. - * for FObjs it is the child number - * for FOText it is the character number + * Formatting properties for this fo element. */ - protected int marker = START; - - protected ArrayList children = new ArrayList(); // made public for searching for id's - - protected boolean isInTableCell = false; + public PropertyList properties; - protected int forcedStartOffset = 0; - protected int forcedWidth = 0; + /** + * Property manager for handler some common properties. + */ + protected PropertyManager propMgr; - protected int widows = 0; - protected int orphans = 0; + /** + * Id of this fo element of null if no id. + */ + protected String id = null; - // count of areas generated-by/returned-by - public int areasGenerated = 0; + /** + * The children of this node. + */ + protected ArrayList children = null; - // markers - protected HashMap markers; + /** + * Markers added to this element. + */ + protected Map markers = null; + /** + * Create a new formatting object. + * All formatting object classes extend this class. + * + * @param parent the parent node + */ public FObj(FONode parent) { super(parent); - markers = new HashMap(); - if (parent instanceof FObj) { - this.areaClass = ((FObj) parent).areaClass; - } } + /** + * Set the name of this element. + * The prepends "fo:" to the name to indicate it is in the fo namespace. + * + * @param str the xml element name + */ public void setName(String str) { name = "fo:" + str; } - protected static PropertyListBuilder plb = null; - protected PropertyListBuilder getListBuilder() { if (plb == null) { plb = new PropertyListBuilder(); @@ -105,7 +113,6 @@ * will be altered for the next element. */ public void handleAttrs(Attributes attlist) throws FOPException { - String uri = "http://www.w3.org/1999/XSL/Format"; FONode par = parent; while (par != null && !(par instanceof FObj)) { par = par.parent; @@ -114,7 +121,7 @@ if (par != null) { props = ((FObj) par).properties; } - properties = getListBuilder().makeList(uri, name, attlist, props, + properties = getListBuilder().makeList(FO_URI, name, attlist, props, (FObj) par); properties.setFObj(this); this.propMgr = makePropertyManager(properties); @@ -126,10 +133,27 @@ return new PropertyManager(propertyList); } + /** + * Add the child to this object. + * + * @param child the child node to add + */ protected void addChild(FONode child) { - children.add(child); + if (containsMarkers() && child.isMarker()) { + addMarker((Marker)child); + } else { + if (children == null) { + children = new ArrayList(); + } + children.add(child); + } } + /** + * Set the structure handler for handling structure events. + * + * @param st the structure handler + */ public void setStructHandler(StructureHandler st) { structHandler = st; } @@ -144,12 +168,18 @@ return (properties.get(name)); } + /** + * Setup the id for this formatting object. + * Most formatting objects can have an id that can be referenced. + * This methods checks that the id isn't already used by another + * fo and sets the id attribute of this object. + */ protected void setupID() { Property prop = this.properties.get("id"); if (prop != null) { String str = prop.getString(); if (str != null && !str.equals("")) { - HashSet idrefs = structHandler.getIDReferences(); + Set idrefs = structHandler.getIDReferences(); if (!idrefs.contains(str)) { id = str; idrefs.add(id); @@ -160,34 +190,44 @@ } } + /** + * Get the id string for this formatting object. + * This will be unique for the fo document. + * + * @return the id string or null if not set + */ public String getID() { return id; } /** - * Return the "content width" of the areas generated by this FO. - * This is used by percent-based properties to get the dimension of - * the containing block. - * If an FO has a property with a percentage value, that value - * is usually calculated on the basis of the corresponding dimension - * of the area which contains areas generated by the FO. - * NOTE: subclasses of FObj should implement this to return a reasonable - * value! + * Check if this formatting object generates reference areas. + * + * @return true if generates reference areas */ - public int getContentWidth() { - return 0; - } - public boolean generatesReferenceAreas() { return false; } - + /** + * Check if this formatting object generates inline areas. + * + * @return true if generates inline areas + */ public boolean generatesInlineAreas() { return true; } /** + * Check if this formatting object may contain markers. + * + * @return true if this can contian markers + */ + protected boolean containsMarkers() { + return false; + } + + /** * Set writing mode for this FO. * Find nearest ancestor, including self, which generates * reference areas and use the value of its writing-mode property. @@ -231,147 +271,57 @@ * this FObj. */ public ListIterator getChildren(FONode childNode) { - int i = children.indexOf(childNode); - if (i >= 0) { - return children.listIterator(i); - } else { - return null; - } - } - - public void setIsInTableCell() { - this.isInTableCell = true; - // made recursive by Eric Schaeffer - for (int i = 0; i < this.children.size(); i++) { - Object obj = this.children.get(i); - if (obj instanceof FObj) { - FObj child = (FObj) obj; - child.setIsInTableCell(); - } - } - } - - public void forceStartOffset(int offset) { - this.forcedStartOffset = offset; - // made recursive by Eric Schaeffer - for (int i = 0; i < this.children.size(); i++) { - Object obj = this.children.get(i); - if (obj instanceof FObj) { - FObj child = (FObj) obj; - child.forceStartOffset(offset); - } - } - } - - public void forceWidth(int width) { - this.forcedWidth = width; - // made recursive by Eric Schaeffer - for (int i = 0; i < this.children.size(); i++) { - Object obj = this.children.get(i); - if (obj instanceof FObj) { - FObj child = (FObj) obj; - child.forceWidth(width); - } - } - } - - public void resetMarker() { - this.marker = START; - int numChildren = this.children.size(); - for (int i = 0; i < numChildren; i++) { - Object obj = this.children.get(i); - if (obj instanceof FObj) { - FObj child = (FObj) obj; - child.resetMarker(); + if (children != null) { + int i = children.indexOf(childNode); + if (i >= 0) { + return children.listIterator(i); } } - } - - public void setWidows(int wid) { - widows = wid; - } - - public void setOrphans(int orph) { - orphans = orph; - } - - public void removeAreas() { - // still to do - } - - /** - * At the start of a new span area layout may be partway through a - * nested FO, and balancing requires rollback to this known point. - * The snapshot records exactly where layout is at. - * @param snapshot a ArrayList of markers (Integer) - * @returns the updated ArrayList of markers (Integers) - */ - public ArrayList getMarkerSnapshot(ArrayList snapshot) { - snapshot.add(new Integer(this.marker)); - - // terminate if no kids or child not yet accessed - if (this.marker < 0) { - return snapshot; - } else if (children.isEmpty()) { - return snapshot; - } else { - return ( (FObj) children.get(this.marker)).getMarkerSnapshot( - snapshot); - } + return null; } /** - * When balancing occurs, the flow layout() method restarts at the - * point specified by the current marker snapshot, which is retrieved - * and restored using this method. - * @param snapshot the ArrayList of saved markers (Integers) + * Add the marker to this formatting object. + * If this object can contain markers it checks that the marker + * has a unique class-name for this object and that it is + * the first child. */ - public void rollback(ArrayList snapshot) { - this.marker = ((Integer) snapshot.get(0)).intValue(); - snapshot.remove(0); - - if (this.marker == START) { - // make sure all the children of this FO are also reset - resetMarker(); - return; - } else if ((this.marker == -1) || children.isEmpty()) { - return; - } - - int numChildren = this.children.size(); - - if (this.marker <= START) { - return; - } - - for (int i = this.marker + 1; i < numChildren; i++) { - Object obj = this.children.get(i); - if (obj instanceof FObj) { - FObj child = (FObj) obj; - child.resetMarker(); + public void addMarker(Marker marker) { + String mcname = marker.getMarkerClassName(); + if (children != null) { + // check for empty children + for (Iterator iter = children.iterator(); iter.hasNext();) { + FONode node = (FONode)iter.next(); + if (node instanceof FOText) { + FOText text = (FOText)node; + if (text.willCreateArea()) { + getLogger().error("fo:marker must be an initial child: " + mcname); + return; + } else { + iter.remove(); + } + } else { + getLogger().error("fo:marker must be an initial child: " + mcname); + return; + } } } - ((FObj) children.get(this.marker)).rollback(snapshot); - } - - - public void addMarker(Marker marker) throws FOPException { - String mcname = marker.getMarkerClassName(); - if (!markers.containsKey(mcname) && children.isEmpty()) { + if (markers == null) { + markers = new HashMap(); + } + if (!markers.containsKey(mcname)) { markers.put(mcname, marker); } else { - getLogger().error("fo:marker must be an initial child," + "and 'marker-class-name' must be unique for same parent"); - throw new FOPException( - "fo:marker must be an initial child," + "and 'marker-class-name' must be unique for same parent"); + getLogger().error("fo:marker 'marker-class-name' must be unique for same parent: " + mcname); } } public boolean hasMarkers() { - return !markers.isEmpty(); + return markers != null && !markers.isEmpty(); } - public ArrayList getMarkers() { - return new ArrayList(markers.values()); + public Map getMarkers() { + return markers; } /** 1.31 +5 -4 xml-fop/src/org/apache/fop/fo/FObjMixed.java Index: FObjMixed.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FObjMixed.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- FObjMixed.java 13 Sep 2002 08:21:53 -0000 1.30 +++ FObjMixed.java 15 Nov 2002 11:56:27 -0000 1.31 @@ -22,7 +22,7 @@ * and their processing */ public class FObjMixed extends FObj { - TextInfo textInfo = null; + protected TextInfo textInfo = null; protected FontInfo fontInfo = null; public FObjMixed(FONode parent) { @@ -35,8 +35,10 @@ } public void addLayoutManager(List lms) { - lms.add(new InlineStackingLayoutManager(this, + if (children != null) { + lms.add(new InlineStackingLayoutManager(this, new LMiter(children.listIterator()))); + } } protected void addCharacters(char data[], int start, int length) { @@ -54,7 +56,6 @@ } public void setup() { - if (this.properties != null) { setupID(); } 1.4 +2 -2 xml-fop/src/org/apache/fop/fo/RecursiveCharIterator.java Index: RecursiveCharIterator.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/RecursiveCharIterator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- RecursiveCharIterator.java 25 Oct 2002 09:29:41 -0000 1.3 +++ RecursiveCharIterator.java 15 Nov 2002 11:56:27 -0000 1.4 @@ -54,7 +54,7 @@ private void getNextCharIter() { - if (childIter.hasNext()) { + if (childIter != null && childIter.hasNext()) { this.curChild = (FONode) childIter.next(); this.curCharIter = curChild.charIterator(); } else { 1.18 +6 -1 xml-fop/src/org/apache/fop/fo/flow/BasicLink.java Index: BasicLink.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/BasicLink.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- BasicLink.java 3 Nov 2002 16:24:21 -0000 1.17 +++ BasicLink.java 15 Nov 2002 11:56:28 -0000 1.18 @@ -120,8 +120,13 @@ } + protected boolean containsMarkers() { + 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; 1.11 +5 -1 xml-fop/src/org/apache/fop/fo/flow/BidiOverride.java Index: BidiOverride.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/BidiOverride.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- BidiOverride.java 16 Aug 2002 12:44:07 -0000 1.10 +++ BidiOverride.java 15 Nov 2002 11:56:28 -0000 1.11 @@ -74,6 +74,10 @@ } + protected boolean containsMarkers() { + return true; + } + /** * If this bidi has a different writing mode direction * ltr or rtl than its parent writing mode then this 1.64 +3 -15 xml-fop/src/org/apache/fop/fo/flow/Block.java Index: Block.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- Block.java 1 Nov 2002 10:49:34 -0000 1.63 +++ Block.java 15 Nov 2002 11:56:28 -0000 1.64 @@ -52,9 +52,6 @@ int blockWidows; int blockOrphans; - int areaHeight = 0; - int contentWidth = 0; - String id; int span; private int wsTreatment; //ENUMERATION @@ -169,18 +166,9 @@ } - public int getAreaHeight() { - return areaHeight; + protected boolean containsMarkers() { + return true; } - - - /** - * Return the content width of the boxes generated by this FO. - */ - public int getContentWidth() { - return contentWidth; // getAllocationWidth()?? - } - public int getSpan() { return this.span; 1.19 +5 -3 xml-fop/src/org/apache/fop/fo/flow/BlockContainer.java Index: BlockContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/BlockContainer.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- BlockContainer.java 30 Aug 2002 08:03:23 -0000 1.18 +++ BlockContainer.java 15 Nov 2002 11:56:28 -0000 1.19 @@ -78,8 +78,6 @@ // this.properties.get("width"); // this.properties.get("writing-mode"); - this.marker = 0; - this.backgroundColor = this.properties.get("background-color").getColorType(); @@ -95,6 +93,10 @@ public boolean generatesInlineAreas() { return false; + } + + protected boolean containsMarkers() { + return true; } public int getSpan() { 1.14 +4 -1 xml-fop/src/org/apache/fop/fo/flow/Inline.java Index: Inline.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Inline.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Inline.java 23 May 2002 06:27:13 -0000 1.13 +++ Inline.java 15 Nov 2002 11:56:28 -0000 1.14 @@ -87,6 +87,9 @@ } } + protected boolean containsMarkers() { + return true; + } public CharIterator charIterator() { return new InlineCharIterator(this, propMgr.getBorderAndPadding()); 1.9 +5 -1 xml-fop/src/org/apache/fop/fo/flow/InlineContainer.java Index: InlineContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/InlineContainer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- InlineContainer.java 23 May 2002 06:27:13 -0000 1.8 +++ InlineContainer.java 15 Nov 2002 11:56:28 -0000 1.9 @@ -69,6 +69,10 @@ // this.properties.get("writing-mode"); } + protected boolean containsMarkers() { + return true; + } + /** * This creates a single inline container area after * laying out the child block areas. All footnotes, floats 1.29 +5 -1 xml-fop/src/org/apache/fop/fo/flow/Leader.java Index: Leader.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Leader.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- Leader.java 18 Sep 2002 14:04:31 -0000 1.28 +++ Leader.java 15 Nov 2002 11:56:28 -0000 1.29 @@ -116,6 +116,10 @@ leaderArea = fa; } else if(leaderPattern == LeaderPattern.USECONTENT) { + if (children == null) { + getLogger().error("Leader use-content with no content"); + return; + } InlineStackingLayoutManager lm; lm = new InlineStackingLayoutManager(this, new LMiter(children.listIterator())); 1.29 +5 -1 xml-fop/src/org/apache/fop/fo/flow/ListBlock.java Index: ListBlock.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ListBlock.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- ListBlock.java 3 Nov 2002 16:29:58 -0000 1.28 +++ ListBlock.java 15 Nov 2002 11:56:28 -0000 1.29 @@ -92,5 +92,9 @@ return false; } + protected boolean containsMarkers() { + return true; + } } + 1.25 +6 -1 xml-fop/src/org/apache/fop/fo/flow/ListItem.java Index: ListItem.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ListItem.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- ListItem.java 3 Nov 2002 16:29:58 -0000 1.24 +++ ListItem.java 15 Nov 2002 11:56:28 -0000 1.25 @@ -99,4 +99,9 @@ return false; } + protected boolean containsMarkers() { + return true; + } + } + 1.19 +6 -1 xml-fop/src/org/apache/fop/fo/flow/ListItemBody.java Index: ListItemBody.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ListItemBody.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ListItemBody.java 3 Nov 2002 16:29:58 -0000 1.18 +++ ListItemBody.java 15 Nov 2002 11:56:28 -0000 1.19 @@ -46,4 +46,9 @@ } + protected boolean containsMarkers() { + return true; + } + } + 1.19 +6 -1 xml-fop/src/org/apache/fop/fo/flow/ListItemLabel.java Index: ListItemLabel.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ListItemLabel.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ListItemLabel.java 3 Nov 2002 16:29:58 -0000 1.18 +++ ListItemLabel.java 15 Nov 2002 11:56:28 -0000 1.19 @@ -46,4 +46,9 @@ } + protected boolean containsMarkers() { + return true; + } + } + 1.12 +27 -10 xml-fop/src/org/apache/fop/fo/flow/Marker.java Index: Marker.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Marker.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Marker.java 7 Aug 2002 16:54:57 -0000 1.11 +++ Marker.java 15 Nov 2002 11:56:28 -0000 1.12 @@ -16,31 +16,48 @@ import org.xml.sax.Attributes; +/** + * Marker formatting object. + * This is the marker formatting object that handles merkers. + * This attempts to add itself to the parent formatting object. + */ public class Marker extends FObjMixed { private String markerClassName; + /** + * Create a marker fo. + * + * @param parent the parent fo node + */ public Marker(FONode parent) { super(parent); } + /** + * Handle the attributes for this marker. + * This gets the marker-class-name and attempts to add itself + * to the parent formatting object. + * + * @param attlist the attribute list + * @throws FOPException if there is an exception + */ public void handleAttrs(Attributes attlist) throws FOPException { super.handleAttrs(attlist); - // do check to see that 'this' is under fo:flow this.markerClassName = this.properties.get("marker-class-name").getString(); + } - // check to ensure that no other marker with same parent - // has this 'marker-class-name' is in addMarker() method - try { - ((FObj)parent).addMarker(this); - } catch (FOPException fopex) { - getLogger().error("marker cannot be added to '" + parent - + "'"); - } + protected boolean isMarker() { + return true; } + /** + * Get the marker class name for this marker. + * + * @return the marker class name + */ public String getMarkerClassName() { return markerClassName; } 1.48 +7 -2 xml-fop/src/org/apache/fop/fo/flow/Table.java Index: Table.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Table.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Table.java 13 Sep 2002 08:21:54 -0000 1.47 +++ Table.java 15 Nov 2002 11:56:28 -0000 1.48 @@ -63,7 +63,7 @@ tableHeader = (TableBody)child; } else { // add bodies - children.add(child); + super.addChild(child); } } @@ -149,4 +149,9 @@ return false; } + protected boolean containsMarkers() { + return true; + } + } + 1.10 +7 -1 xml-fop/src/org/apache/fop/fo/flow/TableAndCaption.java Index: TableAndCaption.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableAndCaption.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TableAndCaption.java 20 Jun 2002 09:14:13 -0000 1.9 +++ TableAndCaption.java 15 Nov 2002 11:56:28 -0000 1.10 @@ -51,4 +51,10 @@ public boolean generatesInlineAreas() { return false; } + + protected boolean containsMarkers() { + return true; + } + } + 1.46 +5 -1 xml-fop/src/org/apache/fop/fo/flow/TableBody.java Index: TableBody.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableBody.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- TableBody.java 13 Sep 2002 08:21:54 -0000 1.45 +++ TableBody.java 15 Nov 2002 11:56:28 -0000 1.46 @@ -70,5 +70,9 @@ } + protected boolean containsMarkers() { + return true; + } + } 1.9 +7 -1 xml-fop/src/org/apache/fop/fo/flow/TableCaption.java Index: TableCaption.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableCaption.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TableCaption.java 20 Jun 2002 09:14:13 -0000 1.8 +++ TableCaption.java 15 Nov 2002 11:56:28 -0000 1.9 @@ -45,4 +45,10 @@ // this.properties.get("width"); } + + protected boolean containsMarkers() { + return true; + } + } + 1.49 +5 -1 xml-fop/src/org/apache/fop/fo/flow/TableCell.java Index: TableCell.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableCell.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- TableCell.java 1 Nov 2002 10:49:34 -0000 1.48 +++ TableCell.java 15 Nov 2002 11:56:28 -0000 1.49 @@ -296,5 +296,9 @@ } } + protected boolean containsMarkers() { + return true; + } + } 1.8 +6 -1 xml-fop/src/org/apache/fop/fo/flow/Wrapper.java Index: Wrapper.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Wrapper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Wrapper.java 21 Feb 2002 09:54:26 -0000 1.7 +++ Wrapper.java 15 Nov 2002 11:56:28 -0000 1.8 @@ -27,4 +27,9 @@ super(parent); } + protected boolean containsMarkers() { + return true; + } + } + 1.7 +2 -2 xml-fop/src/org/apache/fop/layoutmgr/LMiter.java Index: LMiter.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LMiter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- LMiter.java 13 Nov 2002 10:25:48 -0000 1.6 +++ LMiter.java 15 Nov 2002 11:56:29 -0000 1.7 @@ -33,7 +33,7 @@ protected boolean preLoadNext() { // skip over child FObj's that don't add lms - while (baseIter.hasNext()) { + while (baseIter != null && baseIter.hasNext()) { Object theobj = baseIter.next(); if(theobj instanceof FObj) { FObj fobj = (FObj) theobj;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]