Browse Source

Make maximum-repeats a number property instead of a string. This add

support for expression.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197932 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Finn Bock 20 years ago
parent
commit
3d9c0841e9

+ 2
- 1
src/java/org/apache/fop/fo/FOPropertyMapping.java View File

@@ -2081,8 +2081,9 @@ public class FOPropertyMapping implements Constants {
addPropertyMaker("master-reference", m);

// maximum-repeats
m = new StringProperty.Maker(PR_MAXIMUM_REPEATS);
m = new NumberProperty.Maker(PR_MAXIMUM_REPEATS);
m.setInherited(false);
m.addEnum("no-limit", makeEnumProperty(NO_LIMIT, "NO_LIMIT"));
m.setDefault("no-limit");
addPropertyMaker("maximum-repeats", m);


+ 9
- 12
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java View File

@@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.Property;

/**
* A repeatable-page-master-alternatives formatting object.
@@ -94,20 +95,16 @@ public class RepeatablePageMasterAlternatives extends FObj
+ parent.getName(), locator);
}

String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
if (mr.equals("no-limit")) {
Property mr = getProperty(PR_MAXIMUM_REPEATS);

if (mr.getEnum() == NO_LIMIT) {
this.maximumRepeats = INFINITE;
} else {
try {
this.maximumRepeats = Integer.parseInt(mr);
if (this.maximumRepeats < 0) {
getLogger().debug("negative maximum-repeats: "
+ this.maximumRepeats);
this.maximumRepeats = 0;
}
} catch (NumberFormatException nfe) {
throw new SAXParseException("Invalid number for "
+ "'maximum-repeats' property", locator);
this.maximumRepeats = mr.getNumber().intValue();
if (this.maximumRepeats < 0) {
getLogger().debug("negative maximum-repeats: "
+ this.maximumRepeats);
this.maximumRepeats = 0;
}
}
}

+ 8
- 12
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java View File

@@ -26,6 +26,7 @@ import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.Property;

/**
* A repeatable-page-master-reference formatting object.
@@ -62,21 +63,16 @@ public class RepeatablePageMasterReference extends FObj
pageSequenceMaster.addSubsequenceSpecifier(this);
}

String mr = getPropString(PR_MAXIMUM_REPEATS);
Property mr = getProperty(PR_MAXIMUM_REPEATS);

if (mr.equals("no-limit")) {
if (mr.getEnum() == NO_LIMIT) {
this.maximumRepeats = INFINITE;
} else {
try {
this.maximumRepeats = Integer.parseInt(mr);
if (this.maximumRepeats < 0) {
getLogger().debug("negative maximum-repeats: "
+ this.maximumRepeats);
this.maximumRepeats = 0;
}
} catch (NumberFormatException nfe) {
throw new SAXParseException("Invalid number for "
+ "'maximum-repeats' property", locator);
this.maximumRepeats = mr.getNumber().intValue();
if (this.maximumRepeats < 0) {
getLogger().debug("negative maximum-repeats: "
+ this.maximumRepeats);
this.maximumRepeats = 0;
}
}
}

Loading…
Cancel
Save