+++ /dev/null
-/*
- * $Id: AutoLength.java,v 1.3 2003/03/05 20:38:23 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import org.apache.fop.fo.LengthProperty;
-
-/**
- * A length quantity in XSL which is specified as "auto".
- */
-public class AutoLength extends LengthProperty {
-
- /**
- * @see org.apache.fop.datatypes.Length#isAuto()
- */
- public boolean isAuto() {
- return true;
- }
-
- // Should we do something intelligent here to set the actual size?
- // Would need a reference object!
- // protected void computeValue() {
- // }
-
- /**
- * @see org.apache.fop.fo.Property#getString()
- */
- public String getString() {
- return "auto";
- }
-
-}
*/
package org.apache.fop.datatypes;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.properties.Property;
/**
* This interface is used as a base for compound datatypes.
+++ /dev/null
-/*
- * $Id: FixedLength.java,v 1.4 2003/03/05 20:38:23 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.expr.NumericProperty;
-
-/**
- * a length quantity in XSL
- */
-public class FixedLength extends LengthProperty {
-
- /**
- * Set the length given
- * @param numRelUnits the number of relative units
- * @param iCurFontSize the current font size in base units.
- */
- public FixedLength(double numRelUnits, int iCurFontSize) {
- setComputedValue((int)(numRelUnits * (double)iCurFontSize));
- }
-
- /**
- * Set the length given a number of units and a unit name.
- * @param numUnits quantity of input units
- * @param units input unit specifier (in, cm, etc.)
- */
- public FixedLength(double numUnits, String units) {
- convert(numUnits, units);
- }
-
- /**
- * @param baseUnits the length as a number of base units (millipoints)
- */
- public FixedLength(int baseUnits) {
- setComputedValue(baseUnits);
- }
-
- /**
- * Convert the given length to a dimensionless integer representing
- * a whole number of base units (milli-points).
- * @param dvalue quantity of input units
- * @param unit input unit specifier (in, cm, etc.)
- */
- protected void convert(double dvalue, String unit) {
-
- int assumedResolution = 1; // points/pixel
-
- if (unit.equals("in")) {
- dvalue = dvalue * 72;
- } else if (unit.equals("cm")) {
- dvalue = dvalue * 28.3464567;
- } else if (unit.equals("mm")) {
- dvalue = dvalue * 2.83464567;
- } else if (unit.equals("pt")) {
- // Do nothing.
- // dvalue = dvalue;
- } else if (unit.equals("pc")) {
- dvalue = dvalue * 12;
- /*
- * } else if (unit.equals("em")) {
- * dvalue = dvalue * fontsize;
- */
- } else if (unit.equals("px")) {
- dvalue = dvalue * assumedResolution;
- } else {
- dvalue = 0;
- //log.error("unknown length unit '" + unit
- // + "'");
- }
- setComputedValue((int)(dvalue * 1000));
- }
-
- /**
- * @return Numeric equivalent of this
- */
- public NumericProperty asNumeric() {
- return new NumericProperty(this);
- }
-}
-
+++ /dev/null
-/*
- * $Id: LinearCombinationLength.java,v 1.4 2003/03/05 20:38:24 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import java.util.Vector;
-
-import org.apache.fop.fo.LengthProperty;
-
-/**
- * Class modelling lengths that are build up by combining other lengths
- */
-public class LinearCombinationLength extends LengthProperty {
-
- /** Collection of factors (1-1 correspondence with {@link #lengths} */
- protected Vector factors;
- /** Collection of Length objects (1-1 correspondence with {@link #factors} */
- protected Vector lengths;
-
- /**
- * Constructor. Creates no content. Use {link #addTerm} to build content.
- */
- public LinearCombinationLength() {
- factors = new Vector();
- lengths = new Vector();
- }
-
- /**
- * Add an item to this
- * @param factor the factor to be added
- * @param length the Length to be added
- */
- public void addTerm(double factor, LengthProperty length) {
- factors.addElement(new Double(factor));
- lengths.addElement(length);
- }
-
- /**
- * Sets the computed value in millipoints.
- */
- protected void computeValue() {
- int result = 0;
- int numFactors = factors.size();
- for (int i = 0; i < numFactors; ++i) {
- result +=
- (int)(((Double)factors.elementAt(i)).doubleValue()
- * (double)((Length)lengths.elementAt(i)).getValue());
- }
- setComputedValue(result);
- }
-
-}
+++ /dev/null
-/*
- * $Id: MixedLength.java,v 1.6 2003/03/05 20:38:23 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.expr.NumericProperty;
-import org.apache.fop.fo.expr.PropertyException;
-
-/**
- * A length quantity in XSL which is specified with a mixture
- * of absolute and relative and/or percent components.
- * The actual value may not be computable before layout is done.
- */
-public class MixedLength extends LengthProperty {
-
- /** The collection of Length objects comprising this MixedLength object */
- private Vector lengths ;
-
- /**
- * Constructor
- * @param lengths the collection of Length objects which comprise the new
- * MixedLength object
- */
- public MixedLength(Vector lengths) {
- this.lengths = lengths;
- }
-
- /**
- * Iterates through each internal component, computing and
- * summarizing the values, then setting the value for this
- */
- protected void computeValue() {
- int computedValue = 0;
- boolean bAllComputed = true;
- Enumeration e = lengths.elements();
- while (e.hasMoreElements()) {
- LengthProperty l = (LengthProperty) e.nextElement();
- computedValue += l.getValue();
- if (!l.isComputed()) {
- bAllComputed = false;
- }
- }
- setComputedValue(computedValue, bAllComputed);
- }
-
-
- public double getTableUnits() {
- double tableUnits = 0.0;
- Enumeration e = lengths.elements();
- while (e.hasMoreElements()) {
- tableUnits += ((LengthProperty) e.nextElement()).getTableUnits();
- }
- return tableUnits;
- }
-
- public void resolveTableUnit(double dTableUnit) {
- Enumeration e = lengths.elements();
- while (e.hasMoreElements()) {
- ((LengthProperty) e.nextElement()).resolveTableUnit(dTableUnit);
- }
- }
-
- /**
- * @return String equivalent of this
- */
- public String toString() {
- StringBuffer sbuf = new StringBuffer();
- Enumeration e = lengths.elements();
- while (e.hasMoreElements()) {
- if (sbuf.length() > 0) {
- sbuf.append('+');
- }
- sbuf.append(e.nextElement().toString());
- }
- return sbuf.toString();
- }
-
- /**
- * @return Numeric equivalent of this
- */
- public NumericProperty asNumeric() {
- NumericProperty numeric = null;
- for (Enumeration e = lengths.elements(); e.hasMoreElements();) {
- LengthProperty l = (LengthProperty) e.nextElement();
- if (numeric == null) {
- numeric = l.asNumeric();
- } else {
- try {
- NumericProperty sum = numeric.add(l.asNumeric());
- numeric = sum;
- } catch (PropertyException pe) {
- System.err.println(
- "Can't convert MixedLength to Numeric: " + pe);
- }
- }
- }
- return numeric;
- }
-}
-
+++ /dev/null
-/*
- * $Id: PercentLength.java,v 1.6 2003/03/05 20:38:23 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.expr.NumericProperty;
-
-/**
- * a percent specified length quantity in XSL
- */
-public class PercentLength extends LengthProperty {
-
- /**
- * The percentage itself, expressed as a decimal value, e.g. for 95%, set
- * the value to .95
- */
- private double factor;
-
- /**
- * A PercentBase implementation that contains the base length to which the
- * {@link #factor} should be applied to compute the actual length
- */
- private PercentBase lbase = null;
-
- /**
- * Main constructor. Construct an object based on a factor (the percent,
- * as a factor) and an object which has a method to return the Length which
- * provides the "base" for the actual length that is modeled.
- * @param factor the percentage factor, expressed as a decimal (e.g. use
- * .95 to represent 95%)
- * @param lbase base property to which the factor should be applied
- */
- public PercentLength(double factor, PercentBase lbase) {
- this.factor = factor;
- this.lbase = lbase;
- }
-
- /**
- * Convenience constructor when only the factor is known
- * @param factor the percentage factor, expressed as a decimal (e.g. use
- * .95 to represent 95%)
- */
- public PercentLength(double factor) {
- this(factor, null);
- }
-
- /**
- * @param lbase the base to set
- */
- public void setBaseLength(PercentBase lbase) {
- this.lbase = lbase;
- }
-
- /**
- * @return the base
- */
- public PercentBase getBaseLength() {
- return this.lbase;
- }
-
- /**
- * Return the computed value in millipoints. This assumes that the
- * base length has been resolved to an absolute length value.
- */
- protected void computeValue() {
- setComputedValue((int)(factor * (double)lbase.getBaseLength()));
- }
-
- /**
- *
- * @return the factor
- */
- public double value() {
- return factor;
- }
-
- /**
- * @return the String equivalent of this
- */
- public String toString() {
- // TODO: What about the base value?
- return (new Double(factor * 100.0).toString()) + "%";
- }
-
- /**
- * @return new Numeric object that is equivalent to this
- */
- public NumericProperty asNumeric() {
- return new NumericProperty(this);
- }
-
-}
+++ /dev/null
-/*
- * $Id: TableColLength.java,v 1.6 2003/03/05 20:38:24 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.expr.NumericProperty;
-
-/**
- * A table-column width specification, possibly including some
- * number of proportional "column-units". The absolute size of a
- * column-unit depends on the fixed and proportional sizes of all
- * columns in the table, and on the overall size of the table.
- * It can't be calculated until all columns have been specified and until
- * the actual width of the table is known. Since this can be specified
- * as a percent of its parent containing width, the calculation is done
- * during layout.
- * NOTE: this is only supposed to be allowed if table-layout=fixed.
- */
-public class TableColLength extends LengthProperty {
-
- /**
- * Number of table-column proportional units
- */
- private double tcolUnits;
-
- /**
- * Construct an object with tcolUnits of proportional measure.
- * @param tcolUnits number of table-column proportional units
- */
- public TableColLength(double tcolUnits) {
- this.tcolUnits = tcolUnits;
- }
-
- /**
- * Override the method in Length
- * @return the number of specified proportional table-column units.
- */
- public double getTableUnits() {
- return tcolUnits;
- }
-
- /**
- * Calculate the number of millipoints and set it.
- * @param mpointsPerUnit density of millipoints per unit
- */
- public void resolveTableUnit(double mpointsPerUnit) {
- setComputedValue((int)(tcolUnits * mpointsPerUnit));
- }
-
- //If the table-unit can be resolved, set the computed value
- /*protected void computeValue() {
- if (tblUnitBase.canResolveUnit()) {
- rslt += (int)(tcolUnits * (double)tblUnitBase.getUnitValue());
- setComputedValue(rslt);
- }
- }*/
-
- /**
- * Convert this to a String
- * @return the string representation of this
- */
- public String toString() {
- return (Double.toString(tcolUnits) + " table-column-units");
- }
-
- /**
- * Converts this to a new Numeric object
- * @return the Numeric object
- */
- public NumericProperty asNumeric() {
- return new NumericProperty(this);
- }
-}
-
+++ /dev/null
-/*
- * $Id: ToBeImplementedProperty.java,v 1.6 2003/03/05 20:38:23 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes;
-
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.properties.PropertyMaker;
-
-public class ToBeImplementedProperty extends Property {
-
- public static class Maker extends PropertyMaker {
-
- public Maker(int propId) {
- super(propId);
- }
-
- public Property convertProperty(Property p,
- PropertyList propertyList, FObj fo) {
- if (p instanceof ToBeImplementedProperty) {
- return p;
- }
-
- ToBeImplementedProperty val =
- new ToBeImplementedProperty(getPropId());
- return val;
- }
- }
-
- /**
- * Constructor
- * @param propName name of Property
- */
- public ToBeImplementedProperty(int propId) {
-
- //XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an
- //UnimplementedPropertyException or something similar should
- //get thrown here instead.
-
-// Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor("fop");
-// log.warn("property - \"" + propName
-// + "\" is not implemented yet.");
- }
-}
-
*/
package org.apache.fop.fo;
+import org.apache.fop.fo.properties.ListProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
/**
+++ /dev/null
-/*
- * $Id: CharacterProperty.java,v 1.3 2003/03/05 21:48:02 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.fo.properties.PropertyMaker;
-
-/**
- * Superclass for properties that wrap a character value
- */
-public class CharacterProperty extends Property {
-
- /**
- * Inner class for creating instances of CharacterProperty
- */
- public static class Maker extends PropertyMaker {
-
- /**
- * @param propName name of property for which a Maker should be created
- */
- public Maker(int propId) {
- super(propId);
- }
-
- public Property make(PropertyList propertyList, String value,
- FObj fo) {
- char c = value.charAt(0);
- return new CharacterProperty(c);
- }
-
- } // end Charakter.Maker
-
- private char character;
-
- /**
- * @param character character value to be wrapped in this property
- */
- public CharacterProperty(char character) {
- this.character = character;
- }
-
- /**
- * @return this.character cast as an Object
- */
- public Object getObject() {
- return new Character(character);
- }
-
- /**
- * @return this.character
- */
- public char getCharacter() {
- return this.character;
- }
-
- /**
- * @return this.character cast as a String
- */
- public String getString() {
- return new Character(character).toString();
- }
-
-}
+++ /dev/null
-/*
- * $Id: ColorTypeProperty.java,v 1.5 2003/03/05 21:48:02 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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 java.awt.Color;
-import java.util.StringTokenizer;
-
-import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.fo.properties.PropertyMaker;
-
-/**
- * Superclass for properties that wrap ColorType values
- */
-public class ColorTypeProperty extends Property implements ColorType {
- /**
- * the red component
- */
- protected float red = 0f;
-
- /**
- * the green component
- */
- protected float green = 0f;
-
- /**
- * the blue component
- */
- protected float blue = 0f;
-
- /**
- * the alpha component (indicator of opaque-ness)
- * 0.0 - 1.0; 0.0 is completely transparent; 1.0 is completely opaque
- * see definition at http://java.sun.com/j2se/1.3/docs/api/java/awt/Color.html
- */
- protected float alpha = 1f;
-
- /**
- * Inner class for creating instances of ColorTypeProperty
- */
- public static class Maker extends PropertyMaker {
-
- /**
- * @param propName name of property for which a Maker should be created
- */
- public Maker(int propId) {
- super(propId);
- }
-
- public Property convertProperty(Property p,
- PropertyList propertyList, FObj fo) {
- if (p instanceof ColorTypeProperty) {
- return p;
- }
- ColorTypeProperty val = p.getColorType();
- if (val != null) {
- return val;
- }
- return convertPropertyDatatype(p, propertyList, fo);
- }
-
- }
-
- /**
- * Main constructor
- * @param red red component
- * @param green green component
- * @param blue blue component
- */
- public ColorTypeProperty(float red, float green, float blue) {
- this.red = red;
- this.green = green;
- this.blue = blue;
- }
-
- /**
- * Set the colour given a particular String specifying either a
- * colour name or #RGB or #RRGGBB
- * @param value RGB value as String to be parsed
- */
- public ColorTypeProperty(String value) {
- if (value.startsWith("#")) {
- try {
- if (value.length() == 4) {
- // note: divide by 15 so F = FF = 1 and so on
- this.red = Integer.parseInt(value.substring(1, 2), 16)
- / 15f;
- this.green = Integer.parseInt(value.substring(2, 3), 16)
- / 15f;
- this.blue = Integer.parseInt(value.substring(3), 16)
- / 15f;
- } else if (value.length() == 7) {
- // note: divide by 255 so FF = 1
- this.red = Integer.parseInt(value.substring(1, 3), 16)
- / 255f;
- this.green = Integer.parseInt(value.substring(3, 5), 16)
- / 255f;
- this.blue = Integer.parseInt(value.substring(5), 16)
- / 255f;
- } else {
- this.red = 0;
- this.green = 0;
- this.blue = 0;
- //log.error("unknown colour format. Must be #RGB or #RRGGBB");
- }
- } catch (Exception e) {
- this.red = 0;
- this.green = 0;
- this.blue = 0;
- //log.error("unknown colour format. Must be #RGB or #RRGGBB");
- }
- } else if (value.startsWith("rgb(")) {
- int poss = value.indexOf("(");
- int pose = value.indexOf(")");
- if (poss != -1 && pose != -1) {
- value = value.substring(poss + 1, pose);
- StringTokenizer st = new StringTokenizer(value, ",");
- try {
- if (st.hasMoreTokens()) {
- String str = st.nextToken().trim();
- if (str.endsWith("%")) {
- this.red =
- Integer.parseInt(str.substring(0, str.length() - 1))
- * 2.55f;
- } else {
- this.red = Integer.parseInt(str) / 255f;
- }
- }
- if (st.hasMoreTokens()) {
- String str = st.nextToken().trim();
- if (str.endsWith("%")) {
- this.green =
- Integer.parseInt(str.substring(0, str.length() - 1))
- * 2.55f;
- } else {
- this.green = Integer.parseInt(str) / 255f;
- }
- }
- if (st.hasMoreTokens()) {
- String str = st.nextToken().trim();
- if (str.endsWith("%")) {
- this.blue =
- Integer.parseInt(str.substring(0, str.length() - 1))
- * 2.55f;
- } else {
- this.blue = Integer.parseInt(str) / 255f;
- }
- }
- } catch (Exception e) {
- this.red = 0;
- this.green = 0;
- this.blue = 0;
- //log.error("unknown colour format. Must be #RGB or #RRGGBB");
- }
- }
- } else if (value.startsWith("url(")) {
- // refers to a gradient
- } else {
- if (value.toLowerCase().equals("transparent")) {
- this.red = 0;
- this.green = 0;
- this.blue = 0;
- this.alpha = 0;
- } else {
- boolean found = false;
- for (int count = 0; count < NAMES.length; count++) {
- if (value.toLowerCase().equals(NAMES[count])) {
- this.red = VALUES[count][0] / 255f;
- this.green = VALUES[count][1] / 255f;
- this.blue = VALUES[count][2] / 255f;
- found = true;
- break;
- }
- }
- if (!found) {
- this.red = 0;
- this.green = 0;
- this.blue = 0;
- //log.error("unknown colour name: "
- // + value);
- }
- }
- }
- }
-
- /**
- * Returns the blue component of the color.
- * @return float a value between 0.0 and 1.0
- */
- public float getBlue() {
- return this.blue;
- }
-
- /**
- * Returns the green component of the color.
- * @return float a value between 0.0 and 1.0
- */
- public float getGreen() {
- return this.green;
- }
-
- /**
- * Returns the red component of the color.
- * @return float a value between 0.0 and 1.0
- */
- public float getRed() {
- return this.red;
- }
-
- /**
- * Returns the alpha (degree of opaque-ness) component of the color.
- * @return float a value between 0.0 (fully transparent) and 1.0 (fully opaque)
- */
- public float getAlpha() {
- return this.alpha;
- }
-
- /**
- * Returns an AWT instance of this color
- * @return float the AWT color represented by this ColorType instance
- */
- public Color getAWTColor() {
- return new Color(this.red, this.green, this.blue, this.alpha);
- }
-
- /**
- * @param floatValue value (between 0.0 and 1.0) of color channel
- * @return integer equivalent (between 0 and 255)
- */
- public static int convertChannelToInteger (float floatValue) {
- if (floatValue > 1.0) {
- floatValue = 1.0f;
- }
- if (floatValue < 0) {
- floatValue = 0;
- }
- return (int) (floatValue * 255);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer sbuf = new StringBuffer(8);
- sbuf.append('#');
- String s = Integer.toHexString((int)(red * 255.0));
- if (s.length() == 1) {
- sbuf.append('0');
- }
- sbuf.append(s);
- s = Integer.toHexString((int)(green * 255.0));
- if (s.length() == 1) {
- sbuf.append('0');
- }
- sbuf.append(s);
- s = Integer.toHexString((int)(blue * 255.0));
- if (s.length() == 1) {
- sbuf.append('0');
- }
- sbuf.append(s);
- return sbuf.toString();
- }
-
- /** The names of the predefined colors */
- protected static final String[] NAMES = {
- "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
- "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
- "burlywood", "cadetblue", "chartreuse", "chocolate", "coral",
- "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue",
- "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey",
- "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange",
- "darkorchid", "darkred", "darksalmon", "darkseagreen",
- "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise",
- "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey",
- "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia",
- "gainsboro", "lightpink", "lightsalmon", "lightseagreen",
- "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue",
- "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon",
- "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
- "mediumseagreen", "mediumslateblue", "mediumspringgreen",
- "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream",
- "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive",
- "olivedrab", "orange", "orangered", "orchid", "palegoldenrod",
- "palegreen", "paleturquoise", "palevioletred", "papayawhip",
- "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red",
- "rosybrown", "royalblue", "saddlebrown", "salmon", "ghostwhite",
- "gold", "goldenrod", "gray", "grey", "green", "greenyellow",
- "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki",
- "lavender", "lavenderblush", "lawngreen", "lemonchiffon",
- "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow",
- "lightgray", "lightgreen", "lightgrey", "sandybrown", "seagreen",
- "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray",
- "slategrey", "snow", "springgreen", "steelblue", "tan", "teal",
- "thistle", "tomato", "turquoise", "violet", "wheat", "white",
- "whitesmoke", "yellow", "yellowgreen"
- };
-
- /** The color values for the predefined colors */
- protected static final int[][] VALUES = {
- {
- 240, 248, 255
- }, {
- 250, 235, 215
- }, {
- 0, 255, 255
- }, {
- 127, 255, 212
- }, {
- 240, 255, 255
- }, {
- 245, 245, 220
- }, {
- 255, 228, 196
- }, {
- 0, 0, 0
- }, {
- 255, 235, 205
- }, {
- 0, 0, 255
- }, {
- 138, 43, 226
- }, {
- 165, 42, 42
- }, {
- 222, 184, 135
- }, {
- 95, 158, 160
- }, {
- 127, 255, 0
- }, {
- 210, 105, 30
- }, {
- 255, 127, 80
- }, {
- 100, 149, 237
- }, {
- 255, 248, 220
- }, {
- 220, 20, 60
- }, {
- 0, 255, 255
- }, {
- 0, 0, 139
- }, {
- 0, 139, 139
- }, {
- 184, 134, 11
- }, {
- 169, 169, 169
- }, {
- 0, 100, 0
- }, {
- 169, 169, 169
- }, {
- 189, 183, 107
- }, {
- 139, 0, 139
- }, {
- 85, 107, 47
- }, {
- 255, 140, 0
- }, {
- 153, 50, 204
- }, {
- 139, 0, 0
- }, {
- 233, 150, 122
- }, {
- 143, 188, 143
- }, {
- 72, 61, 139
- }, {
- 47, 79, 79
- }, {
- 47, 79, 79
- }, {
- 0, 206, 209
- }, {
- 148, 0, 211
- }, {
- 255, 20, 147
- }, {
- 0, 191, 255
- }, {
- 105, 105, 105
- }, {
- 105, 105, 105
- }, {
- 30, 144, 255
- }, {
- 178, 34, 34
- }, {
- 255, 250, 240
- }, {
- 34, 139, 34
- }, {
- 255, 0, 255
- }, {
- 220, 220, 220
- }, {
- 255, 182, 193
- }, {
- 255, 160, 122
- }, {
- 32, 178, 170
- }, {
- 135, 206, 250
- }, {
- 119, 136, 153
- }, {
- 119, 136, 153
- }, {
- 176, 196, 222
- }, {
- 255, 255, 224
- }, {
- 0, 255, 0
- }, {
- 50, 205, 50
- }, {
- 250, 240, 230
- }, {
- 255, 0, 255
- }, {
- 128, 0, 0
- }, {
- 102, 205, 170
- }, {
- 0, 0, 205
- }, {
- 186, 85, 211
- }, {
- 147, 112, 219
- }, {
- 60, 179, 113
- }, {
- 123, 104, 238
- }, {
- 0, 250, 154
- }, {
- 72, 209, 204
- }, {
- 199, 21, 133
- }, {
- 25, 25, 112
- }, {
- 245, 255, 250
- }, {
- 255, 228, 225
- }, {
- 255, 228, 181
- }, {
- 255, 222, 173
- }, {
- 0, 0, 128
- }, {
- 253, 245, 230
- }, {
- 128, 128, 0
- }, {
- 107, 142, 35
- }, {
- 255, 165, 0
- }, {
- 255, 69, 0
- }, {
- 218, 112, 214
- }, {
- 238, 232, 170
- }, {
- 152, 251, 152
- }, {
- 175, 238, 238
- }, {
- 219, 112, 147
- }, {
- 255, 239, 213
- }, {
- 255, 218, 185
- }, {
- 205, 133, 63
- }, {
- 255, 192, 203
- }, {
- 221, 160, 221
- }, {
- 176, 224, 230
- }, {
- 128, 0, 128
- }, {
- 255, 0, 0
- }, {
- 188, 143, 143
- }, {
- 65, 105, 225
- }, {
- 139, 69, 19
- }, {
- 250, 128, 114
- }, {
- 248, 248, 255
- }, {
- 255, 215, 0
- }, {
- 218, 165, 32
- }, {
- 128, 128, 128
- }, {
- 128, 128, 128
- }, {
- 0, 128, 0
- }, {
- 173, 255, 47
- }, {
- 240, 255, 240
- }, {
- 255, 105, 180
- }, {
- 205, 92, 92
- }, {
- 75, 0, 130
- }, {
- 255, 255, 240
- }, {
- 240, 230, 140
- }, {
- 230, 230, 250
- }, {
- 255, 240, 245
- }, {
- 124, 252, 0
- }, {
- 255, 250, 205
- }, {
- 173, 216, 230
- }, {
- 240, 128, 128
- }, {
- 224, 255, 255
- }, {
- 250, 250, 210
- }, {
- 211, 211, 211
- }, {
- 144, 238, 144
- }, {
- 211, 211, 211
- }, {
- 244, 164, 96
- }, {
- 46, 139, 87
- }, {
- 255, 245, 238
- }, {
- 160, 82, 45
- }, {
- 192, 192, 192
- }, {
- 135, 206, 235
- }, {
- 106, 90, 205
- }, {
- 112, 128, 144
- }, {
- 112, 128, 144
- }, {
- 255, 250, 250
- }, {
- 0, 255, 127
- }, {
- 70, 130, 180
- }, {
- 210, 180, 140
- }, {
- 0, 128, 128
- }, {
- 216, 191, 216
- }, {
- 255, 99, 71
- }, {
- 64, 224, 208
- }, {
- 238, 130, 238
- }, {
- 245, 222, 179
- }, {
- 255, 255, 255
- }, {
- 245, 245, 245
- }, {
- 255, 255, 0
- }, {
- 154, 205, 50
- }
- };
-
- /*
- * aliceblue rgb(240, 248, 255)
- * antiquewhite rgb(250, 235, 215)
- * aqua rgb( 0, 255, 255)
- * aquamarine rgb(127, 255, 212)
- * azure rgb(240, 255, 255)
- * beige rgb(245, 245, 220)
- * bisque rgb(255, 228, 196)
- * black rgb( 0, 0, 0)
- * blanchedalmond rgb(255, 235, 205)
- * blue rgb( 0, 0, 255)
- * blueviolet rgb(138, 43, 226)
- * brown rgb(165, 42, 42)
- * burlywood rgb(222, 184, 135)
- * cadetblue rgb( 95, 158, 160)
- * chartreuse rgb(127, 255, 0)
- * chocolate rgb(210, 105, 30)
- * coral rgb(255, 127, 80)
- * cornflowerblue rgb(100, 149, 237)
- * cornsilk rgb(255, 248, 220)
- * crimson rgb(220, 20, 60)
- * cyan rgb( 0, 255, 255)
- * darkblue rgb( 0, 0, 139)
- * darkcyan rgb( 0, 139, 139)
- * darkgoldenrod rgb(184, 134, 11)
- * darkgray rgb(169, 169, 169)
- * darkgreen rgb( 0, 100, 0)
- * darkgrey rgb(169, 169, 169)
- * darkkhaki rgb(189, 183, 107)
- * darkmagenta rgb(139, 0, 139)
- * darkolivegreen rgb( 85, 107, 47)
- * darkorange rgb(255, 140, 0)
- * darkorchid rgb(153, 50, 204)
- * darkred rgb(139, 0, 0)
- * darksalmon rgb(233, 150, 122)
- * darkseagreen rgb(143, 188, 143)
- * darkslateblue rgb( 72, 61, 139)
- * darkslategray rgb( 47, 79, 79)
- * darkslategrey rgb( 47, 79, 79)
- * darkturquoise rgb( 0, 206, 209)
- * darkviolet rgb(148, 0, 211)
- * deeppink rgb(255, 20, 147)
- * deepskyblue rgb( 0, 191, 255)
- * dimgray rgb(105, 105, 105)
- * dimgrey rgb(105, 105, 105)
- * dodgerblue rgb( 30, 144, 255)
- * firebrick rgb(178, 34, 34)
- * floralwhite rgb(255, 250, 240)
- * forestgreen rgb( 34, 139, 34)
- * fuchsia rgb(255, 0, 255)
- * gainsboro rgb(220, 220, 220)
- * lightpink rgb(255, 182, 193)
- * lightsalmon rgb(255, 160, 122)
- * lightseagreen rgb( 32, 178, 170)
- * lightskyblue rgb(135, 206, 250)
- * lightslategray rgb(119, 136, 153)
- * lightslategrey rgb(119, 136, 153)
- * lightsteelblue rgb(176, 196, 222)
- * lightyellow rgb(255, 255, 224)
- * lime rgb( 0, 255, 0)
- * limegreen rgb( 50, 205, 50)
- * linen rgb(250, 240, 230)
- * magenta rgb(255, 0, 255)
- * maroon rgb(128, 0, 0)
- * mediumaquamarine rgb(102, 205, 170)
- * mediumblue rgb( 0, 0, 205)
- * mediumorchid rgb(186, 85, 211)
- * mediumpurple rgb(147, 112, 219)
- * mediumseagreen rgb( 60, 179, 113)
- * mediumslateblue rgb(123, 104, 238)
- * mediumspringgreen rgb( 0, 250, 154)
- * mediumturquoise rgb( 72, 209, 204)
- * mediumvioletred rgb(199, 21, 133)
- * midnightblue rgb( 25, 25, 112)
- * mintcream rgb(245, 255, 250)
- * mistyrose rgb(255, 228, 225)
- * moccasin rgb(255, 228, 181)
- * navajowhite rgb(255, 222, 173)
- * navy rgb( 0, 0, 128)
- * oldlace rgb(253, 245, 230)
- * olive rgb(128, 128, 0)
- * olivedrab rgb(107, 142, 35)
- * orange rgb(255, 165, 0)
- * orangered rgb(255, 69, 0)
- * orchid rgb(218, 112, 214)
- * palegoldenrod rgb(238, 232, 170)
- * palegreen rgb(152, 251, 152)
- * paleturquoise rgb(175, 238, 238)
- * palevioletred rgb(219, 112, 147)
- * papayawhip rgb(255, 239, 213)
- * peachpuff rgb(255, 218, 185)
- * peru rgb(205, 133, 63)
- * pink rgb(255, 192, 203)
- * plum rgb(221, 160, 221)
- * powderblue rgb(176, 224, 230)
- * purple rgb(128, 0, 128)
- * red rgb(255, 0, 0)
- * rosybrown rgb(188, 143, 143)
- * royalblue rgb( 65, 105, 225)
- * saddlebrown rgb(139, 69, 19)
- * salmon rgb(250, 128, 114)
- * ghostwhite rgb(248, 248, 255)
- * gold rgb(255, 215, 0)
- * goldenrod rgb(218, 165, 32)
- * gray rgb(128, 128, 128)
- * grey rgb(128, 128, 128)
- * green rgb( 0, 128, 0)
- * greenyellow rgb(173, 255, 47)
- * honeydew rgb(240, 255, 240)
- * hotpink rgb(255, 105, 180)
- * indianred rgb(205, 92, 92)
- * indigo rgb( 75, 0, 130)
- * ivory rgb(255, 255, 240)
- * khaki rgb(240, 230, 140)
- * lavender rgb(230, 230, 250)
- * lavenderblush rgb(255, 240, 245)
- * lawngreen rgb(124, 252, 0)
- * lemonchiffon rgb(255, 250, 205)
- * lightblue rgb(173, 216, 230)
- * lightcoral rgb(240, 128, 128)
- * lightcyan rgb(224, 255, 255)
- * lightgoldenrodyellow rgb(250, 250, 210)
- * lightgray rgb(211, 211, 211)
- * lightgreen rgb(144, 238, 144)
- * lightgrey rgb(211, 211, 211)
- * sandybrown rgb(244, 164, 96)
- * seagreen rgb( 46, 139, 87)
- * seashell rgb(255, 245, 238)
- * sienna rgb(160, 82, 45)
- * silver rgb(192, 192, 192)
- * skyblue rgb(135, 206, 235)
- * slateblue rgb(106, 90, 205)
- * slategray rgb(112, 128, 144)
- * slategrey rgb(112, 128, 144)
- * snow rgb(255, 250, 250)
- * springgreen rgb( 0, 255, 127)
- * steelblue rgb( 70, 130, 180)
- * tan rgb(210, 180, 140)
- * teal rgb( 0, 128, 128)
- * thistle rgb(216, 191, 216)
- * tomato rgb(255, 99, 71)
- * turquoise rgb( 64, 224, 208)
- * violet rgb(238, 130, 238)
- * wheat rgb(245, 222, 179)
- * white rgb(255, 255, 255)
- * whitesmoke rgb(245, 245, 245)
- * yellow rgb(255, 255, 0)
- * yellowgreen rgb(154, 205, 50)
- */
-
- /**
- * Can't convert to any other types
- * @return this.colorType
- */
- public ColorTypeProperty getColorType() {
- return this;
- }
-
- /**
- * @return this.colorType cast as an Object
- */
- public Object getObject() {
- return this;
- }
-}
-
+++ /dev/null
-/*
- * $Id: CondLengthProperty.java,v 1.5 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes.CompoundDatatype;
-import org.apache.fop.fo.properties.CompoundPropertyMaker;
-
-/**
- * Superclass for properties that have conditional lengths
- */
-public class CondLengthProperty extends Property implements CompoundDatatype {
- private Property length;
- private Property conditionality;
-
- /**
- * Inner class for creating instances of CondLengthProperty
- */
- public static class Maker extends CompoundPropertyMaker {
-
- /**
- * @param name of property for which a Maker should be created
- */
- public Maker(int propId) {
- super(propId);
- }
-
- /**
- * Create a new empty instance of CondLengthProperty.
- * @return the new instance.
- */
- public Property makeNewProperty() {
- return new CondLengthProperty();
- }
-
- /**
- * @see CompoundPropertyMaker#convertProperty
- */
- public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
- {
- if (p instanceof KeepProperty) {
- return p;
- }
- return super.convertProperty(p, propertyList, fo);
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
- */
- public void setComponent(int cmpId, Property cmpnValue,
- boolean bIsDefault) {
- if (cmpId == CP_LENGTH) {
- length = cmpnValue;
- } else if (cmpId == CP_CONDITIONALITY) {
- conditionality = cmpnValue;
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
- */
- public Property getComponent(int cmpId) {
- if (cmpId == CP_LENGTH) {
- return length;
- } else if (cmpId == CP_CONDITIONALITY) {
- return conditionality;
- } else {
- return null;
- }
- }
-
- /**
- * Returns the conditionality.
- * @return the conditionality
- */
- public Property getConditionality() {
- return this.conditionality;
- }
-
- /**
- * Returns the length.
- * @return the length
- */
- public Property getLengthComponent() {
- return this.length;
- }
-
- /**
- * Indicates if the length can be discarded on certain conditions.
- * @return true if the length can be discarded.
- */
- public boolean isDiscard() {
- return this.conditionality.getEnum() == Constants.DISCARD;
- }
-
- /**
- * Returns the computed length value.
- * @return the length in millipoints
- */
- public int getLengthValue() {
- return this.length.getLength().getValue();
- }
-
- public String toString() {
- return "CondLength[" + (isDiscard() ? "discard, " : "") +
- length.getObject().toString() + "]";
- }
-
-
- /**
- * @return this.condLength
- */
- public CondLengthProperty getCondLength() {
- return this;
- }
-
- /**
- * TODO: Should we allow this?
- * @return this.condLength cast as a Length
- */
- public LengthProperty getLength() {
- return length.getLength();
- }
-
- /**
- * @return this.condLength cast as an Object
- */
- public Object getObject() {
- return this;
- }
-
-}
+++ /dev/null
-/*
- * $Id: EnumProperty.java,v 1.8 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.fo.properties.PropertyMaker;
-
-/**
- * Superclass for properties that wrap an enumeration value
- */
-public class EnumProperty extends Property {
-
- /**
- * Inner class for creating EnumProperty instances
- */
- public static class Maker extends PropertyMaker {
-
- /**
- * @param propName name of property for which a Maker should be created
- */
- public Maker(int propId) {
- super(propId);
- }
-
- /**
- * Called by subclass if no match found.
- * @param value string containing the value to be checked
- * @return null (indicates that an appropriate match was not found)
- */
- public Property checkEnumValues(String value) {
- //log.error("Unknown enumerated value for property '"
- // + getPropName() + "': " + value);
- return super.checkEnumValues(value);
- }
-
- protected Property findConstant(String value) {
- return null;
- }
-
- public Property convertProperty(Property p,
- PropertyList propertyList,
- FObj fo) throws FOPException {
- if (p instanceof EnumProperty) {
- return p;
- } else {
- return super.convertProperty(p, propertyList, fo);
- }
- }
- }
-
- private int value;
-
- /**
- * @param explicitValue enumerated value to be set for this property
- */
- public EnumProperty(int explicitValue) {
- this.value = explicitValue;
- }
-
- /**
- * @return this.value
- */
- public int getEnum() {
- return this.value;
- }
-
- /**
- * @return this.value cast as an Object
- */
- public Object getObject() {
- // TODO return String value: property must reference maker
- // return maker.getEnumValue(this.value);
- return new Integer(this.value);
- }
-
-}
-
import java.util.Map;
import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.ToBeImplementedProperty;
import org.apache.fop.fo.properties.BorderWidthPropertyMaker;
+import org.apache.fop.fo.properties.CharacterProperty;
+import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.CondLengthProperty;
import org.apache.fop.fo.properties.CorrespondingPropertyMaker;
import org.apache.fop.fo.properties.DimensionPropertyMaker;
+import org.apache.fop.fo.properties.EnumProperty;
import org.apache.fop.fo.properties.IndentPropertyMaker;
+import org.apache.fop.fo.properties.KeepProperty;
+import org.apache.fop.fo.properties.LengthPairProperty;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.fo.properties.LineHeightPropertyMaker;
+import org.apache.fop.fo.properties.ListProperty;
+import org.apache.fop.fo.properties.NumberProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
+import org.apache.fop.fo.properties.SpaceProperty;
+import org.apache.fop.fo.properties.StringProperty;
+import org.apache.fop.fo.properties.ToBeImplementedProperty;
/**
* This class creates and returns an array of Property.Maker instances
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.flow.Marker;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import java.util.Enumeration;
+import org.apache.fop.fo.properties.ListProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
public class GenericShorthandParser implements ShorthandParser {
+++ /dev/null
-/*
- * $Id: KeepProperty.java,v 1.3 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes.CompoundDatatype;
-import org.apache.fop.fo.properties.CompoundPropertyMaker;
-
-/**
- * Superclass for properties that wrap Keep values
- */
-public class KeepProperty extends Property implements CompoundDatatype {
- private Property withinLine;
- private Property withinColumn;
- private Property withinPage;
-
- /**
- * Inner class for creating instances of KeepProperty
- */
- public static class Maker extends CompoundPropertyMaker {
-
- /**
- * @param name name of property for which Maker should be created
- */
- protected Maker(int propId) {
- super(propId);
- }
-
- /**
- * Create a new empty instance of KeepProperty.
- * @return the new instance.
- */
- public Property makeNewProperty() {
- return new KeepProperty();
- }
-
- /**
- * @see CompoundPropertyMaker#convertProperty
- */
- public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
- {
- if (p instanceof KeepProperty) {
- return p;
- }
- return super.convertProperty(p, propertyList, fo);
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
- */
- public void setComponent(int cmpId, Property cmpnValue,
- boolean bIsDefault) {
- if (cmpId == CP_WITHIN_LINE) {
- setWithinLine(cmpnValue, bIsDefault);
- } else if (cmpId == CP_WITHIN_COLUMN) {
- setWithinColumn(cmpnValue, bIsDefault);
- } else if (cmpId == CP_WITHIN_PAGE) {
- setWithinPage(cmpnValue, bIsDefault);
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
- */
- public Property getComponent(int cmpId) {
- if (cmpId == CP_WITHIN_LINE) {
- return getWithinLine();
- } else if (cmpId == CP_WITHIN_COLUMN) {
- return getWithinColumn();
- } else if (cmpId == CP_WITHIN_PAGE) {
- return getWithinPage();
- } else {
- return null;
- }
- }
-
- /**
- * @param withinLine withinLine property to set
- * @param bIsDefault not used (??)
- */
- public void setWithinLine(Property withinLine, boolean bIsDefault) {
- this.withinLine = withinLine;
- }
-
- /**
- * @param withinColumn withinColumn property to set
- * @param bIsDefault not used (??)
- */
- protected void setWithinColumn(Property withinColumn,
- boolean bIsDefault) {
- this.withinColumn = withinColumn;
- }
-
- /**
- * @param withinPage withinPage property to set
- * @param bIsDefault not used (??)
- */
- public void setWithinPage(Property withinPage, boolean bIsDefault) {
- this.withinPage = withinPage;
- }
-
- /**
- * @return the withinLine property
- */
- public Property getWithinLine() {
- return this.withinLine;
- }
-
- /**
- * @return the withinColumn property
- */
- public Property getWithinColumn() {
- return this.withinColumn;
- }
-
- /**
- * @return the withinPage property
- */
- public Property getWithinPage() {
- return this.withinPage;
- }
-
- /**
- * Not sure what to do here. There isn't really a meaningful single value.
- * @return String representation
- */
- public String toString() {
- return "Keep[" +
- "withinLine:" + getWithinLine().getObject() +
- ", withinColumn:" + getWithinColumn().getObject() +
- ", withinPage:" + getWithinPage().getObject() + "]";
- }
-
- /**
- * @return this.keep
- */
- public KeepProperty getKeep() {
- return this;
- }
-
- /**
- * @return this.keep cast as Object
- */
- public Object getObject() {
- return this;
- }
-
-}
+++ /dev/null
-/*
- * $Id: LengthPairProperty.java,v 1.3 2003/03/05 21:48:02 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes.CompoundDatatype;
-import org.apache.fop.fo.properties.CompoundPropertyMaker;
-
-/**
- * Superclass for properties wrapping a LengthPair value
- */
-public class LengthPairProperty extends Property implements CompoundDatatype {
- private Property ipd;
- private Property bpd;
-
- /**
- * Inner class for creating instances of LengthPairProperty
- */
- public static class Maker extends CompoundPropertyMaker {
-
- /**
- * @param name name of property for which this Maker should be created
- */
- protected Maker(int propId) {
- super(propId);
- }
-
- /**
- * Create a new empty instance of LengthPairProperty.
- * @return the new instance.
- */
- public Property makeNewProperty() {
- return new LengthPairProperty();
- }
-
- /**
- * @see CompoundPropertyMaker#convertProperty
- */
- public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
- {
- if (p instanceof LengthPairProperty) {
- return p;
- }
- return super.convertProperty(p, propertyList, fo);
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
- */
- public void setComponent(int cmpId, Property cmpnValue,
- boolean bIsDefault) {
- if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) {
- bpd = cmpnValue;
- } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) {
- ipd = cmpnValue;
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
- */
- public Property getComponent(int cmpId) {
- if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) {
- return getBPD();
- } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) {
- return getIPD();
- } else {
- return null; // SHOULDN'T HAPPEN
- }
- }
-
- /**
- * @return Property holding the ipd length
- */
- public Property getIPD() {
- return this.ipd;
- }
-
- /**
- * @return Property holding the bpd length
- */
- public Property getBPD() {
- return this.bpd;
- }
-
- public String toString() {
- return "LengthPair[" +
- "ipd:" + getIPD().getObject() +
- ", bpd:" + getBPD().getObject() + "]";
- }
-
- /**
- * @return this.lengthPair
- */
- public LengthPairProperty getLengthPair() {
- return this;
- }
-
- /**
- * @return this.lengthPair cast as an Object
- */
- public Object getObject() {
- return this;
- }
-
-}
+++ /dev/null
-/*
- * $Id: LengthProperty.java,v 1.7 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes.AutoLength;
-import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.expr.NumericProperty;
-import org.apache.fop.fo.properties.PropertyMaker;
-
-/**
- * Superclass for properties wrapping a Length value.
- */
-public class LengthProperty extends Property implements Length {
- /** Holds the length in millipoints. */
- protected int millipoints = 0;
- /** Indicates if the value has been computed, or not. */
- protected boolean bIsComputed = false;
-
- /**
- * Inner class for making instances of LengthProperty
- */
- public static class Maker extends PropertyMaker {
- private boolean autoOk = false;
-
- /**
- * @param name name of property for which Maker should be created
- */
- public Maker(int propId) {
- super(propId);
- }
-
- /**
- * protected Property checkPropertyKeywords(String value) {
- * if (isAutoLengthAllowed() && value.equals("auto")) {
- * return new LengthProperty(Length.AUTO);
- * }
- * return null;
- * }
- */
-
- /**
- * @return false (auto-length is not allowed for Length values)
- */
- protected boolean isAutoLengthAllowed() {
- return autoOk;
- }
-
- /**
- * Set the auto length flag.
- * @param inherited
- */
- public void setAutoOk(boolean autoOk) {
- this.autoOk = autoOk;
- }
-
- /**
- * @see Property.Maker#convertProperty
- */
- public Property convertProperty(Property p,
- PropertyList propertyList,
- FObj fo) throws FOPException {
- Property prop = super.convertProperty(p, propertyList, fo);
- if (prop != null) {
- return prop;
- }
- if (isAutoLengthAllowed()) {
- String pval = p.getString();
- if (pval != null && pval.equals("auto")) {
- return new AutoLength();
- }
- }
- if (p instanceof LengthProperty) {
- return p;
- }
- LengthProperty val = p.getLength();
- if (val != null) {
- return val;
- }
- return convertPropertyDatatype(p, propertyList, fo);
- }
-
- }
-
-
- /**
- * Returns the length in 1/1000ths of a point (millipoints)
- * @return the length in millipoints
- */
- public int getValue() {
- if (!bIsComputed) {
- computeValue();
- }
- return millipoints;
- }
-
- /**
- * Computes the value.
- */
- protected void computeValue() {
- }
-
-
- /**
- * Sets the computed value.
- * @param millipoints the length in millipoints
- */
- protected void setComputedValue(int millipoints) {
- setComputedValue(millipoints, true);
- }
-
- /**
- * Sets the computed value.
- * @param millipoints the length in millipoints
- * @param bSetComputed True if the isComputed flag should be set.
- */
- protected void setComputedValue(int millipoints, boolean bSetComputed) {
- this.millipoints = millipoints;
- this.bIsComputed = bSetComputed;
- }
-
- /**
- * Indicates if the length has the "auto" value.
- * @return True if the length is set to "auto"
- */
- public boolean isAuto() {
- return false;
- }
-
- /**
- * Indicates if the length has been computed.
- * @return True if the length has been computed
- */
- public boolean isComputed() {
- return this.bIsComputed;
- }
-
- /**
- * Return the number of table units which are included in this
- * length specification.
- * This will always be 0 unless the property specification used
- * the proportional-column-width() function (only only table
- * column FOs).
- * <p>If this value is not 0, the actual value of the Length cannot
- * be known without looking at all of the columns in the table to
- * determine the value of a "table-unit".
- * @return The number of table units which are included in this
- * length specification.
- */
- public double getTableUnits() {
- return 0.0;
- }
-
- public void resolveTableUnit(double dTableUnit) {
- }
-
- /**
- * @return null (cannot be converted to a Numeric ??)
- */
- public NumericProperty asNumeric() {
- return null;
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- String s = millipoints + "mpt";
- return s;
- }
-
- /**
- * @return this.lenght cast as a Numeric
- */
- public NumericProperty getNumeric() {
- return asNumeric() ;
- }
-
- /**
- * @return this.length
- */
- public LengthProperty getLength() {
- return this;
- }
-
- /**
- * @return this.length cast as an Object
- */
- public Object getObject() {
- return this;
- }
-
-}
-
+++ /dev/null
-/*
- * $Id: LengthRangeProperty.java,v 1.5 2003/03/05 21:48:02 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.datatypes.CompoundDatatype;
-import org.apache.fop.fo.properties.CompoundPropertyMaker;
-
-/**
- * Superclass for properties that contain LengthRange values
- */
-public class LengthRangeProperty extends Property implements CompoundDatatype {
- private Property minimum;
- private Property optimum;
- private Property maximum;
- private static final int MINSET = 1;
- private static final int OPTSET = 2;
- private static final int MAXSET = 4;
- private int bfSet = 0; // bit field
- private boolean bChecked = false;
-
- /**
- * Inner class for a Maker for LengthProperty objects
- */
- public static class Maker extends CompoundPropertyMaker {
-
- /**
- * @param name name of property for which to create Maker
- */
- protected Maker(int propId) {
- super(propId);
- }
-
- /**
- * Create a new empty instance of LengthRangeProperty.
- * @return the new instance.
- */
- public Property makeNewProperty() {
- return new LengthRangeProperty();
- }
-
- /**
- * @see CompoundPropertyMaker#convertProperty
- */
- public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
- {
- if (p instanceof LengthRangeProperty) {
- return p;
- }
- return super.convertProperty(p, propertyList, fo);
- }
- }
-
-
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
- */
- public void setComponent(int cmpId, Property cmpnValue,
- boolean bIsDefault) {
- if (cmpId == CP_MINIMUM) {
- setMinimum(cmpnValue, bIsDefault);
- } else if (cmpId == CP_OPTIMUM) {
- setOptimum(cmpnValue, bIsDefault);
- } else if (cmpId == CP_MAXIMUM) {
- setMaximum(cmpnValue, bIsDefault);
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
- */
- public Property getComponent(int cmpId) {
- if (cmpId == CP_MINIMUM) {
- return getMinimum();
- } else if (cmpId == CP_OPTIMUM) {
- return getOptimum();
- } else if (cmpId == CP_MAXIMUM) {
- return getMaximum();
- } else {
- return null; // SHOULDN'T HAPPEN
- }
- }
-
- /**
- * Set minimum value to min.
- * @param minimum A Length value specifying the minimum value for this
- * LengthRange.
- * @param bIsDefault If true, this is set as a "default" value
- * and not a user-specified explicit value.
- */
- protected void setMinimum(Property minimum, boolean bIsDefault) {
- this.minimum = minimum;
- if (!bIsDefault) {
- bfSet |= MINSET;
- }
- }
-
-
- /**
- * Set maximum value to max if it is >= optimum or optimum isn't set.
- * @param max A Length value specifying the maximum value for this
- * @param bIsDefault If true, this is set as a "default" value
- * and not a user-specified explicit value.
- */
- protected void setMaximum(Property max, boolean bIsDefault) {
- maximum = max;
- if (!bIsDefault) {
- bfSet |= MAXSET;
- }
- }
-
-
- /**
- * Set the optimum value.
- * @param opt A Length value specifying the optimum value for this
- * @param bIsDefault If true, this is set as a "default" value
- * and not a user-specified explicit value.
- */
- protected void setOptimum(Property opt, boolean bIsDefault) {
- optimum = opt;
- if (!bIsDefault) {
- bfSet |= OPTSET;
- }
- }
-
- // Minimum is prioritaire, if explicit
- private void checkConsistency() {
- if (bChecked) {
- return;
- }
- // Make sure max >= min
- // Must also control if have any allowed enum values!
-
- /**
- * *******************
- * if (minimum.mvalue() > maximum.mvalue()) {
- * if ((bfSet&MINSET)!=0) {
- * // if minimum is explicit, force max to min
- * if ((bfSet&MAXSET)!=0) {
- * // Warning: min>max, resetting max to min
- * log.error("forcing max to min in LengthRange");
- * }
- * maximum = minimum ;
- * }
- * else {
- * minimum = maximum; // minimum was default value
- * }
- * }
- * // Now make sure opt <= max and opt >= min
- * if (optimum.mvalue() > maximum.mvalue()) {
- * if ((bfSet&OPTSET)!=0) {
- * if ((bfSet&MAXSET)!=0) {
- * // Warning: opt > max, resetting opt to max
- * log.error("forcing opt to max in LengthRange");
- * optimum = maximum ;
- * }
- * else {
- * maximum = optimum; // maximum was default value
- * }
- * }
- * else {
- * // opt is default and max is explicit or default
- * optimum = maximum ;
- * }
- * }
- * else if (optimum.mvalue() < minimum.mvalue()) {
- * if ((bfSet&MINSET)!=0) {
- * // if minimum is explicit, force opt to min
- * if ((bfSet&OPTSET)!=0) {
- * log.error("forcing opt to min in LengthRange");
- * }
- * optimum = minimum ;
- * }
- * else {
- * minimum = optimum; // minimum was default value
- * }
- * }
- * *******$*******
- */
- bChecked = true;
- }
-
- /**
- * @return minimum length
- */
- public Property getMinimum() {
- checkConsistency();
- return this.minimum;
- }
-
- /**
- * @return maximum length
- */
- public Property getMaximum() {
- checkConsistency();
- return this.maximum;
- }
-
- /**
- * @return optimum length
- */
- public Property getOptimum() {
- checkConsistency();
- return this.optimum;
- }
-
- public String toString() {
- return "LengthRange[" +
- "min:" + getMinimum().getObject() +
- ", max:" + getMaximum().getObject() +
- ", opt:" + getOptimum().getObject() + "]";
- }
-
- /**
- * @return this.lengthRange
- */
- public LengthRangeProperty getLengthRange() {
- return this;
- }
-
- /**
- * @return this.lengthRange cast as an Object
- */
- public Object getObject() {
- return this;
- }
-
-}
+++ /dev/null
-/*
- * $Id: ListProperty.java,v 1.3 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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 java.util.Vector;
-
-import org.apache.fop.fo.properties.PropertyMaker;
-
-/**
- * Superclass for properties that are lists of other properties
- */
-public class ListProperty extends Property {
-
- /**
- * Inner class for creating instances of ListProperty
- */
- public static class Maker extends PropertyMaker {
-
- /**
- * @param name name of property for which Maker should be created
- */
- public Maker(int propId) {
- super(propId);
- }
-
- /**
- * @see Property.Maker#convertProperty
- */
- public Property convertProperty(Property p,
- PropertyList propertyList, FObj fo) {
- if (p instanceof ListProperty) {
- return p;
- } else {
- return new ListProperty(p);
- }
- }
-
- }
-
- /** Vector containing the list of sub-properties */
- protected Vector list;
-
- /**
- * @param prop the first Property to be added to the list
- */
- public ListProperty(Property prop) {
- list = new Vector();
- list.addElement(prop);
- }
-
- /**
- * Add a new property to the list
- * @param prop Property to be added to the list
- */
- public void addProperty(Property prop) {
- list.addElement(prop);
- }
-
- /**
- * @return this.list
- */
- public Vector getList() {
- return list;
- }
-
- /**
- * @return this.list cast as an Object
- */
- public Object getObject() {
- return list;
- }
-
-}
+++ /dev/null
-/*
- * $Id: NumberProperty.java,v 1.6 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.fo.expr.NumericProperty;
-import org.apache.fop.fo.properties.PropertyMaker;
-
-/**
- * Class for handling numeric properties
- */
-public class NumberProperty extends Property {
-
- /**
- * Inner class for making NumberProperty objects
- */
- public static class Maker extends PropertyMaker {
-
- /**
- * Constructor for NumberProperty.Maker
- * @param propName the name of the property
- */
- public Maker(int propId) {
- super(propId);
- }
-
- /**
- * @see Property.Maker#convertProperty
- */
- public 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 Number number;
-
- /**
- * Constructor for Number input
- * @param num Number object value for property
- */
- public NumberProperty(Number num) {
- this.number = num;
- }
-
- /**
- * Constructor for double input
- * @param num double numeric value for property
- */
- public NumberProperty(double num) {
- this.number = new Double(num);
- }
-
- /**
- * Constructor for integer input
- * @param num integer numeric value for property
- */
- public NumberProperty(int num) {
- this.number = new Integer(num);
- }
-
- /**
- * @return this.number cast as a 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());
- * }
- */
-
- /**
- * @return this.number cast as an Object
- */
- public Object getObject() {
- return this.number;
- }
-
- /**
- * Convert NumberProperty to Numeric object
- * @return Numeric object corresponding to this
- */
- public NumericProperty getNumeric() {
- return new NumericProperty(this.number);
- }
-
- /**
- * Convert NumberProperty to a ColorType. Not sure why this is needed.
- * @return ColorType that corresponds to black
- */
- public ColorTypeProperty getColorType() {
- // Convert numeric value to color ???
- // Convert to hexadecimal and then try to make it into a color?
- return new ColorTypeProperty((float)0.0, (float)0.0, (float)0.0);
- }
-
-}
+++ /dev/null
-/*
- * $Id: Property.java,v 1.22 2003/03/05 21:48:02 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.fo.expr.NumericProperty;
-import java.util.Vector;
-
-/**
- * Base class for all property objects
- * @author unascribed
- */
-public class Property {
-
- /**
- * The original specified value for properties which inherit
- * specified values.
- */
- private String specVal;
-
- /**
- * Set the original value specified for the property attribute.
- * @param specVal The specified value.
- */
- public void setSpecifiedValue(String specVal) {
- this.specVal = specVal;
- }
-
- /**
- * Return the original value specified for the property attribute.
- * @return The specified value as a String.
- */
- public String getSpecifiedValue() {
- return specVal;
- }
-
-/*
- * This section contains accessor functions for all possible Property datatypes
- */
-
-
- /**
- * This method expects to be overridden by subclasses
- * @return Length property value
- */
- public LengthProperty getLength() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return ColorType property value
- */
- public ColorTypeProperty getColorType() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return CondLength property value
- */
- public CondLengthProperty getCondLength() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return LenghtRange property value
- */
- public LengthRangeProperty getLengthRange() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return LengthPair property value
- */
- public LengthPairProperty getLengthPair() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return Space property value
- */
- public SpaceProperty getSpace() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return Keep property value
- */
- public KeepProperty getKeep() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return integer equivalent of enumerated property value
- */
- public int getEnum() {
- return 0;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return char property value
- */
- public char getCharacter() {
- return 0;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return collection of other property (sub-property) objects
- */
- public Vector getList() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return Number property value
- */
- public Number getNumber() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return Numeric property value
- */
- public NumericProperty getNumeric() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return NCname property value
- */
- public String getNCname() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses
- * @return Object property value
- */
- public Object getObject() {
- return null;
- }
-
- /**
- * This method expects to be overridden by subclasses.
- * @return String property value
- */
- public String getString() {
- return null;
- }
-
- /**
- * Return a string representation of the property value. Only used
- * for debugging.
- */
- public String toString() {
- return getString();
- }
-}
// FOP
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
/**
// FOP
import org.apache.fop.fonts.Font;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.CommonMarginInline;
*/
package org.apache.fop.fo;
+import org.apache.fop.fo.properties.ListProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
/**
+++ /dev/null
-/*
- * $Id: SpaceProperty.java,v 1.5 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.fo.properties.CompoundPropertyMaker;
-
-/**
- * Base class used for handling properties of the fo:space-before and
- * fo:space-after variety. It is extended by org.apache.fop.fo.properties.GenericSpace,
- * which is extended by many other properties.
- */
-public class SpaceProperty extends LengthRangeProperty {
- private Property precedence;
- private Property conditionality;
-
- /**
- * Inner class used to create new instances of SpaceProperty
- */
- public static class Maker extends CompoundPropertyMaker {
-
- /**
- * @param name name of the property whose Maker is to be created
- */
- protected Maker(int propId) {
- super(propId);
- }
-
- /**
- * Create a new empty instance of SpaceProperty.
- * @return the new instance.
- */
- public Property makeNewProperty() {
- return new SpaceProperty();
- }
-
- /**
- * @see CompoundPropertyMaker#convertProperty
- */
- public Property convertProperty(Property p,
- PropertyList propertyList,
- FObj fo) throws FOPException {
- if (p instanceof SpaceProperty) {
- return p;
- }
- return super.convertProperty(p, propertyList, fo);
- }
- }
-
-
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
- */
- public void setComponent(int cmpId, Property cmpnValue,
- boolean bIsDefault) {
- if (cmpId == CP_PRECEDENCE) {
- setPrecedence(cmpnValue, bIsDefault);
- } else if (cmpId == CP_CONDITIONALITY) {
- setConditionality(cmpnValue, bIsDefault);
- } else {
- super.setComponent(cmpId, cmpnValue, bIsDefault);
- }
- }
-
- /**
- * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
- */
- public Property getComponent(int cmpId) {
- if (cmpId == CP_PRECEDENCE) {
- return getPrecedence();
- } else if (cmpId == CP_CONDITIONALITY) {
- return getConditionality();
- } else {
- return super.getComponent(cmpId);
- }
- }
-
- /**
- *
- * @param precedence precedence Property to set
- * @param bIsDefault (is not used anywhere)
- */
- protected void setPrecedence(Property precedence, boolean bIsDefault) {
- this.precedence = precedence;
- }
-
- /**
- *
- * @param conditionality conditionality Property to set
- * @param bIsDefault (is not used anywhere)
- */
- protected void setConditionality(Property conditionality,
- boolean bIsDefault) {
- this.conditionality = conditionality;
- }
-
- /**
- * @return precedence Property
- */
- public Property getPrecedence() {
- return this.precedence;
- }
-
- /**
- * @return conditionality Property
- */
- public Property getConditionality() {
- return this.conditionality;
- }
-
- public String toString() {
- return "Space[" +
- "min:" + getMinimum().getObject() +
- ", max:" + getMaximum().getObject() +
- ", opt:" + getOptimum().getObject() +
- ", precedence:" + precedence.getObject() +
- ", conditionality:" + conditionality.getObject() + "]";
- }
-
- /**
- * @return the Space (datatype) object contained here
- */
- public SpaceProperty getSpace() {
- return this;
- }
-
- /**
- * Space extends LengthRange.
- * @return the Space (datatype) object contained here
- */
- public LengthRangeProperty getLengthRange() {
- return this;
- }
-
- /**
- * @return the Space (datatype) object contained here
- */
- public Object getObject() {
- return this;
- }
-
-}
+++ /dev/null
-/*
- * $Id: StringProperty.java,v 1.4 2003/03/05 21:48:01 jeremias Exp $
- * ============================================================================
- * The Apache Software License, Version 1.1
- * ============================================================================
- *
- * Copyright (C) 1999-2003 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.fo.properties.PropertyMaker;
-
-/**
- * Exists primarily as a container for its Maker inner class, which is
- * extended by many string-based FO property classes.
- */
-public class StringProperty extends Property {
-
- /**
- * Inner class for making instances of StringProperty
- */
- public static class Maker extends PropertyMaker {
-
- /**
- * @param propName name of property for which to create a Maker
- */
- public Maker(int propId) {
- super(propId);
- }
-
- /**
- * Make a new StringProperty object
- * @param propertyList not used
- * @param value String value of the new object
- * @param fo not used
- * @return the StringProperty object
- */
- 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
- }
- String str = checkValueKeywords(value);
- if (str != null) {
- value = str;
- }
- }
- return new StringProperty(value);
- }
-
- } // end String.Maker
-
- private String str;
-
- /**
- * @param str String value to place in this object
- */
- public StringProperty(String str) {
- this.str = str;
- // System.err.println("Set StringProperty: " + str);
- }
-
- /**
- * @return the Object equivalent of this property
- */
- public Object getObject() {
- return this.str;
- }
-
- /**
- * @return the String equivalent of this property
- */
- public String getString() {
- return this.str;
- }
-
-}
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
/**
* Class modelling the abs Number Function. See Sec. 5.10.1 of the XSL-FO spec.
package org.apache.fop.fo.expr;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.flow.ListItem;
+import org.apache.fop.fo.properties.Property;
/**
* Class corresponding to the body-start Property Value function. See Sec.
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.NumberProperty;
+import org.apache.fop.fo.properties.NumberProperty;
+import org.apache.fop.fo.properties.Property;
class CeilingFunction extends FunctionBase {
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.NumberProperty;
+import org.apache.fop.fo.properties.NumberProperty;
+import org.apache.fop.fo.properties.Property;
class FloorFunction extends FunctionBase {
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FOPropertyMapping;
+import org.apache.fop.fo.properties.Property;
/**
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FOPropertyMapping;
+import org.apache.fop.fo.properties.Property;
/**
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
/**
* Class modelling the from-table-column Property Value function. See Sec.
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.datatypes.PercentBase;
/**
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FOPropertyMapping;
+import org.apache.fop.fo.properties.Property;
/**
* Class modelling the inherited-property-value Property Value function. See
package org.apache.fop.fo.expr;
import org.apache.fop.datatypes.LengthBase;
-import org.apache.fop.datatypes.LinearCombinationLength;
-import org.apache.fop.datatypes.PercentLength;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.LengthProperty;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.flow.ListItem;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.LinearCombinationLength;
+import org.apache.fop.fo.properties.PercentLength;
+import org.apache.fop.fo.properties.Property;
/**
* Class modelling the label-end Property Value function. See Sec. 5.10.4 of the
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
/**
* Class for managing the "max" Number Function. See Sec. 5.10.1 in the XSL-FO
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
/**
* Class for managing the "min" Number Function. See Sec. 5.10.1 in the XSL-FO
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.datatypes.ColorType;
/**
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FOPropertyMapping;
+import org.apache.fop.fo.properties.Property;
/**
* Class modelling the from-nearest-specified-value function. See Sec. 5.10.4
import java.util.Vector;
import org.apache.fop.datatypes.PercentBase;
-import org.apache.fop.datatypes.FixedLength;
-import org.apache.fop.datatypes.TableColLength;
-import org.apache.fop.datatypes.PercentLength;
-import org.apache.fop.datatypes.MixedLength;
-
-import org.apache.fop.fo.ColorTypeProperty;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.Property;
+
+import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.FixedLength;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.MixedLength;
+import org.apache.fop.fo.properties.PercentLength;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.TableColLength;
public class NumericProperty extends Property {
// Bit fields
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
-import org.apache.fop.datatypes.TableColLength;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.TableColLength;
/**
* Class modelling the proportional-column-width function. See Sec. 5.10.4 of
*/
package org.apache.fop.fo.expr;
-import org.apache.fop.datatypes.FixedLength;
import org.apache.fop.datatypes.PercentBase;
-import org.apache.fop.datatypes.PercentLength;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.ColorTypeProperty;
-import org.apache.fop.fo.ListProperty;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.NumberProperty;
-import org.apache.fop.fo.StringProperty;
+import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.FixedLength;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.ListProperty;
+import org.apache.fop.fo.properties.NumberProperty;
+import org.apache.fop.fo.properties.PercentLength;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.StringProperty;
import java.util.HashMap;
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.datatypes.PercentBase;
class RGBColorFunction extends FunctionBase {
package org.apache.fop.fo.expr;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.NumberProperty;
+import org.apache.fop.fo.properties.NumberProperty;
+import org.apache.fop.fo.properties.Property;
class RoundFunction extends FunctionBase {
public int nbArgs() {
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
-import org.apache.fop.fo.LengthProperty;
+import org.apache.fop.fo.properties.LengthProperty;
import org.apache.fop.image.ImageFactory;
import org.apache.fop.image.FopImage;
// Java
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.PercentLength;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.fo.FObjMixed;
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.PercentLength;
import org.apache.fop.fonts.Font;
/**
// FOP
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.fo.LengthRangeProperty;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.CommonRelativePosition;
+import org.apache.fop.fo.properties.LengthRangeProperty;
/**
* Class modelling the fo:table object. See Sec. 6.7.3 of the XSL-FO Standard.
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
+import org.apache.fop.fo.properties.Property;
/**
* Class modelling the fo:table-column object. See Sec. 6.7.4 of the XSL-FO
import org.apache.fop.datatypes.KeepValue;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.fo.Constants;
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.Property;
/**
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOTreeVisitor;
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.Property;
import org.apache.fop.fo.FOPropertyMapping;
/**
// FOP
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.EnumProperty;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.FOTreeVisitor;
import org.apache.fop.fo.properties.CommonAccessibility;
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.EnumProperty;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fonts.Font;
import org.apache.fop.fo.properties.CommonMarginInline;
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+
+/**
+ * A length quantity in XSL which is specified as "auto".
+ */
+public class AutoLength extends LengthProperty {
+
+ /**
+ * @see org.apache.fop.datatypes.Length#isAuto()
+ */
+ public boolean isAuto() {
+ return true;
+ }
+
+ // Should we do something intelligent here to set the actual size?
+ // Would need a reference object!
+ // protected void computeValue() {
+ // }
+
+ /**
+ * @see org.apache.fop.fo.Property#getString()
+ */
+ public String getString() {
+ return "auto";
+ }
+
+}
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
/**
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that wrap a character value
+ */
+public class CharacterProperty extends Property {
+
+ /**
+ * Inner class for creating instances of CharacterProperty
+ */
+ public static class Maker extends PropertyMaker {
+
+ /**
+ * @param propName name of property for which a Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ public Property make(PropertyList propertyList, String value,
+ FObj fo) {
+ char c = value.charAt(0);
+ return new CharacterProperty(c);
+ }
+
+ } // end Charakter.Maker
+
+ private char character;
+
+ /**
+ * @param character character value to be wrapped in this property
+ */
+ public CharacterProperty(char character) {
+ this.character = character;
+ }
+
+ /**
+ * @return this.character cast as an Object
+ */
+ public Object getObject() {
+ return new Character(character);
+ }
+
+ /**
+ * @return this.character
+ */
+ public char getCharacter() {
+ return this.character;
+ }
+
+ /**
+ * @return this.character cast as a String
+ */
+ public String getString() {
+ return new Character(character).toString();
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import java.awt.Color;
+import java.util.StringTokenizer;
+
+import org.apache.fop.datatypes.ColorType;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that wrap ColorType values
+ */
+public class ColorTypeProperty extends Property implements ColorType {
+ /**
+ * the red component
+ */
+ protected float red = 0f;
+
+ /**
+ * the green component
+ */
+ protected float green = 0f;
+
+ /**
+ * the blue component
+ */
+ protected float blue = 0f;
+
+ /**
+ * the alpha component (indicator of opaque-ness)
+ * 0.0 - 1.0; 0.0 is completely transparent; 1.0 is completely opaque
+ * see definition at http://java.sun.com/j2se/1.3/docs/api/java/awt/Color.html
+ */
+ protected float alpha = 1f;
+
+ /**
+ * Inner class for creating instances of ColorTypeProperty
+ */
+ public static class Maker extends PropertyMaker {
+
+ /**
+ * @param propName name of property for which a Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ public Property convertProperty(Property p,
+ PropertyList propertyList, FObj fo) {
+ if (p instanceof ColorTypeProperty) {
+ return p;
+ }
+ ColorTypeProperty val = p.getColorType();
+ if (val != null) {
+ return val;
+ }
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+
+ }
+
+ /**
+ * Main constructor
+ * @param red red component
+ * @param green green component
+ * @param blue blue component
+ */
+ public ColorTypeProperty(float red, float green, float blue) {
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
+ }
+
+ /**
+ * Set the colour given a particular String specifying either a
+ * colour name or #RGB or #RRGGBB
+ * @param value RGB value as String to be parsed
+ */
+ public ColorTypeProperty(String value) {
+ if (value.startsWith("#")) {
+ try {
+ if (value.length() == 4) {
+ // note: divide by 15 so F = FF = 1 and so on
+ this.red = Integer.parseInt(value.substring(1, 2), 16)
+ / 15f;
+ this.green = Integer.parseInt(value.substring(2, 3), 16)
+ / 15f;
+ this.blue = Integer.parseInt(value.substring(3), 16)
+ / 15f;
+ } else if (value.length() == 7) {
+ // note: divide by 255 so FF = 1
+ this.red = Integer.parseInt(value.substring(1, 3), 16)
+ / 255f;
+ this.green = Integer.parseInt(value.substring(3, 5), 16)
+ / 255f;
+ this.blue = Integer.parseInt(value.substring(5), 16)
+ / 255f;
+ } else {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ //log.error("unknown colour format. Must be #RGB or #RRGGBB");
+ }
+ } catch (Exception e) {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ //log.error("unknown colour format. Must be #RGB or #RRGGBB");
+ }
+ } else if (value.startsWith("rgb(")) {
+ int poss = value.indexOf("(");
+ int pose = value.indexOf(")");
+ if (poss != -1 && pose != -1) {
+ value = value.substring(poss + 1, pose);
+ StringTokenizer st = new StringTokenizer(value, ",");
+ try {
+ if (st.hasMoreTokens()) {
+ String str = st.nextToken().trim();
+ if (str.endsWith("%")) {
+ this.red =
+ Integer.parseInt(str.substring(0, str.length() - 1))
+ * 2.55f;
+ } else {
+ this.red = Integer.parseInt(str) / 255f;
+ }
+ }
+ if (st.hasMoreTokens()) {
+ String str = st.nextToken().trim();
+ if (str.endsWith("%")) {
+ this.green =
+ Integer.parseInt(str.substring(0, str.length() - 1))
+ * 2.55f;
+ } else {
+ this.green = Integer.parseInt(str) / 255f;
+ }
+ }
+ if (st.hasMoreTokens()) {
+ String str = st.nextToken().trim();
+ if (str.endsWith("%")) {
+ this.blue =
+ Integer.parseInt(str.substring(0, str.length() - 1))
+ * 2.55f;
+ } else {
+ this.blue = Integer.parseInt(str) / 255f;
+ }
+ }
+ } catch (Exception e) {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ //log.error("unknown colour format. Must be #RGB or #RRGGBB");
+ }
+ }
+ } else if (value.startsWith("url(")) {
+ // refers to a gradient
+ } else {
+ if (value.toLowerCase().equals("transparent")) {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ this.alpha = 0;
+ } else {
+ boolean found = false;
+ for (int count = 0; count < NAMES.length; count++) {
+ if (value.toLowerCase().equals(NAMES[count])) {
+ this.red = VALUES[count][0] / 255f;
+ this.green = VALUES[count][1] / 255f;
+ this.blue = VALUES[count][2] / 255f;
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ //log.error("unknown colour name: "
+ // + value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the blue component of the color.
+ * @return float a value between 0.0 and 1.0
+ */
+ public float getBlue() {
+ return this.blue;
+ }
+
+ /**
+ * Returns the green component of the color.
+ * @return float a value between 0.0 and 1.0
+ */
+ public float getGreen() {
+ return this.green;
+ }
+
+ /**
+ * Returns the red component of the color.
+ * @return float a value between 0.0 and 1.0
+ */
+ public float getRed() {
+ return this.red;
+ }
+
+ /**
+ * Returns the alpha (degree of opaque-ness) component of the color.
+ * @return float a value between 0.0 (fully transparent) and 1.0 (fully opaque)
+ */
+ public float getAlpha() {
+ return this.alpha;
+ }
+
+ /**
+ * Returns an AWT instance of this color
+ * @return float the AWT color represented by this ColorType instance
+ */
+ public Color getAWTColor() {
+ return new Color(this.red, this.green, this.blue, this.alpha);
+ }
+
+ /**
+ * @param floatValue value (between 0.0 and 1.0) of color channel
+ * @return integer equivalent (between 0 and 255)
+ */
+ public static int convertChannelToInteger (float floatValue) {
+ if (floatValue > 1.0) {
+ floatValue = 1.0f;
+ }
+ if (floatValue < 0) {
+ floatValue = 0;
+ }
+ return (int) (floatValue * 255);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer sbuf = new StringBuffer(8);
+ sbuf.append('#');
+ String s = Integer.toHexString((int)(red * 255.0));
+ if (s.length() == 1) {
+ sbuf.append('0');
+ }
+ sbuf.append(s);
+ s = Integer.toHexString((int)(green * 255.0));
+ if (s.length() == 1) {
+ sbuf.append('0');
+ }
+ sbuf.append(s);
+ s = Integer.toHexString((int)(blue * 255.0));
+ if (s.length() == 1) {
+ sbuf.append('0');
+ }
+ sbuf.append(s);
+ return sbuf.toString();
+ }
+
+ /** The names of the predefined colors */
+ protected static final String[] NAMES = {
+ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
+ "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
+ "burlywood", "cadetblue", "chartreuse", "chocolate", "coral",
+ "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue",
+ "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey",
+ "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange",
+ "darkorchid", "darkred", "darksalmon", "darkseagreen",
+ "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise",
+ "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey",
+ "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia",
+ "gainsboro", "lightpink", "lightsalmon", "lightseagreen",
+ "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue",
+ "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon",
+ "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
+ "mediumseagreen", "mediumslateblue", "mediumspringgreen",
+ "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream",
+ "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive",
+ "olivedrab", "orange", "orangered", "orchid", "palegoldenrod",
+ "palegreen", "paleturquoise", "palevioletred", "papayawhip",
+ "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red",
+ "rosybrown", "royalblue", "saddlebrown", "salmon", "ghostwhite",
+ "gold", "goldenrod", "gray", "grey", "green", "greenyellow",
+ "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki",
+ "lavender", "lavenderblush", "lawngreen", "lemonchiffon",
+ "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow",
+ "lightgray", "lightgreen", "lightgrey", "sandybrown", "seagreen",
+ "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray",
+ "slategrey", "snow", "springgreen", "steelblue", "tan", "teal",
+ "thistle", "tomato", "turquoise", "violet", "wheat", "white",
+ "whitesmoke", "yellow", "yellowgreen"
+ };
+
+ /** The color values for the predefined colors */
+ protected static final int[][] VALUES = {
+ {
+ 240, 248, 255
+ }, {
+ 250, 235, 215
+ }, {
+ 0, 255, 255
+ }, {
+ 127, 255, 212
+ }, {
+ 240, 255, 255
+ }, {
+ 245, 245, 220
+ }, {
+ 255, 228, 196
+ }, {
+ 0, 0, 0
+ }, {
+ 255, 235, 205
+ }, {
+ 0, 0, 255
+ }, {
+ 138, 43, 226
+ }, {
+ 165, 42, 42
+ }, {
+ 222, 184, 135
+ }, {
+ 95, 158, 160
+ }, {
+ 127, 255, 0
+ }, {
+ 210, 105, 30
+ }, {
+ 255, 127, 80
+ }, {
+ 100, 149, 237
+ }, {
+ 255, 248, 220
+ }, {
+ 220, 20, 60
+ }, {
+ 0, 255, 255
+ }, {
+ 0, 0, 139
+ }, {
+ 0, 139, 139
+ }, {
+ 184, 134, 11
+ }, {
+ 169, 169, 169
+ }, {
+ 0, 100, 0
+ }, {
+ 169, 169, 169
+ }, {
+ 189, 183, 107
+ }, {
+ 139, 0, 139
+ }, {
+ 85, 107, 47
+ }, {
+ 255, 140, 0
+ }, {
+ 153, 50, 204
+ }, {
+ 139, 0, 0
+ }, {
+ 233, 150, 122
+ }, {
+ 143, 188, 143
+ }, {
+ 72, 61, 139
+ }, {
+ 47, 79, 79
+ }, {
+ 47, 79, 79
+ }, {
+ 0, 206, 209
+ }, {
+ 148, 0, 211
+ }, {
+ 255, 20, 147
+ }, {
+ 0, 191, 255
+ }, {
+ 105, 105, 105
+ }, {
+ 105, 105, 105
+ }, {
+ 30, 144, 255
+ }, {
+ 178, 34, 34
+ }, {
+ 255, 250, 240
+ }, {
+ 34, 139, 34
+ }, {
+ 255, 0, 255
+ }, {
+ 220, 220, 220
+ }, {
+ 255, 182, 193
+ }, {
+ 255, 160, 122
+ }, {
+ 32, 178, 170
+ }, {
+ 135, 206, 250
+ }, {
+ 119, 136, 153
+ }, {
+ 119, 136, 153
+ }, {
+ 176, 196, 222
+ }, {
+ 255, 255, 224
+ }, {
+ 0, 255, 0
+ }, {
+ 50, 205, 50
+ }, {
+ 250, 240, 230
+ }, {
+ 255, 0, 255
+ }, {
+ 128, 0, 0
+ }, {
+ 102, 205, 170
+ }, {
+ 0, 0, 205
+ }, {
+ 186, 85, 211
+ }, {
+ 147, 112, 219
+ }, {
+ 60, 179, 113
+ }, {
+ 123, 104, 238
+ }, {
+ 0, 250, 154
+ }, {
+ 72, 209, 204
+ }, {
+ 199, 21, 133
+ }, {
+ 25, 25, 112
+ }, {
+ 245, 255, 250
+ }, {
+ 255, 228, 225
+ }, {
+ 255, 228, 181
+ }, {
+ 255, 222, 173
+ }, {
+ 0, 0, 128
+ }, {
+ 253, 245, 230
+ }, {
+ 128, 128, 0
+ }, {
+ 107, 142, 35
+ }, {
+ 255, 165, 0
+ }, {
+ 255, 69, 0
+ }, {
+ 218, 112, 214
+ }, {
+ 238, 232, 170
+ }, {
+ 152, 251, 152
+ }, {
+ 175, 238, 238
+ }, {
+ 219, 112, 147
+ }, {
+ 255, 239, 213
+ }, {
+ 255, 218, 185
+ }, {
+ 205, 133, 63
+ }, {
+ 255, 192, 203
+ }, {
+ 221, 160, 221
+ }, {
+ 176, 224, 230
+ }, {
+ 128, 0, 128
+ }, {
+ 255, 0, 0
+ }, {
+ 188, 143, 143
+ }, {
+ 65, 105, 225
+ }, {
+ 139, 69, 19
+ }, {
+ 250, 128, 114
+ }, {
+ 248, 248, 255
+ }, {
+ 255, 215, 0
+ }, {
+ 218, 165, 32
+ }, {
+ 128, 128, 128
+ }, {
+ 128, 128, 128
+ }, {
+ 0, 128, 0
+ }, {
+ 173, 255, 47
+ }, {
+ 240, 255, 240
+ }, {
+ 255, 105, 180
+ }, {
+ 205, 92, 92
+ }, {
+ 75, 0, 130
+ }, {
+ 255, 255, 240
+ }, {
+ 240, 230, 140
+ }, {
+ 230, 230, 250
+ }, {
+ 255, 240, 245
+ }, {
+ 124, 252, 0
+ }, {
+ 255, 250, 205
+ }, {
+ 173, 216, 230
+ }, {
+ 240, 128, 128
+ }, {
+ 224, 255, 255
+ }, {
+ 250, 250, 210
+ }, {
+ 211, 211, 211
+ }, {
+ 144, 238, 144
+ }, {
+ 211, 211, 211
+ }, {
+ 244, 164, 96
+ }, {
+ 46, 139, 87
+ }, {
+ 255, 245, 238
+ }, {
+ 160, 82, 45
+ }, {
+ 192, 192, 192
+ }, {
+ 135, 206, 235
+ }, {
+ 106, 90, 205
+ }, {
+ 112, 128, 144
+ }, {
+ 112, 128, 144
+ }, {
+ 255, 250, 250
+ }, {
+ 0, 255, 127
+ }, {
+ 70, 130, 180
+ }, {
+ 210, 180, 140
+ }, {
+ 0, 128, 128
+ }, {
+ 216, 191, 216
+ }, {
+ 255, 99, 71
+ }, {
+ 64, 224, 208
+ }, {
+ 238, 130, 238
+ }, {
+ 245, 222, 179
+ }, {
+ 255, 255, 255
+ }, {
+ 245, 245, 245
+ }, {
+ 255, 255, 0
+ }, {
+ 154, 205, 50
+ }
+ };
+
+ /*
+ * aliceblue rgb(240, 248, 255)
+ * antiquewhite rgb(250, 235, 215)
+ * aqua rgb( 0, 255, 255)
+ * aquamarine rgb(127, 255, 212)
+ * azure rgb(240, 255, 255)
+ * beige rgb(245, 245, 220)
+ * bisque rgb(255, 228, 196)
+ * black rgb( 0, 0, 0)
+ * blanchedalmond rgb(255, 235, 205)
+ * blue rgb( 0, 0, 255)
+ * blueviolet rgb(138, 43, 226)
+ * brown rgb(165, 42, 42)
+ * burlywood rgb(222, 184, 135)
+ * cadetblue rgb( 95, 158, 160)
+ * chartreuse rgb(127, 255, 0)
+ * chocolate rgb(210, 105, 30)
+ * coral rgb(255, 127, 80)
+ * cornflowerblue rgb(100, 149, 237)
+ * cornsilk rgb(255, 248, 220)
+ * crimson rgb(220, 20, 60)
+ * cyan rgb( 0, 255, 255)
+ * darkblue rgb( 0, 0, 139)
+ * darkcyan rgb( 0, 139, 139)
+ * darkgoldenrod rgb(184, 134, 11)
+ * darkgray rgb(169, 169, 169)
+ * darkgreen rgb( 0, 100, 0)
+ * darkgrey rgb(169, 169, 169)
+ * darkkhaki rgb(189, 183, 107)
+ * darkmagenta rgb(139, 0, 139)
+ * darkolivegreen rgb( 85, 107, 47)
+ * darkorange rgb(255, 140, 0)
+ * darkorchid rgb(153, 50, 204)
+ * darkred rgb(139, 0, 0)
+ * darksalmon rgb(233, 150, 122)
+ * darkseagreen rgb(143, 188, 143)
+ * darkslateblue rgb( 72, 61, 139)
+ * darkslategray rgb( 47, 79, 79)
+ * darkslategrey rgb( 47, 79, 79)
+ * darkturquoise rgb( 0, 206, 209)
+ * darkviolet rgb(148, 0, 211)
+ * deeppink rgb(255, 20, 147)
+ * deepskyblue rgb( 0, 191, 255)
+ * dimgray rgb(105, 105, 105)
+ * dimgrey rgb(105, 105, 105)
+ * dodgerblue rgb( 30, 144, 255)
+ * firebrick rgb(178, 34, 34)
+ * floralwhite rgb(255, 250, 240)
+ * forestgreen rgb( 34, 139, 34)
+ * fuchsia rgb(255, 0, 255)
+ * gainsboro rgb(220, 220, 220)
+ * lightpink rgb(255, 182, 193)
+ * lightsalmon rgb(255, 160, 122)
+ * lightseagreen rgb( 32, 178, 170)
+ * lightskyblue rgb(135, 206, 250)
+ * lightslategray rgb(119, 136, 153)
+ * lightslategrey rgb(119, 136, 153)
+ * lightsteelblue rgb(176, 196, 222)
+ * lightyellow rgb(255, 255, 224)
+ * lime rgb( 0, 255, 0)
+ * limegreen rgb( 50, 205, 50)
+ * linen rgb(250, 240, 230)
+ * magenta rgb(255, 0, 255)
+ * maroon rgb(128, 0, 0)
+ * mediumaquamarine rgb(102, 205, 170)
+ * mediumblue rgb( 0, 0, 205)
+ * mediumorchid rgb(186, 85, 211)
+ * mediumpurple rgb(147, 112, 219)
+ * mediumseagreen rgb( 60, 179, 113)
+ * mediumslateblue rgb(123, 104, 238)
+ * mediumspringgreen rgb( 0, 250, 154)
+ * mediumturquoise rgb( 72, 209, 204)
+ * mediumvioletred rgb(199, 21, 133)
+ * midnightblue rgb( 25, 25, 112)
+ * mintcream rgb(245, 255, 250)
+ * mistyrose rgb(255, 228, 225)
+ * moccasin rgb(255, 228, 181)
+ * navajowhite rgb(255, 222, 173)
+ * navy rgb( 0, 0, 128)
+ * oldlace rgb(253, 245, 230)
+ * olive rgb(128, 128, 0)
+ * olivedrab rgb(107, 142, 35)
+ * orange rgb(255, 165, 0)
+ * orangered rgb(255, 69, 0)
+ * orchid rgb(218, 112, 214)
+ * palegoldenrod rgb(238, 232, 170)
+ * palegreen rgb(152, 251, 152)
+ * paleturquoise rgb(175, 238, 238)
+ * palevioletred rgb(219, 112, 147)
+ * papayawhip rgb(255, 239, 213)
+ * peachpuff rgb(255, 218, 185)
+ * peru rgb(205, 133, 63)
+ * pink rgb(255, 192, 203)
+ * plum rgb(221, 160, 221)
+ * powderblue rgb(176, 224, 230)
+ * purple rgb(128, 0, 128)
+ * red rgb(255, 0, 0)
+ * rosybrown rgb(188, 143, 143)
+ * royalblue rgb( 65, 105, 225)
+ * saddlebrown rgb(139, 69, 19)
+ * salmon rgb(250, 128, 114)
+ * ghostwhite rgb(248, 248, 255)
+ * gold rgb(255, 215, 0)
+ * goldenrod rgb(218, 165, 32)
+ * gray rgb(128, 128, 128)
+ * grey rgb(128, 128, 128)
+ * green rgb( 0, 128, 0)
+ * greenyellow rgb(173, 255, 47)
+ * honeydew rgb(240, 255, 240)
+ * hotpink rgb(255, 105, 180)
+ * indianred rgb(205, 92, 92)
+ * indigo rgb( 75, 0, 130)
+ * ivory rgb(255, 255, 240)
+ * khaki rgb(240, 230, 140)
+ * lavender rgb(230, 230, 250)
+ * lavenderblush rgb(255, 240, 245)
+ * lawngreen rgb(124, 252, 0)
+ * lemonchiffon rgb(255, 250, 205)
+ * lightblue rgb(173, 216, 230)
+ * lightcoral rgb(240, 128, 128)
+ * lightcyan rgb(224, 255, 255)
+ * lightgoldenrodyellow rgb(250, 250, 210)
+ * lightgray rgb(211, 211, 211)
+ * lightgreen rgb(144, 238, 144)
+ * lightgrey rgb(211, 211, 211)
+ * sandybrown rgb(244, 164, 96)
+ * seagreen rgb( 46, 139, 87)
+ * seashell rgb(255, 245, 238)
+ * sienna rgb(160, 82, 45)
+ * silver rgb(192, 192, 192)
+ * skyblue rgb(135, 206, 235)
+ * slateblue rgb(106, 90, 205)
+ * slategray rgb(112, 128, 144)
+ * slategrey rgb(112, 128, 144)
+ * snow rgb(255, 250, 250)
+ * springgreen rgb( 0, 255, 127)
+ * steelblue rgb( 70, 130, 180)
+ * tan rgb(210, 180, 140)
+ * teal rgb( 0, 128, 128)
+ * thistle rgb(216, 191, 216)
+ * tomato rgb(255, 99, 71)
+ * turquoise rgb( 64, 224, 208)
+ * violet rgb(238, 130, 238)
+ * wheat rgb(245, 222, 179)
+ * white rgb(255, 255, 255)
+ * whitesmoke rgb(245, 245, 245)
+ * yellow rgb(255, 255, 0)
+ * yellowgreen rgb(154, 205, 50)
+ */
+
+ /**
+ * Can't convert to any other types
+ * @return this.colorType
+ */
+ public ColorTypeProperty getColorType() {
+ return this;
+ }
+
+ /**
+ * @return this.colorType cast as an Object
+ */
+ public Object getObject() {
+ return this;
+ }
+}
+
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.CondLengthProperty;
/**
* Stores all common border and padding properties.
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.EnumProperty;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
/**
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that have conditional lengths
+ */
+public class CondLengthProperty extends Property implements CompoundDatatype {
+ private Property length;
+ private Property conditionality;
+
+ /**
+ * Inner class for creating instances of CondLengthProperty
+ */
+ public static class Maker extends CompoundPropertyMaker {
+
+ /**
+ * @param name of property for which a Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Create a new empty instance of CondLengthProperty.
+ * @return the new instance.
+ */
+ public Property makeNewProperty() {
+ return new CondLengthProperty();
+ }
+
+ /**
+ * @see CompoundPropertyMaker#convertProperty
+ */
+ public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
+ throws FOPException
+ {
+ if (p instanceof KeepProperty) {
+ return p;
+ }
+ return super.convertProperty(p, propertyList, fo);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
+ */
+ public void setComponent(int cmpId, Property cmpnValue,
+ boolean bIsDefault) {
+ if (cmpId == CP_LENGTH) {
+ length = cmpnValue;
+ } else if (cmpId == CP_CONDITIONALITY) {
+ conditionality = cmpnValue;
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
+ */
+ public Property getComponent(int cmpId) {
+ if (cmpId == CP_LENGTH) {
+ return length;
+ } else if (cmpId == CP_CONDITIONALITY) {
+ return conditionality;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the conditionality.
+ * @return the conditionality
+ */
+ public Property getConditionality() {
+ return this.conditionality;
+ }
+
+ /**
+ * Returns the length.
+ * @return the length
+ */
+ public Property getLengthComponent() {
+ return this.length;
+ }
+
+ /**
+ * Indicates if the length can be discarded on certain conditions.
+ * @return true if the length can be discarded.
+ */
+ public boolean isDiscard() {
+ return this.conditionality.getEnum() == Constants.DISCARD;
+ }
+
+ /**
+ * Returns the computed length value.
+ * @return the length in millipoints
+ */
+ public int getLengthValue() {
+ return this.length.getLength().getValue();
+ }
+
+ public String toString() {
+ return "CondLength[" + (isDiscard() ? "discard, " : "") +
+ length.getObject().toString() + "]";
+ }
+
+
+ /**
+ * @return this.condLength
+ */
+ public CondLengthProperty getCondLength() {
+ return this;
+ }
+
+ /**
+ * TODO: Should we allow this?
+ * @return this.condLength cast as a Length
+ */
+ public LengthProperty getLength() {
+ return length.getLength();
+ }
+
+ /**
+ * @return this.condLength cast as an Object
+ */
+ public Object getObject() {
+ return this;
+ }
+
+}
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
/**
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
/**
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that wrap an enumeration value
+ */
+public class EnumProperty extends Property {
+
+ /**
+ * Inner class for creating EnumProperty instances
+ */
+ public static class Maker extends PropertyMaker {
+
+ /**
+ * @param propName name of property for which a Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Called by subclass if no match found.
+ * @param value string containing the value to be checked
+ * @return null (indicates that an appropriate match was not found)
+ */
+ public Property checkEnumValues(String value) {
+ //log.error("Unknown enumerated value for property '"
+ // + getPropName() + "': " + value);
+ return super.checkEnumValues(value);
+ }
+
+ protected Property findConstant(String value) {
+ return null;
+ }
+
+ public Property convertProperty(Property p,
+ PropertyList propertyList,
+ FObj fo) throws FOPException {
+ if (p instanceof EnumProperty) {
+ return p;
+ } else {
+ return super.convertProperty(p, propertyList, fo);
+ }
+ }
+ }
+
+ private int value;
+
+ /**
+ * @param explicitValue enumerated value to be set for this property
+ */
+ public EnumProperty(int explicitValue) {
+ this.value = explicitValue;
+ }
+
+ /**
+ * @return this.value
+ */
+ public int getEnum() {
+ return this.value;
+ }
+
+ /**
+ * @return this.value cast as an Object
+ */
+ public Object getObject() {
+ // TODO 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-2003 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.properties;
+
+import org.apache.fop.fo.expr.NumericProperty;
+
+/**
+ * a length quantity in XSL
+ */
+public class FixedLength extends LengthProperty {
+
+ /**
+ * Set the length given
+ * @param numRelUnits the number of relative units
+ * @param iCurFontSize the current font size in base units.
+ */
+ public FixedLength(double numRelUnits, int iCurFontSize) {
+ setComputedValue((int)(numRelUnits * (double)iCurFontSize));
+ }
+
+ /**
+ * Set the length given a number of units and a unit name.
+ * @param numUnits quantity of input units
+ * @param units input unit specifier (in, cm, etc.)
+ */
+ public FixedLength(double numUnits, String units) {
+ convert(numUnits, units);
+ }
+
+ /**
+ * @param baseUnits the length as a number of base units (millipoints)
+ */
+ public FixedLength(int baseUnits) {
+ setComputedValue(baseUnits);
+ }
+
+ /**
+ * Convert the given length to a dimensionless integer representing
+ * a whole number of base units (milli-points).
+ * @param dvalue quantity of input units
+ * @param unit input unit specifier (in, cm, etc.)
+ */
+ protected void convert(double dvalue, String unit) {
+
+ int assumedResolution = 1; // points/pixel
+
+ if (unit.equals("in")) {
+ dvalue = dvalue * 72;
+ } else if (unit.equals("cm")) {
+ dvalue = dvalue * 28.3464567;
+ } else if (unit.equals("mm")) {
+ dvalue = dvalue * 2.83464567;
+ } else if (unit.equals("pt")) {
+ // Do nothing.
+ // dvalue = dvalue;
+ } else if (unit.equals("pc")) {
+ dvalue = dvalue * 12;
+ /*
+ * } else if (unit.equals("em")) {
+ * dvalue = dvalue * fontsize;
+ */
+ } else if (unit.equals("px")) {
+ dvalue = dvalue * assumedResolution;
+ } else {
+ dvalue = 0;
+ //log.error("unknown length unit '" + unit
+ // + "'");
+ }
+ setComputedValue((int)(dvalue * 1000));
+ }
+
+ /**
+ * @return Numeric equivalent of this
+ */
+ public NumericProperty asNumeric() {
+ return new NumericProperty(this);
+ }
+}
+
package org.apache.fop.fo.properties;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.FixedLength;
import org.apache.fop.fo.FOPropertyMapping;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.NumericProperty;
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that wrap Keep values
+ */
+public class KeepProperty extends Property implements CompoundDatatype {
+ private Property withinLine;
+ private Property withinColumn;
+ private Property withinPage;
+
+ /**
+ * Inner class for creating instances of KeepProperty
+ */
+ public static class Maker extends CompoundPropertyMaker {
+
+ /**
+ * @param name name of property for which Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Create a new empty instance of KeepProperty.
+ * @return the new instance.
+ */
+ public Property makeNewProperty() {
+ return new KeepProperty();
+ }
+
+ /**
+ * @see CompoundPropertyMaker#convertProperty
+ */
+ public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
+ throws FOPException
+ {
+ if (p instanceof KeepProperty) {
+ return p;
+ }
+ return super.convertProperty(p, propertyList, fo);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
+ */
+ public void setComponent(int cmpId, Property cmpnValue,
+ boolean bIsDefault) {
+ if (cmpId == CP_WITHIN_LINE) {
+ setWithinLine(cmpnValue, bIsDefault);
+ } else if (cmpId == CP_WITHIN_COLUMN) {
+ setWithinColumn(cmpnValue, bIsDefault);
+ } else if (cmpId == CP_WITHIN_PAGE) {
+ setWithinPage(cmpnValue, bIsDefault);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
+ */
+ public Property getComponent(int cmpId) {
+ if (cmpId == CP_WITHIN_LINE) {
+ return getWithinLine();
+ } else if (cmpId == CP_WITHIN_COLUMN) {
+ return getWithinColumn();
+ } else if (cmpId == CP_WITHIN_PAGE) {
+ return getWithinPage();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @param withinLine withinLine property to set
+ * @param bIsDefault not used (??)
+ */
+ public void setWithinLine(Property withinLine, boolean bIsDefault) {
+ this.withinLine = withinLine;
+ }
+
+ /**
+ * @param withinColumn withinColumn property to set
+ * @param bIsDefault not used (??)
+ */
+ protected void setWithinColumn(Property withinColumn,
+ boolean bIsDefault) {
+ this.withinColumn = withinColumn;
+ }
+
+ /**
+ * @param withinPage withinPage property to set
+ * @param bIsDefault not used (??)
+ */
+ public void setWithinPage(Property withinPage, boolean bIsDefault) {
+ this.withinPage = withinPage;
+ }
+
+ /**
+ * @return the withinLine property
+ */
+ public Property getWithinLine() {
+ return this.withinLine;
+ }
+
+ /**
+ * @return the withinColumn property
+ */
+ public Property getWithinColumn() {
+ return this.withinColumn;
+ }
+
+ /**
+ * @return the withinPage property
+ */
+ public Property getWithinPage() {
+ return this.withinPage;
+ }
+
+ /**
+ * Not sure what to do here. There isn't really a meaningful single value.
+ * @return String representation
+ */
+ public String toString() {
+ return "Keep[" +
+ "withinLine:" + getWithinLine().getObject() +
+ ", withinColumn:" + getWithinColumn().getObject() +
+ ", withinPage:" + getWithinPage().getObject() + "]";
+ }
+
+ /**
+ * @return this.keep
+ */
+ public KeepProperty getKeep() {
+ return this;
+ }
+
+ /**
+ * @return this.keep cast as Object
+ */
+ public Object getObject() {
+ return this;
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties wrapping a LengthPair value
+ */
+public class LengthPairProperty extends Property implements CompoundDatatype {
+ private Property ipd;
+ private Property bpd;
+
+ /**
+ * Inner class for creating instances of LengthPairProperty
+ */
+ public static class Maker extends CompoundPropertyMaker {
+
+ /**
+ * @param name name of property for which this Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Create a new empty instance of LengthPairProperty.
+ * @return the new instance.
+ */
+ public Property makeNewProperty() {
+ return new LengthPairProperty();
+ }
+
+ /**
+ * @see CompoundPropertyMaker#convertProperty
+ */
+ public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
+ throws FOPException
+ {
+ if (p instanceof LengthPairProperty) {
+ return p;
+ }
+ return super.convertProperty(p, propertyList, fo);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
+ */
+ public void setComponent(int cmpId, Property cmpnValue,
+ boolean bIsDefault) {
+ if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) {
+ bpd = cmpnValue;
+ } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) {
+ ipd = cmpnValue;
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
+ */
+ public Property getComponent(int cmpId) {
+ if (cmpId == CP_BLOCK_PROGRESSION_DIRECTION) {
+ return getBPD();
+ } else if (cmpId == CP_INLINE_PROGRESSION_DIRECTION) {
+ return getIPD();
+ } else {
+ return null; // SHOULDN'T HAPPEN
+ }
+ }
+
+ /**
+ * @return Property holding the ipd length
+ */
+ public Property getIPD() {
+ return this.ipd;
+ }
+
+ /**
+ * @return Property holding the bpd length
+ */
+ public Property getBPD() {
+ return this.bpd;
+ }
+
+ public String toString() {
+ return "LengthPair[" +
+ "ipd:" + getIPD().getObject() +
+ ", bpd:" + getBPD().getObject() + "]";
+ }
+
+ /**
+ * @return this.lengthPair
+ */
+ public LengthPairProperty getLengthPair() {
+ return this;
+ }
+
+ /**
+ * @return this.lengthPair cast as an Object
+ */
+ public Object getObject() {
+ return this;
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.NumericProperty;
+
+/**
+ * Superclass for properties wrapping a Length value.
+ */
+public class LengthProperty extends Property implements Length {
+ /** Holds the length in millipoints. */
+ protected int millipoints = 0;
+ /** Indicates if the value has been computed, or not. */
+ protected boolean bIsComputed = false;
+
+ /**
+ * Inner class for making instances of LengthProperty
+ */
+ public static class Maker extends PropertyMaker {
+ private boolean autoOk = false;
+
+ /**
+ * @param name name of property for which Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * protected Property checkPropertyKeywords(String value) {
+ * if (isAutoLengthAllowed() && value.equals("auto")) {
+ * return new LengthProperty(Length.AUTO);
+ * }
+ * return null;
+ * }
+ */
+
+ /**
+ * @return false (auto-length is not allowed for Length values)
+ */
+ protected boolean isAutoLengthAllowed() {
+ return autoOk;
+ }
+
+ /**
+ * Set the auto length flag.
+ * @param inherited
+ */
+ public void setAutoOk(boolean autoOk) {
+ this.autoOk = autoOk;
+ }
+
+ /**
+ * @see Property.Maker#convertProperty
+ */
+ public Property convertProperty(Property p,
+ PropertyList propertyList,
+ FObj fo) throws FOPException {
+ Property prop = super.convertProperty(p, propertyList, fo);
+ if (prop != null) {
+ return prop;
+ }
+ if (isAutoLengthAllowed()) {
+ String pval = p.getString();
+ if (pval != null && pval.equals("auto")) {
+ return new AutoLength();
+ }
+ }
+ if (p instanceof LengthProperty) {
+ return p;
+ }
+ LengthProperty val = p.getLength();
+ if (val != null) {
+ return val;
+ }
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+
+ }
+
+
+ /**
+ * Returns the length in 1/1000ths of a point (millipoints)
+ * @return the length in millipoints
+ */
+ public int getValue() {
+ if (!bIsComputed) {
+ computeValue();
+ }
+ return millipoints;
+ }
+
+ /**
+ * Computes the value.
+ */
+ protected void computeValue() {
+ }
+
+
+ /**
+ * Sets the computed value.
+ * @param millipoints the length in millipoints
+ */
+ protected void setComputedValue(int millipoints) {
+ setComputedValue(millipoints, true);
+ }
+
+ /**
+ * Sets the computed value.
+ * @param millipoints the length in millipoints
+ * @param bSetComputed True if the isComputed flag should be set.
+ */
+ protected void setComputedValue(int millipoints, boolean bSetComputed) {
+ this.millipoints = millipoints;
+ this.bIsComputed = bSetComputed;
+ }
+
+ /**
+ * Indicates if the length has the "auto" value.
+ * @return True if the length is set to "auto"
+ */
+ public boolean isAuto() {
+ return false;
+ }
+
+ /**
+ * Indicates if the length has been computed.
+ * @return True if the length has been computed
+ */
+ public boolean isComputed() {
+ return this.bIsComputed;
+ }
+
+ /**
+ * Return the number of table units which are included in this
+ * length specification.
+ * This will always be 0 unless the property specification used
+ * the proportional-column-width() function (only only table
+ * column FOs).
+ * <p>If this value is not 0, the actual value of the Length cannot
+ * be known without looking at all of the columns in the table to
+ * determine the value of a "table-unit".
+ * @return The number of table units which are included in this
+ * length specification.
+ */
+ public double getTableUnits() {
+ return 0.0;
+ }
+
+ public void resolveTableUnit(double dTableUnit) {
+ }
+
+ /**
+ * @return null (cannot be converted to a Numeric ??)
+ */
+ public NumericProperty asNumeric() {
+ return null;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ String s = millipoints + "mpt";
+ return s;
+ }
+
+ /**
+ * @return this.lenght cast as a Numeric
+ */
+ public NumericProperty getNumeric() {
+ return asNumeric() ;
+ }
+
+ /**
+ * @return this.length
+ */
+ public LengthProperty getLength() {
+ return this;
+ }
+
+ /**
+ * @return this.length cast as an Object
+ */
+ public Object getObject() {
+ return this;
+ }
+
+}
+
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that contain LengthRange values
+ */
+public class LengthRangeProperty extends Property implements CompoundDatatype {
+ private Property minimum;
+ private Property optimum;
+ private Property maximum;
+ private static final int MINSET = 1;
+ private static final int OPTSET = 2;
+ private static final int MAXSET = 4;
+ private int bfSet = 0; // bit field
+ private boolean bChecked = false;
+
+ /**
+ * Inner class for a Maker for LengthProperty objects
+ */
+ public static class Maker extends CompoundPropertyMaker {
+
+ /**
+ * @param name name of property for which to create Maker
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Create a new empty instance of LengthRangeProperty.
+ * @return the new instance.
+ */
+ public Property makeNewProperty() {
+ return new LengthRangeProperty();
+ }
+
+ /**
+ * @see CompoundPropertyMaker#convertProperty
+ */
+ public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
+ throws FOPException
+ {
+ if (p instanceof LengthRangeProperty) {
+ return p;
+ }
+ return super.convertProperty(p, propertyList, fo);
+ }
+ }
+
+
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
+ */
+ public void setComponent(int cmpId, Property cmpnValue,
+ boolean bIsDefault) {
+ if (cmpId == CP_MINIMUM) {
+ setMinimum(cmpnValue, bIsDefault);
+ } else if (cmpId == CP_OPTIMUM) {
+ setOptimum(cmpnValue, bIsDefault);
+ } else if (cmpId == CP_MAXIMUM) {
+ setMaximum(cmpnValue, bIsDefault);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
+ */
+ public Property getComponent(int cmpId) {
+ if (cmpId == CP_MINIMUM) {
+ return getMinimum();
+ } else if (cmpId == CP_OPTIMUM) {
+ return getOptimum();
+ } else if (cmpId == CP_MAXIMUM) {
+ return getMaximum();
+ } else {
+ return null; // SHOULDN'T HAPPEN
+ }
+ }
+
+ /**
+ * Set minimum value to min.
+ * @param minimum A Length value specifying the minimum value for this
+ * LengthRange.
+ * @param bIsDefault If true, this is set as a "default" value
+ * and not a user-specified explicit value.
+ */
+ protected void setMinimum(Property minimum, boolean bIsDefault) {
+ this.minimum = minimum;
+ if (!bIsDefault) {
+ bfSet |= MINSET;
+ }
+ }
+
+
+ /**
+ * Set maximum value to max if it is >= optimum or optimum isn't set.
+ * @param max A Length value specifying the maximum value for this
+ * @param bIsDefault If true, this is set as a "default" value
+ * and not a user-specified explicit value.
+ */
+ protected void setMaximum(Property max, boolean bIsDefault) {
+ maximum = max;
+ if (!bIsDefault) {
+ bfSet |= MAXSET;
+ }
+ }
+
+
+ /**
+ * Set the optimum value.
+ * @param opt A Length value specifying the optimum value for this
+ * @param bIsDefault If true, this is set as a "default" value
+ * and not a user-specified explicit value.
+ */
+ protected void setOptimum(Property opt, boolean bIsDefault) {
+ optimum = opt;
+ if (!bIsDefault) {
+ bfSet |= OPTSET;
+ }
+ }
+
+ // Minimum is prioritaire, if explicit
+ private void checkConsistency() {
+ if (bChecked) {
+ return;
+ }
+ // Make sure max >= min
+ // Must also control if have any allowed enum values!
+
+ /**
+ * *******************
+ * if (minimum.mvalue() > maximum.mvalue()) {
+ * if ((bfSet&MINSET)!=0) {
+ * // if minimum is explicit, force max to min
+ * if ((bfSet&MAXSET)!=0) {
+ * // Warning: min>max, resetting max to min
+ * log.error("forcing max to min in LengthRange");
+ * }
+ * maximum = minimum ;
+ * }
+ * else {
+ * minimum = maximum; // minimum was default value
+ * }
+ * }
+ * // Now make sure opt <= max and opt >= min
+ * if (optimum.mvalue() > maximum.mvalue()) {
+ * if ((bfSet&OPTSET)!=0) {
+ * if ((bfSet&MAXSET)!=0) {
+ * // Warning: opt > max, resetting opt to max
+ * log.error("forcing opt to max in LengthRange");
+ * optimum = maximum ;
+ * }
+ * else {
+ * maximum = optimum; // maximum was default value
+ * }
+ * }
+ * else {
+ * // opt is default and max is explicit or default
+ * optimum = maximum ;
+ * }
+ * }
+ * else if (optimum.mvalue() < minimum.mvalue()) {
+ * if ((bfSet&MINSET)!=0) {
+ * // if minimum is explicit, force opt to min
+ * if ((bfSet&OPTSET)!=0) {
+ * log.error("forcing opt to min in LengthRange");
+ * }
+ * optimum = minimum ;
+ * }
+ * else {
+ * minimum = optimum; // minimum was default value
+ * }
+ * }
+ * *******$*******
+ */
+ bChecked = true;
+ }
+
+ /**
+ * @return minimum length
+ */
+ public Property getMinimum() {
+ checkConsistency();
+ return this.minimum;
+ }
+
+ /**
+ * @return maximum length
+ */
+ public Property getMaximum() {
+ checkConsistency();
+ return this.maximum;
+ }
+
+ /**
+ * @return optimum length
+ */
+ public Property getOptimum() {
+ checkConsistency();
+ return this.optimum;
+ }
+
+ public String toString() {
+ return "LengthRange[" +
+ "min:" + getMinimum().getObject() +
+ ", max:" + getMaximum().getObject() +
+ ", opt:" + getOptimum().getObject() + "]";
+ }
+
+ /**
+ * @return this.lengthRange
+ */
+ public LengthRangeProperty getLengthRange() {
+ return this;
+ }
+
+ /**
+ * @return this.lengthRange cast as an Object
+ */
+ public Object getObject() {
+ return this;
+ }
+
+}
package org.apache.fop.fo.properties;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.PercentLength;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
/**
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import java.util.Vector;
+
+import org.apache.fop.datatypes.Length;
+
+/**
+ * Class modelling lengths that are build up by combining other lengths
+ */
+public class LinearCombinationLength extends LengthProperty {
+
+ /** Collection of factors (1-1 correspondence with {@link #lengths} */
+ protected Vector factors;
+ /** Collection of Length objects (1-1 correspondence with {@link #factors} */
+ protected Vector lengths;
+
+ /**
+ * Constructor. Creates no content. Use {link #addTerm} to build content.
+ */
+ public LinearCombinationLength() {
+ factors = new Vector();
+ lengths = new Vector();
+ }
+
+ /**
+ * Add an item to this
+ * @param factor the factor to be added
+ * @param length the Length to be added
+ */
+ public void addTerm(double factor, LengthProperty length) {
+ factors.addElement(new Double(factor));
+ lengths.addElement(length);
+ }
+
+ /**
+ * Sets the computed value in millipoints.
+ */
+ protected void computeValue() {
+ int result = 0;
+ int numFactors = factors.size();
+ for (int i = 0; i < numFactors; ++i) {
+ result +=
+ (int)(((Double)factors.elementAt(i)).doubleValue()
+ * (double)((Length)lengths.elementAt(i)).getValue());
+ }
+ setComputedValue(result);
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import java.util.Vector;
+
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Superclass for properties that are lists of other properties
+ */
+public class ListProperty extends Property {
+
+ /**
+ * Inner class for creating instances of ListProperty
+ */
+ public static class Maker extends PropertyMaker {
+
+ /**
+ * @param name name of property for which Maker should be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * @see Property.Maker#convertProperty
+ */
+ public Property convertProperty(Property p,
+ PropertyList propertyList, FObj fo) {
+ if (p instanceof ListProperty) {
+ return p;
+ } else {
+ return new ListProperty(p);
+ }
+ }
+
+ }
+
+ /** Vector containing the list of sub-properties */
+ protected Vector list;
+
+ /**
+ * @param prop the first Property to be added to the list
+ */
+ public ListProperty(Property prop) {
+ list = new Vector();
+ list.addElement(prop);
+ }
+
+ /**
+ * Add a new property to the list
+ * @param prop Property to be added to the list
+ */
+ public void addProperty(Property prop) {
+ list.addElement(prop);
+ }
+
+ /**
+ * @return this.list
+ */
+ public Vector getList() {
+ return list;
+ }
+
+ /**
+ * @return this.list cast as an Object
+ */
+ public Object getObject() {
+ return list;
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.apache.fop.fo.expr.NumericProperty;
+import org.apache.fop.fo.expr.PropertyException;
+
+/**
+ * A length quantity in XSL which is specified with a mixture
+ * of absolute and relative and/or percent components.
+ * The actual value may not be computable before layout is done.
+ */
+public class MixedLength extends LengthProperty {
+
+ /** The collection of Length objects comprising this MixedLength object */
+ private Vector lengths ;
+
+ /**
+ * Constructor
+ * @param lengths the collection of Length objects which comprise the new
+ * MixedLength object
+ */
+ public MixedLength(Vector lengths) {
+ this.lengths = lengths;
+ }
+
+ /**
+ * Iterates through each internal component, computing and
+ * summarizing the values, then setting the value for this
+ */
+ protected void computeValue() {
+ int computedValue = 0;
+ boolean bAllComputed = true;
+ Enumeration e = lengths.elements();
+ while (e.hasMoreElements()) {
+ LengthProperty l = (LengthProperty) e.nextElement();
+ computedValue += l.getValue();
+ if (!l.isComputed()) {
+ bAllComputed = false;
+ }
+ }
+ setComputedValue(computedValue, bAllComputed);
+ }
+
+
+ public double getTableUnits() {
+ double tableUnits = 0.0;
+ Enumeration e = lengths.elements();
+ while (e.hasMoreElements()) {
+ tableUnits += ((LengthProperty) e.nextElement()).getTableUnits();
+ }
+ return tableUnits;
+ }
+
+ public void resolveTableUnit(double dTableUnit) {
+ Enumeration e = lengths.elements();
+ while (e.hasMoreElements()) {
+ ((LengthProperty) e.nextElement()).resolveTableUnit(dTableUnit);
+ }
+ }
+
+ /**
+ * @return String equivalent of this
+ */
+ public String toString() {
+ StringBuffer sbuf = new StringBuffer();
+ Enumeration e = lengths.elements();
+ while (e.hasMoreElements()) {
+ if (sbuf.length() > 0) {
+ sbuf.append('+');
+ }
+ sbuf.append(e.nextElement().toString());
+ }
+ return sbuf.toString();
+ }
+
+ /**
+ * @return Numeric equivalent of this
+ */
+ public NumericProperty asNumeric() {
+ NumericProperty numeric = null;
+ for (Enumeration e = lengths.elements(); e.hasMoreElements();) {
+ LengthProperty l = (LengthProperty) e.nextElement();
+ if (numeric == null) {
+ numeric = l.asNumeric();
+ } else {
+ try {
+ NumericProperty sum = numeric.add(l.asNumeric());
+ numeric = sum;
+ } catch (PropertyException pe) {
+ System.err.println(
+ "Can't convert MixedLength to Numeric: " + pe);
+ }
+ }
+ }
+ return numeric;
+ }
+}
+
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.NumericProperty;
+
+/**
+ * Class for handling numeric properties
+ */
+public class NumberProperty extends Property {
+
+ /**
+ * Inner class for making NumberProperty objects
+ */
+ public static class Maker extends PropertyMaker {
+
+ /**
+ * Constructor for NumberProperty.Maker
+ * @param propName the name of the property
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * @see Property.Maker#convertProperty
+ */
+ public 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 Number number;
+
+ /**
+ * Constructor for Number input
+ * @param num Number object value for property
+ */
+ public NumberProperty(Number num) {
+ this.number = num;
+ }
+
+ /**
+ * Constructor for double input
+ * @param num double numeric value for property
+ */
+ public NumberProperty(double num) {
+ this.number = new Double(num);
+ }
+
+ /**
+ * Constructor for integer input
+ * @param num integer numeric value for property
+ */
+ public NumberProperty(int num) {
+ this.number = new Integer(num);
+ }
+
+ /**
+ * @return this.number cast as a 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());
+ * }
+ */
+
+ /**
+ * @return this.number cast as an Object
+ */
+ public Object getObject() {
+ return this.number;
+ }
+
+ /**
+ * Convert NumberProperty to Numeric object
+ * @return Numeric object corresponding to this
+ */
+ public NumericProperty getNumeric() {
+ return new NumericProperty(this.number);
+ }
+
+ /**
+ * Convert NumberProperty to a ColorType. Not sure why this is needed.
+ * @return ColorType that corresponds to black
+ */
+ public ColorTypeProperty getColorType() {
+ // Convert numeric value to color ???
+ // Convert to hexadecimal and then try to make it into a color?
+ return new ColorTypeProperty((float)0.0, (float)0.0, (float)0.0);
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.fo.expr.NumericProperty;
+
+/**
+ * a percent specified length quantity in XSL
+ */
+public class PercentLength extends LengthProperty {
+
+ /**
+ * The percentage itself, expressed as a decimal value, e.g. for 95%, set
+ * the value to .95
+ */
+ private double factor;
+
+ /**
+ * A PercentBase implementation that contains the base length to which the
+ * {@link #factor} should be applied to compute the actual length
+ */
+ private PercentBase lbase = null;
+
+ /**
+ * Main constructor. Construct an object based on a factor (the percent,
+ * as a factor) and an object which has a method to return the Length which
+ * provides the "base" for the actual length that is modeled.
+ * @param factor the percentage factor, expressed as a decimal (e.g. use
+ * .95 to represent 95%)
+ * @param lbase base property to which the factor should be applied
+ */
+ public PercentLength(double factor, PercentBase lbase) {
+ this.factor = factor;
+ this.lbase = lbase;
+ }
+
+ /**
+ * Convenience constructor when only the factor is known
+ * @param factor the percentage factor, expressed as a decimal (e.g. use
+ * .95 to represent 95%)
+ */
+ public PercentLength(double factor) {
+ this(factor, null);
+ }
+
+ /**
+ * @param lbase the base to set
+ */
+ public void setBaseLength(PercentBase lbase) {
+ this.lbase = lbase;
+ }
+
+ /**
+ * @return the base
+ */
+ public PercentBase getBaseLength() {
+ return this.lbase;
+ }
+
+ /**
+ * Return the computed value in millipoints. This assumes that the
+ * base length has been resolved to an absolute length value.
+ */
+ protected void computeValue() {
+ setComputedValue((int)(factor * (double)lbase.getBaseLength()));
+ }
+
+ /**
+ *
+ * @return the factor
+ */
+ public double value() {
+ return factor;
+ }
+
+ /**
+ * @return the String equivalent of this
+ */
+ public String toString() {
+ // TODO: What about the base value?
+ return (new Double(factor * 100.0).toString()) + "%";
+ }
+
+ /**
+ * @return new Numeric object that is equivalent to this
+ */
+ public NumericProperty asNumeric() {
+ return new NumericProperty(this);
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.fo.expr.NumericProperty;
+
+import java.util.Vector;
+
+/**
+ * Base class for all property objects
+ * @author unascribed
+ */
+public class Property {
+
+ /**
+ * The original specified value for properties which inherit
+ * specified values.
+ */
+ private String specVal;
+
+ /**
+ * Set the original value specified for the property attribute.
+ * @param specVal The specified value.
+ */
+ public void setSpecifiedValue(String specVal) {
+ this.specVal = specVal;
+ }
+
+ /**
+ * Return the original value specified for the property attribute.
+ * @return The specified value as a String.
+ */
+ public String getSpecifiedValue() {
+ return specVal;
+ }
+
+/*
+ * This section contains accessor functions for all possible Property datatypes
+ */
+
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return Length property value
+ */
+ public LengthProperty getLength() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return ColorType property value
+ */
+ public ColorTypeProperty getColorType() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return CondLength property value
+ */
+ public CondLengthProperty getCondLength() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return LenghtRange property value
+ */
+ public LengthRangeProperty getLengthRange() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return LengthPair property value
+ */
+ public LengthPairProperty getLengthPair() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return Space property value
+ */
+ public SpaceProperty getSpace() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return Keep property value
+ */
+ public KeepProperty getKeep() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return integer equivalent of enumerated property value
+ */
+ public int getEnum() {
+ return 0;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return char property value
+ */
+ public char getCharacter() {
+ return 0;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return collection of other property (sub-property) objects
+ */
+ public Vector getList() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return Number property value
+ */
+ public Number getNumber() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return Numeric property value
+ */
+ public NumericProperty getNumeric() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return NCname property value
+ */
+ public String getNCname() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses
+ * @return Object property value
+ */
+ public Object getObject() {
+ return null;
+ }
+
+ /**
+ * This method expects to be overridden by subclasses.
+ * @return String property value
+ */
+ public String getString() {
+ return null;
+ }
+
+ /**
+ * Return a string representation of the property value. Only used
+ * for debugging.
+ */
+ public String toString() {
+ return getString();
+ }
+}
import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.ListProperty;
-import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ShorthandParser;
import org.apache.fop.fo.expr.PropertyInfo;
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Base class used for handling properties of the fo:space-before and
+ * fo:space-after variety. It is extended by org.apache.fop.fo.properties.GenericSpace,
+ * which is extended by many other properties.
+ */
+public class SpaceProperty extends LengthRangeProperty {
+ private Property precedence;
+ private Property conditionality;
+
+ /**
+ * Inner class used to create new instances of SpaceProperty
+ */
+ public static class Maker extends CompoundPropertyMaker {
+
+ /**
+ * @param name name of the property whose Maker is to be created
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Create a new empty instance of SpaceProperty.
+ * @return the new instance.
+ */
+ public Property makeNewProperty() {
+ return new SpaceProperty();
+ }
+
+ /**
+ * @see CompoundPropertyMaker#convertProperty
+ */
+ public Property convertProperty(Property p,
+ PropertyList propertyList,
+ FObj fo) throws FOPException {
+ if (p instanceof SpaceProperty) {
+ return p;
+ }
+ return super.convertProperty(p, propertyList, fo);
+ }
+ }
+
+
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
+ */
+ public void setComponent(int cmpId, Property cmpnValue,
+ boolean bIsDefault) {
+ if (cmpId == CP_PRECEDENCE) {
+ setPrecedence(cmpnValue, bIsDefault);
+ } else if (cmpId == CP_CONDITIONALITY) {
+ setConditionality(cmpnValue, bIsDefault);
+ } else {
+ super.setComponent(cmpId, cmpnValue, bIsDefault);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
+ */
+ public Property getComponent(int cmpId) {
+ if (cmpId == CP_PRECEDENCE) {
+ return getPrecedence();
+ } else if (cmpId == CP_CONDITIONALITY) {
+ return getConditionality();
+ } else {
+ return super.getComponent(cmpId);
+ }
+ }
+
+ /**
+ *
+ * @param precedence precedence Property to set
+ * @param bIsDefault (is not used anywhere)
+ */
+ protected void setPrecedence(Property precedence, boolean bIsDefault) {
+ this.precedence = precedence;
+ }
+
+ /**
+ *
+ * @param conditionality conditionality Property to set
+ * @param bIsDefault (is not used anywhere)
+ */
+ protected void setConditionality(Property conditionality,
+ boolean bIsDefault) {
+ this.conditionality = conditionality;
+ }
+
+ /**
+ * @return precedence Property
+ */
+ public Property getPrecedence() {
+ return this.precedence;
+ }
+
+ /**
+ * @return conditionality Property
+ */
+ public Property getConditionality() {
+ return this.conditionality;
+ }
+
+ public String toString() {
+ return "Space[" +
+ "min:" + getMinimum().getObject() +
+ ", max:" + getMaximum().getObject() +
+ ", opt:" + getOptimum().getObject() +
+ ", precedence:" + precedence.getObject() +
+ ", conditionality:" + conditionality.getObject() + "]";
+ }
+
+ /**
+ * @return the Space (datatype) object contained here
+ */
+ public SpaceProperty getSpace() {
+ return this;
+ }
+
+ /**
+ * Space extends LengthRange.
+ * @return the Space (datatype) object contained here
+ */
+ public LengthRangeProperty getLengthRange() {
+ return this;
+ }
+
+ /**
+ * @return the Space (datatype) object contained here
+ */
+ public Object getObject() {
+ return this;
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Exists primarily as a container for its Maker inner class, which is
+ * extended by many string-based FO property classes.
+ */
+public class StringProperty extends Property {
+
+ /**
+ * Inner class for making instances of StringProperty
+ */
+ public static class Maker extends PropertyMaker {
+
+ /**
+ * @param propName name of property for which to create a Maker
+ */
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * Make a new StringProperty object
+ * @param propertyList not used
+ * @param value String value of the new object
+ * @param fo not used
+ * @return the StringProperty object
+ */
+ 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
+ }
+ String str = checkValueKeywords(value);
+ if (str != null) {
+ value = str;
+ }
+ }
+ return new StringProperty(value);
+ }
+
+ } // end String.Maker
+
+ private String str;
+
+ /**
+ * @param str String value to place in this object
+ */
+ public StringProperty(String str) {
+ this.str = str;
+ // System.err.println("Set StringProperty: " + str);
+ }
+
+ /**
+ * @return the Object equivalent of this property
+ */
+ public Object getObject() {
+ return this.str;
+ }
+
+ /**
+ * @return the String equivalent of this property
+ */
+ public String getString() {
+ return this.str;
+ }
+
+}
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.fo.expr.NumericProperty;
+
+/**
+ * A table-column width specification, possibly including some
+ * number of proportional "column-units". The absolute size of a
+ * column-unit depends on the fixed and proportional sizes of all
+ * columns in the table, and on the overall size of the table.
+ * It can't be calculated until all columns have been specified and until
+ * the actual width of the table is known. Since this can be specified
+ * as a percent of its parent containing width, the calculation is done
+ * during layout.
+ * NOTE: this is only supposed to be allowed if table-layout=fixed.
+ */
+public class TableColLength extends LengthProperty {
+
+ /**
+ * Number of table-column proportional units
+ */
+ private double tcolUnits;
+
+ /**
+ * Construct an object with tcolUnits of proportional measure.
+ * @param tcolUnits number of table-column proportional units
+ */
+ public TableColLength(double tcolUnits) {
+ this.tcolUnits = tcolUnits;
+ }
+
+ /**
+ * Override the method in Length
+ * @return the number of specified proportional table-column units.
+ */
+ public double getTableUnits() {
+ return tcolUnits;
+ }
+
+ /**
+ * Calculate the number of millipoints and set it.
+ * @param mpointsPerUnit density of millipoints per unit
+ */
+ public void resolveTableUnit(double mpointsPerUnit) {
+ setComputedValue((int)(tcolUnits * mpointsPerUnit));
+ }
+
+ //If the table-unit can be resolved, set the computed value
+ /*protected void computeValue() {
+ if (tblUnitBase.canResolveUnit()) {
+ rslt += (int)(tcolUnits * (double)tblUnitBase.getUnitValue());
+ setComputedValue(rslt);
+ }
+ }*/
+
+ /**
+ * Convert this to a String
+ * @return the string representation of this
+ */
+ public String toString() {
+ return (Double.toString(tcolUnits) + " table-column-units");
+ }
+
+ /**
+ * Converts this to a new Numeric object
+ * @return the Numeric object
+ */
+ public NumericProperty asNumeric() {
+ return new NumericProperty(this);
+ }
+}
+
--- /dev/null
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 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.properties;
+
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+
+public class ToBeImplementedProperty extends Property {
+
+ public static class Maker extends PropertyMaker {
+
+ public Maker(int propId) {
+ super(propId);
+ }
+
+ public Property convertProperty(Property p,
+ PropertyList propertyList, FObj fo) {
+ if (p instanceof ToBeImplementedProperty) {
+ return p;
+ }
+
+ ToBeImplementedProperty val =
+ new ToBeImplementedProperty(getPropId());
+ return val;
+ }
+ }
+
+ /**
+ * Constructor
+ * @param propName name of Property
+ */
+ public ToBeImplementedProperty(int propId) {
+
+ //XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an
+ //UnimplementedPropertyException or something similar should
+ //get thrown here instead.
+
+// Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor("fop");
+// log.warn("property - \"" + propName
+// + "\" is not implemented yet.");
+ }
+}
+
//FOP
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.LengthProperty;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.Property;
//RTF
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SimplePageMaster;
-import org.apache.fop.fo.Property;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfPage;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.EnumProperty;
import org.apache.fop.fo.FOInputHandler;
import org.apache.fop.fo.FObj;
-import org.apache.fop.datatypes.FixedLength;
import org.apache.fop.fo.flow.BasicLink;
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.flow.ExternalGraphic;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.SimplePageMaster;
+import org.apache.fop.fo.properties.EnumProperty;
+import org.apache.fop.fo.properties.FixedLength;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.StringProperty;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FOText;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.StringProperty;
import org.apache.fop.apps.Document;
import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfAfterContainer;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.EnumProperty;
import org.apache.fop.fo.expr.NCnameProperty;
+import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.EnumProperty;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.ListProperty;
+import org.apache.fop.fo.properties.NumberProperty;
+import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.LengthProperty;
-import org.apache.fop.fo.ListProperty;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.ColorTypeProperty;
-import org.apache.fop.fo.NumberProperty;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.EnumProperty;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.LengthProperty;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.SpaceProperty;
-import org.apache.fop.fo.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.EnumProperty;
+import org.apache.fop.fo.properties.LengthProperty;
+import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.datatypes.ColorType;
//RTF
*/
package org.apache.fop.traits;
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.SpaceProperty;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.SpaceProperty;
/**
* Store a single Space property value in simplified form, with all