aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-09-04 20:55:21 +0000
committerGlen Mazza <gmazza@apache.org>2004-09-04 20:55:21 +0000
commitfe2d99426ed26953441a63e27aa87935e0877d6d (patch)
tree5570bda4f1bc4ea955660f57aa3e2ed328f13875 /src/java/org/apache/fop
parentce6918191d4a085815a977aa394c8516609e3f91 (diff)
downloadxmlgraphics-fop-fe2d99426ed26953441a63e27aa87935e0877d6d.tar.gz
xmlgraphics-fop-fe2d99426ed26953441a63e27aa87935e0877d6d.zip
1.) Validation for fo:multi-toggle added.
2.) Switch to faster int's for findAncestor(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197902 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/fo/FONode.java34
-rw-r--r--src/java/org/apache/fop/fo/FObj.java11
-rw-r--r--src/java/org/apache/fop/fo/flow/BidiOverride.java8
-rw-r--r--src/java/org/apache/fop/fo/flow/Inline.java6
4 files changed, 30 insertions, 29 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index 64c1f199d..e1bfe272e 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -111,23 +111,6 @@ public abstract class FONode {
}
/**
- * Returns the name of the node
- * @return the name of this node
- */
- public String getName() {
- return null;
- }
-
- /**
- * Returns the Constants class integer value of this node
- * @return the integer enumeration of this FO (e.g., FO_ROOT)
- * if a formatting object, FO_UNKNOWN_NODE otherwise
- */
- public int getNameId() {
- return Constants.FO_UNKNOWN_NODE;
- }
-
- /**
* Checks to make sure, during SAX processing of input document, that the
* incoming node is valid for the this (parent) node (e.g., checking to
* see that fo:table is not an immediate child of fo:root)
@@ -344,5 +327,22 @@ public abstract class FONode {
return "Error(" + loc.getLineNumber() + "/" + loc.getColumnNumber() + "): ";
}
}
+
+ /**
+ * Returns the name of the node
+ * @return the name of this node
+ */
+ public String getName() {
+ return null;
+ }
+
+ /**
+ * Returns the Constants class integer value of this node
+ * @return the integer enumeration of this FO (e.g., FO_ROOT)
+ * if a formatting object, FO_UNKNOWN_NODE otherwise
+ */
+ public int getNameId() {
+ return Constants.FO_UNKNOWN_NODE;
+ }
}
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index a1a25e8b7..cebe2e164 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -514,8 +514,9 @@ public class FObj extends FONode implements Constants {
|| lName.equals("page-number")
|| lName.equals("page-number-citation")
|| lName.equals("basic-link")
- || lName.equals("multi-toggle")
- || (!isOutOfLineFODescendant && lName.equals("footnote"))
+ || (lName.equals("multi-toggle")
+ && (getNameId() == FO_MULTI_CASE || findAncestor(FO_MULTI_CASE) > 0))
+ || (lName.equals("footnote") && !isOutOfLineFODescendant)
|| isNeutralItem(nsURI, lName)));
}
@@ -551,15 +552,15 @@ public class FObj extends FONode implements Constants {
/**
* Convenience method for validity checking. Checks if the
* current node has an ancestor of a given name.
- * @param ancestorName -- node name to check for (e.g., "fo:root")
+ * @param ancestorID -- Constants ID of node name to check for (e.g., FO_ROOT)
* @return number of levels above FO where ancestor exists,
* -1 if not found
*/
- protected int findAncestor(String ancestorName) {
+ protected int findAncestor(int ancestorID) {
int found = 1;
FONode temp = getParent();
while (temp != null) {
- if (temp.getName().equals(ancestorName)) {
+ if (temp.getNameId() == ancestorID) {
return found;
}
found += 1;
diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/java/org/apache/fop/fo/flow/BidiOverride.java
index 0e97b6d83..48874bf1c 100644
--- a/src/java/org/apache/fop/fo/flow/BidiOverride.java
+++ b/src/java/org/apache/fop/fo/flow/BidiOverride.java
@@ -52,10 +52,10 @@ public class BidiOverride extends FObjMixed {
/* Check to see if this node can have block-level children.
* See validateChildNode() below.
*/
- int lvlLeader = findAncestor("fo:leader");
- int lvlInCntr = findAncestor("fo:inline-container");
- int lvlInline = findAncestor("fo:inline");
- int lvlFootnote = findAncestor("fo:footnote");
+ int lvlLeader = findAncestor(FO_LEADER);
+ int lvlInCntr = findAncestor(FO_INLINE_CONTAINER);
+ int lvlInline = findAncestor(FO_INLINE);
+ int lvlFootnote = findAncestor(FO_FOOTNOTE);
if (lvlLeader > 0) {
if (lvlInCntr < 0 ||
diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java
index 5df8b7573..33605498f 100644
--- a/src/java/org/apache/fop/fo/flow/Inline.java
+++ b/src/java/org/apache/fop/fo/flow/Inline.java
@@ -54,9 +54,9 @@ public class Inline extends FObjMixed {
/* Check to see if this node can have block-level children.
* See validateChildNode() below.
*/
- int lvlLeader = findAncestor("fo:leader");
- int lvlFootnote = findAncestor("fo:footnote");
- int lvlInCntr = findAncestor("fo:inline-container");
+ int lvlLeader = findAncestor(FO_LEADER);
+ int lvlFootnote = findAncestor(FO_FOOTNOTE);
+ int lvlInCntr = findAncestor(FO_INLINE_CONTAINER);
if (lvlLeader > 0) {
if (lvlInCntr < 0 ||