aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-11-19 18:32:33 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-11-19 18:32:33 +0000
commit7e22a8c09b279fe24f666062d7b5c42d9fd24504 (patch)
tree19182aaad07feb29737af2af04e0c8318d71d038
parenta25dd06dee70d81601c37e7d508f96ec3c6dd910 (diff)
downloadxmlgraphics-fop-7e22a8c09b279fe24f666062d7b5c42d9fd24504.tar.gz
xmlgraphics-fop-7e22a8c09b279fe24f666062d7b5c42d9fd24504.zip
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
-rw-r--r--src/java/org/apache/fop/apps/Driver.java17
-rw-r--r--src/java/org/apache/fop/layout/LayoutStrategy.java10
2 files changed, 27 insertions, 0 deletions
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;
+ }
+
}