aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-02-17 00:27:54 +0000
committerGlen Mazza <gmazza@apache.org>2005-02-17 00:27:54 +0000
commit7ff677faf4d40f711d0c36ed38c612947127fde5 (patch)
treedb063ad99b930189953adf4de0c2dee790a26105 /src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
parent7674b9cdff836e9ea2f1011a7b7343a6ab0dd468 (diff)
downloadxmlgraphics-fop-7ff677faf4d40f711d0c36ed38c612947127fde5.tar.gz
xmlgraphics-fop-7ff677faf4d40f711d0c36ed38c612947127fde5.zip
PR:
Obtained from: Submitted by: Reviewed by: Cleanup of page number handling throughout application. Removed old code from PageSequence.java. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198434 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index ce86164e9..922a9e207 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -75,7 +75,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
}
}
- private int pageCount = 1;
+ private int startPageNum = 0;
+ private int currentPageNum = 0;
private String pageNumberString;
private boolean isFirstPage = true;
@@ -177,9 +178,9 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
* which creates and adds all the pages to the area tree.
*/
public void activateLayout() {
- pageSeq.initPageNumber();
- pageCount = pageSeq.getCurrentPageNumber();
- pageNumberString = pageSeq.makeFormattedPageNumber(pageCount);
+ startPageNum = pageSeq.getStartingPageNumber();
+ currentPageNum = startPageNum;
+ pageNumberString = pageSeq.makeFormattedPageNumber(currentPageNum);
LineArea title = null;
if (pageSeq.getTitleFO() != null) {
@@ -203,14 +204,15 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
// finish page and add to area tree
finishPage();
- pageCount++;
- pageNumberString = pageSeq.makeFormattedPageNumber(pageCount);
+ currentPageNum++;
+ pageNumberString = pageSeq.makeFormattedPageNumber(currentPageNum);
}
}
- pageCount--;
+ // TODO: Don't decrement currentPageNum when no pages are generated
+ currentPageNum--;
log.debug("Ending layout");
finishPage();
- pageSeq.setCurrentPageNumber(pageCount);
+ pageSeq.getRoot().reportAdditionalPagesGenerated((currentPageNum - startPageNum) + 1);
}
/** @see org.apache.fop.layoutmgr.LayoutManager#isBogus() */
@@ -257,7 +259,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
*
* @return the formatted page number string
*/
- public String getCurrentPageNumber() {
+ public String getCurrentPageNumberString() {
return pageNumberString;
}
@@ -464,7 +466,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
try {
// create a new page
currentSimplePageMaster = pageSeq.getSimplePageMasterToUse(
- pageCount, isFirstPage, bIsBlank);
+ currentPageNum, isFirstPage, bIsBlank);
Region body = currentSimplePageMaster.getRegion(FO_REGION_BODY);
if (!pageSeq.getMainFlow().getFlowName().equals(body.getRegionName())) {
throw new FOPException("Flow '" + pageSeq.getMainFlow().getFlowName()
@@ -477,7 +479,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
throw new IllegalArgumentException("Cannot create page: " + fopex.getMessage());
}
- curPage.setPageNumberString(getCurrentPageNumber());
+ curPage.setPageNumberString(pageNumberString);
if (log.isDebugEnabled()) {
log.debug("[" + curPage.getPageNumberString() + "]");
}
@@ -669,7 +671,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
}
else {
/* IF we are on the kind of page we need, we'll need a new page. */
- if (pageCount%2 != 0) {
+ if (currentPageNum%2 != 0) {
// Current page is odd
return (breakValue == Constants.EN_ODD_PAGE);
}
@@ -687,7 +689,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
if (breakValue == Constants.EN_PAGE) {
return false;
}
- else if (pageCount%2 != 0) {
+ else if (currentPageNum%2 != 0) {
// Current page is odd
return (breakValue == Constants.EN_EVEN_PAGE);
}