From: Simon Pepping Date: Tue, 10 Jan 2006 20:18:13 +0000 (+0000) Subject: The last page sequence should also follow its force-page-count trait. X-Git-Tag: fop-0_92-beta~211 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5fca3a38d09389a5aeae503806d29ecfdd520673;p=xmlgraphics-fop.git 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 --- 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(); diff --git a/status.xml b/status.xml index 0befa8487..3a5574b41 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,10 @@ + + Implement force-page-count property of page-sequence. + Bugfix: Spans that end up with a negative height don't get swallowed anymore. diff --git a/test/layoutengine/standard-testcases/page-sequence_force-page-count_1.xml b/test/layoutengine/standard-testcases/page-sequence_force-page-count_1.xml deleted file mode 100644 index dea51ad4b..000000000 --- a/test/layoutengine/standard-testcases/page-sequence_force-page-count_1.xml +++ /dev/null @@ -1,399 +0,0 @@ - - - - - -

- This test checks the force-page-count property. See bug 38087. -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1. Pageseq: ends odd, [#] / auto / next is auto-even -> nothing - - - expl: ends on {odd|even}, {odd,even} number of pages # / force-page-count / initial-page-number -> action - - - - - - - - - - - - - 2. Pageseq: ends even, [#] / auto / next is auto-even -> addpage - - - - - - - - - - - - - 3. Pageseq: ends even, [#] / auto / next is auto-odd -> nothing - - - - - - - - - - - - - 4. Pageseq: ends odd, [#] / auto / next is auto-odd -> addpage - - - - - - - - - - - - - 5. Pageseq: ends odd, [#] / auto / next is auto-even -> nothing - - - - - - - - - - - - - 6. Pageseq: ends even, [#] / auto / next is numeric even -> addpage - - - - - - - - - - - - - 5. Pageseq: ends even, [#] / auto / next is numeric even -> addpage - - - - - - - - - - - - - 6. Pageseq: ends even, [#] / auto / next is numeric odd -> nothing - - - - - - - - - - - - - 7. Pageseq: ends odd, [#] / auto / next is numeric odd -> addpage - - - - - - - - - - - - - 101. Pageseq: ends odd, [#] / end-on-even/ [next is auto] -> addpage - - - - - - - - - - - - - 102a. Pageseq: see next page - - - 102b. Pageseq: ends even, [#] / end-on-even/ [next is auto] -> nothing - - - - - - - - - - - - - 103. Pageseq: ends odd, [#] / end-on-odd/ [next is auto] -> nothing - - - - - - - - - - - - - 104. Pageseq: ends even, [#] / end-on-odd/ [next is auto] -> addpage - - - - - - - - - - - - - 201. Pageseq: [ends], odd # / even / [next is auto] -> addpage - - - - - - - - - - - - - 202a. Pageseq: see next page - - - 13b. Pageseq: [ends], even # / even / [next is auto] -> nothing - - - - - - - - - - - - - 203. Pageseq: [ends], odd # / odd / [next is auto] -> nothing - - - - - - - - - - - - - 204a. Pageseq: see next page - - - 204b. Pageseq: [ends], even # / odd / [next is auto] -> addpage - - - - - - - - - - - - - 301. Pageseq: ends even, [#] / no-force / next is auto-even -> nothing - - - Only to show the possibility of missing pagenumbers for - force-page-count="no-force". - - - - - - - - - - - - - 302. Pageseq: dont matter, dont matter # / auto / next is auto -> nothing - - - - - - - - - - - - - 999. Pageseq: dont matter, auto / no next - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/test/layoutengine/standard-testcases/page-sequence_force-page-count_auto.xml b/test/layoutengine/standard-testcases/page-sequence_force-page-count_auto.xml new file mode 100644 index 000000000..4673fa97c --- /dev/null +++ b/test/layoutengine/standard-testcases/page-sequence_force-page-count_auto.xml @@ -0,0 +1,110 @@ + + + + + +

+ This test checks the behaviour of the force-page-count property + when set to auto and it depends therefore on the value of + initial-page-number of the following page-sequence. +

+
+ + + + + + + + + + onpage001 + + + + + onpage002 + + + + + onpage004 + + + + + onpage005 + + + + + onpage007 + + + + + onpage100 + + + + + onpage104 + + + + + onpage111 + + + + + onpage115 + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/test/layoutengine/standard-testcases/page-sequence_force-page-count_noauto.xml b/test/layoutengine/standard-testcases/page-sequence_force-page-count_noauto.xml new file mode 100644 index 000000000..9476c7d6f --- /dev/null +++ b/test/layoutengine/standard-testcases/page-sequence_force-page-count_noauto.xml @@ -0,0 +1,129 @@ + + + + + +

+ This test checks the force-page-count property for nonauto + values (end-on-even, end-on-odd, even, odd, no-force) and + shows the ignoring on the last page-sequence. +

+
+ + + + + + + + + + + onpage201 + + + + + onpage203 + onpage204 + + + + + onpage205 + + + + + onpage206 + + + + + onpage208 + + + + + onpage210 + onpage211 + + + + + onpage212 + + + + + onpage213 + onpage214 + + + + + onpage216 + + + + + onpage218 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +