]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
1. add method to LayoutStrategy indicating whether an FO Tree should be built for...
authorWilliam Victor Mote <vmote@apache.org>
Wed, 19 Nov 2003 18:32:33 +0000 (18:32 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Wed, 19 Nov 2003 18:32:33 +0000 (18:32 +0000)
2. add logic in Driver.render() to handle the case of a LayoutStrategy that does not want to build an FO Tree

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

src/java/org/apache/fop/apps/Driver.java
src/java/org/apache/fop/layout/LayoutStrategy.java

index 48cbcc7616f16c2015b4db86a748660a6d11c04d..d921142b38080b16e17fa9216efcd6ad1f71d1fc 100644 (file)
@@ -600,6 +600,23 @@ public class Driver implements LogEnabled {
     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;
index 24d9cc7ebf0fc378bb880f0ff2be49d52598704e..6a5b84a21a436353c285b9f0d6c30d988fbe5e68 100644 (file)
@@ -86,4 +86,14 @@ public abstract class LayoutStrategy {
      */
     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;
+    }
+
 }