diff options
author | Jeremias Maerki <jeremias@apache.org> | 2007-12-27 10:34:15 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2007-12-27 10:34:15 +0000 |
commit | 0c87214d3a98d0836083d191b36aa7abf944d0dc (patch) | |
tree | 4a0c8a4abd081996088ad1b3f711ed61aa6ff2f6 /src/java/org/apache/fop/area | |
parent | ed61f771c493e86046f3d13e3d6a553d825dd8f3 (diff) | |
download | xmlgraphics-fop-0c87214d3a98d0836083d191b36aa7abf944d0dc.tar.gz xmlgraphics-fop-0c87214d3a98d0836083d191b36aa7abf944d0dc.zip |
Added new extension element: fox:external-document. It allows to add whole documents such as multi-page TIFF images to be inserted as peers to a page-sequence. Each image will make up an entire page. See the documentation for details. ATM, only single pages are possible. Multi-page images will be supported with the new image package.
Some preparations for page-position="only" but the implementation is incomplete and "only" has no effect, yet. (Just uploaded some stuff I once started)
Some javadoc cleanups.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@607032 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 | 34 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/RenderPagesModel.java | 2 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 6eb2d738b..a107da833 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -35,13 +35,17 @@ import org.apache.fop.apps.FormattingResults; import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.extensions.ExtensionAttachment; +import org.apache.fop.fo.extensions.ExternalDocument; import org.apache.fop.fo.extensions.destination.Destination; +import org.apache.fop.fo.pagination.AbstractPageSequence; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Root; import org.apache.fop.fo.pagination.bookmarks.BookmarkTree; +import org.apache.fop.layoutmgr.ExternalDocumentLayoutManager; import org.apache.fop.layoutmgr.LayoutManagerMaker; import org.apache.fop.layoutmgr.LayoutManagerMapping; import org.apache.fop.layoutmgr.PageSequenceLayoutManager; +import org.apache.fop.layoutmgr.TopLevelLayoutManager; /** * Area tree handler for formatting objects. @@ -78,7 +82,7 @@ public class AreaTreeHandler extends FOEventHandler { // The formatting results to be handed back to the caller. private FormattingResults results = new FormattingResults(); - private PageSequenceLayoutManager prevPageSeqLM; + private TopLevelLayoutManager prevPageSeqLM; private int idGen = 0; @@ -235,13 +239,39 @@ public class AreaTreeHandler extends FOEventHandler { } /** + * @see org.apache.fop.fo.FOEventHandler#startExternalDocument(org.apache.fop.fo.extensions.ExternalDocument) + */ + public void startExternalDocument(ExternalDocument document) { + rootFObj = document.getRoot(); + finishPrevPageSequence(document.getInitialPageNumber()); + document.initPageNumber(); + } + + /** + * @see org.apache.fop.fo.FOEventHandler#endExternalDocument(org.apache.fop.fo.extensions.ExternalDocument) + */ + public void endExternalDocument(ExternalDocument document) { + if (statistics != null) { + statistics.end(); + } + + ExternalDocumentLayoutManager edLM; + edLM = getLayoutManagerMaker().makeExternalDocumentLayoutManager(this, document); + edLM.activateLayout(); + // preserve the current PageSequenceLayoutManger for the + // force-page-count check at the beginning of the next PageSequence + prevPageSeqLM = edLM; + + } + + /** * Called by the PageSequenceLayoutManager when it is finished with a * page-sequence. * * @param pageSequence the page-sequence just finished * @param pageCount The number of pages generated for the page-sequence */ - public void notifyPageSequenceFinished(PageSequence pageSequence, + public void notifyPageSequenceFinished(AbstractPageSequence pageSequence, int pageCount) { this.results.haveFormattedPageSequence(pageSequence, pageCount); if (log.isDebugEnabled()) { diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/java/org/apache/fop/area/RenderPagesModel.java index a5257977a..1b3a22706 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/java/org/apache/fop/area/RenderPagesModel.java @@ -173,7 +173,7 @@ public class RenderPagesModel extends AreaTreeModel { } } catch (Exception e) { // use error handler to handle this FOP or IO Exception - log.error(e); + log.error("Error while rendering page " + pageViewport.getPageIndex(), e); if (e instanceof RuntimeException) { throw (RuntimeException)e; } |