diff options
Diffstat (limited to 'src/java/org/apache/fop/fo')
-rw-r--r-- | src/java/org/apache/fop/fo/Constants.java | 32 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOTreeBuilder.java | 8 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FObj.java | 34 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Flow.java | 30 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java | 2 |
5 files changed, 89 insertions, 17 deletions
diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java index 5309bcf1a..3e9bd22ef 100644 --- a/src/java/org/apache/fop/fo/Constants.java +++ b/src/java/org/apache/fop/fo/Constants.java @@ -21,8 +21,38 @@ package org.apache.fop.fo; public interface Constants { + /* These constants are used by apps.CommandLineOptions and + apps.Driver to describe the input (either .FO or .XML/.XSL) + and desired output (PDF, PS, AWT, etc.) of the document */ + + /** input / output not set */ + int NOT_SET = 0; + /** input: fo file */ + int FO_INPUT = 1; + /** input: xml+xsl file */ + int XSLT_INPUT = 2; + /** output: pdf file */ + int RENDER_PDF = 1; + /** output: screen using swing */ + int RENDER_AWT = 2; + /** output: mif file */ + int RENDER_MIF = 3; + /** output: sent swing rendered file to printer */ + int RENDER_PRINT = 4; + /** output: pcl file */ + int RENDER_PCL = 5; + /** output: postscript file */ + int RENDER_PS = 6; + /** output: text file */ + int RENDER_TXT = 7; + /** output: svg file */ + int RENDER_SVG = 8; + /** output: XML area tree */ + int RENDER_XML = 9; + /** output: RTF file */ + int RENDER_RTF = 10; + // element constants - int FO_BASIC_LINK = 1; int FO_BIDI_OVERRIDE = 2; int FO_BLOCK = 3; diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index e8be41305..eef720a45 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -305,14 +305,6 @@ public class FOTreeBuilder extends DefaultHandler { foInputHandler = null; } - /** - * Indicates if data has been processed. - * @return True if data has been processed - */ - public boolean hasData() { - return (rootFObj != null); - } - } // code stolen from org.apache.batik.util and modified slightly diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index ac90c68a8..ec4864fac 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -441,5 +441,39 @@ public class FObj extends FONode implements Constants { return null; } + /** + * Convenience method for validity checking. Checks if the + * incoming node is a member of the "%block;" parameter entity + * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations + * @param nsURI namespace URI of incoming invalid node + * @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) { + return (nsURI == FOElementMapping.URI && + (lName.equals("block") + || lName.equals("table") + || lName.equals("table-and-caption") + || lName.equals("block-container") + || lName.equals("list-block") + || lName.equals("float"))) + || isNeutralItem(nsURI, lName); + } + + /** + * Convenience method for validity checking. Checks if the + * incoming node is a member of the neutral item list + * as defined in Sect. 6.2 of the XSL 1.0 & 1.1 Recommendations + * @param nsURI namespace URI of incoming invalid node + * @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) { + return (nsURI == FOElementMapping.URI && + (lName.equals("multi-switch") + || lName.equals("multi-properties") + || lName.equals("wrapper") + || lName.equals("retrieve-marker"))); + } } diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index ac2911e9d..d7cc88cf3 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -23,6 +23,7 @@ import java.util.ArrayList; // XML import org.xml.sax.Attributes; +import org.xml.sax.Locator; // FOP import org.apache.fop.fo.FONode; @@ -63,6 +64,28 @@ public class Flow extends FObj { } /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL/FOP Content Model: (%block;)+ + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) { + if (!isBlockItem(nsURI, localName)) { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * Make sure content model satisfied, if so then tell the + * StructureRenderer that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#end + */ + protected void end() { + if (children == null) { + missingChildElementError("(%block;)+"); + } + getFOInputHandler().endFlow(this); + } + + /** * @see org.apache.fop.fo.FObj#addProperties */ protected void addProperties(Attributes attlist) throws FOPException { @@ -96,13 +119,6 @@ public class Flow extends FObj { } /** - * Tell the StructureRenderer that we are at the end of the flow. - */ - protected void end() { - getFOInputHandler().endFlow(this); - } - - /** * @param name the name of the flow to set * @throws FOPException for an empty name */ diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index e2919c3de..a97cbae1e 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -74,7 +74,7 @@ public class LayoutMasterSet extends FObj { */ protected void end() { if (children == null) { - missingChildElementError("(simple-page-master|page-sequence-master)+"); + missingChildElementError("(simple-page-master|page-sequence-master)+"); } } |