From: William Victor Mote Date: Wed, 19 Nov 2003 18:32:33 +0000 (+0000) Subject: 1. add method to LayoutStrategy indicating whether an FO Tree should be built for... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~998 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7e22a8c09b279fe24f666062d7b5c42d9fd24504;p=xmlgraphics-fop.git 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 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197018 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 48cbcc761..d921142b3 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -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; diff --git a/src/java/org/apache/fop/layout/LayoutStrategy.java b/src/java/org/apache/fop/layout/LayoutStrategy.java index 24d9cc7eb..6a5b84a21 100644 --- a/src/java/org/apache/fop/layout/LayoutStrategy.java +++ b/src/java/org/apache/fop/layout/LayoutStrategy.java @@ -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; + } + }