vmote 2003/11/19 10:32:33
Modified: src/java/org/apache/fop/apps Driver.java
src/java/org/apache/fop/layout LayoutStrategy.java
Log:
1. add method to LayoutStrategy indicating whether an FO Tree should be built for
this strategy
2. add logic in Driver.render() to handle the case of a LayoutStrategy that does not
want to build an FO Tree
Revision Changes Path
1.49 +17 -0 xml-fop/src/java/org/apache/fop/apps/Driver.java
Index: Driver.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- Driver.java 8 Nov 2003 15:16:53 -0000 1.48
+++ Driver.java 19 Nov 2003 18:32:33 -0000 1.49
@@ -600,6 +600,23 @@
public synchronized void render(XMLReader parser, InputSource source)
throws FOPException {
parser.setContentHandler(getContentHandler());
+
+ /**
+ * The following statement handles the case of a LayoutStrategy that
+ * does not wish to build an FO Tree, but wishes to parse the incoming
+ * document some other way. This applies primarily to the alt-design
+ * system.
+ */
+ if (currentDocument.getLayoutStrategy() != null) {
+ if (currentDocument.getLayoutStrategy().foTreeNeeded() != true) {
+ currentDocument.getLayoutStrategy().format(null, null);
+ return;
+ }
+ }
+
+ /**
+ * For all other cases, we wish to parse normally.
+ */
try {
if (foInputHandler instanceof FOTreeHandler) {
FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
1.6 +11 -1 xml-fop/src/java/org/apache/fop/layout/LayoutStrategy.java
Index: LayoutStrategy.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layout/LayoutStrategy.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LayoutStrategy.java 20 Aug 2003 19:46:47 -0000 1.5
+++ LayoutStrategy.java 19 Nov 2003 18:32:33 -0000 1.6
@@ -86,4 +86,14 @@
*/
public abstract void format (PageSequence pageSeq, AreaTree areaTree)
throws FOPException;
+
+ /**
+ * Indicates whether an FO Tree should be built for this layout strategy.
+ * Override this in subclasses if an FO Tree is not needed.
+ * @return true if an FO Tree is needed, false otherwise
+ */
+ public boolean foTreeNeeded() {
+ return true;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]