diff options
author | Simon Pepping <spepping@apache.org> | 2006-01-10 20:18:13 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2006-01-10 20:18:13 +0000 |
commit | 5fca3a38d09389a5aeae503806d29ecfdd520673 (patch) | |
tree | 50c8e220715528c54ecdff01870c35e991dd0302 /src/java/org/apache/fop | |
parent | 1d7764872f439f37092c68976258fbc28463e22b (diff) | |
download | xmlgraphics-fop-5fca3a38d09389a5aeae503806d29ecfdd520673.tar.gz xmlgraphics-fop-5fca3a38d09389a5aeae503806d29ecfdd520673.zip |
The last page sequence should also follow its force-page-count trait.
Replace one test case with two leaner test cases, submitted by Gerhard
Oettl, see bug 38087.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@367775 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeHandler.java | 23 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java | 8 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 422ebecf6..dfe2e7fa3 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -37,6 +37,7 @@ 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.datatypes.Numeric; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fo.extensions.ExtensionAttachment; import org.apache.fop.fo.pagination.PageSequence; @@ -265,15 +266,21 @@ public class AreaTreeHandler extends FOEventHandler { } } - /** @see org.apache.fop.fo.FOEventHandler */ - public void startPageSequence(PageSequence pageSequence) { - rootFObj = pageSequence.getRoot(); - // finish the previous pageSequence (handle force-page-count) + /** + * finish the previous pageSequence + */ + private void finishPrevPageSequence(Numeric initialPageNumber) { if (prevPageSeqLM != null) { - prevPageSeqLM.doForcePageCount(pageSequence.getInitialPageNumber()); + prevPageSeqLM.doForcePageCount(initialPageNumber); prevPageSeqLM.finishPageSequence(); prevPageSeqLM = null; } + } + + /** @see org.apache.fop.fo.FOEventHandler */ + public void startPageSequence(PageSequence pageSequence) { + rootFObj = pageSequence.getRoot(); + finishPrevPageSequence(pageSequence.getInitialPageNumber()); pageSequence.initPageNumber(); //extension attachments from fo:root wrapAndAddExtensionAttachments(rootFObj.getExtensionAttachments()); @@ -339,11 +346,7 @@ public class AreaTreeHandler extends FOEventHandler { */ public void endDocument() throws SAXException { - // finish the last pageSequence - if (prevPageSeqLM != null) { - prevPageSeqLM.finishPageSequence(); - prevPageSeqLM = null; - } + finishPrevPageSequence(null); // process fo:bookmark-tree BookmarkTree bookmarkTree = rootFObj.getBookmarkTree(); if (bookmarkTree != null) { diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index a7c6c7b6a..71b319f7e 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -893,8 +893,10 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { } - /* - * check if the page-number of the last page suits to the force-page-count property + /** + * Act upon the force-page-count trait, + * in relation to the initial-page-number trait of the following page-sequence. + * @param nextPageSeqInitialPageNumber initial-page-number trait of next page-sequence */ public void doForcePageCount(Numeric nextPageSeqInitialPageNumber) { @@ -913,7 +915,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { // if force-page-count is auto then set the value of forcePageCount // depending on the initial-page-number of the next page-sequence - if (forcePageCount == Constants.EN_AUTO) { + if (nextPageSeqInitialPageNumber != null && forcePageCount == Constants.EN_AUTO) { if (nextPageSeqInitialPageNumber.getEnum() != 0) { // auto | auto-odd | auto-even int nextPageSeqPageNumberType = nextPageSeqInitialPageNumber.getEnum(); |