Browse Source

Switched to long licence

Some general checkstyle fixing


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196018 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
Jeremias Maerki 21 years ago
parent
commit
eef12c894b
50 changed files with 3022 additions and 768 deletions
  1. 55
    8
      src/org/apache/fop/datatypes/AutoLength.java
  2. 89
    18
      src/org/apache/fop/datatypes/ColorType.java
  3. 66
    8
      src/org/apache/fop/datatypes/CompoundDatatype.java
  4. 74
    9
      src/org/apache/fop/datatypes/CondLength.java
  5. 48
    6
      src/org/apache/fop/datatypes/FODimension.java
  6. 50
    8
      src/org/apache/fop/datatypes/FixedLength.java
  7. 50
    6
      src/org/apache/fop/datatypes/Keep.java
  8. 48
    5
      src/org/apache/fop/datatypes/KeepValue.java
  9. 77
    9
      src/org/apache/fop/datatypes/Length.java
  10. 50
    8
      src/org/apache/fop/datatypes/LengthBase.java
  11. 48
    5
      src/org/apache/fop/datatypes/LengthPair.java
  12. 49
    6
      src/org/apache/fop/datatypes/LengthRange.java
  13. 49
    6
      src/org/apache/fop/datatypes/LinearCombinationLength.java
  14. 50
    7
      src/org/apache/fop/datatypes/MixedLength.java
  15. 51
    8
      src/org/apache/fop/datatypes/PercentBase.java
  16. 48
    5
      src/org/apache/fop/datatypes/PercentLength.java
  17. 48
    5
      src/org/apache/fop/datatypes/Space.java
  18. 49
    6
      src/org/apache/fop/datatypes/TableColLength.java
  19. 50
    6
      src/org/apache/fop/datatypes/ToBeImplemented.java
  20. 52
    7
      src/org/apache/fop/datatypes/ToBeImplementedProperty.java
  21. 63
    20
      src/org/apache/fop/fo/PropertyManager.java
  22. 53
    12
      src/org/apache/fop/fo/expr/Numeric.java
  23. 49
    6
      src/org/apache/fop/fo/expr/PropertyInfo.java
  24. 75
    23
      src/org/apache/fop/fo/flow/Block.java
  25. 57
    12
      src/org/apache/fop/fo/flow/BlockContainer.java
  26. 54
    11
      src/org/apache/fop/fo/flow/ExternalGraphic.java
  27. 69
    25
      src/org/apache/fop/fo/flow/InstreamForeignObject.java
  28. 65
    21
      src/org/apache/fop/fo/flow/Leader.java
  29. 65
    19
      src/org/apache/fop/fo/flow/ListBlock.java
  30. 64
    19
      src/org/apache/fop/fo/flow/ListItem.java
  31. 73
    25
      src/org/apache/fop/fo/flow/PageNumber.java
  32. 67
    23
      src/org/apache/fop/fo/flow/PageNumberCitation.java
  33. 94
    45
      src/org/apache/fop/fo/flow/Table.java
  34. 65
    20
      src/org/apache/fop/fo/flow/TableBody.java
  35. 88
    36
      src/org/apache/fop/fo/flow/TableCell.java
  36. 65
    21
      src/org/apache/fop/fo/flow/TableColumn.java
  37. 71
    26
      src/org/apache/fop/fo/flow/TableRow.java
  38. 50
    7
      src/org/apache/fop/fo/pagination/RegionBASE.java
  39. 66
    26
      src/org/apache/fop/fo/pagination/RegionBody.java
  40. 80
    35
      src/org/apache/fop/fo/pagination/SimplePageMaster.java
  41. 64
    18
      src/org/apache/fop/layout/BorderAndPadding.java
  42. 60
    19
      src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
  43. 67
    24
      src/org/apache/fop/layoutmgr/BlockLayoutManager.java
  44. 67
    25
      src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
  45. 69
    24
      src/org/apache/fop/layoutmgr/SpaceSpecifier.java
  46. 98
    53
      src/org/apache/fop/layoutmgr/TextLayoutManager.java
  47. 2
    2
      src/org/apache/fop/layoutmgr/TraitSetter.java
  48. 4
    4
      src/org/apache/fop/render/pdf/PDFRenderer.java
  49. 55
    6
      src/org/apache/fop/render/ps/PSRenderer.java
  50. 102
    15
      src/org/apache/fop/traits/SpaceVal.java

+ 55
- 8
src/org/apache/fop/datatypes/AutoLength.java View File

@@ -1,19 +1,63 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;

/**
* a length quantity in XSL which is specified as "auto"
* A length quantity in XSL which is specified as "auto".
*/
public class AutoLength extends Length {

/**
* @see org.apache.fop.datatypes.Length#isAuto()
*/
public boolean isAuto() {
return true;
}
@@ -23,6 +67,9 @@ public class AutoLength extends Length {
// protected void computeValue() {
// }

/**
* @see java.lang.Object#toString()
*/
public String toString() {
return "auto";
}

+ 89
- 18
src/org/apache/fop/datatypes/ColorType.java View File

@@ -1,17 +1,60 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.*;
import java.io.Serializable;
import java.util.StringTokenizer;

/**
* a colour quantity in XSL
* A colour quantity in XSL.
*/
public class ColorType implements Serializable {

@@ -35,6 +78,12 @@ public class ColorType implements Serializable {
*/
protected float alpha = 0;

/**
* Main constructor
* @param red red component
* @param green green component
* @param blue blue component
*/
public ColorType(float red, float green, float blue) {
this.red = red;
this.green = green;
@@ -42,8 +91,9 @@ public class ColorType implements Serializable {
}

/**
* set the colour given a particular String specifying either a
* 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 ColorType(String value) {
if (value.startsWith("#")) {
@@ -130,11 +180,11 @@ public class ColorType implements Serializable {
this.alpha = 1;
} else {
boolean found = false;
for (int count = 0; count < names.length; count++) {
if (value.toLowerCase().equals(names[count])) {
this.red = vals[count][0] / 255f;
this.green = vals[count][1] / 255f;
this.blue = vals[count][2] / 255f;
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;
}
@@ -150,22 +200,41 @@ public class ColorType implements Serializable {
}
}

public float blue() {
/**
* Returns the blue component of the color.
* @return float a value between 0.0 and 1.0
*/
public float getBlue() {
return this.blue;
}

public float green() {
/**
* Returns the green component of the color.
* @return float a value between 0.0 and 1.0
*/
public float getGreen() {
return this.green;
}

public float red() {
/**
* 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 (transparency) component of the color.
* @return float a value between 0.0 and 1.0
*/
public float alpha() {
return this.alpha;
}

/**
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer sbuf = new StringBuffer(8);
sbuf.append('#');
@@ -187,7 +256,8 @@ public class ColorType implements Serializable {
return sbuf.toString();
}

protected static final String[] names = {
/** 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",
@@ -220,7 +290,8 @@ public class ColorType implements Serializable {
"whitesmoke", "yellow", "yellowgreen"
};

protected static final int[][] vals = {
/** The color values for the predefined colors */
protected static final int[][] VALUES = {
{
240, 248, 255
}, {

+ 66
- 8
src/org/apache/fop/datatypes/CompoundDatatype.java View File

@@ -1,16 +1,74 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;

/**
* This interface is used as a base for compound datatypes.
*/
public interface CompoundDatatype {
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault);
/**
* Sets a component of the compound datatype.
* @param sCmpnName name of the component
* @param cmpnValue value of the component
* @param bIsDefault Indicates if it's the default value
*/
void setComponent(String sCmpnName, Property cmpnValue, boolean bIsDefault);

public Property getComponent(String sCmpnName);
/**
* Returns a component of the compound datatype.
* @param sCmpnName name of the component
* @return the value of the component
*/
Property getComponent(String sCmpnName);
}

+ 74
- 9
src/org/apache/fop/datatypes/CondLength.java View File

@@ -1,24 +1,70 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;
import org.apache.fop.fo.properties.Constants;

/**
* a space quantity in XSL (space-before, space-after)
* A space quantity in XSL (space-before, space-after).
* See length-conditional datatype in the specs.
*/
public class CondLength implements CompoundDatatype {

private Property length;
private Property conditionality;

// From CompoundDatatype
/**
* @see org.apache.fop.datatypes.CompoundDatatype#setComponent(String, Property, boolean)
*/
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("length")) {
@@ -28,6 +74,9 @@ public class CondLength implements CompoundDatatype {
}
}

/**
* @see org.apache.fop.datatypes.CompoundDatatype#getComponent(String)
*/
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("length")) {
return length;
@@ -38,20 +87,36 @@ public class CondLength implements CompoundDatatype {
}
}

/**
* Returns the conditionality.
* @return the conditionality
*/
public Property getConditionality() {
return this.conditionality;
}

/**
* Returns the length.
* @return the length
*/
public Property getLength() {
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;
}

public int mvalue() {
return this.length.getLength().mvalue();
/**
* Returns the computed length value.
* @return the length in millipoints
*/
public int getLengthValue() {
return this.length.getLength().getValue();
}

}

+ 48
- 6
src/org/apache/fop/datatypes/FODimension.java View File

@@ -1,13 +1,55 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;


/**
* This datatype hold a pair of resolved lengths,
* specifiying the dimensions in

+ 50
- 8
src/org/apache/fop/datatypes/FixedLength.java View File

@@ -1,13 +1,55 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;
import org.apache.fop.fo.expr.Numeric;

/**
@@ -43,7 +85,7 @@ public class FixedLength extends Length {
*/
protected void convert(double dvalue, String unit) {

int assumed_resolution = 1; // points/pixel
int assumedResolution = 1; // points/pixel

if (unit.equals("in")) {
dvalue = dvalue * 72;
@@ -60,7 +102,7 @@ public class FixedLength extends Length {
* dvalue = dvalue * fontsize;
*/
} else if (unit.equals("px")) {
dvalue = dvalue * assumed_resolution;
dvalue = dvalue * assumedResolution;
} else {
dvalue = 0;
//log.error("unknown length unit '" + unit

+ 50
- 6
src/org/apache/fop/datatypes/Keep.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;
@@ -17,7 +60,8 @@ public class Keep implements CompoundDatatype {
private Property withinColumn;
private Property withinPage;

public Keep() {}
public Keep() {
}

// From CompoundDatatype
public void setComponent(String sCmpnName, Property cmpnValue,

+ 48
- 5
src/org/apache/fop/datatypes/KeepValue.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;

/**

+ 77
- 9
src/org/apache/fop/datatypes/Length.java View File

@@ -1,50 +1,115 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.expr.Numeric;
import org.apache.fop.fo.Property;

/**
* a length quantity in XSL
* A length quantity in XSL
*/
public class Length {

/** Holds the length in millipoints. */
protected int millipoints = 0;
/** Indicates if the value has been computed, or not. */
protected boolean bIsComputed = false;

/**
* return the length in 1/1000ths of a point
* Returns the length in 1/1000ths of a point (millipoints)
* @return the length in millipoints
*/
public int mvalue() {
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;
}
@@ -72,6 +137,9 @@ public class Length {
return null;
}

/**
* @see java.lang.Object#toString()
*/
public String toString() {
String s = millipoints + "mpt";
return s;

+ 50
- 8
src/org/apache/fop/datatypes/LengthBase.java View File

@@ -1,14 +1,56 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.FONode;
import org.apache.fop.fo.PropertyList;

public class LengthBase implements PercentBase {
@@ -67,9 +109,9 @@ public class LengthBase implements PercentBase {
public int getBaseLength() {
switch (iBaseType) {
case FONTSIZE:
return propertyList.get("font-size").getLength().mvalue();
return propertyList.get("font-size").getLength().getValue();
case INH_FONTSIZE:
return propertyList.getInherited("font-size").getLength().mvalue();
return propertyList.getInherited("font-size").getLength().getValue();
//case CONTAINING_BOX:
// depends on property?? inline-progression vs block-progression
//return parentFO.getContentWidth();

+ 48
- 5
src/org/apache/fop/datatypes/LengthPair.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;

+ 49
- 6
src/org/apache/fop/datatypes/LengthRange.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;
@@ -52,7 +95,7 @@ public class LengthRange implements CompoundDatatype {

/**
* Set minimum value to min.
* @param min A Length value specifying the minimum value for this
* @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.

+ 49
- 6
src/org/apache/fop/datatypes/LinearCombinationLength.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;
@@ -33,7 +76,7 @@ public class LinearCombinationLength extends Length {
for (int i = 0; i < numFactors; ++i) {
result +=
(int)(((Double)factors.elementAt(i)).doubleValue()
* (double)((Length)lengths.elementAt(i)).mvalue());
* (double)((Length)lengths.elementAt(i)).getValue());
}
setComputedValue(result);
}

+ 50
- 7
src/org/apache/fop/datatypes/MixedLength.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;
@@ -32,8 +75,8 @@ public class MixedLength extends Length {
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
Length l = (Length) e.nextElement();
computedValue += l.mvalue();
if (! l.isComputed()) {
computedValue += l.getValue();
if (!l.isComputed()) {
bAllComputed = false;
}
}

+ 51
- 8
src/org/apache/fop/datatypes/PercentBase.java View File

@@ -1,14 +1,57 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;

public interface PercentBase {
public int getDimension();
public double getBaseValue();
public int getBaseLength();
int getDimension();
double getBaseValue();
int getBaseLength();
}

+ 48
- 5
src/org/apache/fop/datatypes/PercentLength.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.expr.Numeric;

+ 48
- 5
src/org/apache/fop/datatypes/Space.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.Property;

+ 49
- 6
src/org/apache/fop/datatypes/TableColLength.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.expr.Numeric;
@@ -25,7 +68,7 @@ public class TableColLength extends Length {
/**
* Number of table-column proportional units
*/
double tcolUnits;
private double tcolUnits;

/**
* Construct an object with tcolUnits of proportional measure.

+ 50
- 6
src/org/apache/fop/datatypes/ToBeImplemented.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;

/**
@@ -12,7 +55,8 @@ package org.apache.fop.datatypes;
*/
public class ToBeImplemented {

public ToBeImplemented(String value) {}
public ToBeImplemented(String value) {
}

}


+ 52
- 7
src/org/apache/fop/datatypes/ToBeImplementedProperty.java View File

@@ -1,13 +1,58 @@
/*
* $Id$ --
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* $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.datatypes;

import org.apache.fop.fo.*;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;

public class ToBeImplementedProperty extends Property {


+ 63
- 20
src/org/apache/fop/fo/PropertyManager.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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;

// Java
@@ -122,7 +165,7 @@ public class PropertyManager {

// NOTE: this is incomplete. font-size may be specified with
// various kinds of keywords too
int fontSize = properties.get("font-size").getLength().mvalue();
int fontSize = properties.get("font-size").getLength().getValue();
//int fontVariant = properties.get("font-variant").getEnum();
String fname = fontInfo.fontLookup(fontFamily, fontStyle,
fontWeight);
@@ -267,23 +310,23 @@ public class PropertyManager {

// Common Margin Properties-Block
props.marginTop =
this.properties.get("margin-top").getLength().mvalue();
this.properties.get("margin-top").getLength().getValue();
props.marginBottom =
this.properties.get("margin-bottom").getLength().mvalue();
this.properties.get("margin-bottom").getLength().getValue();
props.marginLeft =
this.properties.get("margin-left").getLength().mvalue();
this.properties.get("margin-left").getLength().getValue();
props.marginRight =
this.properties.get("margin-right").getLength().mvalue();
this.properties.get("margin-right").getLength().getValue();

// For now, we only get the optimum value for space-before and after
props.spaceBefore = this.properties.get("space-before").
getSpace().getOptimum().getLength().mvalue();
getSpace().getOptimum().getLength().getValue();
props.spaceAfter = this.properties.get("space-after").
getSpace().getOptimum().getLength().mvalue();
getSpace().getOptimum().getLength().getValue();
props.startIndent = this.properties.get("start-indent").
getLength().mvalue();
getLength().getValue();
props.endIndent = this.properties.get("end-indent").
getLength().mvalue();
getLength().getValue();

return props;
}
@@ -389,10 +432,10 @@ public class PropertyManager {
AbsolutePositionProps props = new AbsolutePositionProps();
props.absolutePosition =
this.properties.get("absolute-position").getEnum();
props.top = this.properties.get("top").getLength().mvalue();
props.bottom = this.properties.get("bottom").getLength().mvalue();
props.left = this.properties.get("left").getLength().mvalue();
props.right = this.properties.get("right").getLength().mvalue();
props.top = this.properties.get("top").getLength().getValue();
props.bottom = this.properties.get("bottom").getLength().getValue();
props.left = this.properties.get("left").getLength().getValue();
props.right = this.properties.get("right").getLength().getValue();
return props;
}

@@ -403,7 +446,7 @@ public class PropertyManager {
*/
public BlockProps getBlockProps() {
BlockProps props = new BlockProps();
props.firstIndent = this.properties.get("text-indent").getLength().mvalue();
props.firstIndent = this.properties.get("text-indent").getLength().getValue();
props.lastIndent = 0;
/*this.properties.get("last-line-end-indent").getLength().mvalue(); */
props.textAlign = this.properties.get("text-align").getEnum();
@@ -458,7 +501,7 @@ public class PropertyManager {
properties.get("white-space-collapse").getEnum();

textInfo.lineHeight = this.properties.get(
"line-height").getLength().mvalue();
"line-height").getLength().getValue();
}
return textInfo;
}

+ 53
- 12
src/org/apache/fop/fo/expr/Numeric.java View File

@@ -1,19 +1,60 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.expr;

import java.util.Vector;

import org.apache.fop.fo.Property;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.FixedLength;
import org.apache.fop.datatypes.PercentLength;
import org.apache.fop.datatypes.LinearCombinationLength;
import org.apache.fop.datatypes.MixedLength;
import org.apache.fop.datatypes.TableColLength;
import org.apache.fop.datatypes.PercentBase;
@@ -94,7 +135,7 @@ public class Numeric {
* @param l The Length.
*/
public Numeric(FixedLength l) {
this(ABS_LENGTH, (double)l.mvalue(), 0.0, 0.0, 1, null);
this(ABS_LENGTH, (double)l.getValue(), 0.0, 0.0, 1, null);
}

/**
@@ -268,7 +309,7 @@ public class Numeric {
double opval = op.absValue;
return new Numeric(valType, opval * absValue, opval * pcValue,
opval * tcolValue, dim, pcBase);
} else if (valType == op.valType &&!isMixedType()) {
} else if (valType == op.valType && !isMixedType()) {
// Check same relbase and pcbase ???
PercentBase npcBase = ((valType & PC_LENGTH) != 0) ? pcBase
: op.pcBase;
@@ -301,7 +342,7 @@ public class Numeric {
double opval = op.absValue;
return new Numeric(valType, absValue / opval, pcValue / opval,
tcolValue / opval, dim, pcBase);
} else if (valType == op.valType &&!isMixedType()) {
} else if (valType == op.valType && !isMixedType()) {
PercentBase npcBase = ((valType & PC_LENGTH) != 0) ? pcBase
: op.pcBase;
return new Numeric(valType,
@@ -332,7 +373,7 @@ public class Numeric {
public Numeric max(Numeric op) throws PropertyException {
double rslt = 0.0;
// Only compare if have same dimension and value type!
if (dim == op.dim && valType == op.valType &&!isMixedType()) {
if (dim == op.dim && valType == op.valType && !isMixedType()) {
if (valType == ABS_LENGTH) {
rslt = absValue - op.absValue;
} else if (valType == PC_LENGTH) {
@@ -358,7 +399,7 @@ public class Numeric {
public Numeric min(Numeric op) throws PropertyException {
double rslt = 0.0;
// Only compare if have same dimension and value type!
if (dim == op.dim && valType == op.valType &&!isMixedType()) {
if (dim == op.dim && valType == op.valType && !isMixedType()) {
if (valType == ABS_LENGTH) {
rslt = absValue - op.absValue;
} else if (valType == PC_LENGTH) {

+ 49
- 6
src/org/apache/fop/fo/expr/PropertyInfo.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.expr;

import java.util.Stack;
@@ -58,7 +101,7 @@ public class PropertyInfo {
* Return the current font-size value as base units (milli-points).
*/
public int currentFontSize() {
return plist.get("font-size").getLength().mvalue();
return plist.get("font-size").getLength().getValue();
}

public FObj getFO() {

+ 75
- 23
src/org/apache/fop/fo/flow/Block.java View File

@@ -1,19 +1,72 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.CharIterator;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.RecursiveCharIterator;
import org.apache.fop.fo.TextInfo;
import org.apache.fop.fo.properties.Constants;
import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.HyphenationProps;
import org.apache.fop.layout.MarginProps;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.BlockLayoutManager;
import org.apache.fop.util.CharUtilities;

@@ -145,17 +198,17 @@ public class Block extends FObjMixed {
this.properties.get("text-align-last").getEnum();
this.breakAfter = this.properties.get("break-after").getEnum();
this.lineHeight = this.properties.get(
"line-height").getLength().mvalue();
"line-height").getLength().getValue();
this.startIndent = this.properties.get(
"start-indent").getLength().mvalue();
"start-indent").getLength().getValue();
this.endIndent = this.properties.get(
"end-indent").getLength().mvalue();
"end-indent").getLength().getValue();
this.spaceBefore = this.properties.get(
"space-before.optimum").getLength().mvalue();
"space-before.optimum").getLength().getValue();
this.spaceAfter = this.properties.get(
"space-after.optimum").getLength().mvalue();
"space-after.optimum").getLength().getValue();
this.textIndent = this.properties.get(
"text-indent").getLength().mvalue();
"text-indent").getLength().getValue();
this.keepWithNext =
this.properties.get("keep-with-next").getEnum();

@@ -231,8 +284,8 @@ public class Block extends FObjMixed {
bIgnore = lfCheck.nextIsLF();
break;
case Constants.IGNORE_IF_SURROUNDING_LINEFEED:
bIgnore = (bPrevWasLF ||
lfCheck.nextIsLF());
bIgnore = (bPrevWasLF
|| lfCheck.nextIsLF());
break;
case Constants.IGNORE_IF_AFTER_LINEFEED:
bIgnore = bPrevWasLF;
@@ -242,9 +295,8 @@ public class Block extends FObjMixed {
if (bIgnore) {
charIter.remove();
} else if (bWScollapse) {
if (bInWS || (lfTreatment ==
Constants.PRESERVE &&
(bPrevWasLF || lfCheck.nextIsLF()))) {
if (bInWS || (lfTreatment == Constants.PRESERVE
&& (bPrevWasLF || lfCheck.nextIsLF()))) {
charIter.remove();
} else {
bInWS = true;
@@ -315,8 +367,8 @@ public class Block extends FObjMixed {
if (c == '\n') {
bNextIsLF = true;
break;
} else if (CharUtilities.classOf(c) !=
CharUtilities.XMLWHITESPACE) {
} else if (CharUtilities.classOf(c)
!= CharUtilities.XMLWHITESPACE) {
break;
}
}

+ 57
- 12
src/org/apache/fop/fo/flow/BlockContainer.java View File

@@ -1,19 +1,64 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.*;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layout.AbsolutePositionProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.MarginProps;
import org.apache.fop.layoutmgr.BlockContainerLayoutManager;

import org.xml.sax.Attributes;
@@ -83,8 +128,8 @@ public class BlockContainer extends FObj {
this.backgroundColor =
this.properties.get("background-color").getColorType();

this.width = this.properties.get("width").getLength().mvalue();
this.height = this.properties.get("height").getLength().mvalue();
this.width = this.properties.get("width").getLength().getValue();
this.height = this.properties.get("height").getLength().getValue();
span = this.properties.get("span").getEnum();

}

+ 54
- 11
src/org/apache/fop/fo/flow/ExternalGraphic.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
@@ -124,20 +167,20 @@ public class ExternalGraphic extends FObj {
// assume lr-tb for now
Length ipd = properties.get("inline-progression-dimension.optimum").getLength();
if (!ipd.isAuto()) {
viewWidth = ipd.mvalue();
viewWidth = ipd.getValue();
} else {
ipd = properties.get("width").getLength();
if (!ipd.isAuto()) {
viewWidth = ipd.mvalue();
viewWidth = ipd.getValue();
}
}
Length bpd = properties.get("block-progression-dimension.optimum").getLength();
if (!bpd.isAuto()) {
viewHeight = bpd.mvalue();
viewHeight = bpd.getValue();
} else {
bpd = properties.get("height").getLength();
if (!bpd.isAuto()) {
viewHeight = bpd.mvalue();
viewHeight = bpd.getValue();
}
}

@@ -153,7 +196,7 @@ public class ExternalGraphic extends FObj {
cheight = viewHeight;
}
} else {*/
cheight = ch.mvalue();
cheight = ch.getValue();
}
Length cw = properties.get("content-width").getLength();
if (!cw.isAuto()) {
@@ -162,7 +205,7 @@ public class ExternalGraphic extends FObj {
cwidth = viewWidth;
}
} else {*/
cwidth = cw.mvalue();
cwidth = cw.getValue();
}

int scaling = properties.get("scaling").getEnum();

+ 69
- 25
src/org/apache/fop/fo/flow/InstreamForeignObject.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
@@ -118,29 +161,29 @@ public class InstreamForeignObject extends FObj {
int ipd = -1;
boolean bpdauto = false;
if (hasLH) {
bpd = properties.get("line-height").getLength().mvalue();
bpd = properties.get("line-height").getLength().getValue();
} else {
// this property does not apply when the line-height applies
// isn't the block-progression-dimension always in the same
// direction as the line height?
len = properties.get("block-progression-dimension.optimum").getLength();
if (!len.isAuto()) {
bpd = len.mvalue();
bpd = len.getValue();
} else {
len = properties.get("height").getLength();
if(!len.isAuto()) {
bpd = len.mvalue();
if (!len.isAuto()) {
bpd = len.getValue();
}
}
}

len = properties.get("inline-progression-dimension.optimum").getLength();
if (!len.isAuto()) {
ipd = len.mvalue();
ipd = len.getValue();
} else {
len = properties.get("width").getLength();
if (!len.isAuto()) {
ipd = len.mvalue();
ipd = len.getValue();
}
}

@@ -155,7 +198,7 @@ public class InstreamForeignObject extends FObj {
cwidth = ipd;
}
} else {*/
cwidth = len.mvalue();
cwidth = len.getValue();
}
len = properties.get("content-height").getLength();
if (!len.isAuto()) {
@@ -164,10 +207,11 @@ public class InstreamForeignObject extends FObj {
cwidth = bpd;
}
} else {*/
cheight = len.mvalue();
cheight = len.getValue();
}

Point2D csize = new Point2D.Float(cwidth == -1 ? -1 : cwidth / 1000f, cheight == -1 ? -1 : cheight / 1000f);
Point2D csize = new Point2D.Float(cwidth == -1 ? -1 : cwidth / 1000f,
cheight == -1 ? -1 : cheight / 1000f);
Point2D size = child.getDimension(csize);
if (size == null) {
// error
@@ -184,7 +228,7 @@ public class InstreamForeignObject extends FObj {
// adjust the larger
double rat1 = cwidth / (size.getX() * 1000f);
double rat2 = cheight / (size.getY() * 1000f);
if(rat1 < rat2) {
if (rat1 < rat2) {
// reduce cheight
cheight = (int)(rat1 * size.getY() * 1000);
} else {
@@ -202,9 +246,9 @@ public class InstreamForeignObject extends FObj {
boolean clip = false;
if (cwidth > ipd || cheight > bpd) {
int overflow = properties.get("overflow").getEnum();
if(overflow == Overflow.HIDDEN) {
if (overflow == Overflow.HIDDEN) {
clip = true;
} else if(overflow == Overflow.ERROR_IF_OVERFLOW) {
} else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
getLogger().error("Instream foreign object overflows the viewport: clipping");
clip = true;
}
@@ -215,31 +259,31 @@ public class InstreamForeignObject extends FObj {
int da = properties.get("display-align").getEnum();
switch (da) {
case DisplayAlign.BEFORE:
break;
break;
case DisplayAlign.AFTER:
yoffset = bpd - cheight;
break;
break;
case DisplayAlign.CENTER:
yoffset = (bpd - cheight) / 2;
break;
break;
case DisplayAlign.AUTO:
default:
break;
break;
}

int ta = properties.get("text-align").getEnum();
switch (ta) {
case TextAlign.CENTER:
xoffset = (ipd - cwidth) / 2;
break;
break;
case TextAlign.END:
xoffset = ipd - cwidth;
break;
break;
case TextAlign.START:
break;
break;
case TextAlign.JUSTIFY:
default:
break;
break;
}
Rectangle2D placement = new Rectangle2D.Float(xoffset, yoffset, cwidth, cheight);


+ 65
- 21
src/org/apache/fop/fo/flow/Leader.java View File

@@ -1,15 +1,59 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
// Java
import java.util.List;

// FOP
import org.apache.fop.apps.StructureHandler;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.FilledArea;
@@ -78,7 +122,7 @@ public class Leader extends FObjMixed {
}

protected InlineArea getInlineArea() {
if(leaderArea == null) {
if (leaderArea == null) {
createLeaderArea();
}
return leaderArea;
@@ -87,7 +131,7 @@ public class Leader extends FObjMixed {
protected void createLeaderArea() {
setup();

if(leaderPattern == LeaderPattern.RULE) {
if (leaderPattern == LeaderPattern.RULE) {
org.apache.fop.area.inline.Leader leader = new org.apache.fop.area.inline.Leader();

leader.setRuleStyle(ruleStyle);
@@ -96,7 +140,7 @@ public class Leader extends FObjMixed {
leaderArea = leader;
} else if (leaderPattern == LeaderPattern.SPACE) {
leaderArea = new Space();
} else if(leaderPattern == LeaderPattern.DOTS) {
} else if (leaderPattern == LeaderPattern.DOTS) {
Word w = new Word();
char dot = '.'; // userAgent.getLeaderDotCharacter();

@@ -108,7 +152,7 @@ public class Leader extends FObjMixed {
w.setOffset(fontState.getAscender());
int width = CharUtilities.getCharWidth(dot, fontState);
Space spacer = null;
if(patternWidth > width) {
if (patternWidth > width) {
spacer = new Space();
spacer.setWidth(patternWidth - width);
width = patternWidth;
@@ -116,13 +160,13 @@ public class Leader extends FObjMixed {
FilledArea fa = new FilledArea();
fa.setUnitWidth(width);
fa.addChild(w);
if(spacer != null) {
if (spacer != null) {
fa.addChild(spacer);
}
fa.setHeight(fontState.getAscender());

leaderArea = fa;
} else if(leaderPattern == LeaderPattern.USECONTENT) {
} else if (leaderPattern == LeaderPattern.USECONTENT) {
if (children == null) {
getLogger().error("Leader use-content with no content");
return;
@@ -144,13 +188,13 @@ public class Leader extends FObjMixed {
clm.fillArea(lm);
int width = clm.getStackingSize();
Space spacer = null;
if(patternWidth > width) {
if (patternWidth > width) {
spacer = new Space();
spacer.setWidth(patternWidth - width);
width = patternWidth;
}
fa.setUnitWidth(width);
if(spacer != null) {
if (spacer != null) {
fa.addChild(spacer);
}
leaderArea = fa;
@@ -207,9 +251,9 @@ public class Leader extends FObjMixed {

// color properties
ColorType c = this.properties.get("color").getColorType();
float red = c.red();
float green = c.green();
float blue = c.blue();
float red = c.getRed();
float green = c.getGreen();
float blue = c.getBlue();

// fo:leader specific properties
// determines the pattern of leader; allowed values: space, rule,dots, use-content
@@ -222,7 +266,7 @@ public class Leader extends FObjMixed {
// the following properties only apply
// for leader-pattern = "rule"
ruleThickness =
properties.get("rule-thickness").getLength().mvalue();
properties.get("rule-thickness").getLength().getValue();
ruleStyle = properties.get("rule-style").getEnum();
break;
case LeaderPattern.DOTS:
@@ -235,7 +279,7 @@ public class Leader extends FObjMixed {

// if leaderPatternWidth = 0 = default = use-font-metric
patternWidth =
this.properties.get("leader-pattern-width").getLength().mvalue();
this.properties.get("leader-pattern-width").getLength().getValue();

}

@@ -251,11 +295,11 @@ public class Leader extends FObjMixed {
protected int getLength(String prop, int dim) {
int length;
Length maxlength = properties.get(prop).getLength();
if(maxlength instanceof PercentLength) {
if (maxlength instanceof PercentLength) {
length = (int)(((PercentLength)maxlength).value()
* dim);
} else {
length = maxlength.mvalue();
length = maxlength.getValue();
}
return length;
}

+ 65
- 19
src/org/apache/fop/fo/flow/ListBlock.java View File

@@ -1,25 +1,71 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// Java
import java.util.List;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.MarginProps;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.list.ListBlockLayoutManager;

// Java
import java.util.Iterator;
import java.util.List;

public class ListBlock extends FObj {

int align;
@@ -75,15 +121,15 @@ public class ListBlock extends FObj {
this.align = this.properties.get("text-align").getEnum();
this.alignLast = this.properties.get("text-align-last").getEnum();
this.lineHeight =
this.properties.get("line-height").getLength().mvalue();
this.properties.get("line-height").getLength().getValue();
this.startIndent =
this.properties.get("start-indent").getLength().mvalue();
this.properties.get("start-indent").getLength().getValue();
this.endIndent =
this.properties.get("end-indent").getLength().mvalue();
this.properties.get("end-indent").getLength().getValue();
this.spaceBefore =
this.properties.get("space-before.optimum").getLength().mvalue();
this.properties.get("space-before.optimum").getLength().getValue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
this.properties.get("space-after.optimum").getLength().getValue();
this.spaceBetweenListRows = 0; // not used at present
this.backgroundColor =
this.properties.get("background-color").getColorType();

+ 64
- 19
src/org/apache/fop/fo/flow/ListItem.java View File

@@ -1,24 +1,69 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.list.ListItemLayoutManager;

// Java
import java.util.Iterator;
import java.util.List;

// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.MarginProps;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.list.ListItemLayoutManager;

public class ListItem extends FObj {
ListItemLabel label = null;
ListItemBody body = null;
@@ -38,7 +83,7 @@ public class ListItem extends FObj {
}

public void addLayoutManager(List list) {
if(label != null && body != null) {
if (label != null && body != null) {
ListItemLayoutManager blm = new ListItemLayoutManager();
blm.setUserAgent(getUserAgent());
blm.setFObj(this);
@@ -79,11 +124,11 @@ public class ListItem extends FObj {
this.align = this.properties.get("text-align").getEnum();
this.alignLast = this.properties.get("text-align-last").getEnum();
this.lineHeight =
this.properties.get("line-height").getLength().mvalue();
this.properties.get("line-height").getLength().getValue();
this.spaceBefore =
this.properties.get("space-before.optimum").getLength().mvalue();
this.properties.get("space-before.optimum").getLength().getValue();
this.spaceAfter =
this.properties.get("space-after.optimum").getLength().mvalue();
this.properties.get("space-after.optimum").getLength().getValue();

}

@@ -92,7 +137,7 @@ public class ListItem extends FObj {
label = (ListItemLabel)child;
} else if ("fo:list-item-body".equals(child.getName())) {
body = (ListItemBody)child;
} else if("fo:marker".equals(child.getName())) {
} else if ("fo:marker".equals(child.getName())) {
// marker
} else {
// error

+ 73
- 25
src/org/apache/fop/fo/flow/PageNumber.java View File

@@ -1,20 +1,68 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// Java
import java.util.List;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.FontInfo;
import org.apache.fop.layout.FontState;
import org.apache.fop.datatypes.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layout.MarginInlineProps;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layout.TextState;
import org.apache.fop.util.CharUtilities;

import org.apache.fop.apps.StructureHandler;
@@ -23,21 +71,21 @@ import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Word;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.area.Trait;

// Java
import java.util.List;

public class PageNumber extends FObj {
protected FontInfo fontInfo = null;
protected FontState fontState;

float red;
float green;
float blue;
int wrapOption;
int whiteSpaceCollapse;
TextState ts;
private float red;
private float green;
private float blue;
private int wrapOption;
private int whiteSpaceCollapse;
private TextState ts;

public PageNumber(FONode parent) {
super(parent);
@@ -63,8 +111,8 @@ public class PageNumber extends FObj {
}
inline.setWord(str);
inline.setIPD(width);
inline.setHeight(fontState.getAscender() -
fontState.getDescender());
inline.setHeight(fontState.getAscender()
- fontState.getDescender());
inline.setOffset(fontState.getAscender());

inline.addTrait(Trait.FONT_NAME,
@@ -123,13 +171,13 @@ public class PageNumber extends FObj {
// this.properties.get("word-spacing");

ColorType c = this.properties.get("color").getColorType();
this.red = c.red();
this.green = c.green();
this.blue = c.blue();
this.red = c.getRed();
this.green = c.getGreen();
this.blue = c.getBlue();

this.wrapOption = this.properties.get("wrap-option").getEnum();
this.whiteSpaceCollapse =
this.properties.get("white-space-collapse").getEnum();
this.properties.get("white-space-collapse").getEnum();
ts = new TextState();

}

+ 67
- 23
src/org/apache/fop/fo/flow/PageNumberCitation.java View File

@@ -1,15 +1,59 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
// Java
import java.util.List;

// FOP
import org.apache.fop.apps.StructureHandler;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Resolveable;
@@ -46,16 +90,16 @@ public class PageNumberCitation extends FObj {
protected FontInfo fontInfo = null;
protected FontState fontState;

float red;
float green;
float blue;
int wrapOption;
int whiteSpaceCollapse;
String pageNumber;
String refId;
TextState ts;
InlineArea inline = null;
boolean unresolved = false;
private float red;
private float green;
private float blue;
private int wrapOption;
private int whiteSpaceCollapse;
private String pageNumber;
private String refId;
private TextState ts;
private InlineArea inline = null;
private boolean unresolved = false;

public PageNumberCitation(FONode parent) {
super(parent);
@@ -108,8 +152,8 @@ public class PageNumberCitation extends FObj {
int width = getStringWidth(str);
word.setWord(str);
inline.setIPD(width);
inline.setHeight(fontState.getAscender() -
fontState.getDescender());
inline.setHeight(fontState.getAscender()
- fontState.getDescender());
inline.setOffset(fontState.getAscender());

inline.addTrait(Trait.FONT_NAME, fontState.getFontName());
@@ -122,8 +166,8 @@ public class PageNumberCitation extends FObj {
String str = "MMM"; // reserve three spaces for page number
int width = getStringWidth(str);
inline.setIPD(width);
inline.setHeight(fontState.getAscender() -
fontState.getDescender());
inline.setHeight(fontState.getAscender()
- fontState.getDescender());
inline.setOffset(fontState.getAscender());

inline.addTrait(Trait.FONT_NAME, fontState.getFontName());
@@ -182,9 +226,9 @@ public class PageNumberCitation extends FObj {
// this.properties.get("word-spacing");

ColorType c = this.properties.get("color").getColorType();
this.red = c.red();
this.green = c.green();
this.blue = c.blue();
this.red = c.getRed();
this.green = c.getGreen();
this.blue = c.getBlue();

this.wrapOption = this.properties.get("wrap-option").getEnum();
this.whiteSpaceCollapse =

+ 94
- 45
src/org/apache/fop/fo/flow/Table.java View File

@@ -1,42 +1,91 @@
/*
* -- $Id$ --
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* $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.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.apps.FOPException;

import org.apache.fop.layoutmgr.table.TableLayoutManager;

// Java
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;

// FOP
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.LengthRange;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.TableLayout;
import org.apache.fop.fo.properties.TableOmitFooterAtBreak;
import org.apache.fop.fo.properties.TableOmitHeaderAtBreak;
import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.MarginProps;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.table.TableLayoutManager;

public class Table extends FObj {
private static final int MINCOLWIDTH = 10000; // 10pt

protected ArrayList columns = null;
TableBody tableHeader = null;
TableBody tableFooter = null;
boolean omitHeaderAtBreak = false;
boolean omitFooterAtBreak = false;

int breakBefore;
int breakAfter;
int spaceBefore;
int spaceAfter;
ColorType backgroundColor;
LengthRange ipd;
int height;
private TableBody tableHeader = null;
private TableBody tableFooter = null;
private boolean omitHeaderAtBreak = false;
private boolean omitFooterAtBreak = false;
private int breakBefore;
private int breakAfter;
private int spaceBefore;
private int spaceAfter;
private ColorType backgroundColor;
private LengthRange ipd;
private int height;

private boolean bAutoLayout = false;
private int contentWidth = 0; // Sum of column widths
@@ -52,14 +101,14 @@ public class Table extends FObj {
}

protected void addChild(FONode child) {
if(child.getName().equals("fo:table-column")) {
if(columns == null) {
if (child.getName().equals("fo:table-column")) {
if (columns == null) {
columns = new ArrayList();
}
columns.add(((TableColumn)child).getLayoutManager());
} else if(child.getName().equals("fo:table-footer")) {
} else if (child.getName().equals("fo:table-footer")) {
tableFooter = (TableBody)child;
} else if(child.getName().equals("fo:table-header")) {
} else if (child.getName().equals("fo:table-header")) {
tableHeader = (TableBody)child;
} else {
// add bodies
@@ -76,10 +125,10 @@ public class Table extends FObj {
tlm.setUserAgent(getUserAgent());
tlm.setFObj(this);
tlm.setColumns(columns);
if(tableHeader != null) {
if (tableHeader != null) {
tlm.setTableHeader(tableHeader.getLayoutManager());
}
if(tableFooter != null) {
if (tableFooter != null) {
tlm.setTableFooter(tableFooter.getLayoutManager());
}
list.add(tlm);
@@ -101,7 +150,7 @@ public class Table extends FObj {

// Common Relative Position Properties
RelativePositionProps mRelProps =
propMgr.getRelativePositionProps();
propMgr.getRelativePositionProps();

// this.properties.get("block-progression-dimension");
// this.properties.get("border-after-precendence");
@@ -127,23 +176,23 @@ public class Table extends FObj {
this.breakBefore = this.properties.get("break-before").getEnum();
this.breakAfter = this.properties.get("break-after").getEnum();
this.spaceBefore = this.properties.get(
"space-before.optimum").getLength().mvalue();
"space-before.optimum").getLength().getValue();
this.spaceAfter = this.properties.get(
"space-after.optimum").getLength().mvalue();
"space-after.optimum").getLength().getValue();
this.backgroundColor =
this.properties.get("background-color").getColorType();
this.ipd = this.properties.get(
"inline-progression-dimension"). getLengthRange();
this.height = this.properties.get("height").getLength().mvalue();
this.bAutoLayout = (this.properties.get("table-layout").getEnum() ==
TableLayout.AUTO);
"inline-progression-dimension").getLengthRange();
this.height = this.properties.get("height").getLength().getValue();
this.bAutoLayout = (this.properties.get(
"table-layout").getEnum() == TableLayout.AUTO);

this.omitHeaderAtBreak = this.properties.get(
"table-omit-header-at-break").getEnum() ==
TableOmitHeaderAtBreak.TRUE;
"table-omit-header-at-break").getEnum()
== TableOmitHeaderAtBreak.TRUE;
this.omitFooterAtBreak = this.properties.get(
"table-omit-footer-at-break").getEnum() ==
TableOmitFooterAtBreak.TRUE;
"table-omit-footer-at-break").getEnum()
== TableOmitFooterAtBreak.TRUE;

}


+ 65
- 20
src/org/apache/fop/fo/flow/TableBody.java View File

@@ -1,31 +1,76 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// Java
import java.util.List;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;

import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;

import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.table.Body;

// Java
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;

public class TableBody extends FObj {

int spaceBefore;
int spaceAfter;
ColorType backgroundColor;
private int spaceBefore;
private int spaceAfter;
private ColorType backgroundColor;

public TableBody(FONode parent) {
super(parent);
@@ -64,9 +109,9 @@ public class TableBody extends FObj {
setupID();

this.spaceBefore = this.properties.get(
"space-before.optimum").getLength().mvalue();
"space-before.optimum").getLength().getValue();
this.spaceAfter = this.properties.get(
"space-after.optimum").getLength().mvalue();
"space-after.optimum").getLength().getValue();
this.backgroundColor =
this.properties.get("background-color").getColorType();


+ 88
- 36
src/org/apache/fop/fo/flow/TableCell.java View File

@@ -1,34 +1,86 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// Java
import java.util.List;

// XML
import org.xml.sax.Attributes;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.*;

import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.BorderCollapse;
import org.apache.fop.fo.properties.DisplayAlign;

import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.table.Cell;

import org.xml.sax.Attributes;

import java.util.List;

public class TableCell extends FObj {

// int spaceBefore;
// int spaceAfter;
ColorType backgroundColor;
// private int spaceBefore;
// private int spaceAfter;
private ColorType backgroundColor;

int numColumnsSpanned;
int numRowsSpanned;
int iColNumber = -1; // uninitialized
private int numColumnsSpanned;
private int numRowsSpanned;
private int iColNumber = -1; // uninitialized

/**
* Offset of content rectangle in inline-progression-direction,
@@ -63,29 +115,28 @@ public class TableCell extends FObj {
/* For collapsed border style */
protected int borderHeight = 0;

/**
* Minimum ontent height of cell.
*/
/** Minimum ontent height of cell. */
protected int minCellHeight = 0;
/** Height of cell */
protected int height = 0;
protected int top; // Ypos of cell ???
/** Ypos of cell ??? */
protected int top;
protected int verticalAlign;
protected boolean bRelativeAlign = false;

// boolean setup = false;
boolean bSepBorders = true;
private boolean bSepBorders = true;

/**
* Set to true if all content completely laid out.
*/
boolean bDone = false;
private boolean bDone = false;

/**
* Border separation value in the block-progression dimension.
* Used in calculating cells height.
*/
int m_borderSeparation = 0;
private int borderSeparation = 0;

public TableCell(FONode parent) {
super(parent);
@@ -105,7 +156,9 @@ public class TableCell extends FObj {
list.add(clm);
}

// Set position relative to table (set by body?)
/**
* Set position relative to table (set by body?)
*/
public void setStartOffset(int offset) {
startOffset = offset;
}
@@ -128,8 +181,7 @@ public class TableCell extends FObj {
return numRowsSpanned;
}

public void doSetup() // throws FOPException
{
public void doSetup() {
// Common Accessibility Properties
AccessibilityProps mAccProps = propMgr.getAccessibilityProps();

@@ -195,7 +247,7 @@ public class TableCell extends FObj {
}

this.minCellHeight =
this.properties.get("height").getLength().mvalue();
this.properties.get("height").getLength().getValue();
}

/**
@@ -212,8 +264,8 @@ public class TableCell extends FObj {
* border-separate should only be specified on the table object,
* but it inherits.
*/
int iSep =
properties.get("border-separation.inline-progression-direction").getLength().mvalue();
int iSep = properties.get(
"border-separation.inline-progression-direction").getLength().getValue();
this.startAdjust = iSep / 2 + bp.getBorderLeftWidth(false)
+ bp.getPaddingLeft(false);
/*
@@ -225,9 +277,9 @@ public class TableCell extends FObj {
+ bp.getPaddingRight(false);
// bp.getBorderEndWidth(false) + bp.getPaddingEnd(false);
// Offset of content rectangle in the block-progression direction
m_borderSeparation =
properties.get("border-separation.block-progression-direction").getLength().mvalue();
this.beforeOffset = m_borderSeparation / 2
borderSeparation = properties.get(
"border-separation.block-progression-direction").getLength().getValue();
this.beforeOffset = borderSeparation / 2
+ bp.getBorderTopWidth(false)
+ bp.getPaddingTop(false);
// bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false);

+ 65
- 21
src/org/apache/fop/fo/flow/TableColumn.java View File

@@ -1,34 +1,78 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.*;

import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.Property;

import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.table.Column;


public class TableColumn extends FObj {

ColorType backgroundColor;
private ColorType backgroundColor;

Length columnWidthPropVal;
int columnWidth;
int columnOffset;
int numColumnsRepeated;
int iColumnNumber;
private Length columnWidthPropVal;
private int columnWidth;
private int columnOffset;
private int numColumnsRepeated;
private int iColumnNumber;

boolean setup = false;
private boolean setup = false;

public TableColumn(FONode parent) {
super(parent);
@@ -88,11 +132,11 @@ public class TableColumn extends FObj {
this.properties.get("background-color").getColorType();

Property prop = this.properties.get("column-width");
if(prop != null) {
if (prop != null) {
columnWidthPropVal = properties.get("column-width").getLength();

// This won't include resolved table-units or % values yet.
columnWidth = columnWidthPropVal.mvalue();
columnWidth = columnWidthPropVal.getValue();
} else {
columnWidth = 300000;
}

+ 71
- 26
src/org/apache/fop/fo/flow/TableRow.java View File

@@ -1,38 +1,85 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.flow;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.*;
import org.apache.fop.layout.*;
import org.apache.fop.apps.FOPException;

import org.apache.fop.layoutmgr.table.Row;

// Java
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;

// FOP
import org.apache.fop.datatypes.ColorType;
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.properties.Constants;

import org.apache.fop.layout.AccessibilityProps;
import org.apache.fop.layout.AuralProps;
import org.apache.fop.layout.BackgroundProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.layoutmgr.table.Row;

public class TableRow extends FObj {

boolean setup = false;
private boolean setup = false;

int breakAfter;
ColorType backgroundColor;
private int breakAfter;
private ColorType backgroundColor;

KeepValue keepWithNext;
KeepValue keepWithPrevious;
KeepValue keepTogether;
private KeepValue keepWithNext;
private KeepValue keepWithPrevious;
private KeepValue keepTogether;

int minHeight = 0; // force row height
private int minHeight = 0; // force row height

public TableRow(FONode parent) {
super(parent);
@@ -88,7 +135,7 @@ public class TableRow extends FObj {
this.keepWithPrevious =
getKeepValue("keep-with-previous.within-column");

this.minHeight = this.properties.get("height").getLength().mvalue();
this.minHeight = this.properties.get("height").getLength().getValue();
setup = true;
}

@@ -101,11 +148,9 @@ public class TableRow extends FObj {
switch (p.getEnum()) {
case Constants.ALWAYS:
return new KeepValue(KeepValue.KEEP_WITH_ALWAYS, 0);
// break;
case Constants.AUTO:
default:
return new KeepValue(KeepValue.KEEP_WITH_AUTO, 0);
// break;
}
}
}

+ 50
- 7
src/org/apache/fop/fo/pagination/RegionBASE.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.pagination;

// FOP
@@ -24,10 +67,10 @@ public abstract class RegionBASE extends Region {
public void end() {
// The problem with this is that it might not be known yet....
// Supposing extent is calculated in terms of percentage
this.extent = this.properties.get("extent").getLength().mvalue();
this.extent = this.properties.get("extent").getLength().getValue();
}

int getExtent() {
public int getExtent() {
return this.extent;
}
}

+ 66
- 26
src/org/apache/fop/fo/pagination/RegionBody.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.pagination;

// Java
@@ -26,14 +69,13 @@ import org.apache.fop.layout.MarginProps;

public class RegionBody extends Region {

ColorType backgroundColor;
private ColorType backgroundColor;

public RegionBody(FONode parent) {
super(parent);
}

protected Rectangle getViewportRectangle (FODimension reldims)
{
protected Rectangle getViewportRectangle (FODimension reldims) {
/*
* Use space-before and space-after which will use corresponding
* absolute margin properties if specified. For indents:
@@ -44,19 +86,17 @@ public class RegionBody extends Region {
MarginProps mProps = propMgr.getMarginProps();
int start = getRelMargin(PropertyList.START, "start-indent");
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB)
vpRect = new Rectangle( start, mProps.spaceBefore,
reldims.ipd - start -
getRelMargin(PropertyList.END, "end-indent"),
reldims.bpd - mProps.spaceBefore -
mProps.spaceAfter);
else
vpRect = new Rectangle( start, mProps.spaceBefore,
reldims.bpd - mProps.spaceBefore -
mProps.spaceAfter,
reldims.ipd - start -
getRelMargin(PropertyList.END, "end-indent")
);
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
vpRect = new Rectangle(start, mProps.spaceBefore,
reldims.ipd - start
- getRelMargin(PropertyList.END, "end-indent"),
reldims.bpd - mProps.spaceBefore - mProps.spaceAfter);
} else {
vpRect = new Rectangle(start, mProps.spaceBefore,
reldims.bpd - mProps.spaceBefore - mProps.spaceAfter,
reldims.ipd - start
- getRelMargin(PropertyList.END, "end-indent"));
}
return vpRect;
}

@@ -66,13 +106,13 @@ public class RegionBody extends Region {
*/
private int getRelMargin(int reldir, String sRelPropName) {
FObj parent = (FObj) getParent();
String sPropName = "margin-" +
parent.properties.wmRelToAbs(reldir);
String sPropName = "margin-"
+ parent.properties.wmRelToAbs(reldir);
Property prop = properties.getExplicitBaseProp(sPropName);
if (prop == null) {
prop = properties.getExplicitBaseProp(sRelPropName);
}
return ((prop != null)? prop.getLength().mvalue() : 0);
return ((prop != null) ? prop.getLength().getValue() : 0);
}

protected String getDefaultRegionName() {
@@ -94,7 +134,7 @@ public class RegionBody extends Region {
// Should set some column stuff here I think, or put it elsewhere
BodyRegion body = new BodyRegion();
setRegionPosition(body, absRegVPRect);
int columnCount=
int columnCount =
this.properties.get("column-count").getNumber().intValue();
if ((columnCount > 1) && (overflow == Overflow.SCROLL)) {
// recover by setting 'column-count' to 1. This is allowed but
@@ -106,7 +146,7 @@ public class RegionBody extends Region {
body.setColumnCount(columnCount);

int columnGap =
this.properties.get("column-gap").getLength().mvalue();
this.properties.get("column-gap").getLength().getValue();
body.setColumnGap(columnGap);
return body;
}

+ 80
- 35
src/org/apache/fop/fo/pagination/SimplePageMaster.java View File

@@ -1,16 +1,69 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* $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.pagination;

// Java
import java.awt.Rectangle;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

// XML
import org.xml.sax.Attributes;

// FOP
import org.apache.fop.fo.*;
import org.apache.fop.area.CTM;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Page;
import org.apache.fop.area.RegionViewport;
@@ -19,13 +72,6 @@ import org.apache.fop.layout.MarginProps;
import org.apache.fop.layout.PageMaster;
import org.apache.fop.apps.FOPException;

import java.awt.Rectangle;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.xml.sax.Attributes;

/**
* A simple-page-master formatting object.
* This creates a simple page from the specified regions
@@ -35,10 +81,10 @@ public class SimplePageMaster extends FObj {
/**
* Page regions (regionClass, Region)
*/
private Map _regions;
private Map regions;

PageMaster pageMaster;
String masterName;
private PageMaster pageMaster;
private String masterName;

public SimplePageMaster(FONode parent) {
super(parent);
@@ -62,7 +108,7 @@ public class SimplePageMaster extends FObj {
+ parent.getName());
}
//Well, there are only 5 regions so we can save a bit of memory here
_regions = new HashMap(5);
regions = new HashMap(5);
}

/**
@@ -71,9 +117,9 @@ public class SimplePageMaster extends FObj {
*/
protected void end() {
int pageWidth =
this.properties.get("page-width").getLength().mvalue();
this.properties.get("page-width").getLength().getValue();
int pageHeight =
this.properties.get("page-height").getLength().mvalue();
this.properties.get("page-height").getLength().getValue();
// this.properties.get("reference-orientation");
// this.properties.get("writing-mode");

@@ -95,15 +141,15 @@ public class SimplePageMaster extends FObj {

// Set up the CTM on the page reference area based on writing-mode
// and reference-orientation
FODimension reldims=new FODimension(0,0);
FODimension reldims = new FODimension(0, 0);
CTM pageCTM = propMgr.getCTMandRelDims(pageRefRect, reldims);

// Create a RegionViewport/ reference area pair for each page region

boolean bHasBody=false;
boolean bHasBody = false;

for (Iterator regenum = _regions.values().iterator();
regenum.hasNext(); ) {
for (Iterator regenum = regions.values().iterator();
regenum.hasNext();) {
Region r = (Region)regenum.next();
RegionViewport rvp = r.makeRegionViewport(reldims, pageCTM);
rvp.setRegion(r.makeRegionReferenceArea(rvp.getViewArea()));
@@ -118,10 +164,9 @@ public class SimplePageMaster extends FObj {
}

this.pageMaster = new PageMaster(new PageViewport(page,
new Rectangle(0,0,
pageWidth,pageHeight)));
new Rectangle(0, 0, pageWidth, pageHeight)));

// _regions = null; // PageSequence access SimplePageMaster....
// regions = null; // PageSequence access SimplePageMaster....
children = null;
properties = null;
}
@@ -146,14 +191,14 @@ public class SimplePageMaster extends FObj {
if (child instanceof Region) {
addRegion((Region)child);
} else {
getLogger().error("SimplePageMaster cannot have child of type " +
child.getName());
getLogger().error("SimplePageMaster cannot have child of type "
+ child.getName());
}
}

protected void addRegion(Region region) {
String key = region.getRegionClass();
if (_regions.containsKey(key)) {
if (regions.containsKey(key)) {
getLogger().error("Only one region of class "
+ key
+ " allowed within a simple-page-master.");
@@ -161,21 +206,21 @@ public class SimplePageMaster extends FObj {
// + key
// + " allowed within a simple-page-master.");
} else {
_regions.put(key, region);
regions.put(key, region);
}
}

public Region getRegion(String regionClass) {
return (Region)_regions.get(regionClass);
return (Region)regions.get(regionClass);
}

protected Map getRegions() {
return _regions;
return regions;
}

protected boolean regionNameExists(String regionName) {
for (Iterator regenum = _regions.values().iterator();
regenum.hasNext(); ) {
for (Iterator regenum = regions.values().iterator();
regenum.hasNext();) {
Region r = (Region)regenum.next();
if (r.getRegionName().equals(regionName)) {
return true;

+ 64
- 18
src/org/apache/fop/layout/BorderAndPadding.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.layout;

import org.apache.fop.datatypes.ColorType;
@@ -24,12 +67,12 @@ public class BorderAndPadding implements Cloneable {
public static final int RIGHT = END;

private static class ResolvedCondLength implements Cloneable {
int iLength; // Resolved length value
boolean bDiscard;
private int iLength; // Resolved length value
private boolean bDiscard;

ResolvedCondLength(CondLength length) {
public ResolvedCondLength(CondLength length) {
bDiscard = length.isDiscard();
iLength = length.mvalue();
iLength = length.getLengthValue();
}

public Object clone() throws CloneNotSupportedException {
@@ -80,7 +123,8 @@ public class BorderAndPadding implements Cloneable {
private BorderInfo[] borderInfo = new BorderInfo[4];
private ResolvedCondLength[] padding = new ResolvedCondLength[4];

public BorderAndPadding() {}
public BorderAndPadding() {
}

public void setBorder(int side, int style, CondLength width,
ColorType color) {
@@ -133,9 +177,9 @@ public class BorderAndPadding implements Cloneable {


public int getBorderWidth(int side, boolean bDiscard) {
if ((borderInfo[side] == null) ||
(borderInfo[side].mStyle == Constants.NONE) ||
(bDiscard && borderInfo[side].mWidth.bDiscard)) {
if ((borderInfo[side] == null)
|| (borderInfo[side].mStyle == Constants.NONE)
|| (bDiscard && borderInfo[side].mWidth.bDiscard)) {
return 0;
} else {
return borderInfo[side].mWidth.iLength;
@@ -145,23 +189,25 @@ public class BorderAndPadding implements Cloneable {
public ColorType getBorderColor(int side) {
if (borderInfo[side] != null) {
return borderInfo[side].mColor;
} else
} else {
return null;
}
}

public int getBorderStyle(int side) {
if (borderInfo[side] != null) {
return borderInfo[side].mStyle;
} else
} else {
return 0;
}
}

public int getPadding(int side, boolean bDiscard) {
if ((padding[side] == null) ||
(bDiscard && padding[side].bDiscard)) {
if ((padding[side] == null) || (bDiscard && padding[side].bDiscard)) {
return 0;
} else
} else {
return padding[side].iLength;
}
}

}

+ 60
- 19
src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java View File

@@ -1,12 +1,58 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.layoutmgr;

import java.util.List;
import java.awt.geom.Rectangle2D;

import org.apache.fop.area.Area;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.Block;
@@ -18,11 +64,6 @@ import org.apache.fop.fo.PropertyList;
import org.apache.fop.area.CTM;
import org.apache.fop.datatypes.FODimension;

import java.util.ArrayList;
import java.util.List;

import java.awt.geom.Rectangle2D;

/**
* LayoutManager for a block FO.
*/
@@ -31,14 +72,14 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
private BlockViewport viewportBlockArea;
private Block curBlockArea;

List childBreaks = new ArrayList();
private List childBreaks = new java.util.ArrayList();

AbsolutePositionProps abProps;
FODimension relDims;
CTM absoluteCTM;
boolean clip = false;
int overflow;
PropertyManager propManager;
private AbsolutePositionProps abProps;
private FODimension relDims;
private CTM absoluteCTM;
private boolean clip = false;
private int overflow;
private PropertyManager propManager;

/**
* Create a new block container layout manager.
@@ -65,8 +106,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {

protected int getRotatedIPD() {
PropertyList props = propManager.getProperties();
int height = props.get("height").getLength().mvalue();
height = props.get("inline-progression-dimension.optimum").getLength().mvalue();
int height = props.get("height").getLength().getValue();
height = props.get("inline-progression-dimension.optimum").getLength().getValue();

return height;
}

+ 67
- 24
src/org/apache/fop/layoutmgr/BlockLayoutManager.java View File

@@ -1,12 +1,59 @@
/*
* $Id$
* Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.layoutmgr;

import java.util.ListIterator;
import java.util.ArrayList;
import java.util.List;

import org.apache.fop.fo.FObj;
import org.apache.fop.fo.TextInfo;
import org.apache.fop.fo.PropertyManager;
@@ -17,10 +64,6 @@ import org.apache.fop.traits.LayoutProps;
import org.apache.fop.layout.BorderAndPadding;
import org.apache.fop.layout.BackgroundProps;

import java.util.ListIterator;
import java.util.ArrayList;
import java.util.List;

/**
* LayoutManager for a block FO.
*/
@@ -28,17 +71,17 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {

private Block curBlockArea;

LayoutProps layoutProps;
BorderAndPadding borderProps;
BackgroundProps backgroundProps;
private LayoutProps layoutProps;
private BorderAndPadding borderProps;
private BackgroundProps backgroundProps;

int lead = 12000;
int lineHeight = 14000;
int follow = 2000;
private int lead = 12000;
private int lineHeight = 14000;
private int follow = 2000;

int iStartPos = 0;
private int iStartPos = 0;

protected List childBreaks = new ArrayList();
protected List childBreaks = new java.util.ArrayList();

/**
* Iterator for Block layout.
@@ -59,7 +102,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
while (proxy.hasNext()) {
LayoutProcessor lm = (LayoutProcessor) proxy.next();
lm.setParent(BlockLayoutManager.this);
if(lm.generatesInlineAreas()) {
if (lm.generatesInlineAreas()) {
LineLayoutManager lineLM = createLineManager(lm);
listLMs.add(lineLM);
} else {
@@ -134,7 +177,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {

MinOptMax stackSize = new MinOptMax();
// if starting add space before
stackSize.add(layoutProps.spaceBefore.space);
stackSize.add(layoutProps.spaceBefore.getSpace());

BreakPoss lastPos = null;

@@ -191,10 +234,10 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
}
}
if(getChildLM() == null || over) {
if(getChildLM() == null) {
if (getChildLM() == null || over) {
if (getChildLM() == null) {
setFinished(true);
stackSize.add(layoutProps.spaceAfter.space);
stackSize.add(layoutProps.spaceAfter.getSpace());
}
BreakPoss breakPoss = new BreakPoss(
new LeafPosition(this, childBreaks.size() - 1));
@@ -217,7 +260,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {

// if adjusted space before
double adjust = layoutContext.getSpaceAdjust();
addBlockSpacing(adjust, layoutProps.spaceBefore.space);
addBlockSpacing(adjust, layoutProps.spaceBefore.getSpace());

addID();
addMarkers(true, true);
@@ -247,7 +290,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
flush();

// if adjusted space after
addBlockSpacing(adjust, layoutProps.spaceAfter.space);
addBlockSpacing(adjust, layoutProps.spaceAfter.getSpace());

curBlockArea = null;
}

+ 67
- 25
src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java View File

@@ -1,12 +1,59 @@
/*
* $Id$
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.layoutmgr;

import java.util.Iterator;
import java.util.ListIterator;
import java.util.HashMap;

import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyManager;
import org.apache.fop.layout.BorderAndPadding;
@@ -17,10 +64,6 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.area.inline.Space;

import java.util.Iterator;
import java.util.ListIterator;
import java.util.HashMap;

/**
* LayoutManager for objects which stack children in the inline direction,
* such as Inline or Line
@@ -173,8 +216,8 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
// Back up the child LM Position
Position childPos = prevPos.getPosition();
reset(childPos);
if (prevBP != null &&
prevBP.getLayoutManager() != childPos.getLM()) {
if (prevBP != null
&& prevBP.getLayoutManager() != childPos.getLM()) {
childLC = null;
}
prevBP = new BreakPoss(childPos);
@@ -198,8 +241,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
* propagate to first child LM
*/
public boolean canBreakBefore(LayoutContext context) {
if (inlineProps.spaceStart.space.min > 0 ||
hasLeadingFence(false)) {
if (inlineProps.spaceStart.getSpace().min > 0 || hasLeadingFence(false)) {
return true;
}
LayoutProcessor lm = getChildLM();
@@ -264,8 +306,8 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
* and initialize pending space from previous LM sibling's
* trailing space specifiers.
*/
boolean bFirstChildBP = (prevBP == null ||
prevBP.getLayoutManager() != curLM);
boolean bFirstChildBP = (prevBP == null
|| prevBP.getLayoutManager() != curLM);

initChildLC(childLC, prevBP, lc.startsNewArea(),
bFirstChildBP, leadingSpace);
@@ -273,9 +315,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
childLC.setHyphContext(lc.getHyphContext());
}

if (((bp = curLM.getNextBreakPoss(childLC)) != null) ||
(lc.tryHyphenate() &&
!lc.getHyphContext().hasMoreHyphPoints())) {
if (((bp = curLM.getNextBreakPoss(childLC)) != null)
|| (lc.tryHyphenate()
&& !lc.getHyphContext().hasMoreHyphPoints())) {
break;
}
// If LM has no content, should it generate any area? If not,
@@ -500,7 +542,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
context.setTrailingSpace(getContext().getTrailingSpace());
}
// Add own trailing space to parent context (or set on area?)
if(context.getTrailingSpace() != null) {
if (context.getTrailingSpace() != null) {
context.getTrailingSpace().addSpace(inlineProps.spaceEnd);
}

@@ -508,10 +550,10 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
TraitSetter.setBorderPaddingTraits(getCurrentArea(),
borderProps, bAreaCreated, !bIsLast);

if(borderProps != null) {
if (borderProps != null) {
TraitSetter.addBorders(getCurrentArea(), borderProps);
}
if(backgroundProps != null) {
if (backgroundProps != null) {
TraitSetter.addBackground(getCurrentArea(), backgroundProps);
}

@@ -556,12 +598,12 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
int iAdjust = spaceRange.opt;
if (dSpaceAdjust > 0.0) {
// Stretch by factor
iAdjust += (int)((double)(spaceRange.max -
spaceRange.opt) * dSpaceAdjust);
iAdjust += (int)((double)(spaceRange.max
- spaceRange.opt) * dSpaceAdjust);
} else if (dSpaceAdjust < 0.0) {
// Shrink by factor
iAdjust += (int)((double)(spaceRange.opt -
spaceRange.min) * dSpaceAdjust);
iAdjust += (int)((double)(spaceRange.opt
- spaceRange.min) * dSpaceAdjust);
}
if (iAdjust != 0) {
//getLogger().debug("Add leading space: " + iAdjust);

+ 69
- 24
src/org/apache/fop/layoutmgr/SpaceSpecifier.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.layoutmgr;

import org.apache.fop.traits.SpaceVal;
@@ -21,7 +64,7 @@ public class SpaceSpecifier implements Cloneable {

private boolean bStartsRefArea;
private boolean bHasForcing = false;
private List vecSpaceVals = new ArrayList();
private List vecSpaceVals = new java.util.ArrayList();


public SpaceSpecifier(boolean bStarts) {
@@ -62,9 +105,10 @@ public class SpaceSpecifier implements Cloneable {
* add it to the sequence.
*/
public void addSpace(SpaceVal moreSpace) {
if (!bStartsRefArea || !moreSpace.bConditional ||
!vecSpaceVals.isEmpty()) {
if (moreSpace.bForcing) {
if (!bStartsRefArea
|| !moreSpace.isConditional()
|| !vecSpaceVals.isEmpty()) {
if (moreSpace.isForcing()) {
if (bHasForcing == false) {
// Remove all other values (must all be non-forcing)
vecSpaceVals.clear();
@@ -73,8 +117,9 @@ public class SpaceSpecifier implements Cloneable {
vecSpaceVals.add(moreSpace);
} else if (bHasForcing == false) {
// Don't bother adding all 0 space-specifier if not forcing
if (moreSpace.space.min != 0 || moreSpace.space.opt != 0 ||
moreSpace.space.max != 0) {
if (moreSpace.getSpace().min != 0
|| moreSpace.getSpace().opt != 0
|| moreSpace.getSpace().max != 0) {
vecSpaceVals.add(moreSpace);
}
}
@@ -97,7 +142,7 @@ public class SpaceSpecifier implements Cloneable {
for (; lastIndex > 0; --lastIndex) {
SpaceVal sval = (SpaceVal) vecSpaceVals.get(
lastIndex - 1);
if (!sval.bConditional) {
if (!sval.isConditional()) {
break;
}
}
@@ -107,19 +152,19 @@ public class SpaceSpecifier implements Cloneable {
for (int index = 0; index < lastIndex; index++) {
SpaceVal sval = (SpaceVal) vecSpaceVals.get(index);
if (bHasForcing) {
resSpace.add(sval.space);
} else if (sval.iPrecedence > iMaxPrec) {
iMaxPrec = sval.iPrecedence;
resSpace = sval.space;
} else if (sval.iPrecedence == iMaxPrec) {
if (sval.space.opt > resSpace.opt) {
resSpace = sval.space;
} else if (sval.space.opt == resSpace.opt) {
if (resSpace.min < sval.space.min) {
resSpace.min = sval.space.min;
resSpace.add(sval.getSpace());
} else if (sval.getPrecedence() > iMaxPrec) {
iMaxPrec = sval.getPrecedence();
resSpace = sval.getSpace();
} else if (sval.getPrecedence() == iMaxPrec) {
if (sval.getSpace().opt > resSpace.opt) {
resSpace = sval.getSpace();
} else if (sval.getSpace().opt == resSpace.opt) {
if (resSpace.min < sval.getSpace().min) {
resSpace.min = sval.getSpace().min;
}
if (resSpace.max > sval.space.max) {
resSpace.max = sval.space.max;
if (resSpace.max > sval.getSpace().max) {
resSpace.max = sval.getSpace().max;
}
}
}

+ 98
- 53
src/org/apache/fop/layoutmgr/TextLayoutManager.java View File

@@ -1,12 +1,57 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.layoutmgr;

import java.util.ArrayList;

import org.apache.fop.fo.TextInfo;
import org.apache.fop.traits.SpaceVal;
import org.apache.fop.area.Trait;
@@ -15,8 +60,6 @@ import org.apache.fop.area.inline.Word;
import org.apache.fop.area.inline.Space;
import org.apache.fop.util.CharUtilities;

import java.util.ArrayList;

/**
* LayoutManager for text (a sequence of characters) which generates one
* or more inline areas.
@@ -30,11 +73,11 @@ public class TextLayoutManager extends AbstractLayoutManager {
* Number of word-spaces?
*/
private class AreaInfo {
short iStartIndex;
short iBreakIndex;
short iWScount;
MinOptMax ipdArea;
AreaInfo(short iSIndex, short iBIndex, short iWS,
private short iStartIndex;
private short iBreakIndex;
private short iWScount;
private MinOptMax ipdArea;
public AreaInfo(short iSIndex, short iBIndex, short iWS,
MinOptMax ipd) {
iStartIndex = iSIndex;
iBreakIndex = iBIndex;
@@ -48,7 +91,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
private ArrayList vecAreaInfo;

/** Non-space characters on which we can end a line. */
private static final String s_breakChars = "-/" ;
private static final String BREAK_CHARS = "-/" ;

private char[] chars;
private TextInfo textInfo;
@@ -81,14 +124,13 @@ public class TextLayoutManager extends AbstractLayoutManager {
/**
* Create a Text layout manager.
*
* @param fobj the fo object that contains the text
* @param chars the characters
* @param textInfo the text information for doing layout
*/
public TextLayoutManager(char[] chars, TextInfo textInfo) {
this.chars = chars;
this.textInfo = textInfo;
this.vecAreaInfo = new ArrayList();
this.vecAreaInfo = new java.util.ArrayList();

// With CID fonts, space isn't neccesary currentFontState.width(32)
spaceCharIPD = CharUtilities.getCharWidth(' ', textInfo.fs);
@@ -96,8 +138,8 @@ public class TextLayoutManager extends AbstractLayoutManager {
hyphIPD = CharUtilities.getCharWidth('-', textInfo.fs);
// Make half-space: <space> on either side of a word-space)
SpaceVal ws = textInfo.wordSpacing;
halfWS = new SpaceVal(MinOptMax.multiply(ws.space, 0.5),
ws.bConditional, ws.bForcing, ws.iPrecedence);
halfWS = new SpaceVal(MinOptMax.multiply(ws.getSpace(), 0.5),
ws.isConditional(), ws.isForcing(), ws.getPrecedence());
}

/**
@@ -124,9 +166,11 @@ public class TextLayoutManager extends AbstractLayoutManager {
(AreaInfo) vecAreaInfo.get(endPos.getLeafPos());
// Skip all leading spaces for hyphenation
int i;
for (i = ai.iStartIndex; i < ai.iBreakIndex &&
CharUtilities.isAnySpace(chars[i]) == true ; i++)
;
for (i = ai.iStartIndex;
i < ai.iBreakIndex && CharUtilities.isAnySpace(chars[i]) == true;
i++) {
//nop
}
sbChars.append(new String(chars, i, ai.iBreakIndex - i));
}

@@ -141,9 +185,9 @@ public class TextLayoutManager extends AbstractLayoutManager {
*/
public boolean canBreakBefore(LayoutContext context) {
char c = chars[iNextStart];
return ((c == NEWLINE) || (textInfo.bWrap &&
(CharUtilities.isSpace(c) ||
s_breakChars.indexOf(c) >= 0)));
return ((c == NEWLINE)
|| (textInfo.bWrap && (CharUtilities.isSpace(c)
|| BREAK_CHARS.indexOf(c) >= 0)));
}

/**
@@ -267,20 +311,21 @@ public class TextLayoutManager extends AbstractLayoutManager {

for (; iNextStart < chars.length; iNextStart++) {
char c = chars[iNextStart];
if (CharUtilities.isAnySpace(c) == false)
if (CharUtilities.isAnySpace(c) == false) {
break;
}
if (c == SPACE || c == NBSPACE) {
++iWScount;
// Counted as word-space
if (iNextStart == iThisStart &&
(iFlags & BreakPoss.ISFIRST) != 0) {
if (iNextStart == iThisStart
&& (iFlags & BreakPoss.ISFIRST) != 0) {
// If possible, treat as normal inter-word space
if (context.getLeadingSpace().hasSpaces()) {
context.getLeadingSpace().addSpace(halfWS);
} else {
// Doesn't combine with any other leading spaces
// from ancestors
spaceIPD.add(halfWS.space);
spaceIPD.add(halfWS.getSpace());
}
} else {
pendingSpace.addSpace(halfWS);
@@ -318,8 +363,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
// Get the size of the next syallable
MinOptMax hyphIPD = new MinOptMax(0);
if (getHyphenIPD(context.getHyphContext(), hyphIPD)) {
iFlags |= (BreakPoss.CAN_BREAK_AFTER |
BreakPoss.HYPHENATED);
iFlags |= (BreakPoss.CAN_BREAK_AFTER | BreakPoss.HYPHENATED);
}
wordIPD += hyphIPD.opt;
} else {
@@ -330,8 +374,8 @@ public class TextLayoutManager extends AbstractLayoutManager {
char c = chars[iNextStart];
if ((c == NEWLINE) || // Include any breakable white-space as break char
// even if fixed width
(textInfo.bWrap && (CharUtilities.isSpace(c) ||
s_breakChars.indexOf(c) >= 0))) {
(textInfo.bWrap && (CharUtilities.isSpace(c)
|| BREAK_CHARS.indexOf(c) >= 0))) {
iFlags |= BreakPoss.CAN_BREAK_AFTER;
if (c != SPACE) {
iNextStart++;
@@ -346,9 +390,10 @@ public class TextLayoutManager extends AbstractLayoutManager {
// line-end, set a flag for parent LM.
int iLastChar;
for (iLastChar = iNextStart;
iLastChar < chars.length &&
chars[iLastChar] == SPACE; iLastChar++)
;
iLastChar < chars.length
&& chars[iLastChar] == SPACE; iLastChar++) {
//nop
}
if (iLastChar == chars.length) {
iFlags |= BreakPoss.REST_ARE_SUPPRESS_AT_LB;
}
@@ -423,10 +468,9 @@ public class TextLayoutManager extends AbstractLayoutManager {
* an area containing all text with a parameter controlling the size of
* the word space. The latter is most efficient for PDF generation.
* Set size of each area.
* @param parentIter Iterator over Position information returned
* @param posIter Iterator over Position information returned
* by this LayoutManager.
* @param dSpaceAdjust Factor controlling how much extra space to add
* in order to justify the line.
* @param context LayoutContext for adjustments
*/
public void addAreas(PositionIterator posIter, LayoutContext context) {
// Add word areas
@@ -445,7 +489,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
}
iWScount += ai.iWScount;
}
if(ai == null) {
if (ai == null) {
return;
}
// Calculate total adjustment
@@ -455,14 +499,14 @@ public class TextLayoutManager extends AbstractLayoutManager {
// Stretch by factor
// System.err.println("Potential stretch = " +
// (ai.ipdArea.max - ai.ipdArea.opt));
iAdjust = (int)((double)(ai.ipdArea.max -
ai.ipdArea.opt) * dSpaceAdjust);
iAdjust = (int)((double)(ai.ipdArea.max
- ai.ipdArea.opt) * dSpaceAdjust);
} else if (dSpaceAdjust < 0.0) {
// Shrink by factor
// System.err.println("Potential shrink = " +
// (ai.ipdArea.opt - ai.ipdArea.min));
iAdjust = (int)((double)(ai.ipdArea.opt -
ai.ipdArea.min) * dSpaceAdjust);
iAdjust = (int)((double)(ai.ipdArea.opt
- ai.ipdArea.min) * dSpaceAdjust);
}
// System.err.println("Text adjustment factor = " + dSpaceAdjust +
// " total=" + iAdjust);
@@ -471,11 +515,11 @@ public class TextLayoutManager extends AbstractLayoutManager {
InlineArea word = null;
int adjust = 0;
// ingnore newline character
if(chars[ai.iBreakIndex - 1] == NEWLINE) {
if (chars[ai.iBreakIndex - 1] == NEWLINE) {
adjust = 1;
}
String str = new String(chars, iStart, ai.iBreakIndex - iStart - adjust);
if(" ".equals(str)) {
if (" ".equals(str)) {
word = new Space();
word.setWidth(ai.ipdArea.opt + iAdjust);
} else {
@@ -489,26 +533,27 @@ public class TextLayoutManager extends AbstractLayoutManager {
}
word = w;
}
if ((chars[iStart] == SPACE || chars[iStart] == NBSPACE) &&
context.getLeadingSpace().hasSpaces()) {
if ((chars[iStart] == SPACE || chars[iStart] == NBSPACE)
&& context.getLeadingSpace().hasSpaces()) {
context.getLeadingSpace().addSpace(halfWS);
}
// Set LAST flag if done making characters
int iLastChar;
for (iLastChar = ai.iBreakIndex;
iLastChar < chars.length && chars[iLastChar] == SPACE;
iLastChar++)
;
iLastChar++) {
//nop
}
context.setFlags(LayoutContext.LAST_AREA,
iLastChar == chars.length);

// Can we have any trailing space? Yes, if last char was a space!
context.setTrailingSpace(new SpaceSpecifier(false));
if (chars[ai.iBreakIndex - 1] == SPACE ||
chars[ai.iBreakIndex - 1] == NBSPACE) {
if (chars[ai.iBreakIndex - 1] == SPACE
|| chars[ai.iBreakIndex - 1] == NBSPACE) {
context.getTrailingSpace().addSpace(halfWS);
}
if(word != null) {
if (word != null) {
parentLM.addChild(word);
}
}
@@ -525,8 +570,8 @@ public class TextLayoutManager extends AbstractLayoutManager {
protected Word createWord(String str, int width, int base) {
Word curWordArea = new Word();
curWordArea.setWidth(width);
curWordArea.setHeight(textInfo.fs.getAscender() -
textInfo.fs.getDescender());
curWordArea.setHeight(textInfo.fs.getAscender()
- textInfo.fs.getDescender());
curWordArea.setOffset(textInfo.fs.getAscender());
curWordArea.setOffset(base);


+ 2
- 2
src/org/apache/fop/layoutmgr/TraitSetter.java View File

@@ -173,10 +173,10 @@ public class TraitSetter {
back.setURL(backProps.backImage);
back.setRepeat(backProps.backRepeat);
if (backProps.backPosHorizontal != null) {
back.setHoriz(backProps.backPosHorizontal.mvalue());
back.setHoriz(backProps.backPosHorizontal.getValue());
}
if (backProps.backPosVertical != null) {
back.setVertical(backProps.backPosVertical.mvalue());
back.setVertical(backProps.backPosVertical.getValue());
}
}


+ 4
- 4
src/org/apache/fop/render/pdf/PDFRenderer.java View File

@@ -1066,7 +1066,7 @@ public class PDFRenderer extends PrintRenderer {
}

private void updateColor(ColorType col, boolean fill, StringBuffer pdf) {
Color newCol = new Color(col.red(), col.green(), col.blue());
Color newCol = new Color(col.getRed(), col.getGreen(), col.getBlue());
boolean update = false;
if (fill) {
update = currentState.setBackColor(newCol);
@@ -1075,9 +1075,9 @@ public class PDFRenderer extends PrintRenderer {
}

if (update) {
PDFColor color = new PDFColor((double)col.red(),
(double)col.green(),
(double)col.blue());
PDFColor color = new PDFColor((double)col.getRed(),
(double)col.getGreen(),
(double)col.getBlue());

closeText();


+ 55
- 6
src/org/apache/fop/render/ps/PSRenderer.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.render.ps;

// Java
@@ -305,7 +348,7 @@ public class PSRenderer extends AbstractRenderer {
}

private void useColor(ColorType col) {
useColor(col.red(), col.green(), col.blue());
useColor(col.getRed(), col.getGreen(), col.getBlue());
}

private void useColor(float red, float green, float blue) {
@@ -613,6 +656,12 @@ public class PSRenderer extends AbstractRenderer {
renderDocument(doc, ns, pos);
}

/**
* Renders an XML document (SVG for example).
* @param doc DOM Document containing the XML document to be rendered
* @param ns Namespace for the XML document
* @param pos Position for the generated graphic/image
*/
public void renderDocument(Document doc, String ns, Rectangle2D pos) {
RendererContext context;
context = new RendererContext(MIME_TYPE);

+ 102
- 15
src/org/apache/fop/traits/SpaceVal.java View File

@@ -1,10 +1,53 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

* ============================================================================
* 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.traits;

import org.apache.fop.datatypes.Space;
@@ -14,20 +57,25 @@ import org.apache.fop.fo.properties.Constants;

/**
* Store a single Space property value in simplified form, with all
* Length values resolved.
* Length values resolved. See section 4.3 in the specs.
*/
public class SpaceVal {
public final MinOptMax space;
public final boolean bConditional;
public final boolean bForcing;
public final int iPrecedence; // Numeric only, if forcing, set to 0
private final MinOptMax space;
private final boolean bConditional;
private final boolean bForcing;
private final int iPrecedence; // Numeric only, if forcing, set to 0

/**
* Constructor for SpaceVal objects based on Space objects.
* @param spaceprop Space object to use
*/
public SpaceVal(Space spaceprop) {
space = new MinOptMax( spaceprop.getMinimum().getLength().mvalue(),
spaceprop.getOptimum().getLength().mvalue(),
spaceprop.getMaximum().getLength().mvalue());
bConditional = (spaceprop.getConditionality().getEnum() ==
Constants.DISCARD);
space = new MinOptMax(spaceprop.getMinimum().getLength().getValue(),
spaceprop.getOptimum().getLength().getValue(),
spaceprop.getMaximum().getLength().getValue());
bConditional =
(spaceprop.getConditionality().getEnum() == Constants.DISCARD);
Property precProp = spaceprop.getPrecedence();
if (precProp.getNumber() != null) {
iPrecedence = precProp.getNumber().intValue();
@@ -38,6 +86,13 @@ public class SpaceVal {
}
}

/**
* Constructor for SpaceVal objects based on the full set of properties.
* @param space space to use
* @param bConditional Conditionality value
* @param bForcing Forcing value
* @param iPrecedence Precedence value
*/
public SpaceVal(MinOptMax space, boolean bConditional,
boolean bForcing, int iPrecedence) {
this.space = space;
@@ -46,5 +101,37 @@ public class SpaceVal {
this.iPrecedence = iPrecedence;
}

/**
* Returns the Conditionality value.
* @return the Conditionality value
*/
public boolean isConditional() {
return bConditional;
}

/**
* Returns the Forcing value.
* @return the Forcing value
*/
public boolean isForcing() {
return bForcing;
}

/**
* Returns the Precedence value.
* @return the Precedence value
*/
public int getPrecedence() {
return iPrecedence;
}

/**
* Returns the Space value.
* @return the Space value
*/
public MinOptMax getSpace() {
return space;
}

}


Loading…
Cancel
Save