Parcourir la source

style changes only


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196627 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
William Victor Mote il y a 21 ans
Parent
révision
7176169d09

+ 28
- 10
src/java/org/apache/fop/datatypes/KeepValue.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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;

/**
@@ -55,25 +55,43 @@ package org.apache.fop.datatypes;
* Stores the different types of keeps in a single convenient format.
*/
public class KeepValue {
/** constant for keep-with-always */
public static final String KEEP_WITH_ALWAYS = "KEEP_WITH_ALWAYS";
/** constant for automatic keep-with computation */
public static final String KEEP_WITH_AUTO = "KEEP_WITH_AUTO";
/** constant for a user-settable keep-with value (??) */
public static final String KEEP_WITH_VALUE = "KEEP_WITH_VALUE";
private String type = KEEP_WITH_AUTO;
private int value = 0;

/**
* Constructor
* @param type one of "KEEP_WITH_ALWAYS", "KEEP_WITH_AUTO", or
* "KEEP_WITH_VALUE"
* @param val keep-with value to use (used only by KEEP_WITH_VALUE ??).
*/
public KeepValue(String type, int val) {
this.type = type;
this.value = val;
}

/**
* @return the keep-with value
*/
public int getValue() {
return value;
}

/**
* @return the descriptive type
*/
public String getType() {
return type;
}

/**
* @return string representation of this
*/
public String toString() {
return type;
}

+ 13
- 10
src/java/org/apache/fop/datatypes/Length.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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.expr.Numeric;
@@ -133,6 +133,9 @@ public class Length {
public void resolveTableUnit(double dTableUnit) {
}

/**
* @return null (cannot be converted to a Numeric ??)
*/
public Numeric asNumeric() {
return null;
}

+ 40
- 10
src/java/org/apache/fop/datatypes/LengthBase.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,24 +42,37 @@
* (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.PropertyList;

/**
* Models a length which can be used as a factor in a percentage length
* calculation
*/
public class LengthBase implements PercentBase {
// Standard kinds of percent-based length
/** constant for a custom percent-based length */
public static final int CUSTOM_BASE = 0;
/** constant for a font-size percent-based length */
public static final int FONTSIZE = 1;
/** constant for an inh (??) font-size percent-based length */
public static final int INH_FONTSIZE = 2;
/** constant for a containing box percent-based length */
public static final int CONTAINING_BOX = 3;
/** constant for a containing refarea percent-based length */
public static final int CONTAINING_REFAREA = 4;
/** array of valid percent-based length types */
public static final int[] PERCENT_BASED_LENGTH_TYPES
= { CUSTOM_BASE, FONTSIZE, INH_FONTSIZE, CONTAINING_BOX,
CONTAINING_REFAREA } ;

/**
* FO parent of the FO for which this property is to be calculated.
@@ -76,6 +89,12 @@ public class LengthBase implements PercentBase {
*/
private /* final */ int iBaseType;

/**
* Constructor
* @param parentFO parent FO for this
* @param plist property list for this
* @param iBaseType a member of {@link #PERCENT_BASED_LENGTH_TYPES}
*/
public LengthBase(FObj parentFO, PropertyList plist, int iBaseType) {
this.parentFO = parentFO;
this.propertyList = plist;
@@ -85,6 +104,7 @@ public class LengthBase implements PercentBase {
/**
* Accessor for parentFO object from subclasses which define
* custom kinds of LengthBase calculations.
* @return this object's parent FO
*/
protected FObj getParentFO() {
return parentFO;
@@ -93,19 +113,29 @@ public class LengthBase implements PercentBase {
/**
* Accessor for propertyList object from subclasses which define
* custom kinds of LengthBase calculations.
* @return this object's PropertyList
*/
protected PropertyList getPropertyList() {
return propertyList;
}

/**
* @return the dimension of this object (always 1)
*/
public int getDimension() {
return 1;
}

/**
* @return the base value of this object (always 1.0)
*/
public double getBaseValue() {
return 1.0;
}

/**
* @return the base length (in millipoints ??) of this object
*/
public int getBaseLength() {
switch (iBaseType) {
case FONTSIZE:

+ 31
- 14
src/java/org/apache/fop/datatypes/LengthPair.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,19 +42,19 @@
* (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.Property;

/**
* This datatype hold a pair of lengths, specifiying the dimensions in
* both inline and block-progression-directions.
* Models a pair of lengths, one specifiying the dimensions for the
* inline-progression-direction, the other for the block-progression-direction.
* It is currently only used to specify border-separation in tables.
*/
public class LengthPair implements CompoundDatatype {
@@ -62,7 +62,13 @@ public class LengthPair implements CompoundDatatype {
private Property ipd;
private Property bpd;

// From CompoundDatatype
/**
* From CompoundDatatype
* @param sCmpnName component name ("block-progression-direction" or
* "inline-progression-direction") which is being set
* @param cmpnValue Property containing the value to be set
* @param bIsDefault true if this is the default property (??)
*/
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("block-progression-direction")) {
@@ -72,7 +78,12 @@ public class LengthPair implements CompoundDatatype {
}
}

// From CompoundDatatype
/**
* From CompoundDatatype
* @param sCmpnName component name ("block-progression-direction" or
* "inline-progression-direction") for which the length is sought
* @return Property containing the length sought
*/
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("block-progression-direction")) {
return getBPD();
@@ -83,10 +94,16 @@ public class LengthPair implements CompoundDatatype {
}
}

/**
* @return Property holding the ipd length
*/
public Property getIPD() {
return this.ipd;
}

/**
* @return Property holding the bpd length
*/
public Property getBPD() {
return this.bpd;
}

+ 22
- 2
src/java/org/apache/fop/datatypes/LengthRange.java Voir le fichier

@@ -68,7 +68,13 @@ public class LengthRange implements CompoundDatatype {
private int bfSet = 0; // bit field
private boolean bChecked = false;

// From CompoundDatatype
/**
* From CompoundDatatype
* @param sCmpnName component name ("minimum", "maximum", or "optimum")
* which is being set
* @param cmpnValue Property object to be set
* @param bIsDefault true of this is the default value (??)
*/
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("minimum")) {
@@ -80,7 +86,12 @@ public class LengthRange implements CompoundDatatype {
}
}

// From CompoundDatatype
/**
* From CompoundDatatype
* @param sCmpnName component name ("minimum", "maximum", or "optimum")
* for which the length is sought
* @return the requested Property, or null if the component name is invalid
*/
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("minimum")) {
return getMinimum();
@@ -192,16 +203,25 @@ public class LengthRange implements CompoundDatatype {
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;

+ 24
- 11
src/java/org/apache/fop/datatypes/LinearCombinationLength.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,33 +42,46 @@
* (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;

/**
* Class modelling lengths that are build up by combining other lengths
*/
public class LinearCombinationLength extends Length {

/** 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, Length length) {
factors.addElement(new Double(factor));
lengths.addElement(length);
}

/**
* Return the computed value in millipoints.
* Sets the computed value in millipoints.
*/
protected void computeValue() {
int result = 0;

+ 26
- 10
src/java/org/apache/fop/datatypes/MixedLength.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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;
@@ -63,12 +63,22 @@ import org.apache.fop.fo.expr.PropertyException;
*/
public class MixedLength extends Length {

/** 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;
@@ -100,6 +110,9 @@ public class MixedLength extends Length {
}
}

/**
* @return String equivalent of this
*/
public String toString() {
StringBuffer sbuf = new StringBuffer();
Enumeration e = lengths.elements();
@@ -112,6 +125,9 @@ public class MixedLength extends Length {
return sbuf.toString();
}

/**
* @return Numeric equivalent of this
*/
public Numeric asNumeric() {
Numeric numeric = null;
for (Enumeration e = lengths.elements(); e.hasMoreElements();) {

+ 20
- 10
src/java/org/apache/fop/datatypes/PercentBase.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,16 +42,26 @@
* (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;

/**
* Interface for objects that can be used as base objects for percentage
* computations
*/
public interface PercentBase {
int getDimension();
double getBaseValue();

/**
* @return the integer size of the object (this will be used as the base to
* which a percentage will be applied to compute the length of the
* referencing item)
*/
int getBaseLength();
}

+ 51
- 19
src/java/org/apache/fop/datatypes/PercentLength.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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.expr.Numeric;
@@ -57,27 +57,50 @@ import org.apache.fop.fo.expr.Numeric;
*/
public class PercentLength extends Length {

/**
* The percentage itself, expressed as a decimal value, e.g. for 95%, set
* the value to .95
*/
private double factor;
private PercentBase lbase = null;

/**
* construct an object based on a factor (the percent, as a
* a factor) and an object which has a method to return the
* Length which provides the "base" for this calculation.
* A PercentBase implementation that contains the base length to which the
* {@link #factor} should be applied to compute the actual length
*/
public PercentLength(double factor) {
this(factor, null);
}
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;
}
@@ -90,16 +113,25 @@ public class PercentLength extends Length {
setComputedValue((int)(factor * (double)lbase.getBaseLength()));
}

/**
*
* @return the factor
*/
public double value() {
return factor;
}

/**
* @return the String equivalent of this
*/
public String toString() {
// return the factor as a percent
// What about the base value?
// TODO: What about the base value?
return (new Double(factor * 100.0).toString()) + "%";
}

/**
* @return new Numeric object that is equivalent to this
*/
public Numeric asNumeric() {
return new Numeric(this);
}

+ 37
- 12
src/java/org/apache/fop/datatypes/Space.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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.Property;
@@ -60,7 +60,12 @@ public class Space extends LengthRange {
private Property precedence;
private Property conditionality;

// From CompoundDatatype
/**
* From CompoundDatatype
* @param sCmpnName name of component
* @param cmpnValue Property object for the component
* @param bIsDefault true if this is the default (??)
*/
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("precedence")) {
@@ -72,7 +77,11 @@ public class Space extends LengthRange {
}
}

// From CompoundDatatype
/**
* From CompoundDatatype
* @param sCmpnName name of component
* @return Property matching the component name
*/
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("precedence")) {
return getPrecedence();
@@ -83,19 +92,35 @@ public class Space extends LengthRange {
}
}

/**
*
* @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;
}

+ 22
- 12
src/java/org/apache/fop/datatypes/TableColLength.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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.expr.Numeric;
@@ -72,14 +72,15 @@ public class TableColLength extends Length {

/**
* 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 to return the number of specified
* proportional table-column units.
* Override the method in Length
* @return the number of specified proportional table-column units.
*/
public double getTableUnits() {
return tcolUnits;
@@ -87,6 +88,7 @@ public class TableColLength extends Length {

/**
* Calculate the number of millipoints and set it.
* @param mpointsPerUnit density of millipoints per unit
*/
public void resolveTableUnit(double mpointsPerUnit) {
setComputedValue((int)(tcolUnits * mpointsPerUnit));
@@ -100,10 +102,18 @@ public class TableColLength extends Length {
}
}*/

/**
* 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 Numeric asNumeric() {
return new Numeric(this);
}

+ 15
- 11
src/java/org/apache/fop/datatypes/ToBeImplemented.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,19 +42,23 @@
* (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;

/**
* a not as yet implemented value
* Models a datatype that has not yet been implemented
*/
public class ToBeImplemented {

/**
*
* @param value name of datatype
*/
public ToBeImplemented(String value) {
}


+ 14
- 10
src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (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;
@@ -73,6 +73,10 @@ public class ToBeImplementedProperty extends Property {
}
}

/**
* Constructor
* @param propName name of Property
*/
public ToBeImplementedProperty(String propName) {

//XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an

+ 21
- 13
src/java/org/apache/fop/fo/Property.java Voir le fichier

@@ -3,34 +3,34 @@
* ============================================================================
* 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
@@ -42,12 +42,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
*
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
*/
package org.apache.fop.fo;

import org.apache.fop.datatypes.ColorType;
@@ -64,14 +64,22 @@ import org.apache.fop.fo.expr.PropertyInfo;
import org.apache.fop.apps.FOPException;
import java.util.Vector;

/**
* Base class for all property objects
* @author unascribed
*/
public class Property {

/**
* Base class for all property makers
* @author unascribed
*/
public static class Maker {
private static final String UNKNOWN = "UNKNOWN";
private String propName;

/**
* Return the name of the property whose value is being set.
* @return the name of the property for this Maker
*/
protected String getPropName() {
return propName;
@@ -106,7 +114,7 @@ public class Property {
* Return a boolean indicating whether this property inherits the
* "specified" value rather than the "computed" value. The default is
* to inherit the "computed" value.
* @return If true, property inherits the value specified.
* @return true, if the property inherits the value specified.
*/
public boolean inheritsSpecified() {
return false;
@@ -114,12 +122,12 @@ public class Property {


/**
* Return an object implementing the PercentBase interface.
* This is used to handle properties specified as a percentage of
* some "base length", such as the content width of their containing
* box.
* Overridden by subclasses which allow percent specifications. See
* the documentation on properties.xsl for details.
* @return an object implementing the PercentBase interface.
*/
public PercentBase getPercentBase(FObj fo, PropertyList pl) {
return null;

Chargement…
Annuler
Enregistrer