gmazza 2004/01/04 17:31:09
Modified: src/java/org/apache/fop/datatypes LengthBase.java
src/java/org/apache/fop/fo PropertyList.java
src/java/org/apache/fop/fo/expr InheritedPropFunction.java
src/java/org/apache/fop/fo/pagination RegionBody.java
Log:
More String->Int Conversions.
Revision Changes Path
1.5 +1 -1 xml-fop/src/java/org/apache/fop/datatypes/LengthBase.java
Index: LengthBase.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/LengthBase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LengthBase.java 29 Dec 2003 23:28:47 -0000 1.4
+++ LengthBase.java 5 Jan 2004 01:31:09 -0000 1.5
@@ -142,7 +142,7 @@
case FONTSIZE:
return propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue();
case INH_FONTSIZE:
- return propertyList.getInherited("font-size").getLength().getValue();
+ return
propertyList.getInherited(Constants.PR_FONT_SIZE).getLength().getValue();
//case CONTAINING_BOX:
// depends on property?? inline-progression vs block-progression
//return parentFO.getContentWidth();
1.20 +20 -34 xml-fop/src/java/org/apache/fop/fo/PropertyList.java
Index: PropertyList.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyList.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- PropertyList.java 5 Jan 2004 00:44:59 -0000 1.19
+++ PropertyList.java 5 Jan 2004 01:31:09 -0000 1.20
@@ -184,20 +184,11 @@
*/
public Property getExplicitOrShorthand(int propId) {
/* Handle request for one part of a compound property */
- String propertyName = FOPropertyMapping.getPropertyName(propId);
-
- int sepchar = propertyName.indexOf('.');
- String baseName;
- if (sepchar > -1) {
- baseName = propertyName.substring(0, sepchar);
- } else {
- baseName = propertyName;
- }
- Property p = getExplicitBaseProp(baseName);
+ Property p = getExplicitBaseProp(propId & Constants.PROPERTY_MASK);
if (p == null) {
p = getShorthand(propId & Constants.PROPERTY_MASK);
}
- if (p != null && sepchar > -1) {
+ if (p != null && (propId & Constants.PROPERTY_MASK) != 0) {
return getSubpropValue(p, propId);
}
return p;
@@ -213,10 +204,8 @@
String propertyName = FOPropertyMapping.getPropertyName(propId);
/* Handle request for one part of a compound property */
- int sepchar = propertyName.indexOf('.');
- if (sepchar > -1) {
- String baseName = propertyName.substring(0, sepchar);
- Property p = getExplicitBaseProp(baseName);
+ if ((propId & Constants.COMPOUND_MASK) != 0) {
+ Property p = getExplicitBaseProp(propId & Constants.PROPERTY_MASK);
if (p != null) {
return getSubpropValue(p, propId);
} else {
@@ -231,7 +220,8 @@
* @param propertyName The name of the base property whose value is desired.
* @return The value if the property is explicitly set, otherwise null.
*/
- public Property getExplicitBaseProp(String propertyName) {
+ public Property getExplicitBaseProp(int propId) {
+ String propertyName = FOPropertyMapping.getPropertyName(propId);
return (Property) super.get(propertyName);
}
@@ -239,11 +229,10 @@
* Return the value of this property inherited by this FO.
* Implements the inherited-property-value function.
* The property must be inheritable!
- * @param propertyName The name of the property whose value is desired.
+ * @param propID The ID of the property whose value is desired.
* @return The inherited value, otherwise null.
*/
- public Property getInherited(String propertyName) {
- int propId = FOPropertyMapping.getPropertyId(propertyName);
+ public Property getInherited(int propId) {
if (parentPropertyList != null
&& isInherited(propId)) {
@@ -315,14 +304,12 @@
* happens in computeProperty.
*/
private Property findProperty(int propId, boolean bTryInherit) {
-
- String propertyName = FOPropertyMapping.getPropertyName(propId);
-
Property p = null;
+
if (isCorrespondingForced(propId)) {
p = computeProperty(propId);
} else {
- p = getExplicitBaseProp(propertyName);
+ p = getExplicitBaseProp(propId);
if (p == null) {
p = this.computeProperty(propId);
}
@@ -348,13 +335,13 @@
* ancestor of the current FO, else the initial value.
*/
public Property getNearestSpecified(int propId) {
- String propertyName = FOPropertyMapping.getPropertyName(propId);
-
Property p = null;
+
for (PropertyList plist = this; p == null && plist != null;
plist = plist.parentPropertyList) {
p = plist.getExplicit(propId);
}
+
if (p == null) {
// If no explicit setting found, return initial (default) value.
try {
@@ -506,7 +493,7 @@
* the base attribute was already created in
* findBaseProperty()
*/
- if (getExplicitBaseProp(basePropertyName) != null) {
+ if (super.get(basePropertyName) != null) {
return;
}
prop = propertyMaker.make(this, attributeValue, parentFO);
@@ -534,7 +521,9 @@
/* If the baseProperty has already been created, return it
* e.g. <fo:leader xxxx="120pt" xxxx.maximum="200pt"... />
*/
- Property baseProperty = getExplicitBaseProp(basePropName);
+ int propId = FOPropertyMapping.getPropertyId(basePropName);
+ Property baseProperty = getExplicitBaseProp(propId);
+
if (baseProperty != null) {
return baseProperty;
}
@@ -544,13 +533,10 @@
*/
String basePropertyValue = attributes.getValue(basePropName);
- if (basePropertyValue != null) {
- int propertyId = FOPropertyMapping.getPropertyId(basePropName);
- if (propertyId != -1) {
- baseProperty = propertyMaker.make(this, basePropertyValue,
- parentFO);
- return baseProperty;
- }
+ if (basePropertyValue != null && propertyMaker != null) {
+ baseProperty = propertyMaker.make(this, basePropertyValue,
+ parentFO);
+ return baseProperty;
}
return null; // could not find base property
1.3 +4 -1
xml-fop/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
Index: InheritedPropFunction.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InheritedPropFunction.java 13 Jul 2003 03:16:11 -0000 1.2
+++ InheritedPropFunction.java 5 Jan 2004 01:31:09 -0000 1.3
@@ -51,6 +51,7 @@
package org.apache.fop.fo.expr;
import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.FOPropertyMapping;
/**
* Class modelling the inherited-property-value Property Value function. See
@@ -79,7 +80,9 @@
if (propName == null) {
throw new PropertyException("Incorrect parameter to
inherited-property-value function");
}
- return pInfo.getPropertyList().getInherited(propName);
+
+ int propId = FOPropertyMapping.getPropertyId(propName);
+ return pInfo.getPropertyList().getInherited(propId);
}
}
1.11 +5 -2 xml-fop/src/java/org/apache/fop/fo/pagination/RegionBody.java
Index: RegionBody.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RegionBody.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RegionBody.java 20 Dec 2003 06:53:23 -0000 1.10
+++ RegionBody.java 5 Jan 2004 01:31:09 -0000 1.11
@@ -60,6 +60,7 @@
import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.properties.CommonMarginBlock;
+import org.apache.fop.fo.properties.FOPropertyMapping;
import org.apache.fop.fo.properties.WritingMode;
/**
@@ -112,9 +113,11 @@
FObj parent = (FObj) getParent();
String sPropName = "margin-"
+ parent.propertyList.wmRelToAbs(reldir);
- Property prop = propertyList.getExplicitBaseProp(sPropName);
+ int propId = FOPropertyMapping.getPropertyId(sPropName);
+ Property prop = propertyList.getExplicitBaseProp(propId);
if (prop == null) {
- prop = propertyList.getExplicitBaseProp(sRelPropName);
+ propId = FOPropertyMapping.getPropertyId(sRelPropName);
+ prop = propertyList.getExplicitBaseProp(propId);
}
return ((prop != null) ? prop.getLength().getValue() : 0);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]