Browse Source

more style fixes


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195362 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
Keiron Liddle 21 years ago
parent
commit
392781f309
100 changed files with 976 additions and 879 deletions
  1. 5
    3
      src/org/apache/fop/apps/AWTStarter.java
  2. 8
    6
      src/org/apache/fop/apps/Driver.java
  3. 4
    3
      src/org/apache/fop/apps/FOInputHandler.java
  4. 10
    8
      src/org/apache/fop/apps/InputHandler.java
  5. 6
    4
      src/org/apache/fop/apps/LayoutHandler.java
  6. 13
    8
      src/org/apache/fop/apps/PrintStarter.java
  7. 1
    1
      src/org/apache/fop/apps/Starter.java
  8. 0
    2
      src/org/apache/fop/area/Area.java
  9. 3
    3
      src/org/apache/fop/area/CTM.java
  10. 6
    0
      src/org/apache/fop/area/inline/InlineParent.java
  11. 21
    15
      src/org/apache/fop/datatypes/ColorType.java
  12. 9
    6
      src/org/apache/fop/datatypes/CondLength.java
  13. 3
    3
      src/org/apache/fop/datatypes/FODimension.java
  14. 11
    10
      src/org/apache/fop/datatypes/FixedLength.java
  15. 10
    8
      src/org/apache/fop/datatypes/Keep.java
  16. 5
    5
      src/org/apache/fop/datatypes/Length.java
  17. 9
    6
      src/org/apache/fop/datatypes/LengthPair.java
  18. 19
    12
      src/org/apache/fop/datatypes/LengthRange.java
  19. 42
    43
      src/org/apache/fop/datatypes/MixedLength.java
  20. 2
    2
      src/org/apache/fop/datatypes/PercentLength.java
  21. 10
    7
      src/org/apache/fop/datatypes/Space.java
  22. 11
    13
      src/org/apache/fop/datatypes/TableColLength.java
  23. 8
    11
      src/org/apache/fop/datatypes/ToBeImplementedProperty.java
  24. 11
    10
      src/org/apache/fop/fo/AbstractCharIterator.java
  25. 6
    3
      src/org/apache/fop/fo/ColorTypeProperty.java
  26. 5
    5
      src/org/apache/fop/fo/EnumProperty.java
  27. 1
    1
      src/org/apache/fop/fo/FONode.java
  28. 4
    3
      src/org/apache/fop/fo/FOText.java
  29. 19
    15
      src/org/apache/fop/fo/FObj.java
  30. 5
    3
      src/org/apache/fop/fo/GenericShorthandParser.java
  31. 39
    31
      src/org/apache/fop/fo/InlineCharIterator.java
  32. 8
    4
      src/org/apache/fop/fo/LengthProperty.java
  33. 10
    8
      src/org/apache/fop/fo/OneCharIterator.java
  34. 1
    1
      src/org/apache/fop/fo/PropertyList.java
  35. 47
    40
      src/org/apache/fop/fo/RecursiveCharIterator.java
  36. 20
    20
      src/org/apache/fop/fo/TextInfo.java
  37. 4
    3
      src/org/apache/fop/fo/expr/AbsFunction.java
  38. 4
    2
      src/org/apache/fop/fo/expr/CeilingFunction.java
  39. 4
    2
      src/org/apache/fop/fo/expr/FloorFunction.java
  40. 4
    2
      src/org/apache/fop/fo/expr/MaxFunction.java
  41. 4
    2
      src/org/apache/fop/fo/expr/MinFunction.java
  42. 24
    19
      src/org/apache/fop/fo/expr/Numeric.java
  43. 3
    2
      src/org/apache/fop/fo/expr/PropertyInfo.java
  44. 28
    17
      src/org/apache/fop/fo/expr/PropertyParser.java
  45. 20
    13
      src/org/apache/fop/fo/expr/PropertyTokenizer.java
  46. 6
    3
      src/org/apache/fop/fo/expr/RoundFunction.java
  47. 3
    2
      src/org/apache/fop/fo/flow/Block.java
  48. 2
    2
      src/org/apache/fop/fo/flow/Character.java
  49. 6
    5
      src/org/apache/fop/fo/flow/TableCell.java
  50. 13
    9
      src/org/apache/fop/fo/flow/TableColumn.java
  51. 4
    3
      src/org/apache/fop/fo/flow/TableRow.java
  52. 2
    2
      src/org/apache/fop/fo/pagination/PageNumberGenerator.java
  53. 11
    11
      src/org/apache/fop/fo/pagination/PageSequence.java
  54. 20
    23
      src/org/apache/fop/fo/pagination/Region.java
  55. 10
    13
      src/org/apache/fop/fo/pagination/RegionAfter.java
  56. 16
    15
      src/org/apache/fop/fo/pagination/RegionBA.java
  57. 5
    4
      src/org/apache/fop/fo/pagination/RegionBASE.java
  58. 8
    10
      src/org/apache/fop/fo/pagination/RegionBefore.java
  59. 8
    8
      src/org/apache/fop/fo/pagination/RegionEnd.java
  60. 15
    14
      src/org/apache/fop/fo/pagination/RegionSE.java
  61. 7
    7
      src/org/apache/fop/fo/pagination/RegionStart.java
  62. 17
    12
      src/org/apache/fop/fonts/apps/PFMReader.java
  63. 1
    1
      src/org/apache/fop/fonts/apps/TTFReader.java
  64. 0
    1
      src/org/apache/fop/image/AbstractFopImage.java
  65. 0
    1
      src/org/apache/fop/image/BmpImage.java
  66. 0
    1
      src/org/apache/fop/image/EPSImage.java
  67. 3
    2
      src/org/apache/fop/image/JimiImage.java
  68. 0
    2
      src/org/apache/fop/image/JpegImage.java
  69. 29
    28
      src/org/apache/fop/layout/BorderAndPadding.java
  70. 23
    19
      src/org/apache/fop/layout/FontState.java
  71. 1
    1
      src/org/apache/fop/layout/hyphenation/ByteVector.java
  72. 1
    1
      src/org/apache/fop/layout/hyphenation/CharVector.java
  73. 1
    1
      src/org/apache/fop/layout/hyphenation/TernaryTree.java
  74. 7
    7
      src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  75. 6
    6
      src/org/apache/fop/layoutmgr/BlockLayoutManager.java
  76. 13
    37
      src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
  77. 5
    1
      src/org/apache/fop/layoutmgr/ContentLayoutManager.java
  78. 6
    6
      src/org/apache/fop/layoutmgr/FlowLayoutManager.java
  79. 4
    3
      src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
  80. 15
    16
      src/org/apache/fop/layoutmgr/LineLayoutManager.java
  81. 18
    16
      src/org/apache/fop/layoutmgr/PageLayoutManager.java
  82. 2
    2
      src/org/apache/fop/layoutmgr/PositionIterator.java
  83. 7
    7
      src/org/apache/fop/layoutmgr/TextLayoutManager.java
  84. 4
    4
      src/org/apache/fop/layoutmgr/TraitSetter.java
  85. 1
    1
      src/org/apache/fop/layoutmgr/table/Body.java
  86. 2
    2
      src/org/apache/fop/pdf/DCTFilter.java
  87. 2
    2
      src/org/apache/fop/pdf/PDFCMap.java
  88. 2
    3
      src/org/apache/fop/pdf/PDFColor.java
  89. 5
    4
      src/org/apache/fop/pdf/PDFColorSpace.java
  90. 1
    0
      src/org/apache/fop/pdf/PDFDocument.java
  91. 42
    42
      src/org/apache/fop/pdf/PDFFunction.java
  92. 8
    8
      src/org/apache/fop/pdf/PDFGState.java
  93. 3
    2
      src/org/apache/fop/pdf/PDFICCStream.java
  94. 4
    4
      src/org/apache/fop/pdf/PDFInfo.java
  95. 2
    2
      src/org/apache/fop/pdf/PDFNumber.java
  96. 34
    34
      src/org/apache/fop/pdf/PDFPattern.java
  97. 37
    37
      src/org/apache/fop/pdf/PDFShading.java
  98. 46
    46
      src/org/apache/fop/pdf/PDFState.java
  99. 1
    1
      src/org/apache/fop/pdf/PDFT1Stream.java
  100. 0
    0
      src/org/apache/fop/render/awt/FontMetricsMapper.java

+ 5
- 3
src/org/apache/fop/apps/AWTStarter.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -138,10 +138,12 @@ public class AWTStarter extends CommandLineStarter {
// center window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height)
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
if (frameSize.width > screenSize.width)
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setVisible(true);

+ 8
- 6
src/org/apache/fop/apps/Driver.java View File

@@ -205,7 +205,7 @@ public class Driver implements LogEnabled {
}

private FOUserAgent getUserAgent() {
if(userAgent == null) {
if (userAgent == null) {
userAgent = new FOUserAgent();
userAgent.enableLogging(getLogger());
userAgent.setBaseURL("file:/.");
@@ -223,7 +223,7 @@ public class Driver implements LogEnabled {


protected Logger getLogger() {
if(this.log == null) {
if (this.log == null) {
this.log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
this.log.error("Logger not set. Using ConsoleLogger as default.");
}
@@ -447,7 +447,7 @@ public class Driver implements LogEnabled {
*/
public ContentHandler getContentHandler() {
// TODO - do this stuff in a better way
if(_renderer != null) {
if (_renderer != null) {
structHandler = new LayoutHandler(_stream, _renderer, true);
} else {
structHandler = new org.apache.fop.mif.MIFHandler(_stream);
@@ -547,7 +547,7 @@ class Service {
public static synchronized Enumeration providers(Class cls) {
ClassLoader cl = cls.getClassLoader();
// null if loaded by bootstrap class loader
if(cl == null) {
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
String serviceFile = "META-INF/services/" + cls.getName();
@@ -555,8 +555,9 @@ class Service {
// getLogger().debug("File: " + serviceFile);

Vector v = (Vector)providerMap.get(serviceFile);
if (v != null)
if (v != null) {
return v.elements();
}

v = new Vector();
providerMap.put(serviceFile, v);
@@ -582,8 +583,9 @@ class Service {
try {
// First strip any comment...
int idx = line.indexOf('#');
if (idx != -1)
if (idx != -1) {
line = line.substring(0, idx);
}

// Trim whitespace.
line = line.trim();

+ 4
- 3
src/org/apache/fop/apps/FOInputHandler.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,9 +19,9 @@ import java.net.URL;
* Manages input if it is an xsl:fo file
*/
public class FOInputHandler extends InputHandler {

File fofile = null;
URL foURL = null;

public FOInputHandler (File fofile) {
this.fofile = fofile;
}
@@ -31,8 +31,9 @@ public class FOInputHandler extends InputHandler {
}

public InputSource getInputSource () {
if (fofile != null)
if (fofile != null) {
return super.fileInputSource(fofile);
}
return super.urlInputSource(foURL);
}


+ 10
- 8
src/org/apache/fop/apps/InputHandler.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -15,14 +15,14 @@ import org.xml.sax.XMLReader;
import java.net.URL;
import java.io.File;

abstract public class InputHandler {
public abstract class InputHandler {


abstract public InputSource getInputSource();
abstract public XMLReader getParser() throws FOPException;
public abstract InputSource getInputSource();
public abstract XMLReader getParser() throws FOPException;


static public InputSource urlInputSource(URL url) {
public static InputSource urlInputSource(URL url) {
return new InputSource(url.toString());
}

@@ -32,14 +32,16 @@ abstract public class InputHandler {
* @param file the File
* @return the InputSource created
*/
static public InputSource fileInputSource(File file) {
public static InputSource fileInputSource(File file) {
/* this code adapted from James Clark's in XT */
String path = file.getAbsolutePath();
String fSep = System.getProperty("file.separator");
if (fSep != null && fSep.length() == 1)
if (fSep != null && fSep.length() == 1) {
path = path.replace(fSep.charAt(0), '/');
if (path.length() > 0 && path.charAt(0) != '/')
}
if (path.length() > 0 && path.charAt(0) != '/') {
path = '/' + path;
}
try {
return new InputSource(new URL("file", null, path).toString());
} catch (java.net.MalformedURLException e) {

+ 6
- 4
src/org/apache/fop/apps/LayoutHandler.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -103,8 +103,9 @@ public class LayoutHandler extends StructureHandler {
public void startDocument() throws SAXException {
pageCount = 0;

if (MEM_PROFILE_WITH_GC)
if (MEM_PROFILE_WITH_GC) {
System.gc(); // This takes time but gives better results
}

initialMemory = runtime.totalMemory() - runtime.freeMemory();
startTime = System.currentTimeMillis();
@@ -130,8 +131,9 @@ public class LayoutHandler extends StructureHandler {
throw new SAXException(e);
}

if (MEM_PROFILE_WITH_GC)
if (MEM_PROFILE_WITH_GC) {
System.gc(); // This takes time but gives better results
}

long memoryNow = runtime.totalMemory() - runtime.freeMemory();
long memoryUsed = (memoryNow - initialMemory) / 1024L;
@@ -160,7 +162,7 @@ public class LayoutHandler extends StructureHandler {

public void startPageSequence(PageSequence pageSeq, org.apache.fop.fo.Title seqTitle, LayoutMasterSet lms) {
Title title = null;
if(seqTitle != null) {
if (seqTitle != null) {
title = seqTitle.getTitleArea();
}
areaTree.startPageSequence(title);

+ 13
- 8
src/org/apache/fop/apps/PrintStarter.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -60,9 +60,11 @@ public class PrintStarter extends CommandLineStarter {
setParserFeatures(parser);

PrinterJob pj = PrinterJob.getPrinterJob();
if(System.getProperty("dialog") != null)
if(!pj.printDialog())
if (System.getProperty("dialog") != null) {
if (!pj.printDialog()) {
throw new FOPException("Printing cancelled by operator");
}
}

PrintRenderer renderer = new PrintRenderer(pj);
int copies = getIntProperty("copies", 1);
@@ -84,7 +86,7 @@ public class PrintStarter extends CommandLineStarter {
}
int getIntProperty(String name, int def) {
String propValue = System.getProperty(name);
if(propValue != null) {
if (propValue != null) {
try {
return Integer.parseInt(propValue);
} catch (Exception e) {
@@ -131,8 +133,9 @@ public class PrintStarter extends CommandLineStarter {
throws IOException {
super.stopRenderer();

if(endNumber == -1)
if (endNumber == -1) {
endNumber = getPageCount();
}

Vector numbers = getInvalidPageNumbers();
for (int i = numbers.size() - 1; i > -1; i--) {
@@ -164,14 +167,16 @@ public class PrintStarter extends CommandLineStarter {
if (i < startNumber || i > endNumber) {
isValid = false;
} else if (mode != EVEN_AND_ALL) {
if (mode == EVEN && ((i + 1) % 2 != 0))
if (mode == EVEN && ((i + 1) % 2 != 0)) {
isValid = false;
else if (mode == ODD && ((i + 1) % 2 != 1))
} else if (mode == ODD && ((i + 1) % 2 != 1)) {
isValid = false;
}
}

if (!isValid)
if (!isValid) {
vec.add(i + "");
}
}

return vec;

+ 1
- 1
src/org/apache/fop/apps/Starter.java View File

@@ -34,7 +34,7 @@ public abstract class Starter extends AbstractLogEnabled {
this.inputHandler = inputHandler;
}

abstract public void run() throws FOPException;
public abstract void run() throws FOPException;

// setting the parser features
public void setParserFeatures(XMLReader parser) throws FOPException {

+ 0
- 2
src/org/apache/fop/area/Area.java View File

@@ -151,8 +151,6 @@ public class Area implements Serializable {
* @param child the child area to add
*/
public void addChild(Area child) {
System.out.println("mmmm");
(new Exception()).printStackTrace();
}

/**

+ 3
- 3
src/org/apache/fop/area/CTM.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -17,7 +17,6 @@ import org.apache.fop.fo.properties.WritingMode;
* The matrix encodes translations, scaling and rotations of the coordinate
* system used to render pages.
*/

public class CTM implements Serializable {
private double a, b, c, d, e, f;

@@ -80,7 +79,7 @@ public class CTM implements Serializable {
* @param bpd The block-progression dimension of the reference area whose
* CTM is being set.
*/
static public CTM getWMctm(int wm, int ipd, int bpd) {
public static CTM getWMctm(int wm, int ipd, int bpd) {
CTM wmctm;
switch (wm) {
case WritingMode.LR_TB:
@@ -207,3 +206,4 @@ public class CTM implements Serializable {
return new double[]{a, b, c, d, e, f};
}
}


+ 6
- 0
src/org/apache/fop/area/inline/InlineParent.java View File

@@ -24,6 +24,11 @@ public class InlineParent extends InlineArea {
*/
protected ArrayList inlines = new ArrayList();

/**
* An inline parent is a reference area somay have clipping
*/
protected boolean clip = false;

/**
* Create a new inline parent to add areas to.
*/
@@ -61,3 +66,4 @@ public class InlineParent extends InlineArea {
}

}


+ 21
- 15
src/org/apache/fop/datatypes/ColorType.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -166,21 +166,27 @@ public class ColorType {
}

public String toString() {
StringBuffer sbuf = new StringBuffer(8);
sbuf.append('#');
String s = Integer.toHexString((int)(red * 255.0));
if (s.length() == 1) sbuf.append('0');
sbuf.append(s);
s = Integer.toHexString((int)(green * 255.0));
if (s.length() == 1) sbuf.append('0');
sbuf.append(s);
s = Integer.toHexString((int)(blue * 255.0));
if (s.length() == 1) sbuf.append('0');
sbuf.append(s);
return sbuf.toString();
StringBuffer sbuf = new StringBuffer(8);
sbuf.append('#');
String s = Integer.toHexString((int)(red * 255.0));
if (s.length() == 1) {
sbuf.append('0');
}
sbuf.append(s);
s = Integer.toHexString((int)(green * 255.0));
if (s.length() == 1) {
sbuf.append('0');
}
sbuf.append(s);
s = Integer.toHexString((int)(blue * 255.0));
if (s.length() == 1) {
sbuf.append('0');
}
sbuf.append(s);
return sbuf.toString();
}

final static String[] names = {
protected static final String[] names = {
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral",
@@ -213,7 +219,7 @@ public class ColorType {
"whitesmoke", "yellow", "yellowgreen"
};

final static int[][] vals = {
protected static final int[][] vals = {
{
240, 248, 255
}, {

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

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -21,19 +21,21 @@ public class CondLength implements CompoundDatatype {
// From CompoundDatatype
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("length"))
if (sCmpnName.equals("length")) {
length = cmpnValue;
else if (sCmpnName.equals("conditionality"))
} else if (sCmpnName.equals("conditionality")) {
conditionality = cmpnValue;
}
}

public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("length"))
if (sCmpnName.equals("length")) {
return length;
else if (sCmpnName.equals("conditionality"))
} else if (sCmpnName.equals("conditionality")) {
return conditionality;
else
} else {
return null;
}
}

public Property getConditionality() {
@@ -53,3 +55,4 @@ public class CondLength implements CompoundDatatype {
}

}


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

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -20,7 +20,7 @@ public class FODimension {


public FODimension(int ipd, int bpd) {
this.ipd = ipd;
this.bpd = bpd;
this.ipd = ipd;
this.bpd = bpd;
}
}

+ 11
- 10
src/org/apache/fop/datatypes/FixedLength.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -45,23 +45,23 @@ public class FixedLength extends Length {

int assumed_resolution = 1; // points/pixel

if (unit.equals("in"))
if (unit.equals("in")) {
dvalue = dvalue * 72;
else if (unit.equals("cm"))
} else if (unit.equals("cm")) {
dvalue = dvalue * 28.3464567;
else if (unit.equals("mm"))
} else if (unit.equals("mm")) {
dvalue = dvalue * 2.83464567;
else if (unit.equals("pt"))
} else if (unit.equals("pt")) {
dvalue = dvalue;
else if (unit.equals("pc"))
} else if (unit.equals("pc")) {
dvalue = dvalue * 12;
/*
* else if (unit.equals("em"))
* } else if (unit.equals("em")) {
* dvalue = dvalue * fontsize;
*/
else if (unit.equals("px"))
} else if (unit.equals("px")) {
dvalue = dvalue * assumed_resolution;
else {
} else {
dvalue = 0;
//log.error("unknown length unit '" + unit
// + "'");
@@ -70,6 +70,7 @@ public class FixedLength extends Length {
}

public Numeric asNumeric() {
return new Numeric(this);
return new Numeric(this);
}
}


+ 10
- 8
src/org/apache/fop/datatypes/Keep.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -22,24 +22,26 @@ public class Keep implements CompoundDatatype {
// From CompoundDatatype
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("within-line"))
if (sCmpnName.equals("within-line")) {
setWithinLine(cmpnValue, bIsDefault);
else if (sCmpnName.equals("within-column"))
} else if (sCmpnName.equals("within-column")) {
setWithinColumn(cmpnValue, bIsDefault);
else if (sCmpnName.equals("within-page"))
} else if (sCmpnName.equals("within-page")) {
setWithinPage(cmpnValue, bIsDefault);
}
}

// From CompoundDatatype
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("within-line"))
if (sCmpnName.equals("within-line")) {
return getWithinLine();
else if (sCmpnName.equals("within-column"))
} else if (sCmpnName.equals("within-column")) {
return getWithinColumn();
else if (sCmpnName.equals("within-page"))
} else if (sCmpnName.equals("within-page")) {
return getWithinPage();
else
} else {
return null;
}
}

public void setWithinLine(Property withinLine, boolean bIsDefault) {

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

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -24,7 +24,7 @@ public class Length {
public int mvalue() {
if (!bIsComputed) {
computeValue();
}
}
return millipoints;
}

@@ -33,7 +33,7 @@ public class Length {


protected void setComputedValue(int millipoints) {
setComputedValue(millipoints, true);
setComputedValue(millipoints, true);
}

protected void setComputedValue(int millipoints, boolean bSetComputed) {
@@ -46,7 +46,7 @@ public class Length {
}

public boolean isComputed() {
return this.bIsComputed;
return this.bIsComputed;
}

/**
@@ -69,7 +69,7 @@ public class Length {
}

public Numeric asNumeric() {
return null;
return null;
}

public String toString() {

+ 9
- 6
src/org/apache/fop/datatypes/LengthPair.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -22,20 +22,22 @@ public class LengthPair implements CompoundDatatype {
// From CompoundDatatype
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("block-progression-direction"))
if (sCmpnName.equals("block-progression-direction")) {
bpd = cmpnValue;
else if (sCmpnName.equals("inline-progression-direction"))
} else if (sCmpnName.equals("inline-progression-direction")) {
ipd = cmpnValue;
}
}

// From CompoundDatatype
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("block-progression-direction"))
if (sCmpnName.equals("block-progression-direction")) {
return getBPD();
else if (sCmpnName.equals("inline-progression-direction"))
} else if (sCmpnName.equals("inline-progression-direction")) {
return getIPD();
else
} else {
return null; // SHOULDN'T HAPPEN
}
}

public Property getIPD() {
@@ -47,3 +49,4 @@ public class LengthPair implements CompoundDatatype {
}

}


+ 19
- 12
src/org/apache/fop/datatypes/LengthRange.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -28,24 +28,26 @@ public class LengthRange implements CompoundDatatype {
// From CompoundDatatype
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("minimum"))
if (sCmpnName.equals("minimum")) {
setMinimum(cmpnValue, bIsDefault);
else if (sCmpnName.equals("optimum"))
} else if (sCmpnName.equals("optimum")) {
setOptimum(cmpnValue, bIsDefault);
else if (sCmpnName.equals("maximum"))
} else if (sCmpnName.equals("maximum")) {
setMaximum(cmpnValue, bIsDefault);
}
}

// From CompoundDatatype
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("minimum"))
if (sCmpnName.equals("minimum")) {
return getMinimum();
else if (sCmpnName.equals("optimum"))
} else if (sCmpnName.equals("optimum")) {
return getOptimum();
else if (sCmpnName.equals("maximum"))
} else if (sCmpnName.equals("maximum")) {
return getMaximum();
else
} else {
return null; // SHOULDN'T HAPPEN
}
}

/**
@@ -57,8 +59,9 @@ public class LengthRange implements CompoundDatatype {
*/
protected void setMinimum(Property minimum, boolean bIsDefault) {
this.minimum = minimum;
if (!bIsDefault)
if (!bIsDefault) {
bfSet |= MINSET;
}
}


@@ -70,8 +73,9 @@ public class LengthRange implements CompoundDatatype {
*/
protected void setMaximum(Property max, boolean bIsDefault) {
maximum = max;
if (!bIsDefault)
if (!bIsDefault) {
bfSet |= MAXSET;
}
}


@@ -83,14 +87,16 @@ public class LengthRange implements CompoundDatatype {
*/
protected void setOptimum(Property opt, boolean bIsDefault) {
optimum = opt;
if (!bIsDefault)
if (!bIsDefault) {
bfSet |= OPTSET;
}
}

// Minimum is prioritaire, if explicit
private void checkConsistency() {
if (bChecked)
if (bChecked) {
return;
}
// Make sure max >= min
// Must also control if have any allowed enum values!

@@ -159,3 +165,4 @@ public class LengthRange implements CompoundDatatype {
}

}


+ 42
- 43
src/org/apache/fop/datatypes/MixedLength.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -23,70 +23,69 @@ public class MixedLength extends Length {
private Vector lengths ;

public MixedLength(Vector lengths) {
this.lengths = lengths;
this.lengths = lengths;
}

protected void computeValue() {
int computedValue =0;
boolean bAllComputed = true;
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
Length l = (Length)e.nextElement();
computedValue += l.mvalue();
if (! l.isComputed()) {
bAllComputed = false;
}
int computedValue = 0;
boolean bAllComputed = true;
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
Length l = (Length) e.nextElement();
computedValue += l.mvalue();
if (! l.isComputed()) {
bAllComputed = false;
}
}
setComputedValue(computedValue, bAllComputed);
}


public double getTableUnits() {
double tableUnits = 0.0;
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
tableUnits += ((Length)e.nextElement()).getTableUnits();
double tableUnits = 0.0;
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
tableUnits += ((Length) e.nextElement()).getTableUnits();
}
return tableUnits;
}

public void resolveTableUnit(double dTableUnit) {
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
((Length)e.nextElement()).resolveTableUnit(dTableUnit);
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
((Length) e.nextElement()).resolveTableUnit(dTableUnit);
}
}

public String toString() {
StringBuffer sbuf = new StringBuffer();
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
if (sbuf.length()>0) {
sbuf.append('+');
}
sbuf.append(e.nextElement().toString());
Enumeration e = lengths.elements();
while (e.hasMoreElements()) {
if (sbuf.length() > 0) {
sbuf.append('+');
}
sbuf.append(e.nextElement().toString());
}
return sbuf.toString();
return sbuf.toString();
}

public Numeric asNumeric() {
Numeric numeric = null;
for (Enumeration e = lengths.elements(); e.hasMoreElements();) {
Length l = (Length)e.nextElement();
if (numeric == null) {
numeric = l.asNumeric();
}
else {
try {
Numeric sum = numeric.add(l.asNumeric());
numeric = sum;
} catch (PropertyException pe) {
System.err.println("Can't convert MixedLength to Numeric: " +
pe);
}
}
}
return numeric;
Numeric numeric = null;
for (Enumeration e = lengths.elements(); e.hasMoreElements();) {
Length l = (Length) e.nextElement();
if (numeric == null) {
numeric = l.asNumeric();
} else {
try {
Numeric sum = numeric.add(l.asNumeric());
numeric = sum;
} catch (PropertyException pe) {
System.err.println(
"Can't convert MixedLength to Numeric: " + pe);
}
}
}
return numeric;
}

}


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

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -58,7 +58,7 @@ public class PercentLength extends Length {
}

public Numeric asNumeric() {
return new Numeric(this);
return new Numeric(this);
}

}

+ 10
- 7
src/org/apache/fop/datatypes/Space.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -20,22 +20,24 @@ public class Space extends LengthRange {
// From CompoundDatatype
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("precedence"))
if (sCmpnName.equals("precedence")) {
setPrecedence(cmpnValue, bIsDefault);
else if (sCmpnName.equals("conditionality"))
} else if (sCmpnName.equals("conditionality")) {
setConditionality(cmpnValue, bIsDefault);
else
} else {
super.setComponent(sCmpnName, cmpnValue, bIsDefault);
}
}

// From CompoundDatatype
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("precedence"))
if (sCmpnName.equals("precedence")) {
return getPrecedence();
else if (sCmpnName.equals("conditionality"))
} else if (sCmpnName.equals("conditionality")) {
return getConditionality();
else
} else {
return super.getComponent(sCmpnName);
}
}

protected void setPrecedence(Property precedence, boolean bIsDefault) {
@@ -56,3 +58,4 @@ public class Space extends LengthRange {
}

}


+ 11
- 13
src/org/apache/fop/datatypes/TableColLength.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -34,8 +34,6 @@ public class TableColLength extends Length {
this.tcolUnits = tcolUnits;
}



/**
* Override the method in Length to return the number of specified
* proportional table-column units.
@@ -48,23 +46,23 @@ public class TableColLength extends Length {
* Calculate the number of millipoints and set it.
*/
public void resolveTableUnit(double mpointsPerUnit) {
setComputedValue((int)(tcolUnits * mpointsPerUnit));
setComputedValue((int)(tcolUnits * mpointsPerUnit));
}

// If the table-unit can be resolved, set the computed value
// protected void computeValue() {
// if (tblUnitBase.canResolveUnit()) {
// rslt += (int)(tcolUnits * (double)tblUnitBase.getUnitValue());
// setComputedValue(rslt);
// }
// }

//If the table-unit can be resolved, set the computed value
/*protected void computeValue() {
if (tblUnitBase.canResolveUnit()) {
rslt += (int)(tcolUnits * (double)tblUnitBase.getUnitValue());
setComputedValue(rslt);
}
}*/

public String toString() {
return (Double.toString(tcolUnits) + " table-column-units");
}

public Numeric asNumeric() {
return new Numeric(this);
return new Numeric(this);
}
}


+ 8
- 11
src/org/apache/fop/datatypes/ToBeImplementedProperty.java View File

@@ -1,6 +1,6 @@
/*
* $Id$ --
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,27 +19,24 @@ public class ToBeImplementedProperty extends Property {

public Property convertProperty(Property p,
PropertyList propertyList, FObj fo) {
if (p instanceof ToBeImplementedProperty)
if (p instanceof ToBeImplementedProperty) {
return p;
}
ToBeImplementedProperty val =
new ToBeImplementedProperty(getPropName());
new ToBeImplementedProperty(getPropName());
return val;
}

}

public ToBeImplementedProperty(String propName) {

// XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an
// UnimplementedPropertyException or something similar should
// get thrown here instead.
//
// This was solved on the maintenance branch by using
// MessageHandler, btu that doesn't exist on the trunk
//XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an
//UnimplementedPropertyException or something similar should
//get thrown here instead.

// Logger log = Hierarchy.getDefaultHierarchy().getLoggerFor("fop");
// log.warn("property - \"" + propName
// + "\" is not implemented yet.");
}

}


+ 11
- 10
src/org/apache/fop/fo/AbstractCharIterator.java View File

@@ -13,16 +13,16 @@ import java.util.NoSuchElementException;
public abstract class AbstractCharIterator implements CharIterator, Cloneable {

abstract public boolean hasNext();
public abstract boolean hasNext();

abstract public char nextChar() throws NoSuchElementException ;
public abstract char nextChar() throws NoSuchElementException ;

public Object next() throws NoSuchElementException {
return new Character(nextChar());
return new Character(nextChar());
}

public void remove() {
throw new UnsupportedOperationException();
throw new UnsupportedOperationException();
}


@@ -30,10 +30,11 @@ public abstract class AbstractCharIterator implements CharIterator, Cloneable {
}

public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException ex) {
return null;
}
try {
return super.clone();
} catch (CloneNotSupportedException ex) {
return null;
}
}
};
}


+ 6
- 3
src/org/apache/fop/fo/ColorTypeProperty.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,11 +19,13 @@ public class ColorTypeProperty extends Property {

public Property convertProperty(Property p,
PropertyList propertyList, FObj fo) {
if (p instanceof ColorTypeProperty)
if (p instanceof ColorTypeProperty) {
return p;
}
ColorType val = p.getColorType();
if (val != null)
if (val != null) {
return new ColorTypeProperty(val);
}
return convertPropertyDatatype(p, propertyList, fo);
}

@@ -45,3 +47,4 @@ public class ColorTypeProperty extends Property {
}

}


+ 5
- 5
src/org/apache/fop/fo/EnumProperty.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -17,7 +17,6 @@ public class EnumProperty extends Property {
super(propName);
}


/**
* Called by subclass if no match found.
*/
@@ -34,12 +33,12 @@ public class EnumProperty extends Property {
public Property convertProperty(Property p,
PropertyList propertyList,
FObj fo) throws FOPException {
if (p instanceof EnumProperty)
if (p instanceof EnumProperty) {
return p;
else
} else {
return null;
}
}

}

private int value;
@@ -59,3 +58,4 @@ public class EnumProperty extends Property {
}

}


+ 1
- 1
src/org/apache/fop/fo/FONode.java View File

@@ -24,7 +24,7 @@ import java.util.NoSuchElementException;
* base class for nodes in the XML tree
*
*/
abstract public class FONode {
public abstract class FONode {
protected FOUserAgent userAgent;
protected FONode parent;
protected String name;

+ 4
- 3
src/org/apache/fop/fo/FOText.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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."
*/
@@ -69,7 +69,7 @@ public class FOText extends FObj {

public void addLayoutManager(List list) {
// if nothing left (length=0)?
if(length == 0) return;
if(length == 0) { return; }

if (length < ca.length) {
char[] tmp = ca;
@@ -93,8 +93,9 @@ public class FOText extends FObj {
if (curIndex < length) {
// Just a char class? Don't actually care about the value!
return ca[curIndex++];
} else
} else {
throw new NoSuchElementException();
}
}

public void remove() {

+ 19
- 15
src/org/apache/fop/fo/FObj.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -39,12 +39,12 @@ public class FObj extends FONode {
/**
* value of marker before layout begins
*/
public final static int START = -1000;
public static final int START = -1000;

/**
* value of marker after break-after
*/
public final static int BREAK_AFTER = -1001;
public static final int BREAK_AFTER = -1001;

/**
* where the layout was up to.
@@ -72,8 +72,9 @@ public class FObj extends FONode {
public FObj(FONode parent) {
super(parent);
markers = new HashMap();
if (parent instanceof FObj)
if (parent instanceof FObj) {
this.areaClass = ((FObj) parent).areaClass;
}
}

public void setName(String str) {
@@ -145,11 +146,11 @@ public class FObj extends FONode {

protected void setupID() {
Property prop = this.properties.get("id");
if(prop != null) {
if (prop != null) {
String str = prop.getString();
if(str != null && !str.equals("")) {
if (str != null && !str.equals("")) {
HashSet idrefs = structHandler.getIDReferences();
if(!idrefs.contains(str)) {
if (!idrefs.contains(str)) {
id = str;
idrefs.add(id);
} else {
@@ -197,8 +198,8 @@ public class FObj extends FONode {
FONode parent;
for (p = this; !p.generatesReferenceAreas() &&
(parent = p.getParent()) != null &&
(parent instanceof FObj); p = (FObj) parent)
;
(parent instanceof FObj); p = (FObj) parent) {
}
this.properties.setWritingMode(
p.getProperty("writing-mode").getEnum());
}
@@ -216,7 +217,7 @@ public class FObj extends FONode {
* @return A ListIterator.
*/
public ListIterator getChildren() {
if(children != null) {
if (children != null) {
return children.listIterator();
}
return null;
@@ -233,8 +234,9 @@ public class FObj extends FONode {
int i = children.indexOf(childNode);
if (i >= 0) {
return children.listIterator(i);
} else
} else {
return null;
}
}

public void setIsInTableCell() {
@@ -308,13 +310,14 @@ public class FObj extends FONode {
snapshot.add(new Integer(this.marker));

// terminate if no kids or child not yet accessed
if (this.marker < 0)
if (this.marker < 0) {
return snapshot;
else if (children.isEmpty())
} else if (children.isEmpty()) {
return snapshot;
else
} else {
return ( (FObj) children.get(this.marker)).getMarkerSnapshot(
snapshot);
}
}

/**
@@ -331,8 +334,9 @@ public class FObj extends FONode {
// make sure all the children of this FO are also reset
resetMarker();
return;
} else if ((this.marker == -1) || children.isEmpty())
} else if ((this.marker == -1) || children.isEmpty()) {
return;
}

int numChildren = this.children.size();


+ 5
- 3
src/org/apache/fop/fo/GenericShorthandParser.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,10 +19,11 @@ public class GenericShorthandParser implements ShorthandParser {
}

protected Property getElement(int index) {
if (list.size() > index)
if (list.size() > index) {
return (Property)list.elementAt(index);
else
} else {
return null;
}
}

protected int count() {
@@ -60,3 +61,4 @@ public class GenericShorthandParser implements ShorthandParser {
}

}


+ 39
- 31
src/org/apache/fop/fo/InlineCharIterator.java View File

@@ -1,3 +1,10 @@
/*
* $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.
*/

package org.apache.fop.fo;

import org.apache.fop.layout.BorderAndPadding;
@@ -8,48 +15,49 @@ import java.util.NoSuchElementException;


public class InlineCharIterator extends RecursiveCharIterator {
private boolean bStartBoundary=false;
private boolean bEndBoundary=false;
private boolean bStartBoundary = false;
private boolean bEndBoundary = false;

public InlineCharIterator(FObj fobj, BorderAndPadding bap) {
super(fobj);
checkBoundaries(bap);
super(fobj);
checkBoundaries(bap);
}


private void checkBoundaries(BorderAndPadding bap) {
// TODO! use start and end in BAP!!
bStartBoundary = (bap.getBorderLeftWidth(false)>0 ||
bap.getPaddingLeft(false)>0);
bEndBoundary = (bap.getBorderRightWidth(false)>0 ||
bap.getPaddingRight(false)>0);
// TODO! use start and end in BAP!!
bStartBoundary = (bap.getBorderLeftWidth(false) > 0 ||
bap.getPaddingLeft(false) > 0);
bEndBoundary = (bap.getBorderRightWidth(false) > 0 ||
bap.getPaddingRight(false) > 0);
}

public boolean hasNext() {
if (bStartBoundary) return true;
return (super.hasNext() || bEndBoundary);
/* If super.hasNext() returns false,
* we return true if we are going to return a "boundary" signal
* else false.
*/
if (bStartBoundary)
return true;
return (super.hasNext() || bEndBoundary);
/* If super.hasNext() returns false,
* we return true if we are going to return a "boundary" signal
* else false.
*/
}

public char nextChar() throws NoSuchElementException {
if (bStartBoundary) {
bStartBoundary=false;
return CharUtilities.CODE_EOT;
}
try {
return super.nextChar();
}
catch (NoSuchElementException e) {
// Underlying has nothing more to return
// Check end boundary char
if (bEndBoundary) {
bEndBoundary=false;
return CharUtilities.CODE_EOT;
}
else throw e;
}
if (bStartBoundary) {
bStartBoundary = false;
return CharUtilities.CODE_EOT;
}
try {
return super.nextChar();
} catch (NoSuchElementException e) {
// Underlying has nothing more to return
// Check end boundary char
if (bEndBoundary) {
bEndBoundary = false;
return CharUtilities.CODE_EOT;
} else
throw e;
}
}
}


+ 8
- 4
src/org/apache/fop/fo/LengthProperty.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -38,14 +38,17 @@ public class LengthProperty extends Property {
FObj fo) throws FOPException {
if (isAutoLengthAllowed()) {
String pval = p.getString();
if (pval != null && pval.equals("auto"))
if (pval != null && pval.equals("auto")) {
return new LengthProperty(new AutoLength());
}
}
if (p instanceof LengthProperty)
if (p instanceof LengthProperty) {
return p;
}
Length val = p.getLength();
if (val != null)
if (val != null) {
return new LengthProperty(val);
}
return convertPropertyDatatype(p, propertyList, fo);
}

@@ -81,3 +84,4 @@ public class LengthProperty extends Property {
}

}


+ 10
- 8
src/org/apache/fop/fo/OneCharIterator.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -17,19 +17,21 @@ public class OneCharIterator extends AbstractCharIterator {
private char charCode;

public OneCharIterator(char c) {
this.charCode = c;
this.charCode = c;
}

public boolean hasNext() {
return bFirst;
return bFirst;
}

public char nextChar() throws NoSuchElementException {
if (bFirst) {
bFirst=false;
return charCode;
}
else throw new NoSuchElementException();
if (bFirst) {
bFirst = false;
return charCode;
} else {
throw new NoSuchElementException();
}
}

}


+ 1
- 1
src/org/apache/fop/fo/PropertyList.java View File

@@ -37,7 +37,7 @@ public class PropertyList extends HashMap {
"inline-progression-dimension"
};

static private final HashMap wmtables = new HashMap(4);
private static final HashMap wmtables = new HashMap(4);
{
wmtables.put(new Integer(WritingMode.LR_TB), /* lr-tb */
new byte[] {

+ 47
- 40
src/org/apache/fop/fo/RecursiveCharIterator.java View File

@@ -1,3 +1,10 @@
/*
* $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.
*/

package org.apache.fop.fo;

import java.util.Iterator;
@@ -12,72 +19,72 @@ public class RecursiveCharIterator extends AbstractCharIterator {
private FONode curChild;

public RecursiveCharIterator(FObj fobj) {
// Set up first child iterator
this.fobj = fobj;
this.childIter = fobj.getChildren();
getNextCharIter();
// Set up first child iterator
this.fobj = fobj;
this.childIter = fobj.getChildren();
getNextCharIter();
}

public RecursiveCharIterator(FObj fobj, FONode child) {
// Set up first child iterator
this.fobj = fobj;
this.childIter = fobj.getChildren(child);
getNextCharIter();
// Set up first child iterator
this.fobj = fobj;
this.childIter = fobj.getChildren(child);
getNextCharIter();
}

public CharIterator mark() {
return (CharIterator) this.clone();
return (CharIterator) this.clone();
}

public Object clone() {
RecursiveCharIterator ci = (RecursiveCharIterator)super.clone();
ci.childIter = fobj.getChildren(ci.curChild);
// Need to advance to the next child, else we get the same one!!!
ci.childIter.next();
ci.curCharIter = (CharIterator)curCharIter.clone();
return ci;
RecursiveCharIterator ci = (RecursiveCharIterator) super.clone();
ci.childIter = fobj.getChildren(ci.curChild);
// Need to advance to the next child, else we get the same one!!!
ci.childIter.next();
ci.curCharIter = (CharIterator) curCharIter.clone();
return ci;
}


public void replaceChar(char c) {
if (curCharIter != null) {
curCharIter.replaceChar(c);
}
if (curCharIter != null) {
curCharIter.replaceChar(c);
}
}


private void getNextCharIter() {
if (childIter.hasNext()) {
this.curChild = (FONode)childIter.next();
this.curCharIter = curChild.charIterator();
}
else {
curChild = null;
curCharIter = null;
}
if (childIter.hasNext()) {
this.curChild = (FONode) childIter.next();
this.curCharIter = curChild.charIterator();
} else {
curChild = null;
curCharIter = null;
}
}

public boolean hasNext() {
while (curCharIter != null) {
if (curCharIter.hasNext()==false) {
getNextCharIter();
}
else return true;
}
return false;
while (curCharIter != null) {
if (curCharIter.hasNext() == false) {
getNextCharIter();
} else
return true;
}
return false;
}

public char nextChar() throws NoSuchElementException {
if (curCharIter != null) {
return curCharIter.nextChar();
}
else throw new NoSuchElementException();
if (curCharIter != null) {
return curCharIter.nextChar();
} else
throw new NoSuchElementException();
}


public void remove() {
if (curCharIter != null) {
curCharIter.remove();
}
if (curCharIter != null) {
curCharIter.remove();
}
}
}


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

@@ -1,8 +1,8 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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."
* LICENSE file included with these sources.
*/

package org.apache.fop.fo;
@@ -15,25 +15,25 @@ import org.apache.fop.traits.SpaceVal;
/**
* Collection of properties used in
*/
public class TextInfo {
public FontState fs;
public ColorType color;
public int wrapOption;
public boolean bWrap ; // True if wrap-option = WRAP
public int whiteSpaceCollapse;
public int verticalAlign;
public int lineHeight;
public class TextInfo {
public FontState fs;
public ColorType color;
public int wrapOption;
public boolean bWrap ; // True if wrap-option = WRAP
public int whiteSpaceCollapse;
public int verticalAlign;
public int lineHeight;

// Props used for calculating inline-progression-dimension
public SpaceVal wordSpacing;
public SpaceVal letterSpacing;
// Props used for calculating inline-progression-dimension
public SpaceVal wordSpacing;
public SpaceVal letterSpacing;

// Add hyphenation props too
public boolean bCanHyphenate=true;
// Add hyphenation props too
public boolean bCanHyphenate=true;

// Textdecoration
public boolean underlined = false;
public boolean overlined = false;
public boolean lineThrough = false;
}
// Textdecoration
public boolean underlined = false;
public boolean overlined = false;
public boolean lineThrough = false;
}


+ 4
- 3
src/org/apache/fop/fo/expr/AbsFunction.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -18,9 +18,10 @@ public class AbsFunction extends FunctionBase {
public Property eval(Property[] args,
PropertyInfo propInfo) throws PropertyException {
Numeric num = args[0].getNumeric();
if (num == null)
if (num == null) {
throw new PropertyException("Non numeric operand to abs function");
// What if has relative composants (percent, table-col units)?
}
// What if has relative composants (percent, table-col units)?
return new NumericProperty(num.abs());
}


+ 4
- 2
src/org/apache/fop/fo/expr/CeilingFunction.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,9 +19,11 @@ class CeilingFunction extends FunctionBase {
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
Number dbl = args[0].getNumber();
if (dbl == null)
if (dbl == null) {
throw new PropertyException("Non number operand to ceiling function");
}
return new NumberProperty(Math.ceil(dbl.doubleValue()));
}

}


+ 4
- 2
src/org/apache/fop/fo/expr/FloorFunction.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -20,9 +20,11 @@ class FloorFunction extends FunctionBase {
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
Number dbl = args[0].getNumber();
if (dbl == null)
if (dbl == null) {
throw new PropertyException("Non number operand to floor function");
}
return new NumberProperty(Math.floor(dbl.doubleValue()));
}

}


+ 4
- 2
src/org/apache/fop/fo/expr/MaxFunction.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -20,9 +20,11 @@ public class MaxFunction extends FunctionBase {
PropertyInfo pInfo) throws PropertyException {
Numeric n1 = args[0].getNumeric();
Numeric n2 = args[1].getNumeric();
if (n1 == null || n2 == null)
if (n1 == null || n2 == null) {
throw new PropertyException("Non numeric operands to max function");
}
return new NumericProperty(n1.max(n2));
}

}


+ 4
- 2
src/org/apache/fop/fo/expr/MinFunction.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -20,9 +20,11 @@ public class MinFunction extends FunctionBase {
PropertyInfo pInfo) throws PropertyException {
Numeric n1 = args[0].getNumeric();
Numeric n2 = args[1].getNumeric();
if (n1 == null || n2 == null)
if (n1 == null || n2 == null) {
throw new PropertyException("Non numeric operands to min function");
}
return new NumericProperty(n1.min(n2));
}

}


+ 24
- 19
src/org/apache/fop/fo/expr/Numeric.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -123,7 +123,7 @@ public class Numeric {
*/
public Length asLength() {
if (dim == 1) {
Vector len = new Vector(3);
Vector len = new Vector(3);
if ((valType & ABS_LENGTH) != 0) {
len.add(new FixedLength((int)absValue));
}
@@ -133,12 +133,11 @@ public class Numeric {
if ((valType & TCOL_LENGTH) != 0) {
len.add(new TableColLength(tcolValue));
}
if (len.size() == 1) {
return (Length)len.elementAt(0);
}
else {
return new MixedLength(len);
}
if (len.size() == 1) {
return (Length)len.elementAt(0);
} else {
return new MixedLength(len);
}
} else {
// or throw exception???
// can't make Length if dimension != 1
@@ -192,8 +191,9 @@ public class Numeric {
private boolean isMixedType() {
int ntype = 0;
for (int t = valType; t != 0; t = t >> 1) {
if ((t & 1) != 0)
if ((t & 1) != 0) {
++ntype;
}
}
return ntype > 1;
}
@@ -333,16 +333,18 @@ public class Numeric {
double rslt = 0.0;
// Only compare if have same dimension and value type!
if (dim == op.dim && valType == op.valType &&!isMixedType()) {
if (valType == ABS_LENGTH)
if (valType == ABS_LENGTH) {
rslt = absValue - op.absValue;
else if (valType == PC_LENGTH)
} else if (valType == PC_LENGTH) {
rslt = pcValue - op.pcValue;
else if (valType == TCOL_LENGTH)
} else if (valType == TCOL_LENGTH) {
rslt = tcolValue - op.tcolValue;
if (rslt > 0.0)
}
if (rslt > 0.0) {
return this;
else
} else {
return op;
}
}
throw new PropertyException("Arguments to max() must have same dimension and value type.");
}
@@ -357,18 +359,21 @@ public class Numeric {
double rslt = 0.0;
// Only compare if have same dimension and value type!
if (dim == op.dim && valType == op.valType &&!isMixedType()) {
if (valType == ABS_LENGTH)
if (valType == ABS_LENGTH) {
rslt = absValue - op.absValue;
else if (valType == PC_LENGTH)
} else if (valType == PC_LENGTH) {
rslt = pcValue - op.pcValue;
else if (valType == TCOL_LENGTH)
} else if (valType == TCOL_LENGTH) {
rslt = tcolValue - op.tcolValue;
if (rslt > 0.0)
}
if (rslt > 0.0) {
return op;
else
} else {
return this;
}
}
throw new PropertyException("Arguments to min() must have same dimension and value type.");
}

}


+ 3
- 2
src/org/apache/fop/fo/expr/PropertyInfo.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -77,8 +77,9 @@ public class PropertyInfo {
}

public void popFunction() {
if (stkFunction != null)
if (stkFunction != null) {
stkFunction.pop();
}
}

private PercentBase getFunctionPercentBase() {

+ 28
- 17
src/org/apache/fop/fo/expr/PropertyParser.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -25,9 +25,9 @@ import java.util.HashMap;
public class PropertyParser extends PropertyTokenizer {
private PropertyInfo propInfo; // Maker and propertyList related info

static private final String RELUNIT = "em";
static private final Numeric negOne = new Numeric(new Double(-1.0));
static final private HashMap functionTable = new HashMap();
private static final String RELUNIT = "em";
private static final Numeric negOne = new Numeric(new Double(-1.0));
private static final HashMap functionTable = new HashMap();

static {
// Initialize the HashMap of XSL-defined functions
@@ -107,8 +107,9 @@ public class PropertyParser extends PropertyTokenizer {
if (propList != null) {
propList.addProperty(prop);
return propList;
} else
} else {
return prop;
}
} else {
if (propList == null) {
propList = new ListProperty(prop);
@@ -129,7 +130,7 @@ public class PropertyParser extends PropertyTokenizer {
// Evaluate and put result on the operand stack
Property prop = parseMultiplicativeExpr();
loop:
for (; ; ) {
for (; ;) {
switch (currentToken) {
case TOK_PLUS:
next();
@@ -156,7 +157,7 @@ public class PropertyParser extends PropertyTokenizer {
private Property parseMultiplicativeExpr() throws PropertyException {
Property prop = parseUnaryExpr();
loop:
for (; ; ) {
for (; ;) {
switch (currentToken) {
case TOK_DIV:
next();
@@ -198,8 +199,9 @@ public class PropertyParser extends PropertyTokenizer {
* and throws an exception if this isn't the case.
*/
private final void expectRpar() throws PropertyException {
if (currentToken != TOK_RPAR)
if (currentToken != TOK_RPAR) {
throw new PropertyException("expected )");
}
next();
}

@@ -272,13 +274,15 @@ public class PropertyParser extends PropertyTokenizer {
if (unitPart.equals(RELUNIT)) {
length = new FixedLength(numPart.doubleValue(),
propInfo.currentFontSize());
} else
} else {
length = new FixedLength(numPart.doubleValue(), unitPart);
}
if (length == null) {
throw new PropertyException("unrecognized unit name: "
+ currentTokenValue);
} else
} else {
prop = new LengthProperty(length);
}
break;

case TOK_COLORSPEC:
@@ -331,8 +335,9 @@ public class PropertyParser extends PropertyTokenizer {
args[i++] = prop;
}
// ignore extra args
if (currentToken != TOK_COMMA)
if (currentToken != TOK_COMMA) {
break;
}
next();
}
expectRpar();
@@ -355,8 +360,9 @@ public class PropertyParser extends PropertyTokenizer {
*/
private Property evalAddition(Numeric op1,
Numeric op2) throws PropertyException {
if (op1 == null || op2 == null)
if (op1 == null || op2 == null) {
throw new PropertyException("Non numeric operand in addition");
}
return new NumericProperty(op1.add(op2));
}

@@ -371,8 +377,9 @@ public class PropertyParser extends PropertyTokenizer {
*/
private Property evalSubtraction(Numeric op1,
Numeric op2) throws PropertyException {
if (op1 == null || op2 == null)
if (op1 == null || op2 == null) {
throw new PropertyException("Non numeric operand in subtraction");
}
return new NumericProperty(op1.subtract(op2));
}

@@ -385,8 +392,9 @@ public class PropertyParser extends PropertyTokenizer {
* @throws PropertyException If the operand is null.
*/
private Property evalNegate(Numeric op) throws PropertyException {
if (op == null)
if (op == null) {
throw new PropertyException("Non numeric operand to unary minus");
}
return new NumericProperty(op.multiply(negOne));
}

@@ -401,8 +409,9 @@ public class PropertyParser extends PropertyTokenizer {
*/
private Property evalMultiply(Numeric op1,
Numeric op2) throws PropertyException {
if (op1 == null || op2 == null)
if (op1 == null || op2 == null) {
throw new PropertyException("Non numeric operand in multiplication");
}
return new NumericProperty(op1.multiply(op2));
}

@@ -418,8 +427,9 @@ public class PropertyParser extends PropertyTokenizer {
*/
private Property evalDivide(Numeric op1,
Numeric op2) throws PropertyException {
if (op1 == null || op2 == null)
if (op1 == null || op2 == null) {
throw new PropertyException("Non numeric operand in division");
}
return new NumericProperty(op1.divide(op2));
}

@@ -434,8 +444,9 @@ public class PropertyParser extends PropertyTokenizer {
*/
private Property evalModulo(Number op1,
Number op2) throws PropertyException {
if (op1 == null || op2 == null)
if (op1 == null || op2 == null) {
throw new PropertyException("Non number operand to modulo");
}
return new NumberProperty(op1.doubleValue() % op2.doubleValue());
}


+ 20
- 13
src/org/apache/fop/fo/expr/PropertyTokenizer.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -71,7 +71,7 @@ class PropertyTokenizer {
boolean currentMaybeOperator = recognizeOperator;
boolean bSawDecimal;
recognizeOperator = true;
for (; ; ) {
for (; ;) {
if (exprIndex >= exprLength) {
currentToken = TOK_EOF;
return;
@@ -145,8 +145,9 @@ class PropertyTokenizer {
exprIndex++;
scanDigits();
}
} else
} else {
bSawDecimal = false;
}
if (exprIndex < exprLength && expr.charAt(exprIndex) == '%') {
exprIndex++;
currentToken = TOK_PERCENT;
@@ -195,14 +196,16 @@ class PropertyTokenizer {
exprIndex);
// Probably should have some multiple of 3 for length!
return;
} else
} else {
throw new PropertyException("illegal character '#'");
}

default:
--exprIndex;
scanName();
if (exprIndex == currentTokenStartIndex)
if (exprIndex == currentTokenStartIndex) {
throw new PropertyException("illegal character");
}
currentTokenValue = expr.substring(currentTokenStartIndex,
exprIndex);
// if (currentMaybeOperator) {
@@ -236,9 +239,10 @@ class PropertyTokenizer {
* Attempt to recognize a valid NAME token in the input expression.
*/
private void scanName() {
if (exprIndex < exprLength && isNameStartChar(expr.charAt(exprIndex)))
if (exprIndex < exprLength && isNameStartChar(expr.charAt(exprIndex))) {
while (++exprIndex < exprLength
&& isNameChar(expr.charAt(exprIndex)));
&& isNameChar(expr.charAt(exprIndex))) { }
}
}

/**
@@ -246,8 +250,9 @@ class PropertyTokenizer {
* input expression.
*/
private void scanDigits() {
while (exprIndex < exprLength && isDigit(expr.charAt(exprIndex)))
while (exprIndex < exprLength && isDigit(expr.charAt(exprIndex))) {
exprIndex++;
}
}

/**
@@ -255,8 +260,9 @@ class PropertyTokenizer {
* input expression.
*/
private void scanHexDigits() {
while (exprIndex < exprLength && isHexDigit(expr.charAt(exprIndex)))
while (exprIndex < exprLength && isHexDigit(expr.charAt(exprIndex))) {
exprIndex++;
}
}

/**
@@ -282,11 +288,11 @@ class PropertyTokenizer {
}


static private final String nameStartChars =
private static final String nameStartChars =
"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static private final String nameChars = ".-0123456789";
static private final String digits = "0123456789";
static private final String hexchars = digits + "abcdefABCDEF";
private static final String nameChars = ".-0123456789";
private static final String digits = "0123456789";
private static final String hexchars = digits + "abcdefABCDEF";

/**
* Return a boolean value indicating whether the argument is a
@@ -342,3 +348,4 @@ class PropertyTokenizer {
}

}


+ 6
- 3
src/org/apache/fop/fo/expr/RoundFunction.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,13 +19,16 @@ class RoundFunction extends FunctionBase {
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
Number dbl = args[0].getNumber();
if (dbl == null)
if (dbl == null) {
throw new PropertyException("Non number operand to round function");
}
double n = dbl.doubleValue();
double r = Math.floor(n + 0.5);
if (r == 0.0 && n < 0.0)
if (r == 0.0 && n < 0.0) {
r = -r; // round(-0.2) returns -0 not 0
}
return new NumberProperty(r);
}

}


+ 3
- 2
src/org/apache/fop/fo/flow/Block.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -278,8 +278,9 @@ public class Block extends FObjMixed {
// only if bWScollapse=true
charIter.remove();
} else {
if (bWScollapse)
if (bWScollapse) {
bInWS = true;
}
charIter.replaceChar('\u0020');
}
break;

+ 2
- 2
src/org/apache/fop/fo/flow/Character.java View File

@@ -40,8 +40,8 @@ import java.util.List;
*
*/
public class Character extends FObj {
public final static int OK = 0;
public final static int DOESNOT_FIT = 1;
public static final int OK = 0;
public static final int DOESNOT_FIT = 1;

private char characterValue;


+ 6
- 5
src/org/apache/fop/fo/flow/TableCell.java View File

@@ -1,6 +1,6 @@
/*
* -- $Id$ --
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* $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.
*/
@@ -188,8 +188,9 @@ public class TableCell extends FObj {
// Depends on all cells starting in row
bRelativeAlign = true;
verticalAlign = this.properties.get("relative-align").getEnum();
} else
} else {
bRelativeAlign = false; // Align on a per-cell basis
}

this.minCellHeight =
this.properties.get("height").getLength().mvalue();
@@ -227,7 +228,7 @@ public class TableCell extends FObj {
this.beforeOffset = m_borderSeparation / 2
+ bp.getBorderTopWidth(false)
+ bp.getPaddingTop(false);
// bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false);
// bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false);

} else {
// System.err.println("Collapse borders");
@@ -295,5 +296,5 @@ public class TableCell extends FObj {
}
}

}


+ 13
- 9
src/org/apache/fop/fo/flow/TableColumn.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -76,19 +76,23 @@ public class TableColumn extends FObj {
// this.properties.get("number-columns-spanned");
// this.properties.get("visibility");

this.iColumnNumber =
this.properties.get("column-number").getNumber().intValue();
iColumnNumber = properties.get("column-number").getNumber().intValue();

this.numColumnsRepeated =
this.properties.get("number-columns-repeated").getNumber().intValue();
numColumnsRepeated =
properties.get("number-columns-repeated").getNumber().intValue();

this.backgroundColor =
this.properties.get("background-color").getColorType();

this.columnWidthPropVal =
this.properties.get("column-width").getLength();
// This won't include resolved table-units or % values yet.
this.columnWidth = columnWidthPropVal.mvalue();
Property prop = this.properties.get("column-width");
if(prop != null) {
columnWidthPropVal = properties.get("column-width").getLength();

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

// initialize id
setupID();

+ 4
- 3
src/org/apache/fop/fo/flow/TableRow.java View File

@@ -1,6 +1,6 @@
/*
* -- $Id$ --
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* $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.
*/
@@ -93,8 +93,9 @@ public class TableRow extends FObj {
private KeepValue getKeepValue(String sPropName) {
Property p = this.properties.get(sPropName);
Number n = p.getNumber();
if (n != null)
if (n != null) {
return new KeepValue(KeepValue.KEEP_WITH_VALUE, n.intValue());
}
switch (p.getEnum()) {
case Constants.ALWAYS:
return new KeepValue(KeepValue.KEEP_WITH_ALWAYS, 0);

+ 2
- 2
src/org/apache/fop/fo/pagination/PageNumberGenerator.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -73,7 +73,7 @@ public class PageNumberGenerator extends AbstractLogEnabled {
minPadding = 0;
}
} else {
// only accepted token is '0+1'at this stage. Because of the
// only accepted token is '0+1'at this stage. Because of the
// wonderful regular expression support in Java, we will resort to a
// loop
for (int i = 0; i < fmtLen - 1; i++) {

+ 11
- 11
src/org/apache/fop/fo/pagination/PageSequence.java View File

@@ -326,16 +326,16 @@ public class PageSequence extends FObj {
pageLM.run();

// Thread layoutThread = new Thread(pageLM);
// layoutThread.start();
// log.debug("Layout thread started");
// // wait on both managers
// try {
// layoutThread.join();
// log.debug("Layout thread done");
// } catch (InterruptedException ie) {
// log.error("PageSequence.format() interrupted waiting on layout");
// }
// layoutThread.start();
// log.debug("Layout thread started");
// // wait on both managers
// try {
// layoutThread.join();
// log.debug("Layout thread done");
// } catch (InterruptedException ie) {
// log.error("PageSequence.format() interrupted waiting on layout");
// }
// Tell the root the last page number we created.
this.root.setRunningPageNumberCounter(this.currentPageNumber);
}
@@ -398,7 +398,7 @@ public class PageSequence extends FObj {
// String formattedPageNumber =
// pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
// currentPage.setFormattedNumber(formattedPageNumber);
// this.currentPageNumber++;
// this.currentPageNumber++;
// //this.root.setRunningPageNumberCounter(this.currentPageNumber);

// BodyAreaContainer bodyArea = currentPage.getBody();

+ 20
- 23
src/org/apache/fop/fo/pagination/Region.java View File

@@ -31,18 +31,17 @@ import org.xml.sax.Attributes;
public abstract class Region extends FObj {
public static final String PROP_REGION_NAME = "region-name";

public final static String BEFORE = "before";
public final static String START = "start";
public final static String END = "end";
public final static String AFTER = "after";
public final static String BODY = "body";
public static final String BEFORE = "before";
public static final String START = "start";
public static final String END = "end";
public static final String AFTER = "after";
public static final String BODY = "body";

private SimplePageMaster _layoutMaster;
private String _regionName;

protected int overflow;


protected Region(FONode parent) {
super(parent);
}
@@ -66,10 +65,9 @@ public abstract class Region extends FObj {
}
}

if (parent instanceof SimplePageMaster) {
_layoutMaster = (SimplePageMaster)parent;
}
else {
if (parent instanceof SimplePageMaster) {
_layoutMaster = (SimplePageMaster)parent;
} else {
throw new FOPException(this.name + " must be child "
+ "of simple-page-master, not "
+ parent.getName());
@@ -84,11 +82,11 @@ public abstract class Region extends FObj {
Rectangle2D absRegionRect = pageCTM.transform(relRegionRect);
// Get the region viewport rectangle in absolute coords by
// transforming it using the page CTM
return new RegionViewport(absRegionRect);
return new RegionViewport(absRegionRect);
}


abstract protected Rectangle getViewportRectangle(FODimension pageRefRect);
protected abstract Rectangle getViewportRectangle(FODimension pageRefRect);

/**
* Create the region reference area for this region master.
@@ -97,32 +95,31 @@ public abstract class Region extends FObj {
* height=top-bottom
*/
public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
RegionReference r = new RegionReference(getRegionAreaClass());
setRegionTraits(r, absRegVPRect);
return r;
RegionReference r = new RegionReference(getRegionAreaClass());
setRegionTraits(r, absRegVPRect);
return r;
}

protected void setRegionTraits(RegionReference r, Rectangle2D absRegVPRect) {
// Common Border, Padding, and Background Properties
BorderAndPadding bap = propMgr.getBorderAndPadding();
BackgroundProps bProps = propMgr.getBackgroundProps();
/* this.backgroundColor =
this.properties.get("background-color").getColorType();*/
/* backgroundColor = properties.get("background-color").getColorType();*/

// this.properties.get("clip");
// this.properties.get("display-align");
this.overflow = this.properties.get("overflow").getEnum();
FODimension reldims = new FODimension(0,0);
r.setCTM(propMgr.getCTMandRelDims(absRegVPRect, reldims));
FODimension reldims = new FODimension(0,0);
r.setCTM(propMgr.getCTMandRelDims(absRegVPRect, reldims));

//r.setBackground(bProps);
//r.setBackground(bProps);
}

/**
* Return the enumerated value designating this type of region in the
* Area tree.
*/
abstract protected int getRegionAreaClass();
protected abstract int getRegionAreaClass();

/**
* Returns the default region name (xsl-region-before, xsl-region-start,
@@ -169,8 +166,8 @@ public abstract class Region extends FObj {
}

protected Region getSiblingRegion(String regionClass) {
// Ask parent for region
return _layoutMaster.getRegion(regionClass);
// Ask parent for region
return _layoutMaster.getRegion(regionClass);
}

boolean getPrecedence() {

+ 10
- 13
src/org/apache/fop/fo/pagination/RegionAfter.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -18,24 +18,21 @@ import org.xml.sax.Attributes;

public class RegionAfter extends RegionBA {


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


protected Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent and precedence
Rectangle vpRect =
new Rectangle(0, reldims.bpd - getExtent(),
reldims.ipd, getExtent());
if (getPrecedence() == false) {
adjustIPD(vpRect);
}
return vpRect;
// Depends on extent and precedence
Rectangle vpRect =
new Rectangle(0, reldims.bpd - getExtent(),
reldims.ipd, getExtent());
if (getPrecedence() == false) {
adjustIPD(vpRect);
}
return vpRect;
}


protected String getDefaultRegionName() {
return "xsl-region-after";
}
@@ -48,5 +45,5 @@ public class RegionAfter extends RegionBA {
return Region.AFTER;
}


}


+ 16
- 15
src/org/apache/fop/fo/pagination/RegionBA.java View File

@@ -27,9 +27,9 @@ public abstract class RegionBA extends RegionBASE {
}

public void end() {
super.end();
super.end();
bPrecedence =
(this.properties.get("precedence").getEnum()==Precedence.TRUE);
(this.properties.get("precedence").getEnum()==Precedence.TRUE);
}

/**
@@ -40,18 +40,19 @@ public abstract class RegionBA extends RegionBASE {
* and end regions if they are present.
*/
protected void adjustIPD(Rectangle vpRect) {
int xoff = 0;
Region start = getSiblingRegion(Region.START);
if (start != null) {
xoff = start.getExtent();
vpRect.translate(xoff, 0);
}
Region end =getSiblingRegion(Region.END);
if (end != null) {
xoff += end.getExtent();
}
if (xoff > 0) {
vpRect.grow(-xoff,0);
}
int xoff = 0;
Region start = getSiblingRegion(Region.START);
if (start != null) {
xoff = start.getExtent();
vpRect.translate(xoff, 0);
}
Region end =getSiblingRegion(Region.END);
if (end != null) {
xoff += end.getExtent();
}
if (xoff > 0) {
vpRect.grow(-xoff,0);
}
}
}


+ 5
- 4
src/org/apache/fop/fo/pagination/RegionBASE.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -24,12 +24,13 @@ 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
// 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();
}

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


+ 8
- 10
src/org/apache/fop/fo/pagination/RegionBefore.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,7 +19,6 @@ import org.xml.sax.Attributes;

public class RegionBefore extends RegionBA {


public RegionBefore(FONode parent) {
super(parent);
}
@@ -28,7 +27,6 @@ public class RegionBefore extends RegionBA {
// super.handleAttrs(attlist);
// }


protected String getDefaultRegionName() {
return "xsl-region-before";
}
@@ -41,19 +39,19 @@ public class RegionBefore extends RegionBA {
return RegionReference.BEFORE;
}


protected Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent and precedence
// Depends on extent and precedence
// This should return rectangle in writing-mode coordinates relative
// to the page-reference area rectangle
// This means the origin is (start, before) and the dimensions are (ipd,bpd)
// Before is always 0, start depends on extent
// ipd depends on precedence, bpd=extent
Rectangle vpRect = new Rectangle(0, 0, reldims.ipd, getExtent());
if (getPrecedence() == false) {
adjustIPD(vpRect);
}
return vpRect;
Rectangle vpRect = new Rectangle(0, 0, reldims.ipd, getExtent());
if (getPrecedence() == false) {
adjustIPD(vpRect);
}
return vpRect;
}

}


+ 8
- 8
src/org/apache/fop/fo/pagination/RegionEnd.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -19,19 +19,18 @@ import org.apache.fop.area.RegionReference;
public class RegionEnd extends RegionSE {



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


protected Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent and precedence
Rectangle vpRect =
new Rectangle(reldims.ipd - getExtent(), 0,
getExtent(), reldims.bpd);
adjustIPD(vpRect);
return vpRect;
// Depends on extent and precedence
Rectangle vpRect =
new Rectangle(reldims.ipd - getExtent(), 0,
getExtent(), reldims.bpd);
adjustIPD(vpRect);
return vpRect;
}

protected String getDefaultRegionName() {
@@ -48,3 +47,4 @@ public class RegionEnd extends RegionSE {
}

}


+ 15
- 14
src/org/apache/fop/fo/pagination/RegionSE.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -28,18 +28,19 @@ public abstract class RegionSE extends RegionBASE {
* diminish by extend of start and end if present.
*/
protected void adjustIPD(Rectangle refRect) {
int yoff = 0;
Region before = getSiblingRegion(Region.BEFORE);
if (before != null && before.getPrecedence()) {
yoff = before.getExtent();
refRect.translate(0, yoff);
}
Region after = getSiblingRegion(Region.AFTER);
if (after != null && after.getPrecedence()) {
yoff += after.getExtent();
}
if (yoff > 0) {
refRect.grow(0,-yoff);
}
int yoff = 0;
Region before = getSiblingRegion(Region.BEFORE);
if (before != null && before.getPrecedence()) {
yoff = before.getExtent();
refRect.translate(0, yoff);
}
Region after = getSiblingRegion(Region.AFTER);
if (after != null && after.getPrecedence()) {
yoff += after.getExtent();
}
if (yoff > 0) {
refRect.grow(0,-yoff);
}
}
}


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

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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."
*/
@@ -19,20 +19,19 @@ import org.apache.fop.area.RegionReference;
public class RegionStart extends RegionSE {



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


protected Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent and precedence
// Depends on extent and precedence
// This is the rectangle relative to the page-reference area in
// writing-mode relative coordinates
Rectangle vpRect =
new Rectangle(0, 0, getExtent(), reldims.bpd);
adjustIPD(vpRect);
return vpRect;
Rectangle vpRect =
new Rectangle(0, 0, getExtent(), reldims.bpd);
adjustIPD(vpRect);
return vpRect;
}

protected String getDefaultRegionName() {
@@ -48,3 +47,4 @@ public class RegionStart extends RegionSE {
}

}


+ 17
- 12
src/org/apache/fop/fonts/apps/PFMReader.java View File

@@ -26,8 +26,7 @@ import java.util.Iterator;
public class PFMReader {
private boolean invokedStandalone = false;

public PFMReader() {}

public PFMReader() { }

/**
* Parse commandline arguments. put options in the HashMap and return
@@ -40,7 +39,7 @@ public class PFMReader {
ArrayList arguments = new ArrayList();
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-")) {
if ((i + 1) < args.length &&!args[i + 1].startsWith("-")) {
if ((i + 1) < args.length && !args[i + 1].startsWith("-")) {
options.put(args[i], args[i + 1]);
i++;
} else {
@@ -54,7 +53,7 @@ public class PFMReader {
return (String[])arguments.toArray(new String[0]);
}

private final static void displayUsage() {
private static final void displayUsage() {
System.out.println(" java org.apache.fop.fonts.apps.PFMReader [options] metricfile.pfm xmlfile.xml\n");
System.out.println(" where options can be:\n");
System.out.println(" -fn <fontname>\n");
@@ -99,22 +98,26 @@ public class PFMReader {
System.out.println("PFM Reader v1.1");
System.out.println();

if (options.get("-ef") != null)
if (options.get("-ef") != null) {
embFile = (String)options.get("-ef");
}

if (options.get("-er") != null)
if (options.get("-er") != null) {
embResource = (String)options.get("-er");
}

if (options.get("-fn") != null)
if (options.get("-fn") != null) {
fontName = (String)options.get("-fn");
}

if (options.get("-cn") != null)
if (options.get("-cn") != null) {
className = (String)options.get("-cn");
}

if (arguments.length != 2 || options.get("-h") != null
|| options.get("-help") != null || options.get("--help") != null)
|| options.get("-help") != null || options.get("--help") != null) {
displayUsage();
else {
} else {
PFMFile pfm = app.loadPFM(arguments[0]);
if (pfm != null) {
app.preview(pfm);
@@ -238,10 +241,12 @@ public class PFMReader {

el = doc.createElement("embed");
root.appendChild(el);
if (file != null)
if (file != null) {
el.setAttribute("file", file);
if (resource != null)
}
if (resource != null) {
el.setAttribute("class", resource);
}

el = doc.createElement("encoding");
root.appendChild(el);

+ 1
- 1
src/org/apache/fop/fonts/apps/TTFReader.java View File

@@ -61,7 +61,7 @@ public class TTFReader {
}


private final static void displayUsage() {
private static final void displayUsage() {
System.out.println(" java org.apache.fop.fonts.apps.TTFReader [options] fontfile.ttf xmlfile.xml\n");
System.out.println(" where options can be:\n");
System.out.println("-enc ansi");

+ 0
- 1
src/org/apache/fop/image/AbstractFopImage.java View File

@@ -14,7 +14,6 @@ import java.awt.color.ICC_Profile;

// FOP
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.pdf.PDFFilter;
import org.apache.fop.image.analyser.ImageReaderFactory;
import org.apache.fop.image.analyser.ImageReader;
import org.apache.fop.fo.FOUserAgent;

+ 0
- 1
src/org/apache/fop/image/BmpImage.java View File

@@ -21,7 +21,6 @@ import java.io.IOException;
import java.awt.color.ColorSpace;

// FOP
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.image.analyser.ImageReader;
import org.apache.fop.fo.FOUserAgent;


+ 0
- 1
src/org/apache/fop/image/EPSImage.java View File

@@ -15,7 +15,6 @@ import java.io.IOException;

// FOP
import org.apache.fop.apps.Driver;
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.image.analyser.ImageReader;
import org.apache.fop.image.analyser.EPSReader;


+ 3
- 2
src/org/apache/fop/image/JimiImage.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -84,7 +84,8 @@ public class JimiImage extends AbstractFopImage {
// this.m_bitsPerPixel = cm.getPixelSize();
this.m_colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
if (cm.hasAlpha()) {
int transparencyType = cm.getTransparency(); // java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
// java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
int transparencyType = cm.getTransparency();
if (transparencyType == java.awt.Transparency.OPAQUE) {
this.m_isTransparent = false;
} else if (transparencyType ==

+ 0
- 2
src/org/apache/fop/image/JpegImage.java View File

@@ -19,8 +19,6 @@ import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;

// FOP
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.pdf.DCTFilter;
import org.apache.fop.image.analyser.ImageReader;
import org.apache.fop.fo.FOUserAgent;


+ 29
- 28
src/org/apache/fop/layout/BorderAndPadding.java View File

@@ -24,7 +24,7 @@ public class BorderAndPadding implements Cloneable {
public static final int RIGHT = END;

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

ResolvedCondLength(CondLength length) {
@@ -32,9 +32,9 @@ public class BorderAndPadding implements Cloneable {
iLength = length.mvalue();
}

public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}

}

@@ -44,23 +44,23 @@ public class BorderAndPadding implements Cloneable {
* @return The copy.
*/
public Object clone() throws CloneNotSupportedException {
BorderAndPadding bp = (BorderAndPadding) super.clone();
bp.padding = (ResolvedCondLength[])padding.clone();
bp.borderInfo = (BorderInfo[])borderInfo.clone();
for (int i=0; i<padding.length; i++) {
if (padding[i] != null) {
bp.padding[i]=(ResolvedCondLength)padding[i].clone();
}
if (borderInfo[i] != null) {
bp.borderInfo[i]=(BorderInfo)borderInfo[i].clone();
}
}
return bp;
BorderAndPadding bp = (BorderAndPadding) super.clone();
bp.padding = (ResolvedCondLength[]) padding.clone();
bp.borderInfo = (BorderInfo[]) borderInfo.clone();
for (int i = 0; i < padding.length; i++) {
if (padding[i] != null) {
bp.padding[i] = (ResolvedCondLength) padding[i].clone();
}
if (borderInfo[i] != null) {
bp.borderInfo[i] = (BorderInfo) borderInfo[i].clone();
}
}
return bp;
}

public static class BorderInfo implements Cloneable {
private int mStyle; // Enum for border style
private ColorType mColor; // Border color
private int mStyle; // Enum for border style
private ColorType mColor; // Border color
private ResolvedCondLength mWidth;

BorderInfo(int style, CondLength width, ColorType color) {
@@ -69,12 +69,12 @@ public class BorderAndPadding implements Cloneable {
mColor = color;
}

public Object clone() throws CloneNotSupportedException {
BorderInfo bi = (BorderInfo) super.clone();
bi.mWidth = (ResolvedCondLength)mWidth.clone();
// do we need to clone the Color too???
return bi;
}
public Object clone() throws CloneNotSupportedException {
BorderInfo bi = (BorderInfo) super.clone();
bi.mWidth = (ResolvedCondLength) mWidth.clone();
// do we need to clone the Color too???
return bi;
}
}

private BorderInfo[] borderInfo = new BorderInfo[4];
@@ -134,12 +134,12 @@ 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)) {
(borderInfo[side].mStyle == Constants.NONE) ||
(bDiscard && borderInfo[side].mWidth.bDiscard)) {
return 0;
} else {
return borderInfo[side].mWidth.iLength;
}
}
}

public ColorType getBorderColor(int side) {
@@ -157,7 +157,8 @@ public class BorderAndPadding implements Cloneable {
}

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
return padding[side].iLength;

+ 23
- 19
src/org/apache/fop/layout/FontState.java View File

@@ -19,6 +19,10 @@ public class FontState {
private String _fontFamily;
private String _fontStyle;
private int _fontWeight;

/**
* normal or small-caps font
*/
private int _fontVariant;

private FontMetric _metric;
@@ -81,30 +85,30 @@ public class FontState {
}

// Use default CodePointMapping
char d = CodePointMapping.getMapping("WinAnsiEncoding").mapChar(c);
if (d != 0) {
c = d;
} else {
c = '#';
}
char d = CodePointMapping.getMapping("WinAnsiEncoding").mapChar(c);
if (d != 0) {
c = d;
} else {
c = '#';
}

return c;
}

public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append('(');
sbuf.append(_fontFamily);
sbuf.append(',');
sbuf.append(_fontName);
sbuf.append(',');
sbuf.append(_fontSize);
sbuf.append(',');
sbuf.append(_fontStyle);
sbuf.append(',');
sbuf.append(_fontWeight);
sbuf.append(')');
return sbuf.toString();
StringBuffer sbuf = new StringBuffer();
sbuf.append('(');
sbuf.append(_fontFamily);
sbuf.append(',');
sbuf.append(_fontName);
sbuf.append(',');
sbuf.append(_fontSize);
sbuf.append(',');
sbuf.append(_fontStyle);
sbuf.append(',');
sbuf.append(_fontWeight);
sbuf.append(')');
return sbuf.toString();
}
}


+ 1
- 1
src/org/apache/fop/layout/hyphenation/ByteVector.java View File

@@ -20,7 +20,7 @@ public class ByteVector implements Serializable {
/**
* Capacity increment size
*/
private final static int DEFAULT_BLOCK_SIZE = 2048;
private static final int DEFAULT_BLOCK_SIZE = 2048;
private int BLOCK_SIZE;

/**

+ 1
- 1
src/org/apache/fop/layout/hyphenation/CharVector.java View File

@@ -20,7 +20,7 @@ public class CharVector implements Cloneable, Serializable {
/**
* Capacity increment size
*/
private final static int DEFAULT_BLOCK_SIZE = 2048;
private static final int DEFAULT_BLOCK_SIZE = 2048;
private int BLOCK_SIZE;

/**

+ 1
- 1
src/org/apache/fop/layout/hyphenation/TernaryTree.java View File

@@ -99,7 +99,7 @@ public class TernaryTree implements Cloneable, Serializable {
protected char freenode;
protected int length; // number of items in tree

protected final static int BLOCK_SIZE = 2048; // allocation size for arrays
protected static final int BLOCK_SIZE = 2048; // allocation size for arrays

TernaryTree() {
init();

+ 7
- 7
src/org/apache/fop/layoutmgr/AbstractLayoutManager.java View File

@@ -62,13 +62,13 @@ public abstract class AbstractLayoutManager implements LayoutManager {
// * is enough space to place the float(s) anchored in the line.
// */
// protected void flush(Area area, boolean bFinished) {
// if (area != null) {
// // area.setFinished(true);
// parentLM.addChild(area, bFinished); // ????
// if (bFinished) {
// setCurrentArea(null);
// }
// }
// if (area != null) {
// // area.setFinished(true);
// parentLM.addChild(area, bFinished); // ????
// if (bFinished) {
// setCurrentArea(null);
// }
// }
// }

/**

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

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -244,22 +244,22 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
return curBlockArea;
}

public void addBorders(Block curBlockArea) {
public void addBorders(Block curBlock) {
BorderProps bps = getBorderProps(BorderAndPadding.TOP);
if(bps.width != 0) {
curBlockArea.addTrait(Trait.BORDER_START, bps);
curBlock.addTrait(Trait.BORDER_START, bps);
}
bps = getBorderProps(BorderAndPadding.BOTTOM);
if(bps.width != 0) {
curBlockArea.addTrait(Trait.BORDER_END, bps);
curBlock.addTrait(Trait.BORDER_END, bps);
}
bps = getBorderProps(BorderAndPadding.LEFT);
if(bps.width != 0) {
curBlockArea.addTrait(Trait.BORDER_BEFORE, bps);
curBlock.addTrait(Trait.BORDER_BEFORE, bps);
}
bps = getBorderProps(BorderAndPadding.RIGHT);
if(bps.width != 0) {
curBlockArea.addTrait(Trait.BORDER_AFTER, bps);
curBlock.addTrait(Trait.BORDER_AFTER, bps);
}
}


+ 13
- 37
src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java View File

@@ -20,11 +20,12 @@ import java.util.Iterator;
* areas in the block-progression direction, such as Flow, Block, ListBlock.
*/
public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
/** Reference to FO whose areas it's managing or to the traits
/**
* Reference to FO whose areas it's managing or to the traits
* of the FO.
*/
LayoutManager curChildLM = null;
BlockParent parentArea = null;
protected LayoutManager curChildLM = null;
protected BlockParent parentArea = null;

public BlockStackingLayoutManager(FObj fobj) {
super(fobj);
@@ -50,11 +51,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {

protected MinOptMax resolveSpaceSpecifier(Area nextArea) {
SpaceSpecifier spaceSpec = new SpaceSpecifier(false);
// Area prevArea = getCurrentArea().getLast();
// if (prevArea != null) {
// spaceSpec.addSpace(prevArea.getSpaceAfter());
// }
// spaceSpec.addSpace(nextArea.getSpaceBefore());
// Area prevArea = getCurrentArea().getLast();
// if (prevArea != null) {
// spaceSpec.addSpace(prevArea.getSpaceAfter());
// }
// spaceSpec.addSpace(nextArea.getSpaceBefore());
return spaceSpec.resolve(false);
}

@@ -96,36 +97,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
return false;
}

// See if the whole thing fits, including space before
// Calculate space between last child in curFlow and childArea
//MinOptMax targetDim = parentArea.getAvailBPD();
MinOptMax spaceBefore = resolveSpaceSpecifier(childArea);
//targetDim.subtract(spaceBefore);
//if (targetDim.max >= childArea.getAllocationBPD().min) {
//parentArea.addBlock(new InterBlockSpace(spaceBefore));
// parentArea.addBlock((Block) childArea);
// return false;
//} else {
parentArea.addBlock((Block) childArea);
flush(); // hand off current area to parent
// Probably need something like max BPD so we don't get into
// infinite loops with large unbreakable chunks

/*LayoutManager childLM =
childArea.getGeneratingFObj(). getLayoutManager();
if (childLM.splitArea(childArea, splitContext)) {
//parentArea.addBlock(new InterBlockSpace(spaceBefore));
parentArea.addBlock((Block) childArea);
}*/
//flush(); // hand off current area to parent
//getParentArea(splitContext.nextArea);
//getParentArea(childArea);
// Check that reference IPD hasn't changed!!!
// If it has, we must "reflow" the content
//addChild(splitContext.nextArea);
//addChild(childArea);
return true;
//}
parentArea.addBlock((Block) childArea);
flush(); // hand off current area to parent

return true;
}



+ 5
- 1
src/org/apache/fop/layoutmgr/ContentLayoutManager.java View File

@@ -60,8 +60,9 @@ public class ContentLayoutManager implements LayoutManager {
int middlefollow = maxtb;

while (!curLM.isFinished()) {
MinOptMax lastSize = null;
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stack.add(bp.getStackingSize());
lastSize = bp.getStackingSize();
childBreaks.add(bp);

if (bp.getLead() > lineLead) {
@@ -74,6 +75,9 @@ public class ContentLayoutManager implements LayoutManager {
middlefollow = bp.getMiddle();
}
}
if(lastSize != null) {
stack.add(lastSize);
}
}

if (maxtb - lineLead > middlefollow) {

+ 6
- 6
src/org/apache/fop/layoutmgr/FlowLayoutManager.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -42,7 +42,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
MinOptMax stackSize = new MinOptMax();

while ((curLM = getChildLM()) != null) {
if(curLM.generatesInlineAreas()) {
if (curLM.generatesInlineAreas()) {
// problem
curLM.setFinished(true);
continue;
@@ -65,7 +65,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
// set stackLimit for remaining space
childLC.setStackLimit(MinOptMax.subtract(bpd, stackSize));

if(bp.isForcedBreak()) {
if (bp.isForcedBreak()) {
breakPage = true;
break;
}
@@ -75,16 +75,16 @@ public class FlowLayoutManager extends BlockStackingLayoutManager {
// check the stack bpd and if greater than available
// height then go to the last best break and return
// break position
if(stackSize.opt > context.getStackLimit().opt) {
if (stackSize.opt > context.getStackLimit().opt) {
breakPage = true;
}
if(breakPage) {
if (breakPage) {
return new BreakPoss(
new LeafPosition(this, blockBreaks.size() - 1));
}
}
setFinished(true);
if(blockBreaks.size() > 0) {
if (blockBreaks.size() > 0) {
return new BreakPoss(
new LeafPosition(this, blockBreaks.size() - 1));
}

+ 4
- 3
src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -170,8 +170,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
LayoutManager lm = getChildLM();
if (lm != null) {
return lm.canBreakBefore(context);
} else
} else {
return false; // ??? NO child LM?
}
}

protected MinOptMax getPrevIPD(LayoutManager lm) {
@@ -322,7 +323,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {

m_prevBP = bp;
// if (bIsLast) {
// setFinished(true); // Our last area, so indicate done
// setFinished(true); // Our last area, so indicate done
// }
return myBP;
}

+ 15
- 16
src/org/apache/fop/layoutmgr/LineLayoutManager.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -101,9 +101,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
}

/**
* Call child layout managers to generate content as long as they
* generate inline areas. If a block-level generating LM is found,
* finish any line being filled and return to the parent LM.
* Call child layout managers to generate content.
* This gets the next break which is a full line.
*
*/
public BreakPoss getNextBreakPoss(LayoutContext context) {
// Get a break from currently active child LM
@@ -269,7 +269,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager {

// Don't justify last line in the sequence or if forced line-end
int talign = bTextAlignment;
if((bTextAlignment == TextAlign.JUSTIFY
if ((bTextAlignment == TextAlign.JUSTIFY
&& (m_prevBP.isForcedBreak()
|| isFinished()))) {
talign = TextAlign.START;
@@ -384,8 +384,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
// points remain. Choose the best break.
if (hyph != null) {
return new HyphContext(hyph.getHyphenationPoints());
} else
} else {
return null;
}
}


@@ -413,27 +414,27 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
for(Iterator iter = m_vecInlineBreaks.listIterator(prevLineEnd);
iter.hasNext(); ) {
BreakPoss bp = (BreakPoss)iter.next();
if(bp.getLead() > lineLead) {
if (bp.getLead() > lineLead) {
lineLead = bp.getLead();
}
if(bp.getTotal() > maxtb) {
if (bp.getTotal() > maxtb) {
maxtb = bp.getTotal();
}
if(bp.getMiddle() > middlefollow) {
if (bp.getMiddle() > middlefollow) {
middlefollow = bp.getMiddle();
}

// the stacking size of textLM accumulate for each break
// so the ipd is only added at the end of each LM
if(bp.getLayoutManager() != lastLM) {
if(lastLM != null) {
if (bp.getLayoutManager() != lastLM) {
if (lastLM != null) {
actual.add(lastBP.getStackingSize());
}
lastLM = bp.getLayoutManager();
}
lastBP = bp;
}
if(lastBP != null) {
if (lastBP != null) {
// add final ipd
actual.add(lastBP.getStackingSize());
// ATTENTION: make sure this hasn't gotten start space for next
@@ -441,7 +442,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
actual.add(lastBP.resolveTrailingSpace(true));
}

if(maxtb - lineLead > middlefollow) {
if (maxtb - lineLead > middlefollow) {
middlefollow = maxtb - lineLead;
}

@@ -481,7 +482,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
int indent = 0;
switch (textalign) {
case TextAlign.JUSTIFY:
if(realWidth != 0) {
if (realWidth != 0) {
dAdjust = (targetWith - realWidth) / realWidth;
}
break;
@@ -562,10 +563,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager {
lc.setLeadingSpace(lc.getTrailingSpace());
lc.setTrailingSpace(new SpaceSpecifier(false));
}
if(lc.getTrailingSpace() != null) {
addSpace(lineArea, lc.getTrailingSpace().resolve(true),
lc.getSpaceAdjust());
}
parentLM.addChild(lineArea);
}
setCurrentArea(null); // ?? necessary

+ 18
- 16
src/org/apache/fop/layoutmgr/PageLayoutManager.java View File

@@ -181,12 +181,14 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
* For now, only handle normal flow areas.
*/
public boolean addChild(Area childArea) {
if (childArea == null)
if (childArea == null) {
return false;
}
if (childArea.getAreaClass() == Area.CLASS_NORMAL) {
return placeFlowRefArea(childArea);
} else
} else {
; // TODO: all the others!
}
return false;
}

@@ -421,20 +423,20 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
*/
private boolean needEmptyPage(int breakValue) {
return false;
// if (breakValue == Constants.PAGE || curPage.isEmpty()) {
// // any page is OK or we already have an empty page
// return false;
// }
// else {
// /* IF we are on the kind of page we need, we'll need a new page. */
// if (curPage.getPageNumber()%2 != 0) {
// // Current page is odd
// return (breakValue == Constants.ODD_PAGE);
// }
// else {
// return (breakValue == Constants.EVEN_PAGE);
// }
// }
// if (breakValue == Constants.PAGE || curPage.isEmpty()) {
// // any page is OK or we already have an empty page
// return false;
// }
// else {
// /* IF we are on the kind of page we need, we'll need a new page. */
// if (curPage.getPageNumber()%2 != 0) {
// // Current page is odd
// return (breakValue == Constants.ODD_PAGE);
// }
// else {
// return (breakValue == Constants.EVEN_PAGE);
// }
// }
}

/**

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

@@ -32,9 +32,9 @@ public abstract class PositionIterator implements Iterator {
return m_childLM;
}

abstract protected LayoutManager getLM(Object nextObj);
protected abstract LayoutManager getLM(Object nextObj);

abstract protected Position getPos(Object nextObj);
protected abstract Position getPos(Object nextObj);

private void lookAhead() {
if (m_parentIter.hasNext()) {

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

@@ -55,7 +55,7 @@ public class TextLayoutManager extends AbstractLayoutManager {
private ArrayList m_vecAreaInfo;

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

private char[] chars;
private TextInfo textInfo;
@@ -450,19 +450,19 @@ public class TextLayoutManager extends AbstractLayoutManager {
double dSpaceAdjust = context.getSpaceAdjust();
if (dSpaceAdjust > 0.0) {
// Stretch by factor
// System.err.println("Potential stretch = " +
// (ai.m_ipdArea.max - ai.m_ipdArea.opt));
// System.err.println("Potential stretch = " +
// (ai.m_ipdArea.max - ai.m_ipdArea.opt));
iAdjust = (int)((double)(ai.m_ipdArea.max -
ai.m_ipdArea.opt) * dSpaceAdjust);
} else if (dSpaceAdjust < 0.0) {
// Shrink by factor
// System.err.println("Potential shrink = " +
// (ai.m_ipdArea.opt - ai.m_ipdArea.min));
// System.err.println("Potential shrink = " +
// (ai.m_ipdArea.opt - ai.m_ipdArea.min));
iAdjust = (int)((double)(ai.m_ipdArea.opt -
ai.m_ipdArea.min) * dSpaceAdjust);
}
// System.err.println("Text adjustment factor = " + dSpaceAdjust +
// " total=" + iAdjust);
// System.err.println("Text adjustment factor = " + dSpaceAdjust +
// " total=" + iAdjust);

// Make an area containing all characters between start and end.
Word word = null;

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

@@ -56,10 +56,10 @@ public class TraitSetter {
Object oTrait) {
int iBP = bpProps.getBorderWidth(iSide, bDiscard);
if (iBP > 0) {
// area.addTrait(new Trait(oTrait,
// new BorderProps(bpProps.getBorderStyle(iSide),
// iBP,
// bpProps.getBorderColor(iSide))));
// area.addTrait(new Trait(oTrait,
// new BorderProps(bpProps.getBorderStyle(iSide),
// iBP,
// bpProps.getBorderColor(iSide))));
area.addTrait(oTrait,
new BorderProps(bpProps.getBorderStyle(iSide),
iBP, bpProps.getBorderColor(iSide)));

+ 1
- 1
src/org/apache/fop/layoutmgr/table/Body.java View File

@@ -87,7 +87,7 @@ public class Body extends BlockStackingLayoutManager {
while (!curLM.isFinished()) {
if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
stackSize.add(bp.getStackingSize());
if (stackSize.min > context.getStackLimit().max) {
if (stackSize.opt > context.getStackLimit().max) {
// reset to last break
if (lastPos != null) {
reset(lastPos.getPosition());

+ 2
- 2
src/org/apache/fop/pdf/DCTFilter.java View File

@@ -9,9 +9,9 @@ package org.apache.fop.pdf;

import org.apache.fop.util.StreamUtilities;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.*;
import java.io.InputStream;
import java.io.OutputStream;

/**
* DCT Filter class. Right now it is just used as a dummy filter flag so

+ 2
- 2
src/org/apache/fop/pdf/PDFCMap.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -210,7 +210,7 @@ public class PDFCMap extends PDFStream {
* p.append("\n/UseCMap ");
* if (base instanceof String) {
* p.append("/"+base);
* } else { // base instanceof PDFStream
* } else {// base instanceof PDFStream
* p.append(((PDFStream)base).referencePDF());
* }
* }

+ 2
- 3
src/org/apache/fop/pdf/PDFColor.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -9,8 +9,6 @@ package org.apache.fop.pdf;

// Java
import java.util.ArrayList;
import java.io.IOException;
import java.io.PrintWriter;

public class PDFColor extends PDFPathPaint {
protected static double blackFactor = 2.0; // could be 3.0 as well.
@@ -306,3 +304,4 @@ public class PDFColor extends PDFPathPaint {
}

}


+ 5
- 4
src/org/apache/fop/pdf/PDFColorSpace.java View File

@@ -33,14 +33,15 @@ public class PDFColorSpace {
}

private int calculateNumComponents() {
if (currentColorSpace == DEVICE_GRAY)
if (currentColorSpace == DEVICE_GRAY) {
return 1;
else if (currentColorSpace == DEVICE_RGB)
} else if (currentColorSpace == DEVICE_RGB) {
return 3;
else if (currentColorSpace == DEVICE_CMYK)
} else if (currentColorSpace == DEVICE_CMYK) {
return 4;
else
} else {
return 0;
}
}

public void setColorSpace(int theColorSpace) {

+ 1
- 0
src/org/apache/fop/pdf/PDFDocument.java View File

@@ -1527,3 +1527,4 @@ public class PDFDocument {
}

}


+ 42
- 42
src/org/apache/fop/pdf/PDFFunction.java View File

@@ -461,9 +461,9 @@ public class PDFFunction extends PDFObject {
}

p.append("endobj\n");
// end of if FunctionType 0

} // end of if FunctionType 0
else if (this.functionType == 2) {
} else if (this.functionType == 2) {
// DOMAIN
if (this.domain != null) {
p.append("/Domain [ ");
@@ -668,103 +668,103 @@ public class PDFFunction extends PDFObject {
}

public boolean equals(Object obj) {
if(obj == null) {
if (obj == null) {
return false;
}
if(obj == this) {
if (obj == this) {
return true;
}
if(!(obj instanceof PDFFunction)) {
if (!(obj instanceof PDFFunction)) {
return false;
}
PDFFunction func = (PDFFunction)obj;
if(functionType != func.functionType) {
if (functionType != func.functionType) {
return false;
}
if(bitsPerSample != func.bitsPerSample) {
if (bitsPerSample != func.bitsPerSample) {
return false;
}
if(order != func.order) {
if (order != func.order) {
return false;
}
if(interpolationExponentN != func.interpolationExponentN) {
if (interpolationExponentN != func.interpolationExponentN) {
return false;
}
if(domain != null) {
if(!domain.equals(func.domain)) {
if (domain != null) {
if (!domain.equals(func.domain)) {
return false;
}
} else if(func.domain != null) {
} else if (func.domain != null) {
return false;
}
if(range != null) {
if(!range.equals(func.range)) {
if (range != null) {
if (!range.equals(func.range)) {
return false;
}
} else if(func.range != null) {
} else if (func.range != null) {
return false;
}
if(size != null) {
if(!size.equals(func.size)) {
if (size != null) {
if (!size.equals(func.size)) {
return false;
}
} else if(func.size != null) {
} else if (func.size != null) {
return false;
}
if(encode != null) {
if(!encode.equals(func.encode)) {
if (encode != null) {
if (!encode.equals(func.encode)) {
return false;
}
} else if(func.encode != null) {
} else if (func.encode != null) {
return false;
}
if(decode != null) {
if(!decode.equals(func.decode)) {
if (decode != null) {
if (!decode.equals(func.decode)) {
return false;
}
} else if(func.decode != null) {
} else if (func.decode != null) {
return false;
}
if(functionDataStream != null) {
if(!functionDataStream.equals(func.functionDataStream)) {
if (functionDataStream != null) {
if (!functionDataStream.equals(func.functionDataStream)) {
return false;
}
} else if(func.functionDataStream != null) {
} else if (func.functionDataStream != null) {
return false;
}
if(filter != null) {
if(!filter.equals(func.filter)) {
if (filter != null) {
if (!filter.equals(func.filter)) {
return false;
}
} else if(func.filter != null) {
} else if (func.filter != null) {
return false;
}
if(cZero != null) {
if(!cZero.equals(func.cZero)) {
if (cZero != null) {
if (!cZero.equals(func.cZero)) {
return false;
}
} else if(func.cZero != null) {
} else if (func.cZero != null) {
return false;
}
if(cOne != null) {
if(!cOne.equals(func.cOne)) {
if (cOne != null) {
if (!cOne.equals(func.cOne)) {
return false;
}
} else if(func.cOne != null) {
} else if (func.cOne != null) {
return false;
}
if(functions != null) {
if(!functions.equals(func.functions)) {
if (functions != null) {
if (!functions.equals(func.functions)) {
return false;
}
} else if(func.functions != null) {
} else if (func.functions != null) {
return false;
}
if(bounds != null) {
if(!bounds.equals(func.bounds)) {
if (bounds != null) {
if (!bounds.equals(func.bounds)) {
return false;
}
} else if(func.bounds != null) {
} else if (func.bounds != null) {
return false;
}
return true;

+ 8
- 8
src/org/apache/fop/pdf/PDFGState.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -81,7 +81,7 @@ public class PDFGState extends PDFObject {
}

public void setAlpha(float val, boolean fill) {
if(fill) {
if (fill) {
values.put(ca, new Float(val));
} else {
values.put(CA, new Float(val));
@@ -113,7 +113,7 @@ public class PDFGState extends PDFObject {

private void appendVal(StringBuffer sb, String name) {
Object val = values.get(name);
if(val != null) {
if (val != null) {
sb.append("/" + name + " " + val + "\n");
}
}
@@ -129,21 +129,21 @@ public class PDFGState extends PDFObject {
*/

public boolean equals(Object obj) {
if(obj == this) {
if (obj == this) {
return true;
}
if(!(obj instanceof PDFGState)) {
if (!(obj instanceof PDFGState)) {
return false;
}
HashMap vals1 = values;
HashMap vals2 = ((PDFGState)obj).values;
if(vals1.size() != vals2.size()) {
if (vals1.size() != vals2.size()) {
return false;
}
for(Iterator iter = vals1.keySet().iterator(); iter.hasNext(); ) {
for(Iterator iter = vals1.keySet().iterator(); iter.hasNext();) {
Object str = iter.next();
Object obj1 = vals1.get(str);
if(!obj1.equals(vals2.get(str))) {
if (!obj1.equals(vals2.get(str))) {
return false;
}
}

+ 3
- 2
src/org/apache/fop/pdf/PDFICCStream.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -39,8 +39,9 @@ public class PDFICCStream extends PDFStream {
pb.append(this.number).append(" ").append(this.generation).append(" obj\n<< ");
pb.append("/N ").append(cp.getNumComponents()).append(" ");
if (pdfColorSpace != null)
if (pdfColorSpace != null) {
pb.append("/Alternate /").append(pdfColorSpace.getColorSpacePDFString()).append(" ");
}
pb.append("/Length ").append((_data.getSize() + 1)).append(" ").append(filterEntry);
pb.append(" >>\n");

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

@@ -71,16 +71,16 @@ public class PDFInfo extends PDFObject {
public byte[] toPDF() {
String p = this.number + " " + this.generation
+ " obj\n<< /Type /Info\n";
if(title != null) {
if (title != null) {
p += "/Title (" + this.title + ")\n";
}
if(author != null) {
if (author != null) {
p += "/Author (" + this.author + ")\n";
}
if(subject != null) {
if (subject != null) {
p += "/Subject (" + this.subject + ")\n";
}
if(keywords != null) {
if (keywords != null) {
p += "/Keywords (" + this.keywords + ")\n";
}


+ 2
- 2
src/org/apache/fop/pdf/PDFNumber.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -9,7 +9,7 @@ package org.apache.fop.pdf;

public class PDFNumber {

private PDFNumber() {}
private PDFNumber() { }

public static String doubleOut(Double doubleDown) {
StringBuffer p = new StringBuffer();

+ 34
- 34
src/org/apache/fop/pdf/PDFPattern.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -198,7 +198,7 @@ public class PDFPattern extends PDFPathPaint {
p.append(this.number + " " + this.generation
+ " obj\n<< \n/Type /Pattern \n");

if(this.resources != null) {
if (this.resources != null) {
p.append("/Resources " + this.resources.referencePDF() + " \n");
}

@@ -308,85 +308,85 @@ public class PDFPattern extends PDFPathPaint {
public byte[] toPDF() { return null; }

public boolean equals(Object obj) {
if(obj == null) {
if (obj == null) {
return false;
}
if(obj == this) {
if (obj == this) {
return true;
}
if(!(obj instanceof PDFPattern)) {
if (!(obj instanceof PDFPattern)) {
return false;
}
PDFPattern patt = (PDFPattern)obj;
if(patternType != patt.patternType) {
if (patternType != patt.patternType) {
return false;
}
if(paintType != patt.paintType) {
if (paintType != patt.paintType) {
return false;
}
if(tilingType != patt.tilingType) {
if (tilingType != patt.tilingType) {
return false;
}
if(xStep != patt.xStep) {
if (xStep != patt.xStep) {
return false;
}
if(yStep != patt.yStep) {
if (yStep != patt.yStep) {
return false;
}
if(bBox != null) {
if(!bBox.equals(patt.bBox)) {
if (bBox != null) {
if (!bBox.equals(patt.bBox)) {
return false;
}
} else if(patt.bBox != null) {
} else if (patt.bBox != null) {
return false;
}
if(bBox != null) {
if(!bBox.equals(patt.bBox)) {
if (bBox != null) {
if (!bBox.equals(patt.bBox)) {
return false;
}
} else if(patt.bBox != null) {
} else if (patt.bBox != null) {
return false;
}
if(xUID != null) {
if(!xUID.equals(patt.xUID)) {
if (xUID != null) {
if (!xUID.equals(patt.xUID)) {
return false;
}
} else if(patt.xUID != null) {
} else if (patt.xUID != null) {
return false;
}
if(extGState != null) {
if(!extGState.equals(patt.extGState)) {
if (extGState != null) {
if (!extGState.equals(patt.extGState)) {
return false;
}
} else if(patt.extGState != null) {
} else if (patt.extGState != null) {
return false;
}
if(matrix != null) {
if(!matrix.equals(patt.matrix)) {
if (matrix != null) {
if (!matrix.equals(patt.matrix)) {
return false;
}
} else if(patt.matrix != null) {
} else if (patt.matrix != null) {
return false;
}
if(resources != null) {
if(!resources.equals(patt.resources)) {
if (resources != null) {
if (!resources.equals(patt.resources)) {
return false;
}
} else if(patt.resources != null) {
} else if (patt.resources != null) {
return false;
}
if(shading != null) {
if(!shading.equals(patt.shading)) {
if (shading != null) {
if (!shading.equals(patt.shading)) {
return false;
}
} else if(patt.shading != null) {
} else if (patt.shading != null) {
return false;
}
if(patternDataStream != null) {
if(!patternDataStream.equals(patt.patternDataStream)) {
if (patternDataStream != null) {
if (!patternDataStream.equals(patt.patternDataStream)) {
return false;
}
} else if(patt.patternDataStream != null) {
} else if (patt.patternDataStream != null) {
return false;
}


+ 37
- 37
src/org/apache/fop/pdf/PDFShading.java View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* 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.
*/
@@ -506,95 +506,95 @@ public class PDFShading extends PDFObject {
}

public boolean equals(Object obj) {
if(obj == null) {
if (obj == null) {
return false;
}
if(obj == this) {
if (obj == this) {
return true;
}
if(!(obj instanceof PDFShading)) {
if (!(obj instanceof PDFShading)) {
return false;
}
PDFShading shad = (PDFShading)obj;
if(shadingType != shad.shadingType) {
if (shadingType != shad.shadingType) {
return false;
}
if(antiAlias != shad.antiAlias) {
if (antiAlias != shad.antiAlias) {
return false;
}
if(bitsPerCoordinate != shad.bitsPerCoordinate) {
if (bitsPerCoordinate != shad.bitsPerCoordinate) {
return false;
}
if(bitsPerFlag != shad.bitsPerFlag) {
if (bitsPerFlag != shad.bitsPerFlag) {
return false;
}
if(bitsPerComponent != shad.bitsPerComponent) {
if (bitsPerComponent != shad.bitsPerComponent) {
return false;
}
if(verticesPerRow != shad.verticesPerRow) {
if (verticesPerRow != shad.verticesPerRow) {
return false;
}
if(colorSpace != null) {
if(!colorSpace.equals(shad.colorSpace)) {
if (colorSpace != null) {
if (!colorSpace.equals(shad.colorSpace)) {
return false;
}
} else if(shad.colorSpace != null) {
} else if (shad.colorSpace != null) {
return false;
}
if(background != null) {
if(!background.equals(shad.background)) {
if (background != null) {
if (!background.equals(shad.background)) {
return false;
}
} else if(shad.background != null) {
} else if (shad.background != null) {
return false;
}
if(bBox != null) {
if(!bBox.equals(shad.bBox)) {
if (bBox != null) {
if (!bBox.equals(shad.bBox)) {
return false;
}
} else if(shad.bBox != null) {
} else if (shad.bBox != null) {
return false;
}
if(domain != null) {
if(!domain.equals(shad.domain)) {
if (domain != null) {
if (!domain.equals(shad.domain)) {
return false;
}
} else if(shad.domain != null) {
} else if (shad.domain != null) {
return false;
}
if(matrix != null) {
if(!matrix.equals(shad.matrix)) {
if (matrix != null) {
if (!matrix.equals(shad.matrix)) {
return false;
}
} else if(shad.matrix != null) {
} else if (shad.matrix != null) {
return false;
}
if(coords != null) {
if(!coords.equals(shad.coords)) {
if (coords != null) {
if (!coords.equals(shad.coords)) {
return false;
}
} else if(shad.coords != null) {
} else if (shad.coords != null) {
return false;
}
if(extend != null) {
if(!extend.equals(shad.extend)) {
if (extend != null) {
if (!extend.equals(shad.extend)) {
return false;
}
} else if(shad.extend != null) {
} else if (shad.extend != null) {
return false;
}
if(decode != null) {
if(!decode.equals(shad.decode)) {
if (decode != null) {
if (!decode.equals(shad.decode)) {
return false;
}
} else if(shad.decode != null) {
} else if (shad.decode != null) {
return false;
}
if(function != null) {
if(!function.equals(shad.function)) {
if (function != null) {
if (!function.equals(shad.function)) {
return false;
}
} else if(shad.function != null) {
} else if (shad.function != null) {
return false;
}
return true;

+ 46
- 46
src/org/apache/fop/pdf/PDFState.java View File

@@ -34,39 +34,39 @@ import java.awt.geom.AffineTransform;
* the possible combinations after completing.
*/
public class PDFState {
private final static String COLOR = "color";
private final static String BACKCOLOR = "backcolor";
private final static String PAINT = "paint";
private final static String BACKPAINT = "backpaint";
private final static String LINECAP = "lineCap";
private final static String LINEJOIN = "lineJoin";
private final static String LINEWIDTH = "lineWidth";
private final static String MITERLIMIT = "miterLimit";
private final static String TEXT = "text";
private final static String DASHOFFSET = "dashOffset";
private final static String DASHARRAY = "dashArray";
private final static String TRANSFORM = "transform";
private final static String FONTSIZE = "fontSize";
private final static String FONTNAME = "fontName";
private final static String CLIP = "clip";
private final static String GSTATE = "gstate";
Color color = Color.black;
Color backcolor = Color.white;
Paint paint = null;
Paint backPaint = null;
int lineCap = 0;
int lineJoin = 0;
float lineWidth = 1;
float miterLimit = 0;
boolean text = false;
int dashOffset = 0;
int[] dashArray = new int[0];
AffineTransform transform = new AffineTransform();
float fontSize = 0;
String fontName = "";
Shape clip = null;
PDFGState gstate = null;
private static final String COLOR = "color";
private static final String BACKCOLOR = "backcolor";
private static final String PAINT = "paint";
private static final String BACKPAINT = "backpaint";
private static final String LINECAP = "lineCap";
private static final String LINEJOIN = "lineJoin";
private static final String LINEWIDTH = "lineWidth";
private static final String MITERLIMIT = "miterLimit";
private static final String TEXT = "text";
private static final String DASHOFFSET = "dashOffset";
private static final String DASHARRAY = "dashArray";
private static final String TRANSFORM = "transform";
private static final String FONTSIZE = "fontSize";
private static final String FONTNAME = "fontName";
private static final String CLIP = "clip";
private static final String GSTATE = "gstate";
private Color color = Color.black;
private Color backcolor = Color.white;
private Paint paint = null;
private Paint backPaint = null;
private int lineCap = 0;
private int lineJoin = 0;
private float lineWidth = 1;
private float miterLimit = 0;
private boolean text = false;
private int dashOffset = 0;
private int[] dashArray = new int[0];
private AffineTransform transform = new AffineTransform();
private float fontSize = 0;
private String fontName = "";
private Shape clip = null;
private PDFGState gstate = null;

ArrayList stateStack = new ArrayList();

@@ -132,7 +132,7 @@ public class PDFState {
while(stateStack.size() > pos + 1) {
stateStack.remove(stateStack.size() - 1);
}
if(stateStack.size() > pos) {
if (stateStack.size() > pos) {
pop();
}
}
@@ -142,7 +142,7 @@ public class PDFState {
}

public boolean setColor(Color col) {
if(!col.equals(color)) {
if (!col.equals(color)) {
color = col;
return true;
}
@@ -150,7 +150,7 @@ public class PDFState {
}

public boolean setBackColor(Color col) {
if(!col.equals(backcolor)) {
if (!col.equals(backcolor)) {
backcolor = col;
return true;
}
@@ -158,12 +158,12 @@ public class PDFState {
}

public boolean setPaint(Paint p) {
if(paint == null) {
if(p != null) {
if (paint == null) {
if (p != null) {
paint = p;
return true;
}
} else if(!paint.equals(p)) {
} else if (!paint.equals(p)) {
paint = p;
return true;
}
@@ -174,11 +174,11 @@ public class PDFState {
* For clips it can start a new state
*/
public boolean checkClip(Shape cl) {
if(clip == null) {
if(cl != null) {
if (clip == null) {
if (cl != null) {
return true;
}
} else if(!new Area(clip).equals(new Area(cl))) {
} else if (!new Area(clip).equals(new Area(cl))) {
return true;
}
return false;
@@ -215,7 +215,7 @@ public class PDFState {
public AffineTransform getTransform() {
AffineTransform tf;
AffineTransform at = new AffineTransform();
for(Iterator iter = stateStack.iterator(); iter.hasNext(); ) {
for (Iterator iter = stateStack.iterator(); iter.hasNext();) {
HashMap map = (HashMap)iter.next();
tf = (AffineTransform)map.get(TRANSFORM);
at.concatenate(tf);
@@ -238,14 +238,14 @@ public class PDFState {
PDFGState state;
PDFGState newstate = new PDFGState(0);
newstate.addValues(defaultState);
for(Iterator iter = stateStack.iterator(); iter.hasNext(); ) {
for (Iterator iter = stateStack.iterator(); iter.hasNext(); ) {
HashMap map = (HashMap)iter.next();
state = (PDFGState)map.get(GSTATE);
if(state != null) {
if (state != null) {
newstate.addValues(state);
}
}
if(gstate != null) {
if (gstate != null) {
newstate.addValues(gstate);
}


+ 1
- 1
src/org/apache/fop/pdf/PDFT1Stream.java View File

@@ -17,7 +17,7 @@ public class PDFT1Stream extends PDFStream {
origLength = len;
}

private final static boolean byteCmp(byte[] src, int offset, byte[] cmp) {
private static final boolean byteCmp(byte[] src, int offset, byte[] cmp) {
boolean ret = true;
for (int i = 0; ret == true && i < cmp.length; i++) {
// System.out.println("Compare: ");

+ 0
- 0
src/org/apache/fop/render/awt/FontMetricsMapper.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save