From 4e4b666ba86600b16a97a5585eb9d985adf9f219 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Wed, 31 Dec 2003 01:41:46 +0000 Subject: [PATCH] More String->Int conversions, primarily from patch from Finn Bock. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197079 13f79535-47bb-0310-9956-ffa450edef68 --- src/codegen/properties.xsl | 8 +++++--- src/java/org/apache/fop/fo/Property.java | 2 +- src/java/org/apache/fop/fo/PropertyList.java | 1 - .../org/apache/fop/fo/expr/FopPropValFunction.java | 6 ++++-- src/java/org/apache/fop/fo/flow/Leader.java | 3 +++ src/java/org/apache/fop/fo/flow/TableRow.java | 4 +++- src/java/org/apache/fop/fo/pagination/Region.java | 10 ++++------ 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 83969ee91..afe8af966 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -735,9 +735,11 @@ public class public Property compute(PropertyList propertyList) { Property computedProperty = null; - Property correspondingProperty = propertyList.get(" - - "); + Property correspondingProperty = propertyList.get(Constants.PR_ + + + + ); if (correspondingProperty != null) { int correspondingValue = correspondingProperty.getEnum(); diff --git a/src/java/org/apache/fop/fo/Property.java b/src/java/org/apache/fop/fo/Property.java index 804a4b890..a21480f9a 100644 --- a/src/java/org/apache/fop/fo/Property.java +++ b/src/java/org/apache/fop/fo/Property.java @@ -95,7 +95,7 @@ public class Property { /** * Construct an instance of a Property.Maker. - * Note: the property name is set to "UNKNOWN". + * Note: the property ID is set to zero */ protected Maker() { this.propId = 0; diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 9c4a09261..adb88617f 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -285,7 +285,6 @@ public class PropertyList extends HashMap { return get(propertyName, false, false); } - /** * Return the property on the current FlowObject. If it isn't set explicitly, * this will try to compute it based on other properties, or if it is diff --git a/src/java/org/apache/fop/fo/expr/FopPropValFunction.java b/src/java/org/apache/fop/fo/expr/FopPropValFunction.java index da4c1fdae..649868585 100644 --- a/src/java/org/apache/fop/fo/expr/FopPropValFunction.java +++ b/src/java/org/apache/fop/fo/expr/FopPropValFunction.java @@ -51,6 +51,7 @@ package org.apache.fop.fo.expr; import org.apache.fop.fo.Property; +import org.apache.fop.fo.properties.FOPropertyMapping; /** @@ -80,8 +81,9 @@ public class FopPropValFunction extends FunctionBase { if (propName == null) { throw new PropertyException("Incorrect parameter to _int-property-value function"); } - // System.err.println("Get property-value for " + propName); - return pInfo.getPropertyList().get(propName); + + int propId = FOPropertyMapping.getPropertyId(propName); + return pInfo.getPropertyList().get(propId); } } diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index 538cea7b1..8711f8ee2 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -62,6 +62,7 @@ import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; +//import org.apache.fop.fo.properties.FOPropertyMapping; import org.apache.fop.fo.properties.LeaderPattern; import org.apache.fop.fonts.Font; @@ -165,6 +166,8 @@ public class Leader extends FObjMixed { public int getLength(String prop, int dim) { int length; +// int propId = FOPropertyMapping.getPropertyId(prop); +// System.out.println("prop/propID = " + prop + " " + propId); Length maxlength = propertyList.get(prop).getLength(); if (maxlength instanceof PercentLength) { length = (int)(((PercentLength)maxlength).value() diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index 272262da6..2225ac94c 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -68,6 +68,7 @@ import org.apache.fop.fo.properties.CommonAural; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.FOPropertyMapping; /** * Class modelling the fo:table-row object. See Sec. 6.7.9 of the XSL-FO @@ -142,7 +143,8 @@ public class TableRow extends FObj { } private KeepValue getKeepValue(String sPropName) { - Property p = this.propertyList.get(sPropName); + int propId = FOPropertyMapping.getPropertyId(sPropName); + Property p = this.propertyList.get(propId); Number n = p.getNumber(); if (n != null) { return new KeepValue(KeepValue.KEEP_WITH_VALUE, n.intValue()); diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 6b97bb5b1..55a7c6306 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -64,8 +64,6 @@ import org.xml.sax.Attributes; */ public abstract class Region extends FObj { - private static final String PROP_REGION_NAME = "region-name"; - /** Key for before regions */ public static final String BEFORE = "before"; /** Key for start regions */ @@ -111,16 +109,16 @@ public abstract class Region extends FObj { super.handleAttrs(attlist); // regions may have name, or default - if (null == this.propertyList.get(PROP_REGION_NAME)) { + if (null == this.propertyList.get(PR_REGION_NAME)) { setRegionName(getDefaultRegionName()); - } else if (this.propertyList.get(PROP_REGION_NAME).getString().equals("")) { + } else if (this.propertyList.get(PR_REGION_NAME).getString().equals("")) { setRegionName(getDefaultRegionName()); } else { - setRegionName(this.propertyList.get(PROP_REGION_NAME).getString()); + setRegionName(this.propertyList.get(PR_REGION_NAME).getString()); // check that name is OK. Not very pretty. if (isReserved(getRegionName()) && !getRegionName().equals(getDefaultRegionName())) { - throw new FOPException(PROP_REGION_NAME + " '" + regionName + throw new FOPException("region-name '" + regionName + "' for " + this.name + " not permitted."); } -- 2.39.5