aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-07-13 05:25:26 +0000
committerGlen Mazza <gmazza@apache.org>2004-07-13 05:25:26 +0000
commit92305f8b1fc6cb805e1d76f3541cc48e9037266f (patch)
tree758b57666aed2718ffb299bc1912461c36760922 /src/java/org/apache/fop/fo
parent2562ceb381063ca04af64a23a1e2de683f4332ba (diff)
downloadxmlgraphics-fop-92305f8b1fc6cb805e1d76f3541cc48e9037266f.tar.gz
xmlgraphics-fop-92305f8b1fc6cb805e1d76f3541cc48e9037266f.zip
PR:
Obtained from: Submitted by: Reviewed by: 1. Removed Driver.setXMLReader(), this can be done via JAXP. 2. Moved the business logic for creating FOTreeBuilder's FOInputHandler object from Driver to FOTreeBuilder. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo')
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index eef720a45..0516016a4 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -22,6 +22,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.Reader;
import java.util.Enumeration;
import java.util.Iterator;
@@ -32,6 +33,10 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.area.AreaTreeHandler;
+import org.apache.fop.render.mif.MIFHandler;
+import org.apache.fop.render.rtf.RTFHandler;
import org.apache.fop.fo.ElementMapping.Maker;
import org.apache.fop.fo.pagination.Root;
import org.xml.sax.Attributes;
@@ -90,11 +95,24 @@ public class FOTreeBuilder extends DefaultHandler {
}
/**
- * Sets the structure handler to receive events.
- * @param foih FOInputHandler instance
+ * Creates the FOInputHandler object based on passed-in render type
+ * @param render type
*/
- public void setFOInputHandler(FOInputHandler foih) {
- this.foInputHandler = foih;
+ public void initialize(int renderType, FOUserAgent foUserAgent,
+ OutputStream stream) throws FOPException {
+ if (renderType == Constants.RENDER_MIF) {
+ foInputHandler = new MIFHandler(foUserAgent, stream);
+ } else if (renderType == Constants.RENDER_RTF) {
+ foInputHandler = new RTFHandler(foUserAgent, stream);
+ } else {
+ if (renderType == Constants.NOT_SET) {
+ throw new IllegalStateException(
+ "Render must be set using setRender(int renderType)");
+ }
+
+ foInputHandler = new AreaTreeHandler(foUserAgent, renderType,
+ stream);
+ }
}
/**