gmazza 2005/02/17 19:54:50
Modified: src/java/org/apache/fop/fo/pagination PageSequence.java
Root.java
src/java/org/apache/fop/layoutmgr
PageSequenceLayoutManager.java
Log:
More cleanup in PageSequence (also removed local LayoutMasterSet variable to
emphasize Root's ownership of this object in the FO Tree hierarchy.)
Revision Changes Path
1.58 +5 -30
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.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- PageSequence.java 17 Feb 2005 00:30:47 -0000 1.57
+++ PageSequence.java 18 Feb 2005 03:54:50 -0000 1.58
@@ -31,9 +31,7 @@
import org.apache.fop.fo.ValidationException;
/**
- * This provides pagination of flows onto pages. Much of the
- * logic for paginating flows is contained in this class.
- * The main entry point is the format method.
+ * Implementation of the fo:page-sequence formatting object.
*/
public class PageSequence extends FObj {
// The value of properties relevant for fo:page-sequence.
@@ -54,11 +52,6 @@
*/
private Root root;
- /**
- * the set of layout masters (provided by the root object)
- */
- private LayoutMasterSet layoutMasterSet;
-
// There doesn't seem to be anything in the spec requiring flows
// to be in the order given, only that they map to the regions
// defined in the page sequence, so all we need is this one hashmap
@@ -69,12 +62,8 @@
*/
public HashMap flowMap;
-// private boolean isFlowSet = false;
-
- // page number and related formatting variables
public int startingPageNumber = 0;
private PageNumberGenerator pageNumberGenerator;
- private boolean isForcing = false;
/**
* The currentSimplePageMaster is either the page master for the
@@ -126,14 +115,13 @@
*/
protected void startOfNode() throws FOPException {
this.root = (Root) parent;
- layoutMasterSet = root.getLayoutMasterSet();
flowMap = new HashMap();
this.simplePageMaster =
- this.layoutMasterSet.getSimplePageMaster(masterReference);
+
root.getLayoutMasterSet().getSimplePageMaster(masterReference);
if (this.simplePageMaster == null) {
this.pageSequenceMaster =
-
this.layoutMasterSet.getPageSequenceMaster(masterReference);
+
root.getLayoutMasterSet().getPageSequenceMaster(masterReference);
if (this.pageSequenceMaster == null) {
throw new ValidationException("master-reference '" +
masterReference
+ "' for fo:page-sequence matches no"
@@ -143,7 +131,6 @@
}
}
- // get the 'format' properties
this.pageNumberGenerator =
new PageNumberGenerator(format, groupingSeparator, groupingSize,
letterValue);
@@ -232,7 +219,7 @@
+ "\" found within fo:page-sequence", flow.locator);
}
- if (!layoutMasterSet.regionNameExists(flowName)
+ if (!root.getLayoutMasterSet().regionNameExists(flowName)
&& !flowName.equals("xsl-before-float-separator")
&& !flowName.equals("xsl-footnote-separator")) {
throw new ValidationException("flow-name \""
@@ -253,10 +240,6 @@
startingPageNumber =
root.getEndingPageNumberOfPreviousSequence() + 1;
pageNumberType = initialPageNumber.getEnum();
if (pageNumberType == EN_AUTO_ODD) {
- // Next page but force odd. May force empty page creation!
- // Whose master is used for this??? Assume no.
- // Use force-page-count = auto
- // on preceding page-sequence to make sure that there is no
gap!
if (startingPageNumber % 2 == 0) {
startingPageNumber++;
}
@@ -318,7 +301,7 @@
// if (masterName != null) {
// SimplePageMaster spm =
-// this.layoutMasterSet.getSimplePageMaster(masterName);
+//
root.getLayoutMasterSet().getSimplePageMaster(masterName);
// Region region = spm.getRegion(FO_REGION_BODY);
@@ -331,14 +314,6 @@
// return false;
// }
-// public boolean isFlowSet() {
-// return isFlowSet;
-// }
-
-// public void setIsFlowSet(boolean isFlowSet) {
-// this.isFlowSet = isFlowSet;
-// }
-
/**
* Get the starting page number for this page sequence.
*
1.40 +2 -2 xml-fop/src/java/org/apache/fop/fo/pagination/Root.java
Index: Root.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Root.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Root.java 17 Feb 2005 00:27:54 -0000 1.39
+++ Root.java 18 Feb 2005 03:54:50 -0000 1.40
@@ -177,11 +177,11 @@
}
/**
- * Report additional pages generated to increase the totalPagesGenerated
counter
+ * Notify additional pages generated to increase the totalPagesGenerated
counter
* @param lastPageNumber the last page number of the sequence
* @throws IllegalArgumentException for negative additional page counts
*/
- public void reportAdditionalPagesGenerated(int additionalPages) {
+ public void notifyAdditionalPagesGenerated(int additionalPages) {
if (additionalPages >= 0) {
totalPagesGenerated += additionalPages;
} else {
1.35 +2 -2
xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
Index: PageSequenceLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- PageSequenceLayoutManager.java 17 Feb 2005 09:17:35 -0000 1.34
+++ PageSequenceLayoutManager.java 18 Feb 2005 03:54:50 -0000 1.35
@@ -212,7 +212,7 @@
currentPageNum--;
log.debug("Ending layout");
finishPage();
- pageSeq.getRoot().reportAdditionalPagesGenerated((currentPageNum -
startPageNum) + 1);
+ pageSeq.getRoot().notifyAdditionalPagesGenerated((currentPageNum -
startPageNum) + 1);
}
/** @see org.apache.fop.layoutmgr.LayoutManager#isBogus() */
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]