diff options
author | Glen Mazza <gmazza@apache.org> | 2004-01-05 01:31:09 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-01-05 01:31:09 +0000 |
commit | 352273a94c46788b4a88c88d9444f1ddf6ddf36d (patch) | |
tree | f02803636fc6b423bf7d74e531ccd88be513fd6e /src/java | |
parent | 9715ae547a6da42aaf42ccbdd9a4cf2917c6e7ba (diff) | |
download | xmlgraphics-fop-352273a94c46788b4a88c88d9444f1ddf6ddf36d.tar.gz xmlgraphics-fop-352273a94c46788b4a88c88d9444f1ddf6ddf36d.zip |
More String->Int Conversions.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197115 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
4 files changed, 30 insertions, 38 deletions
diff --git a/src/java/org/apache/fop/datatypes/LengthBase.java b/src/java/org/apache/fop/datatypes/LengthBase.java index 705603762..b0d494966 100644 --- a/src/java/org/apache/fop/datatypes/LengthBase.java +++ b/src/java/org/apache/fop/datatypes/LengthBase.java @@ -142,7 +142,7 @@ public class LengthBase implements PercentBase { 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(); diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 08b44bf4f..0f02b0132 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -184,20 +184,11 @@ public class PropertyList extends HashMap { */ 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 @@ public class PropertyList extends HashMap { 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 @@ public class PropertyList extends HashMap { * @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 @@ public class PropertyList extends HashMap { * 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 @@ public class PropertyList extends HashMap { * 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 @@ public class PropertyList extends HashMap { * 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 @@ public class PropertyList extends HashMap { * 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 @@ public class PropertyList extends HashMap { /* 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 @@ public class PropertyList extends HashMap { */ 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 diff --git a/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java b/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java index 7cdcdd850..8b660412f 100644 --- a/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java +++ b/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java @@ -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 @@ public class InheritedPropFunction extends FunctionBase { 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); } } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index 0ead97981..38b0f8cd0 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -60,6 +60,7 @@ import org.apache.fop.fo.FObj; 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 @@ public class RegionBody extends Region { 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); } |