]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Created a "isOutOfLineFODescendant" member variable to FObj, needed for
authorGlen Mazza <gmazza@apache.org>
Sun, 25 Jul 2004 16:11:04 +0000 (16:11 +0000)
committerGlen Mazza <gmazza@apache.org>
Sun, 25 Jul 2004 16:11:04 +0000 (16:11 +0000)
input FOValidation. As defined in Sect. 6.2 of the spec, certain child FO's
are not valid if the parent FO is a descendant of an out of line FO (sect. 6.10)

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197839 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/FObj.java

index f3a52ae3e3c425a4c69230bf40fb073cccb204fd..a61790606dc62ff2bbfb0b04276ca16fd9df0b32 100644 (file)
@@ -56,6 +56,13 @@ public class FObj extends FONode implements Constants {
     /** Dynamic layout dimension. Used to resolve relative lengths. */
     protected Map layoutDimension = null;
 
+    /** During input FO validation, certain FO's are not valid as
+        child nodes if this FO is a descendant of an Out Of Line 
+        Formatting Object as defined in specification.
+        See Section 6.2 of 1.0/1.2 spec for more information.
+    */
+    protected boolean isOutOfLineFODescendant = false;
+
     /**
      * Create a new formatting object.
      * All formatting object classes extend this class.
@@ -64,7 +71,18 @@ public class FObj extends FONode implements Constants {
      */
     public FObj(FONode parent) {
         super(parent);
-
+        
+        // determine if isOutOfLineFODescendant should be set
+        if (parent != null && parent instanceof FObj) {
+            if (((FObj)parent).getIsOutOfLineFODescendant() == true) {
+                isOutOfLineFODescendant = true;
+            } else if (parent.getName().equals("fo:float")
+                || parent.getName().equals("fo:footnote")
+                || parent.getName().equals("fo:footnote-body")) {
+                isOutOfLineFODescendant = true;
+            }
+        }
+        
         if (propertyListTable == null) {
             propertyListTable = new PropertyMaker[Constants.PROPERTY_COUNT+1];
             PropertyMaker[] list = FOPropertyMapping.getGenericMappings();
@@ -75,6 +93,16 @@ public class FObj extends FONode implements Constants {
         }
     }
 
+    /**
+     * Used to indicate if this FO is the descendant of an out-of-line
+     * formatting object  (From Sect. 6.10, fo:float, fo:footnote, 
+     * fo:footnote-body).  Important for validating child nodes.
+     * @return true if descendant, false otherwise
+     */
+    public boolean getIsOutOfLineFODescendant() {
+        return isOutOfLineFODescendant;
+    }
+
     /**
      * @see org.apache.fop.fo.FONode#processNode
      */
@@ -446,7 +474,7 @@ public class FObj extends FONode implements Constants {
      * @param lName local name (i.e., no prefix) of incoming node 
      * @return true if a member, false if not
      */
-    protected static boolean isBlockItem(String nsURI, String lName) {
+    protected boolean isBlockItem(String nsURI, String lName) {
         return (nsURI == FOElementMapping.URI && 
             (lName.equals("block") 
             || lName.equals("table") 
@@ -465,7 +493,7 @@ public class FObj extends FONode implements Constants {
      * @param lName local name (i.e., no prefix) of incoming node 
      * @return true if a member, false if not
      */
-    protected static boolean isInlineItem(String nsURI, String lName) {
+    protected boolean isInlineItem(String nsURI, String lName) {
         return (nsURI == FOElementMapping.URI && 
             (lName.equals("bidi-override") 
             || lName.equals("character") 
@@ -478,7 +506,7 @@ public class FObj extends FONode implements Constants {
             || lName.equals("page-number-citation")
             || lName.equals("basic-link")
             || lName.equals("multi-toggle")
-            || lName.equals("footnote") // temp only -- not always correct (see spec)
+            || (!isOutOfLineFODescendant && lName.equals("footnote"))
             || isNeutralItem(nsURI, lName)));
     }
 
@@ -490,12 +518,12 @@ public class FObj extends FONode implements Constants {
      * @param lName local name (i.e., no prefix) of incoming node 
      * @return true if a member, false if not
      */
-    protected static boolean isNeutralItem(String nsURI, String lName) {
+    protected boolean isNeutralItem(String nsURI, String lName) {
         return (nsURI == FOElementMapping.URI && 
             (lName.equals("multi-switch") 
             || lName.equals("multi-properties")
             || lName.equals("wrapper") 
-            || lName.equals("float") // temp only -- not always correct (see spec)
+            || (!isOutOfLineFODescendant && lName.equals("float"))
             || lName.equals("retrieve-marker")));
     }
 }