From: Karen Lease Date: Fri, 10 Nov 2000 21:52:02 +0000 (+0000) Subject: Rewrite for new properties functions X-Git-Tag: pre-columns~123 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=996c317210ece7beaf49ca4a236c2f0c84093a77;p=xmlgraphics-fop.git Rewrite for new properties functions git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193763 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 214c9cb23..4b7b9f1c1 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -3,10 +3,66 @@ xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="redirect"> + + + - - + + + + + + + + + + + + + + + + + + + + + + + + Maker + + + + + + + + + + + + .Maker + + + + + + Property.Maker + + + + + + + + implements + + package org.apache.fop.fo.properties; @@ -15,97 +71,217 @@ import org.apache.fop.fo.*; import org.apache.fop.apps.FOPException; import org.apache.fop.messaging.MessageHandler; -public class extends Property { +public class extends { - public static class Maker extends Property.Maker { - public boolean isInherited() { return ; } - - public Property make(PropertyList propertyList, String value) throws FOPException { - - - - v; - - double d = toDouble(value); - - - if (value.equals("")) { - v = new (); - } + + + public interface Enums { + + int = ; - - else if (!Double.isNaN(d)) { - v = new ( ); - } + } + + + + + protected final static EnumProperty s_prop = new EnumProperty(Enums.); - else { - v = new (); - } - return new (propertyList, v); - - - return new (propertyList, new (value)); - - + + + + + + final private static Property.Maker s_Maker = + new Property.Maker( + "."); + + + + static public Property.Maker maker(String propName) { + return new (propName); } - public Property make(PropertyList propertyList) throws FOPException { - return make(propertyList, ""); + protected (String name) { + super(name); } - } - public static Property.Maker maker() { - return new .Maker(); - } + + protected Property.Maker getSubpropMaker(String subprop) { + + if (subprop.equals("")) + return s_Maker; + + return super.getSubpropMaker(subprop); + } - private value; + protected Property setSubprop(Property baseProp, String subpropName, + Property subProp) { + val = + (()baseProp).get(); + + + + + + + if (subpropName.equals("")) + val.set(subProp.get()); + else + + return super.setSubprop(baseProp, subpropName, subProp); + return baseProp; + } - public (PropertyList propertyList, explicitValue) { - this.propertyList = propertyList; - this.value = explicitValue; - } + public Property getSubpropValue(Property baseProp, String subpropName) { + val = + (()baseProp).get(); + + + + + + + if (subpropName.equals("")) + return new Property( + val.get()); + + return super.getSubpropValue(baseProp, subpropName); + } + - public get() { - return this.value; - } + + private Property m_defaultProp=null; + -} - - + + public boolean isInherited() { return ; } + - - - -package org.apache.fop.fo.properties; + + + public boolean inheritsSpecified() { + return true; + } + -import org.apache.fop.datatypes.*; -import org.apache.fop.fo.*; -import org.apache.fop.apps.FOPException; -import org.apache.fop.messaging.MessageHandler; + + + static class PropLengthBase extends LengthBase { + private FObj fo; + private PropertyList propertyList ; + + public PropLengthBase(FObj fo, PropertyList plist) { + this.fo = fo; + // get from FO???? + this.propertyList = plist; + //this.propertyList = fo.getProperties(); + } -public class extends Property { - - public final static int = ; + public int getBaseLength() { + + + return propertyList.get("font-size").getLength().mvalue(); + + + return propertyList.getInherited("font-size").getLength().mvalue(); + + + + return fo.getContainingWidth(); + + + return ; + + + } + } + + /** Return instance of internal class to calculate base Length + * for percent specifications. + */ + public PercentBase getPercentBase(final FObj fo, + final PropertyList propertyList) { + return new PropLengthBase(fo, propertyList); + } + + + + + protected boolean isAutoLengthAllowed() { + return true; + } + + + + + + protected Property findConstant(String value) { + + if (value.equals("")) { return s_prop; } + + return super.findConstant(value); + } + - public static class Maker extends Property.Maker { - public boolean isInherited() { return ; } + + + protected String checkValueKeywords(String value) { + + if (value.equals("")) { + return new String(""); + } + + return super.checkValueKeywords(value); + } + - public Property make(PropertyList propertyList, String value) throws FOPException { - int v; - - if (value.equals("")) { v = ; } - else + + + // See if other value types are acceptable + protected Property convertPropertyDatatype(Property p, + PropertyList propertyList, FObj fo) { + { - MessageHandler.errorln("WARNING: Unknown value for : " + value); - return make(propertyList, ""); + + + + + + + + + + = + p.get(); + if ( != null) { + return new ( + ); + } } - return new (propertyList, v); + + return super.convertPropertyDatatype(p, propertyList, fo); } + - public Property make(PropertyList propertyList) throws FOPException { - return make(propertyList, ""); + + public Property make(PropertyList propertyList, boolean bForceNew) throws FOPException { + + return make(propertyList, "", null); + + if (bForceNew) { + // Make a new property instead of using the static default + return make(propertyList, "", null); + } + if (m_defaultProp == null) + m_defaultProp=make(propertyList, "", null); + return m_defaultProp; + } - + + + + public Property compute(PropertyList propertyList) { Property computedProperty = null; Property correspondingProperty = propertyList.get(""); @@ -113,33 +289,18 @@ public class extends Property { int correspondingValue = correspondingProperty.getEnum(); if (correspondingValue == ) - computedProperty = new (propertyList, ); + computedProperty = new EnumProperty(); else ; } return computedProperty; } - - } - - public static Property.Maker maker() { - return new .Maker(); - } - - private int value; - - public (PropertyList propertyList, int explicitValue) { - this.propertyList = propertyList; - this.value = explicitValue; - } - - public int getEnum() { - return this.value; - } - + } + +