for (int i = 1; i < list.length; i++) {
if (list[i] != null)
propertyListTable[i] = list[i];
- }
+ }
}
}
* @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) {
return true;
}
- /**
- * 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
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();
return indices;
}
-
public static short[] getPropertySet(int elementId) {
if (mapping == null) {
mapping = new short[Constants.ELEMENT_COUNT+1][];
return mapping[elementId];
}
+ /**
+ * 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
*/
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;
- }
}
public int getNameId() {
return FO_BIDI_OVERRIDE;
}
-
- /**
- * @return true (BidiOverride can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
}
public int getNameId() {
return FO_BLOCK;
}
-
- /**
- * @return true (Block can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
}
return false;
}
- /**
- * @return true (BlockContainer can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
/**
* @return the span for this object
*/
getFOInputHandler().endInline(this);
}
- /**
- * @return true (Inline can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
/**
* @see org.apache.fop.fo.FObjMixed#charIterator
*/
// this.propertyList.get("writing-mode");
}
- /**
- * @return true (InlineContainer can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
/**
* @see org.apache.fop.fo.FObj#addLayoutManager(List)
*/
return false;
}
- /**
- * @return true (ListBlock can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
/**
* @see org.apache.fop.fo.FObj#addLayoutManager(List)
*/
return false;
}
- /**
- * @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
}
- /**
- * @return true (ListItemBody can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
public String getName() {
return "fo:list-item-body";
}
}
- /**
- * @return true (ListItemLabel may contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
protected void endOfNode() throws SAXParseException {
super.endOfNode();
getFOInputHandler().endListLabel();
return false;
}
- /**
- * @return true (Table contains Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
public ArrayList getColumns() {
return columns;
}
return false;
}
- /**
- * @return true (TableAndCaption contains Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
public String getName() {
return "fo:table-and-caption";
}
}
- /**
- * @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.
}
- /**
- * @return true (TableCaption contains Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
public String getName() {
return "fo:table-caption";
}
}
}
- /**
- *
- * @return true (TableCell can contain Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
/**
* @see org.apache.fop.fo.FObj#addLayoutManager(List)
*/
super(parent);
}
- /**
- * @return true (Wrapper contains Markers)
- */
- protected boolean containsMarkers() {
- return true;
- }
-
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveWrapper(this);
}