aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-08-26 20:32:26 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-08-26 20:32:26 +0000
commit2c3ddd7aefd9204f2b1f63bfbbdb3826fc58ba90 (patch)
tree4a884e011bb0f5b0e7a67348e2799ac114e78386 /src
parent3a3765cc5bf1972db666c136021579bdb9038406 (diff)
downloadxmlgraphics-fop-2c3ddd7aefd9204f2b1f63bfbbdb3826fc58ba90.tar.gz
xmlgraphics-fop-2c3ddd7aefd9204f2b1f63bfbbdb3826fc58ba90.zip
move fo/pagination/PageSequence.createPage() to layoutmgr/PageLayoutManager
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196850 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequence.java51
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java66
2 files changed, 60 insertions, 57 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java
index 240b02100..750381be1 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java
@@ -54,8 +54,6 @@ package org.apache.fop.fo.pagination;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
-import org.apache.fop.layout.PageMaster;
-import org.apache.fop.area.PageViewport;
import org.apache.fop.apps.FOPException;
// Java
@@ -113,8 +111,6 @@ public class PageSequence extends FObj {
// state attributes used during layout
//
- private PageViewport currentPage;
-
// page number and related formatting variables
private String ipnValue;
private int currentPageNumber = 0;
@@ -379,48 +375,6 @@ public class PageSequence extends FObj {
}
/**
- * Called by PageLayoutManager when it needs a new page on which to
- * place content. The PageSequence manages the page number (odd/even),
- * but the PLM tells it if the page is blank or is the last page.
- *
- * @param pageNumber the page number to create page for
- * @param bIsBlank If true, use a master for a blank page.
- * @param firstPage true if this is the first page
- * @param bIsLast If true, use the master for the last page in the sequence.
- * @return the page viewport created for the page number
- * @throws FOPException if there is an error creating page
- */
- public PageViewport createPage(int pageNumber, boolean bIsBlank,
- boolean firstPage, boolean bIsLast)
- throws FOPException {
- if (this.pageSequenceMaster != null) {
- this.currentSimplePageMaster = this.pageSequenceMaster
- .getNextSimplePageMaster(((pageNumber % 2) == 1),
- firstPage,
- bIsBlank);
- }
- Region body = currentSimplePageMaster.getRegion(Region.BODY);
- if (!this.mainFlow.getFlowName().equals(body.getRegionName())) {
- throw new FOPException("Flow '" + this.mainFlow.getFlowName()
- + "' does not map to the region-body in page-master '"
- + currentSimplePageMaster.getMasterName() + "'");
- }
- PageMaster pageMaster = this.currentSimplePageMaster.getPageMaster();
- PageViewport p = pageMaster.makePage();
- return p;
- // The page will have a viewport/reference area pair defined
- // for each region in the master.
- // Set up the page itself
-// SKIP ALL THIS FOR NOW!!!
-// //this.root.setRunningPageNumberCounter(this.currentPageNumber);
-
-// this.pageCount++; // used for 'force-page-count' calculations
-
- // handle the 'force-page-count'
- //forcePage(areaTree, firstAvailPageNumber);
- }
-
- /**
* Creates a new page area for the given parameters
* @param areaTree the area tree the page should be contained in
* @param firstAvailPageNumber the page number for this page
@@ -742,6 +696,10 @@ public class PageSequence extends FObj {
return currentSimplePageMaster;
}
+ public void setCurrentSimplePageMaster(SimplePageMaster simplePageMaster) {
+ this.currentSimplePageMaster = simplePageMaster;
+ }
+
/**
* Get the static content FO node from the flow map.
* This gets the static content flow for the given flow name.
@@ -819,4 +777,5 @@ public class PageSequence extends FObj {
public Root getRoot() {
return root;
}
+
}
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index e20ce986e..ee422c051 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -3,34 +3,34 @@
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -42,12 +42,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.layoutmgr;
import org.apache.fop.apps.FOPException;
@@ -72,6 +72,7 @@ import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.properties.RetrieveBoundary;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
+import org.apache.fop.layout.PageMaster;
import java.util.ArrayList;
import java.util.List;
@@ -430,7 +431,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
private PageViewport makeNewPage(boolean bIsBlank, boolean bIsLast) {
finishPage();
try {
- curPage = pageSequence.createPage(pageCount, bIsBlank, isFirstPage, bIsLast);
+ curPage = createPage(pageSequence, pageCount, bIsBlank, isFirstPage, bIsLast);
isFirstPage = false;
} catch (FOPException fopex) { /* ???? */
fopex.printStackTrace();
@@ -686,5 +687,48 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
finishPage();
}
+ /**
+ * Called by PageLayoutManager when it needs a new page on which to
+ * place content. The PageSequence manages the page number (odd/even),
+ * but the PLM tells it if the page is blank or is the last page.
+ *
+ * @param pageNumber the page number to create page for
+ * @param bIsBlank If true, use a master for a blank page.
+ * @param firstPage true if this is the first page
+ * @param bIsLast If true, use the master for the last page in the sequence.
+ * @return the page viewport created for the page number
+ * @throws FOPException if there is an error creating page
+ */
+ public PageViewport createPage(PageSequence pageSequence, int pageNumber,
+ boolean bIsBlank, boolean firstPage,
+ boolean bIsLast)
+ throws FOPException {
+ if (pageSequence.getPageSequenceMaster() != null) {
+ pageSequence.setCurrentSimplePageMaster (pageSequence.getPageSequenceMaster()
+ .getNextSimplePageMaster(((pageNumber % 2) == 1),
+ firstPage,
+ bIsBlank));
+ }
+ Region body = pageSequence.getCurrentSimplePageMaster().getRegion(Region.BODY);
+ if (!pageSequence.getMainFlow().getFlowName().equals(body.getRegionName())) {
+ throw new FOPException("Flow '" + pageSequence.getMainFlow().getFlowName()
+ + "' does not map to the region-body in page-master '"
+ + pageSequence.getCurrentSimplePageMaster().getMasterName() + "'");
+ }
+ PageMaster pageMaster = pageSequence.getCurrentSimplePageMaster().getPageMaster();
+ PageViewport p = pageMaster.makePage();
+ return p;
+ // The page will have a viewport/reference area pair defined
+ // for each region in the master.
+ // Set up the page itself
+// SKIP ALL THIS FOR NOW!!!
+// //pageSequence.root.setRunningPageNumberCounter(pageSequence.currentPageNumber);
+
+// pageSequence.pageCount++; // used for 'force-page-count' calculations
+
+ // handle the 'force-page-count'
+ //forcePage(areaTree, firstAvailPageNumber);
+ }
+
}