aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-06-17 07:02:13 +0000
committerGlen Mazza <gmazza@apache.org>2004-06-17 07:02:13 +0000
commitea13be29f9ebac2fa09fa8770bee8a93ab0d4a52 (patch)
tree240b591429681a07c6a92920643964570f18b525 /src/java
parent2aa878b44760079c9321ae5a7d4a0e2f6938cfd8 (diff)
downloadxmlgraphics-fop-ea13be29f9ebac2fa09fa8770bee8a93ab0d4a52.tar.gz
xmlgraphics-fop-ea13be29f9ebac2fa09fa8770bee8a93ab0d4a52.zip
1. Child element validity checking added for fo:page-sequence-master.
2. AreaTree object moved from Document/Driver to FOTreeHandler, as it is specific to this subclass of FOInputHandler only (RTFHandler and MIFHandler don't use area trees). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197723 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/apps/Document.java18
-rw-r--r--src/java/org/apache/fop/apps/Driver.java9
-rw-r--r--src/java/org/apache/fop/fo/FOInputHandler.java7
-rw-r--r--src/java/org/apache/fop/fo/FOTreeHandler.java17
-rw-r--r--src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java33
6 files changed, 58 insertions, 28 deletions
diff --git a/src/java/org/apache/fop/apps/Document.java b/src/java/org/apache/fop/apps/Document.java
index ec28fa891..141ed6526 100644
--- a/src/java/org/apache/fop/apps/Document.java
+++ b/src/java/org/apache/fop/apps/Document.java
@@ -19,10 +19,9 @@
package org.apache.fop.apps;
// FOP
-import org.apache.fop.area.AreaTree;
-import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.fo.FOInputHandler;
import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.render.Renderer;
// SAX
import org.xml.sax.SAXException;
@@ -39,11 +38,8 @@ public class Document {
/** The Font information relevant for this document */
private FontInfo fontInfo;
- /** The current AreaTree for the PageSequence being rendered. */
- public AreaTree areaTree;
-
- /** The AreaTreeModel for the PageSequence being rendered. */
- public AreaTreeModel atModel;
+ /** The Renderer being used for this document */
+ protected Renderer renderer;
/**
* Structure handler used to notify structure
@@ -77,12 +73,12 @@ public class Document {
}
/**
- * Get the area tree for this layout handler.
+ * Get the renderer for this document
*
- * @return the area tree for this document
+ * @return the renderer for this document
*/
- public AreaTree getAreaTree() {
- return areaTree;
+ public Renderer getRenderer() {
+ return renderer;
}
/**
diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java
index db981f716..afdee0e4d 100644
--- a/src/java/org/apache/fop/apps/Driver.java
+++ b/src/java/org/apache/fop/apps/Driver.java
@@ -19,9 +19,6 @@
package org.apache.fop.apps;
// FOP
-import org.apache.fop.area.AreaTree;
-import org.apache.fop.area.RenderPagesModel;
-
import org.apache.fop.fo.ElementMapping;
import org.apache.fop.fo.FOTreeBuilder;
@@ -490,11 +487,9 @@ public class Driver {
"Renderer not set when using standard foInputHandler");
}
+ currentDocument.renderer = renderer;
foInputHandler = new FOTreeHandler(currentDocument, true);
- currentDocument.areaTree = new AreaTree();
- currentDocument.atModel = new RenderPagesModel(renderer);
- //this.atModel = new CachedRenderPagesModel(renderer);
- currentDocument.areaTree.setTreeModel(currentDocument.atModel);
+
try {
renderer.setupFontInfo(currentDocument.getFontInfo());
// check that the "any,normal,400" font exists
diff --git a/src/java/org/apache/fop/fo/FOInputHandler.java b/src/java/org/apache/fop/fo/FOInputHandler.java
index c44ddf91e..67176aa2b 100644
--- a/src/java/org/apache/fop/fo/FOInputHandler.java
+++ b/src/java/org/apache/fop/fo/FOInputHandler.java
@@ -119,13 +119,6 @@ public abstract class FOInputHandler {
return doc;
}
- /**
- * @return the current Area Tree object
- */
- public AreaTree getAreaTree() {
- return doc.getAreaTree();
- }
-
/**
* Returns the Driver object associated with this FOInputHandler.
* @return the Driver object
diff --git a/src/java/org/apache/fop/fo/FOTreeHandler.java b/src/java/org/apache/fop/fo/FOTreeHandler.java
index 2082bcb35..549c73d3b 100644
--- a/src/java/org/apache/fop/fo/FOTreeHandler.java
+++ b/src/java/org/apache/fop/fo/FOTreeHandler.java
@@ -30,6 +30,7 @@ import org.xml.sax.SAXException;
import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.area.AreaTree;
+import org.apache.fop.area.RenderPagesModel;
import org.apache.fop.area.Title;
import org.apache.fop.fo.extensions.Bookmarks;
import org.apache.fop.fo.flow.BasicLink;
@@ -76,6 +77,9 @@ public class FOTreeHandler extends FOInputHandler {
*/
private Runtime runtime;
+ /** The current AreaTree for the FOTreeHandler. */
+ public AreaTree areaTree;
+
/**
* Keep track of the number of pages rendered.
*/
@@ -105,6 +109,11 @@ public class FOTreeHandler extends FOInputHandler {
*/
public FOTreeHandler(Document doc, boolean store) {
super(doc);
+
+ areaTree = new AreaTree();
+ // this.atModel = new CachedRenderPagesModel(renderer);
+ areaTree.setTreeModel(new RenderPagesModel(doc.getRenderer()));
+
if (collectStatistics) {
runtime = Runtime.getRuntime();
}
@@ -597,4 +606,12 @@ public class FOTreeHandler extends FOInputHandler {
*/
public void endPageNumber(PageNumber pagenum) {
}
+
+ /**
+ * @return the current Area Tree object
+ */
+ public AreaTree getAreaTree() {
+ return areaTree;
+ }
+
}
diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
index 16e549489..3101df6e6 100644
--- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
+++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
@@ -24,6 +24,7 @@ import java.util.Map;
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
// FOP
import org.apache.fop.fo.FONode;
@@ -31,7 +32,6 @@ import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.apps.FOPException;
-import org.xml.sax.Locator;
/**
* The layout-master-set formatting object.
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
index f5b53214f..53617b602 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
@@ -21,13 +21,15 @@ package org.apache.fop.fo.pagination;
// Java
import java.util.List;
-// SAX
+// XML
import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
// FOP
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.apps.FOPException;
@@ -58,6 +60,33 @@ public class PageSequenceMaster extends FObj {
super(parent);
}
+
+
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL/FOP: (single-page-master-reference|repeatable-page-master-reference|
+ * repeatable-page-master-alternatives)+
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName) {
+ if (nsURI == FOElementMapping.URI) {
+ if (!localName.equals("single-page-master-reference")
+ && !localName.equals("repeatable-page-master-reference")
+ && !localName.equals("repeatable-page-master-alternatives")) {
+ invalidChildError(loc, nsURI, localName);
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ protected void end() {
+ if (children == null) {
+ missingChildElementError("(single-page-master-reference|" +
+ "repeatable-page-master-reference|repeatable-page-master-alternatives)+");
+ }
+ }
+
+
/**
* @see org.apache.fop.fo.FObj#addProperties
*/