diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-07-30 13:32:02 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-07-30 13:32:02 +0000 |
commit | db1b760fee89862bde170ff1f40bd69e5437fb4d (patch) | |
tree | 192a5a686475d32e84d2869f1bfd92e9b6d7707e /src/java/org/apache/fop/area | |
parent | 21e083ea6532254e3af7d85ab047af3511460559 (diff) | |
download | xmlgraphics-fop-db1b760fee89862bde170ff1f40bd69e5437fb4d.tar.gz xmlgraphics-fop-db1b760fee89862bde170ff1f40bd69e5437fb4d.zip |
Bugzilla #35937:
FormattingResults mechanism ported from maintenance branch to trunk.
Submitted by: Manuel Mall <mm.at.arcus.com.au>
Patch tweaked slightly to avoid the reference of Fop.java into the area package.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@226511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeHandler.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 88b19d3c6..5619dcbb6 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -35,6 +35,7 @@ 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.apps.FormattingResults; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Root; @@ -92,6 +93,9 @@ public class AreaTreeHandler extends FOEventHandler { // Each idref has a HashSet of Resolvable objects containing that idref private Map unresolvedIDRefs = new HashMap(); + // The formatting results to be handed back to the caller. + private FormattingResults results = new FormattingResults(); + private static Log log = LogFactory.getLog(AreaTreeHandler.class); /** @@ -209,6 +213,15 @@ public class AreaTreeHandler extends FOEventHandler { } /** + * Get information about the rendered output, like + * number of pages created. + * @return the results structure + */ + public FormattingResults getResults() { + return this.results; + } + + /** * Add an Resolvable object with an unresolved idref * @param idref the idref whose target id has not yet been located * @param res the Resolvable object needing the idref to be resolved @@ -256,10 +269,17 @@ public class AreaTreeHandler extends FOEventHandler { // If no main flow, nothing to layout! if (pageSequence.getMainFlow() != null) { PageSequenceLayoutManager pageSLM; - pageSLM = - getLayoutManagerMaker().makePageSequenceLayoutManager(this, - pageSequence); + pageSLM = getLayoutManagerMaker().makePageSequenceLayoutManager( + this, pageSequence); pageSLM.activateLayout(); + this.results.haveFormattedPageSequence(pageSequence, + getAreaTreeModel().getPageCount(getAreaTreeModel().getPageSequenceCount())); + if (log.isDebugEnabled()) { + log.debug("Last page-sequence produced " + + getAreaTreeModel().getPageCount( + getAreaTreeModel().getPageSequenceCount()) + + " pages."); + } } } |