bckfnn 2004/09/13 01:05:34
Modified: src/java/org/apache/fop/fo Constants.java
FOPropertyMapping.java
src/java/org/apache/fop/fo/pagination PageSequence.java
Log:
Changed initial-page-number from string to number property.
Revision Changes Path
1.15 +4 -2 xml-fop/src/java/org/apache/fop/fo/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Constants.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Constants.java 7 Sep 2004 20:10:25 -0000 1.14
+++ Constants.java 13 Sep 2004 08:05:34 -0000 1.15
@@ -498,7 +498,9 @@
int LINE_HEIGHT = 108;
int MAX_HEIGHT = 109;
int NO_LIMIT = 110;
- int ENUM_COUNT = 110;
+ int AUTO_ODD = 111;
+ int AUTO_EVEN = 112;
+ int ENUM_COUNT = 112;
// Enumeration Interfaces
1.24 +5 -2 xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java
Index: FOPropertyMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- FOPropertyMapping.java 7 Sep 2004 20:47:09 -0000 1.23
+++ FOPropertyMapping.java 13 Sep 2004 08:05:34 -0000 1.24
@@ -2062,8 +2062,11 @@
addPropertyMaker("force-page-count", m);
// initial-page-number
- m = new StringProperty.Maker(PR_INITIAL_PAGE_NUMBER);
+ m = new NumberProperty.Maker(PR_INITIAL_PAGE_NUMBER);
m.setInherited(false);
+ m.addEnum("auto", makeEnumProperty(AUTO, "AUTO"));
+ m.addEnum("auto-odd", makeEnumProperty(AUTO_ODD, "AUTO_ODD"));
+ m.addEnum("auto-even", makeEnumProperty(AUTO_EVEN, "AUTO_EVEN"));
m.setDefault("auto");
addPropertyMaker("initial-page-number", m);
1.45 +7 -27 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.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- PageSequence.java 6 Sep 2004 18:44:32 -0000 1.44
+++ PageSequence.java 13 Sep 2004 08:05:34 -0000 1.45
@@ -29,6 +29,7 @@
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.properties.Property;
/**
* This provides pagination of flows onto pages. Much of the
@@ -40,9 +41,6 @@
// initial-page-number types
//
public static final int EXPLICIT = 0;
- public static final int AUTO = 1;
- public static final int AUTO_EVEN = 2;
- public static final int AUTO_ODD = 3;
/**
* The parent root object
@@ -74,7 +72,6 @@
//
// page number and related formatting variables
- private String ipnValue;
public int currentPageNumber = 0;
private int explicitFirstNumber = 0; // explicitly specified
public int firstPageNumber = 0; // actual
@@ -134,23 +131,15 @@
// we are now on the first page of the page sequence
thisIsFirstPage = true;
- ipnValue = getPropString(PR_INITIAL_PAGE_NUMBER);
+ Property ipnValue = getProperty(PR_INITIAL_PAGE_NUMBER);
- if (ipnValue.equals("auto")) {
- pageNumberType = AUTO;
- } else if (ipnValue.equals("auto-even")) {
- pageNumberType = AUTO_EVEN;
- } else if (ipnValue.equals("auto-odd")) {
- pageNumberType = AUTO_ODD;
+ if (ipnValue.getEnum() != 0) {
+ // auto | auto-odd | auto-even.
+ pageNumberType = ipnValue.getEnum();
} else {
pageNumberType = EXPLICIT;
- try {
- int pageStart = new Integer(ipnValue).intValue();
- this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1;
- } catch (NumberFormatException nfe) {
- throw new SAXParseException("\"" + ipnValue
- + "\" is not a valid value for initial-page-number", locator);
- }
+ int pageStart = ipnValue.getNumber().intValue();
+ this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1;
}
String masterName = getPropString(PR_MASTER_REFERENCE);
@@ -533,15 +522,6 @@
// public void setIsFlowSet(boolean isFlowSet) {
// this.isFlowSet = isFlowSet;
// }
-
- /**
- * Get the "initial-page-number" value.
- *
- * @return the initial-page-number property value
- */
- public String getIpnValue() {
- return ipnValue;
- }
/**
* Get the current page number for this page sequence.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]