--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.datatypes.ColorType;
+
+public class ColorTypeProperty extends Property {
+
+ public static class Maker extends Property.Maker {
+
+ public Maker(String propName) {
+ super(propName);
+ }
+
+ protected Property convertProperty(Property p, PropertyList propertyList,
+ FObj fo) {
+ if (p instanceof ColorTypeProperty)
+ return p;
+ ColorType val = p.getColorType();
+ if (val != null)
+ return new ColorTypeProperty(val);
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+ }
+
+ private ColorType colorType;
+
+ public ColorTypeProperty(ColorType colorType) {
+ this.colorType = colorType;
+ }
+
+ // Can't convert to any other types
+ public ColorType getColorType() {
+ return this.colorType;
+ }
+
+ public Object getObject() { return this.colorType; }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.CondLength;
+
+public class CondLengthProperty extends LengthProperty {
+
+ public static class Maker extends LengthProperty.Maker {
+
+ public /* protected*/ Maker(String name) {
+ super(name);
+ }
+
+ protected Property convertProperty(Property p, PropertyList propertyList,
+ FObj fo) {
+ if (p instanceof CondLengthProperty)
+ return p;
+ Length val = p.getLength();
+ if (val != null)
+ return new CondLengthProperty(new CondLength(val));
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+ }
+
+ public CondLengthProperty(CondLength length) {
+ super(length);
+ }
+
+
+ public CondLength getCondLength() {
+ return (CondLength)super.getLength();
+ }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.messaging.MessageHandler;
+
+public class EnumProperty extends Property {
+
+ public static class Maker extends Property.Maker {
+
+ protected Maker(String propName) {
+ super(propName);
+ }
+
+ // set the Property from the String value
+ public Property make(PropertyList propertyList, String value, FObj fo)
+ throws FOPException
+ {
+ Property p = findConstant(value);
+ if (p == null) {
+ MessageHandler.errorln("WARNING: Unknown value for property '" +
+ getPropName() + "': " + value);
+ return make(propertyList); // return the default value
+ }
+ else {
+ return p; //makeProperty(v);
+ }
+ }
+
+ protected Property findConstant(String value) {
+ return null;
+ }
+
+ /***
+ protected Property makeProperty(int v) {
+ return new EnumProperty(v);
+ }
+ ***/
+ }
+
+ private int value;
+
+ public EnumProperty(int explicitValue) {
+ this.value = explicitValue;
+ }
+
+ public int getEnum() {
+ return this.value;
+ }
+
+ public Object getObject() {
+ // FIXME: return String value: property must reference maker
+ // return maker.getEnumValue(this.value);
+ return new Integer(this.value);
+ }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentLength;
+import org.apache.fop.datatypes.TableColLength;
+import org.apache.fop.fo.expr.Numeric;
+
+public class LengthProperty extends Property {
+
+ public static class Maker extends Property.Maker {
+
+ public /* protected*/ Maker(String name) {
+ super(name);
+ }
+
+ /**
+ protected Property checkPropertyKeywords(String value) {
+ if (isAutoLengthAllowed() && value.equals("auto")) {
+ return new LengthProperty(Length.AUTO);
+ }
+ return null;
+ }
+ **/
+
+ protected boolean isAutoLengthAllowed() {
+ return false;
+ }
+
+ protected Property convertProperty(Property p, PropertyList propertyList,
+ FObj fo) {
+ if (isAutoLengthAllowed()) {
+ String pval = p.getString();
+ if (pval != null && pval.equals("auto"))
+ return new LengthProperty(Length.AUTO);
+ }
+ if (p instanceof LengthProperty)
+ return p;
+ Length val = p.getLength();
+ if (val != null)
+ return new LengthProperty(val);
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+ }
+
+ /*
+ public static Property.Maker maker(String prop) {
+ return new Maker(prop);
+ }
+ */
+
+ /** This object may be also be a subclass of Length, such
+ * as PercentLength, TableColLength.
+ */
+ private Length length ;
+
+ public LengthProperty(Length length) {
+ this.length = length;
+ //System.err.println("Set LengthProperty: " + length.toString());
+ }
+
+ public Numeric getNumeric() {
+ // Can't just do new Numeric(length) because it always uses
+ // the constructor for Length!
+ // Otherwise, must make each class know about Numeric...
+ // ie, return length.asNumeric(): cleaner
+ if (length instanceof PercentLength)
+ return new Numeric((PercentLength)length);
+ if (length instanceof TableColLength)
+ return new Numeric((TableColLength)length);
+ return new Numeric(length);
+ }
+
+ public Length getLength() { return this.length; }
+
+ public Object getObject() { return this.length; }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.LengthRange;
+
+public class LengthRangeProperty extends Property {
+
+ public static class Maker extends LengthProperty.Maker {
+
+ protected Maker(String name) {
+ super(name);
+ }
+
+ protected Property convertProperty(Property p, PropertyList propertyList,
+ FObj fo) {
+ Length val = p.getLength();
+ if (val != null)
+ return new LengthRangeProperty(new LengthRange(val));
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+ }
+
+ private LengthRange lengthRange ;
+
+ public LengthRangeProperty(LengthRange lengthRange) {
+ this.lengthRange = lengthRange;
+ }
+
+ public LengthRange getLengthRange() { return this.lengthRange; }
+
+ /* Question, should we allow this? */
+ public Length getLength() { return this.lengthRange.getOptimum(); }
+ public Object getObject() { return this.lengthRange ; }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.datatypes.ColorType;
+import org.apache.fop.fo.expr.Numeric;
+
+public class NumberProperty extends Property {
+
+ public static class Maker extends Property.Maker {
+
+ public Maker(String propName) {
+ super(propName);
+ }
+
+ protected Property convertProperty(Property p, PropertyList propertyList,
+ FObj fo) {
+ if (p instanceof NumberProperty)
+ return p;
+ Number val = p.getNumber();
+ if (val != null)
+ return new NumberProperty(val);
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+ }
+
+ private final Number number;
+
+ public NumberProperty(Number number) {
+ this.number = number;
+ }
+
+ public NumberProperty(double number) {
+ this.number = new Double(number);
+ }
+
+ public NumberProperty(int number) {
+ this.number = new Integer(number);
+ }
+
+ public Number getNumber() {
+ return this.number;
+ }
+
+ /**
+ public Double getDouble() {
+ return new Double(this.number.doubleValue());
+ }
+
+ public Integer getInteger() {
+ return new Integer(this.number.intValue());
+ }
+ **/
+
+ public Object getObject() { return this.number; }
+
+ public Numeric getNumeric() {
+ return new Numeric(this.number);
+ }
+
+ public ColorType getColorType() {
+ // Convert numeric value to color ???
+ // Convert to hexadecimal and then try to make it into a color?
+ return new ColorType((float)0.0, (float)0.0, (float)0.0);
+ }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.Space;
+import org.apache.fop.datatypes.LengthRange;
+
+public class SpaceProperty extends Property {
+
+ public static class Maker extends LengthRangeProperty.Maker {
+
+ protected Maker(String name) {
+ super(name);
+ }
+
+ protected Property convertProperty(Property p, PropertyList propertyList,
+ FObj fo) {
+ Length val = p.getLength();
+ if (val != null)
+ return new SpaceProperty(new Space(val));
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+ }
+
+ private Space space ;
+
+ public SpaceProperty(Space space) {
+ this.space = space;
+ }
+
+ public Space getSpace() { return this.space; }
+
+ /* Question, should we allow this? */
+ public Length getLength() { return this.space.getOptimum(); }
+ /* Space extends LengthRange */
+ public LengthRange getLengthRange() { return this.space; }
+ public Object getObject() { return this.space; }
+
+}
--- /dev/null
+/*-- $Id$ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+package org.apache.fop.fo;
+
+
+public class StringProperty extends Property {
+
+ public static class Maker extends Property.Maker {
+
+ public Maker(String propName) {
+ super(propName);
+ }
+
+ public Property make(PropertyList propertyList, String value, FObj fo) {
+ // Work around the fact that most String properties are not
+ // specified as actual String literals (with "" or '') since
+ // the attribute values themselves are Strings!
+ // If the value starts with ' or ", make sure it also ends with
+ // this character
+ // Otherwise, just take the whole value as the String
+ int vlen = value.length()-1;
+ if (vlen > 0) {
+ char q1 = value.charAt(0);
+ if (q1 == '"' || q1 == '\'') {
+ if (value.charAt(vlen) == q1) {
+ return new StringProperty(value.substring(1,vlen));
+ }
+ System.err.println("Warning String-valued property starts with quote" +
+ " but doesn't end with quote: " + value);
+ // fall through and use the entire value, including first quote
+ }
+ }
+ return new StringProperty(value);
+ }
+ } // end String.Maker
+
+ private String str ;
+
+ public StringProperty(String str) {
+ this.str = str;
+ // System.err.println("Set StringProperty: " + str);
+ }
+
+ public Object getObject() { return this.str; }
+
+ public String getString() { return this.str; }
+}