vmote 2003/08/26 13:32:26
Modified: src/java/org/apache/fop/fo/pagination PageSequence.java
src/java/org/apache/fop/layoutmgr PageLayoutManager.java
Log:
move fo/pagination/PageSequence.createPage() to layoutmgr/PageLayoutManager
Revision Changes Path
1.10 +5 -46 xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java
Index: PageSequence.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PageSequence.java 20 Aug 2003 17:56:24 -0000 1.9
+++ PageSequence.java 26 Aug 2003 20:32:26 -0000 1.10
@@ -54,8 +54,6 @@
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 @@
// 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 @@
}
/**
- * 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 @@
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 Root getRoot() {
return root;
}
+
}
1.4 +55 -11 xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PageLayoutManager.java 22 Aug 2003 17:42:41 -0000 1.3
+++ PageLayoutManager.java 26 Aug 2003 20:32:26 -0000 1.4
@@ -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
* [EMAIL PROTECTED]
- *
+ *
* 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 <[EMAIL PROTECTED]>. 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.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 @@
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();
@@ -684,6 +685,49 @@
// See finishPage...
protected void flush() {
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);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]