diff options
18 files changed, 33 insertions, 127 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index bfb97398c..5c6f67196 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -92,7 +92,7 @@ public class FObj extends FONode implements Constants { for (int i = 1; i < list.length; i++) { if (list[i] != null) propertyListTable[i] = list[i]; - } + } } } @@ -163,7 +163,8 @@ public class FObj extends FONode implements Constants { * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode child) { - if (containsMarkers() && "fo:marker".equals(child.getName())) { + if (PropertySets.canHaveMarkers(getNameId()) && + "fo:marker".equals(child.getName())) { addMarker((Marker) child); } else { if (childNodes == null) { @@ -335,16 +336,6 @@ public class FObj extends FONode implements Constants { } /** - * Check if this formatting object may contain markers. - * - * @return true if this can contain markers - * @todo confirm if still needed after validateChildNode() fully implemented - */ - protected boolean containsMarkers() { - return false; - } - - /** * Set writing mode for this FO. * Use that from the nearest ancestor, including self, which generates * reference areas, or from root FO if no ancestor found. diff --git a/src/java/org/apache/fop/fo/PropertySets.java b/src/java/org/apache/fop/fo/PropertySets.java index 2494d25b5..e48381e85 100644 --- a/src/java/org/apache/fop/fo/PropertySets.java +++ b/src/java/org/apache/fop/fo/PropertySets.java @@ -25,6 +25,7 @@ import java.util.ArrayList; public class PropertySets { private static short[][] mapping = null; + private static BitSet can_have_markers = null; private Element[] elements = new Element[Constants.ELEMENT_COUNT+1]; private BitSet block_elems = new BitSet(); @@ -998,7 +999,6 @@ public class PropertySets { return indices; } - public static short[] getPropertySet(int elementId) { if (mapping == null) { mapping = new short[Constants.ELEMENT_COUNT+1][]; @@ -1011,6 +1011,35 @@ public class PropertySets { } /** + * Determines if fo:markers are allowed as children for the given FO + * @param elementId Constants enumeration ID of the FO (e.g., FO_ROOT) + * @return true if fo:markers allowed, false otherwise + * @todo check if still needed after validateChildNode() fully implemented + */ + public static boolean canHaveMarkers(int elementId) { + if (can_have_markers == null) { + can_have_markers = new BitSet(); + can_have_markers.set(Constants.FO_BASIC_LINK); + can_have_markers.set(Constants.FO_BIDI_OVERRIDE); + can_have_markers.set(Constants.FO_BLOCK); + can_have_markers.set(Constants.FO_BLOCK_CONTAINER); + can_have_markers.set(Constants.FO_INLINE); + can_have_markers.set(Constants.FO_INLINE_CONTAINER); + can_have_markers.set(Constants.FO_LIST_BLOCK); + can_have_markers.set(Constants.FO_LIST_ITEM); + can_have_markers.set(Constants.FO_LIST_ITEM_BODY); + can_have_markers.set(Constants.FO_LIST_ITEM_LABEL); + can_have_markers.set(Constants.FO_TABLE); + can_have_markers.set(Constants.FO_TABLE_BODY); + can_have_markers.set(Constants.FO_TABLE_CELL); + can_have_markers.set(Constants.FO_TABLE_AND_CAPTION); + can_have_markers.set(Constants.FO_TABLE_CAPTION); + can_have_markers.set(Constants.FO_WRAPPER); + } + return can_have_markers.get(elementId); + } + + /** * An object that represent the properties and contents of a fo element */ class Element { diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index 63784aebc..2c5d29abf 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -141,12 +141,4 @@ public class BasicLink extends Inline { public int getNameId() { return FO_BASIC_LINK; } - - /** - * @return true (BasicLink can contain Markers) - * @todo see if can remove in favor of a BitSet for all FO's - */ - protected boolean containsMarkers() { - return true; - } } diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/java/org/apache/fop/fo/flow/BidiOverride.java index de1cd83dc..f942fa4d4 100644 --- a/src/java/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/java/org/apache/fop/fo/flow/BidiOverride.java @@ -146,11 +146,4 @@ public class BidiOverride extends FObjMixed { public int getNameId() { return FO_BIDI_OVERRIDE; } - - /** - * @return true (BidiOverride can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } } diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index b45b97782..01e0f18cd 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -350,11 +350,4 @@ public class Block extends FObjMixed { public int getNameId() { return FO_BLOCK; } - - /** - * @return true (Block can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } } diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index 7c6aeccfe..d6562e78f 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -120,13 +120,6 @@ public class BlockContainer extends FObj { } /** - * @return true (BlockContainer can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @return the span for this object */ public int getSpan() { diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index d23aea29d..e8077de83 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -94,13 +94,6 @@ public class Inline extends FObjMixed { } /** - * @return true (Inline can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObjMixed#charIterator */ public CharIterator charIterator() { diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java index c96fd6afe..602b617eb 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java @@ -87,13 +87,6 @@ public class InlineContainer extends FObj { } /** - * @return true (InlineContainer can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 147ac5ab3..b58226aa1 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -95,13 +95,6 @@ public class ListBlock extends FObj { } /** - * @return true (ListBlock can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index af7cc7e56..85b0528cb 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -99,13 +99,6 @@ public class ListItem extends FObj { } /** - * @return true (ListItem can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) * @todo remove checks for non-nulls after validateChildNode() added */ diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java index db7431a04..4e7c277f5 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java @@ -53,13 +53,6 @@ public class ListItemBody extends FObj { } - /** - * @return true (ListItemBody can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - public String getName() { return "fo:list-item-body"; } diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index 50b1d227c..0980b766e 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -65,13 +65,6 @@ public class ListItemLabel extends FObj { } - /** - * @return true (ListItemLabel may contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - protected void endOfNode() throws SAXParseException { super.endOfNode(); getFOInputHandler().endListLabel(); diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 6778f01aa..e78274576 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -173,13 +173,6 @@ public class Table extends FObj implements LMVisited { return false; } - /** - * @return true (Table contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public ArrayList getColumns() { return columns; } diff --git a/src/java/org/apache/fop/fo/flow/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/TableAndCaption.java index 872eb99bd..7f2b671db 100644 --- a/src/java/org/apache/fop/fo/flow/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/TableAndCaption.java @@ -74,13 +74,6 @@ public class TableAndCaption extends ToBeImplementedElement { return false; } - /** - * @return true (TableAndCaption contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public String getName() { return "fo:table-and-caption"; } diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index 4bf3e1e82..c9aa41528 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -90,13 +90,6 @@ public class TableBody extends FObj implements LMVisited { } /** - * @return true (TableBody contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * 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. diff --git a/src/java/org/apache/fop/fo/flow/TableCaption.java b/src/java/org/apache/fop/fo/flow/TableCaption.java index 650de9b08..1a5816702 100644 --- a/src/java/org/apache/fop/fo/flow/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/TableCaption.java @@ -67,13 +67,6 @@ public class TableCaption extends ToBeImplementedElement { } - /** - * @return true (TableCaption contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public String getName() { return "fo:table-caption"; } diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index 041901aa4..72c02d79c 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -334,14 +334,6 @@ public class TableCell extends FObj { } /** - * - * @return true (TableCell can contain Markers) - */ - protected boolean containsMarkers() { - return true; - } - - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index bf7eee07b..82a9be783 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -41,13 +41,6 @@ public class Wrapper extends FObjMixed implements LMVisited { super(parent); } - /** - * @return true (Wrapper contains Markers) - */ - protected boolean containsMarkers() { - return true; - } - public void acceptVisitor(AddLMVisitor aLMV) { aLMV.serveWrapper(this); } |