aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r--src/java/org/apache/fop/area/AreaTreeHandler.java34
-rw-r--r--src/java/org/apache/fop/area/RenderPagesModel.java2
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;
}