aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/apps/AWTStarter.java8
-rw-r--r--src/org/apache/fop/apps/Driver.java14
-rw-r--r--src/org/apache/fop/apps/FOInputHandler.java7
-rw-r--r--src/org/apache/fop/apps/InputHandler.java18
-rw-r--r--src/org/apache/fop/apps/LayoutHandler.java10
-rw-r--r--src/org/apache/fop/apps/PrintStarter.java21
-rw-r--r--src/org/apache/fop/apps/Starter.java2
-rw-r--r--src/org/apache/fop/area/Area.java2
-rw-r--r--src/org/apache/fop/area/CTM.java6
-rw-r--r--src/org/apache/fop/area/inline/InlineParent.java6
-rw-r--r--src/org/apache/fop/datatypes/ColorType.java36
-rw-r--r--src/org/apache/fop/datatypes/CondLength.java15
-rw-r--r--src/org/apache/fop/datatypes/FODimension.java6
-rw-r--r--src/org/apache/fop/datatypes/FixedLength.java21
-rw-r--r--src/org/apache/fop/datatypes/Keep.java18
-rw-r--r--src/org/apache/fop/datatypes/Length.java10
-rw-r--r--src/org/apache/fop/datatypes/LengthPair.java15
-rw-r--r--src/org/apache/fop/datatypes/LengthRange.java31
-rw-r--r--src/org/apache/fop/datatypes/MixedLength.java85
-rw-r--r--src/org/apache/fop/datatypes/PercentLength.java4
-rw-r--r--src/org/apache/fop/datatypes/Space.java17
-rw-r--r--src/org/apache/fop/datatypes/TableColLength.java24
-rw-r--r--src/org/apache/fop/datatypes/ToBeImplementedProperty.java19
-rw-r--r--src/org/apache/fop/fo/AbstractCharIterator.java21
-rw-r--r--src/org/apache/fop/fo/ColorTypeProperty.java9
-rw-r--r--src/org/apache/fop/fo/EnumProperty.java10
-rw-r--r--src/org/apache/fop/fo/FONode.java2
-rw-r--r--src/org/apache/fop/fo/FOText.java7
-rw-r--r--src/org/apache/fop/fo/FObj.java34
-rw-r--r--src/org/apache/fop/fo/GenericShorthandParser.java8
-rw-r--r--src/org/apache/fop/fo/InlineCharIterator.java70
-rw-r--r--src/org/apache/fop/fo/LengthProperty.java12
-rw-r--r--src/org/apache/fop/fo/OneCharIterator.java18
-rw-r--r--src/org/apache/fop/fo/PropertyList.java2
-rw-r--r--src/org/apache/fop/fo/RecursiveCharIterator.java87
-rw-r--r--src/org/apache/fop/fo/TextInfo.java40
-rw-r--r--src/org/apache/fop/fo/expr/AbsFunction.java7
-rw-r--r--src/org/apache/fop/fo/expr/CeilingFunction.java6
-rw-r--r--src/org/apache/fop/fo/expr/FloorFunction.java6
-rw-r--r--src/org/apache/fop/fo/expr/MaxFunction.java6
-rw-r--r--src/org/apache/fop/fo/expr/MinFunction.java6
-rw-r--r--src/org/apache/fop/fo/expr/Numeric.java43
-rw-r--r--src/org/apache/fop/fo/expr/PropertyInfo.java5
-rw-r--r--src/org/apache/fop/fo/expr/PropertyParser.java45
-rw-r--r--src/org/apache/fop/fo/expr/PropertyTokenizer.java33
-rw-r--r--src/org/apache/fop/fo/expr/RoundFunction.java9
-rw-r--r--src/org/apache/fop/fo/flow/Block.java5
-rw-r--r--src/org/apache/fop/fo/flow/Character.java4
-rw-r--r--src/org/apache/fop/fo/flow/TableCell.java11
-rw-r--r--src/org/apache/fop/fo/flow/TableColumn.java22
-rw-r--r--src/org/apache/fop/fo/flow/TableRow.java7
-rw-r--r--src/org/apache/fop/fo/pagination/PageNumberGenerator.java4
-rw-r--r--src/org/apache/fop/fo/pagination/PageSequence.java22
-rw-r--r--src/org/apache/fop/fo/pagination/Region.java43
-rw-r--r--src/org/apache/fop/fo/pagination/RegionAfter.java23
-rw-r--r--src/org/apache/fop/fo/pagination/RegionBA.java31
-rw-r--r--src/org/apache/fop/fo/pagination/RegionBASE.java9
-rw-r--r--src/org/apache/fop/fo/pagination/RegionBefore.java18
-rw-r--r--src/org/apache/fop/fo/pagination/RegionEnd.java16
-rw-r--r--src/org/apache/fop/fo/pagination/RegionSE.java29
-rw-r--r--src/org/apache/fop/fo/pagination/RegionStart.java14
-rw-r--r--src/org/apache/fop/fonts/apps/PFMReader.java29
-rw-r--r--src/org/apache/fop/fonts/apps/TTFReader.java2
-rw-r--r--src/org/apache/fop/image/AbstractFopImage.java1
-rw-r--r--src/org/apache/fop/image/BmpImage.java1
-rw-r--r--src/org/apache/fop/image/EPSImage.java1
-rw-r--r--src/org/apache/fop/image/JimiImage.java5
-rw-r--r--src/org/apache/fop/image/JpegImage.java2
-rw-r--r--src/org/apache/fop/layout/BorderAndPadding.java57
-rw-r--r--src/org/apache/fop/layout/FontState.java42
-rw-r--r--src/org/apache/fop/layout/hyphenation/ByteVector.java2
-rw-r--r--src/org/apache/fop/layout/hyphenation/CharVector.java2
-rw-r--r--src/org/apache/fop/layout/hyphenation/TernaryTree.java2
-rw-r--r--src/org/apache/fop/layoutmgr/AbstractLayoutManager.java14
-rw-r--r--src/org/apache/fop/layoutmgr/BlockLayoutManager.java12
-rw-r--r--src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java50
-rw-r--r--src/org/apache/fop/layoutmgr/ContentLayoutManager.java6
-rw-r--r--src/org/apache/fop/layoutmgr/FlowLayoutManager.java12
-rw-r--r--src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java7
-rw-r--r--src/org/apache/fop/layoutmgr/LineLayoutManager.java31
-rw-r--r--src/org/apache/fop/layoutmgr/PageLayoutManager.java34
-rw-r--r--src/org/apache/fop/layoutmgr/PositionIterator.java4
-rw-r--r--src/org/apache/fop/layoutmgr/TextLayoutManager.java14
-rw-r--r--src/org/apache/fop/layoutmgr/TraitSetter.java8
-rw-r--r--src/org/apache/fop/layoutmgr/table/Body.java2
-rw-r--r--src/org/apache/fop/pdf/DCTFilter.java4
-rw-r--r--src/org/apache/fop/pdf/PDFCMap.java4
-rw-r--r--src/org/apache/fop/pdf/PDFColor.java5
-rw-r--r--src/org/apache/fop/pdf/PDFColorSpace.java9
-rw-r--r--src/org/apache/fop/pdf/PDFDocument.java1
-rw-r--r--src/org/apache/fop/pdf/PDFFunction.java84
-rw-r--r--src/org/apache/fop/pdf/PDFGState.java16
-rw-r--r--src/org/apache/fop/pdf/PDFICCStream.java5
-rw-r--r--src/org/apache/fop/pdf/PDFInfo.java8
-rw-r--r--src/org/apache/fop/pdf/PDFNumber.java4
-rw-r--r--src/org/apache/fop/pdf/PDFPattern.java68
-rw-r--r--src/org/apache/fop/pdf/PDFShading.java74
-rw-r--r--src/org/apache/fop/pdf/PDFState.java92
-rw-r--r--src/org/apache/fop/pdf/PDFT1Stream.java2
-rw-r--r--src/org/apache/fop/render/awt/FontMetricsMapper.java4
-rw-r--r--src/org/apache/fop/render/pdf/fonts/SingleByteFont.java9
-rw-r--r--src/org/apache/fop/render/txt/TXTStream.java6
-rw-r--r--src/org/apache/fop/traits/LayoutProps.java18
-rw-r--r--src/org/apache/fop/traits/SpaceVal.java40
-rw-r--r--src/org/apache/fop/util/CharUtilities.java88
105 files changed, 1069 insertions, 951 deletions
diff --git a/src/org/apache/fop/apps/AWTStarter.java b/src/org/apache/fop/apps/AWTStarter.java
index 3b661f2e7..682167629 100644
--- a/src/org/apache/fop/apps/AWTStarter.java
+++ b/src/org/apache/fop/apps/AWTStarter.java
@@ -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);
diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java
index 5424bd715..4b341a0cd 100644
--- a/src/org/apache/fop/apps/Driver.java
+++ b/src/org/apache/fop/apps/Driver.java
@@ -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();
diff --git a/src/org/apache/fop/apps/FOInputHandler.java b/src/org/apache/fop/apps/FOInputHandler.java
index 732a400a2..7a98b23a0 100644
--- a/src/org/apache/fop/apps/FOInputHandler.java
+++ b/src/org/apache/fop/apps/FOInputHandler.java
@@ -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);
}
diff --git a/src/org/apache/fop/apps/InputHandler.java b/src/org/apache/fop/apps/InputHandler.java
index e19d238aa..6ce9ffd79 100644
--- a/src/org/apache/fop/apps/InputHandler.java
+++ b/src/org/apache/fop/apps/InputHandler.java
@@ -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) {
diff --git a/src/org/apache/fop/apps/LayoutHandler.java b/src/org/apache/fop/apps/LayoutHandler.java
index fa0f74840..0f5e4b9c6 100644
--- a/src/org/apache/fop/apps/LayoutHandler.java
+++ b/src/org/apache/fop/apps/LayoutHandler.java
@@ -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);
diff --git a/src/org/apache/fop/apps/PrintStarter.java b/src/org/apache/fop/apps/PrintStarter.java
index cb80c3210..a9be6d853 100644
--- a/src/org/apache/fop/apps/PrintStarter.java
+++ b/src/org/apache/fop/apps/PrintStarter.java
@@ -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;
diff --git a/src/org/apache/fop/apps/Starter.java b/src/org/apache/fop/apps/Starter.java
index 9538cee29..21d53d27b 100644
--- a/src/org/apache/fop/apps/Starter.java
+++ b/src/org/apache/fop/apps/Starter.java
@@ -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 {
diff --git a/src/org/apache/fop/area/Area.java b/src/org/apache/fop/area/Area.java
index 9bfc6a434..5c381d2db 100644
--- a/src/org/apache/fop/area/Area.java
+++ b/src/org/apache/fop/area/Area.java
@@ -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();
}
/**
diff --git a/src/org/apache/fop/area/CTM.java b/src/org/apache/fop/area/CTM.java
index cdb28de0f..d2cacdbdc 100644
--- a/src/org/apache/fop/area/CTM.java
+++ b/src/org/apache/fop/area/CTM.java
@@ -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};
}
}
+
diff --git a/src/org/apache/fop/area/inline/InlineParent.java b/src/org/apache/fop/area/inline/InlineParent.java
index 33216bf81..3f5b9d69e 100644
--- a/src/org/apache/fop/area/inline/InlineParent.java
+++ b/src/org/apache/fop/area/inline/InlineParent.java
@@ -25,6 +25,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.
*/
public InlineParent() {
@@ -61,3 +66,4 @@ public class InlineParent extends InlineArea {
}
}
+
diff --git a/src/org/apache/fop/datatypes/ColorType.java b/src/org/apache/fop/datatypes/ColorType.java
index ae0284bf0..cab72e557 100644
--- a/src/org/apache/fop/datatypes/ColorType.java
+++ b/src/org/apache/fop/datatypes/ColorType.java
@@ -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
}, {
diff --git a/src/org/apache/fop/datatypes/CondLength.java b/src/org/apache/fop/datatypes/CondLength.java
index 1e2f1999c..39a468592 100644
--- a/src/org/apache/fop/datatypes/CondLength.java
+++ b/src/org/apache/fop/datatypes/CondLength.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/datatypes/FODimension.java b/src/org/apache/fop/datatypes/FODimension.java
index e9acf32a9..b83e37101 100644
--- a/src/org/apache/fop/datatypes/FODimension.java
+++ b/src/org/apache/fop/datatypes/FODimension.java
@@ -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;
}
}
diff --git a/src/org/apache/fop/datatypes/FixedLength.java b/src/org/apache/fop/datatypes/FixedLength.java
index bfce0c018..6640bc9c9 100644
--- a/src/org/apache/fop/datatypes/FixedLength.java
+++ b/src/org/apache/fop/datatypes/FixedLength.java
@@ -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);
}
}
+
diff --git a/src/org/apache/fop/datatypes/Keep.java b/src/org/apache/fop/datatypes/Keep.java
index 8d16c25b9..4d40d73d7 100644
--- a/src/org/apache/fop/datatypes/Keep.java
+++ b/src/org/apache/fop/datatypes/Keep.java
@@ -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) {
diff --git a/src/org/apache/fop/datatypes/Length.java b/src/org/apache/fop/datatypes/Length.java
index 410fc65d5..98b21fe73 100644
--- a/src/org/apache/fop/datatypes/Length.java
+++ b/src/org/apache/fop/datatypes/Length.java
@@ -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() {
diff --git a/src/org/apache/fop/datatypes/LengthPair.java b/src/org/apache/fop/datatypes/LengthPair.java
index f643ff168..963540a1d 100644
--- a/src/org/apache/fop/datatypes/LengthPair.java
+++ b/src/org/apache/fop/datatypes/LengthPair.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/datatypes/LengthRange.java b/src/org/apache/fop/datatypes/LengthRange.java
index 158ab9c20..c16bdec67 100644
--- a/src/org/apache/fop/datatypes/LengthRange.java
+++ b/src/org/apache/fop/datatypes/LengthRange.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/datatypes/MixedLength.java b/src/org/apache/fop/datatypes/MixedLength.java
index 0667d1597..0835b6b82 100644
--- a/src/org/apache/fop/datatypes/MixedLength.java
+++ b/src/org/apache/fop/datatypes/MixedLength.java
@@ -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;
}
-
}
+
diff --git a/src/org/apache/fop/datatypes/PercentLength.java b/src/org/apache/fop/datatypes/PercentLength.java
index 779115bb3..067b7f124 100644
--- a/src/org/apache/fop/datatypes/PercentLength.java
+++ b/src/org/apache/fop/datatypes/PercentLength.java
@@ -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);
}
}
diff --git a/src/org/apache/fop/datatypes/Space.java b/src/org/apache/fop/datatypes/Space.java
index 26ec95221..ae878e271 100644
--- a/src/org/apache/fop/datatypes/Space.java
+++ b/src/org/apache/fop/datatypes/Space.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/datatypes/TableColLength.java b/src/org/apache/fop/datatypes/TableColLength.java
index 85832c139..1670d1269 100644
--- a/src/org/apache/fop/datatypes/TableColLength.java
+++ b/src/org/apache/fop/datatypes/TableColLength.java
@@ -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);
}
}
+
diff --git a/src/org/apache/fop/datatypes/ToBeImplementedProperty.java b/src/org/apache/fop/datatypes/ToBeImplementedProperty.java
index 63cfa957f..89005ea84 100644
--- a/src/org/apache/fop/datatypes/ToBeImplementedProperty.java
+++ b/src/org/apache/fop/datatypes/ToBeImplementedProperty.java
@@ -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.");
}
-
}
+
diff --git a/src/org/apache/fop/fo/AbstractCharIterator.java b/src/org/apache/fop/fo/AbstractCharIterator.java
index b040f413e..69d342dfd 100644
--- a/src/org/apache/fop/fo/AbstractCharIterator.java
+++ b/src/org/apache/fop/fo/AbstractCharIterator.java
@@ -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;
+ }
}
-};
+}
+
diff --git a/src/org/apache/fop/fo/ColorTypeProperty.java b/src/org/apache/fop/fo/ColorTypeProperty.java
index 17ea1e911..3433ee699 100644
--- a/src/org/apache/fop/fo/ColorTypeProperty.java
+++ b/src/org/apache/fop/fo/ColorTypeProperty.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fo/EnumProperty.java b/src/org/apache/fop/fo/EnumProperty.java
index 08e9e2e01..2b87bb0e2 100644
--- a/src/org/apache/fop/fo/EnumProperty.java
+++ b/src/org/apache/fop/fo/EnumProperty.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fo/FONode.java b/src/org/apache/fop/fo/FONode.java
index 4b0a532d9..4f4c34af9 100644
--- a/src/org/apache/fop/fo/FONode.java
+++ b/src/org/apache/fop/fo/FONode.java
@@ -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;
diff --git a/src/org/apache/fop/fo/FOText.java b/src/org/apache/fop/fo/FOText.java
index 3d9a04770..13dbf0f4f 100644
--- a/src/org/apache/fop/fo/FOText.java
+++ b/src/org/apache/fop/fo/FOText.java
@@ -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() {
diff --git a/src/org/apache/fop/fo/FObj.java b/src/org/apache/fop/fo/FObj.java
index 0fb07f47d..1a3061de5 100644
--- a/src/org/apache/fop/fo/FObj.java
+++ b/src/org/apache/fop/fo/FObj.java
@@ -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();
diff --git a/src/org/apache/fop/fo/GenericShorthandParser.java b/src/org/apache/fop/fo/GenericShorthandParser.java
index 4237beb0f..3ba0badd0 100644
--- a/src/org/apache/fop/fo/GenericShorthandParser.java
+++ b/src/org/apache/fop/fo/GenericShorthandParser.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fo/InlineCharIterator.java b/src/org/apache/fop/fo/InlineCharIterator.java
index fe2a8eeda..d8db82707 100644
--- a/src/org/apache/fop/fo/InlineCharIterator.java
+++ b/src/org/apache/fop/fo/InlineCharIterator.java
@@ -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;
+ }
}
}
+
diff --git a/src/org/apache/fop/fo/LengthProperty.java b/src/org/apache/fop/fo/LengthProperty.java
index 8d367c214..07afc74f2 100644
--- a/src/org/apache/fop/fo/LengthProperty.java
+++ b/src/org/apache/fop/fo/LengthProperty.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fo/OneCharIterator.java b/src/org/apache/fop/fo/OneCharIterator.java
index 2eb8a7a5b..aea844eaa 100644
--- a/src/org/apache/fop/fo/OneCharIterator.java
+++ b/src/org/apache/fop/fo/OneCharIterator.java
@@ -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();
+ }
}
}
+
diff --git a/src/org/apache/fop/fo/PropertyList.java b/src/org/apache/fop/fo/PropertyList.java
index 02f136eab..bab83a353 100644
--- a/src/org/apache/fop/fo/PropertyList.java
+++ b/src/org/apache/fop/fo/PropertyList.java
@@ -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[] {
diff --git a/src/org/apache/fop/fo/RecursiveCharIterator.java b/src/org/apache/fop/fo/RecursiveCharIterator.java
index 0cc52152c..c39f886a7 100644
--- a/src/org/apache/fop/fo/RecursiveCharIterator.java
+++ b/src/org/apache/fop/fo/RecursiveCharIterator.java
@@ -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();
+ }
}
}
+
diff --git a/src/org/apache/fop/fo/TextInfo.java b/src/org/apache/fop/fo/TextInfo.java
index 1bd9d8185..0c2ff695b 100644
--- a/src/org/apache/fop/fo/TextInfo.java
+++ b/src/org/apache/fop/fo/TextInfo.java
@@ -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;
+}
diff --git a/src/org/apache/fop/fo/expr/AbsFunction.java b/src/org/apache/fop/fo/expr/AbsFunction.java
index 7a40c9d39..85847796d 100644
--- a/src/org/apache/fop/fo/expr/AbsFunction.java
+++ b/src/org/apache/fop/fo/expr/AbsFunction.java
@@ -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());
}
diff --git a/src/org/apache/fop/fo/expr/CeilingFunction.java b/src/org/apache/fop/fo/expr/CeilingFunction.java
index 9f4200415..b02a260f2 100644
--- a/src/org/apache/fop/fo/expr/CeilingFunction.java
+++ b/src/org/apache/fop/fo/expr/CeilingFunction.java
@@ -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()));
}
}
+
diff --git a/src/org/apache/fop/fo/expr/FloorFunction.java b/src/org/apache/fop/fo/expr/FloorFunction.java
index 868067bd7..6b26d6224 100644
--- a/src/org/apache/fop/fo/expr/FloorFunction.java
+++ b/src/org/apache/fop/fo/expr/FloorFunction.java
@@ -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()));
}
}
+
diff --git a/src/org/apache/fop/fo/expr/MaxFunction.java b/src/org/apache/fop/fo/expr/MaxFunction.java
index 1a145a567..80b1a6bbe 100644
--- a/src/org/apache/fop/fo/expr/MaxFunction.java
+++ b/src/org/apache/fop/fo/expr/MaxFunction.java
@@ -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));
}
}
+
diff --git a/src/org/apache/fop/fo/expr/MinFunction.java b/src/org/apache/fop/fo/expr/MinFunction.java
index 4691e7588..097d80db5 100644
--- a/src/org/apache/fop/fo/expr/MinFunction.java
+++ b/src/org/apache/fop/fo/expr/MinFunction.java
@@ -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));
}
}
+
diff --git a/src/org/apache/fop/fo/expr/Numeric.java b/src/org/apache/fop/fo/expr/Numeric.java
index 68a8d15a7..98eb9529c 100644
--- a/src/org/apache/fop/fo/expr/Numeric.java
+++ b/src/org/apache/fop/fo/expr/Numeric.java
@@ -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.");
}
}
+
diff --git a/src/org/apache/fop/fo/expr/PropertyInfo.java b/src/org/apache/fop/fo/expr/PropertyInfo.java
index 747ec17af..5424abf7f 100644
--- a/src/org/apache/fop/fo/expr/PropertyInfo.java
+++ b/src/org/apache/fop/fo/expr/PropertyInfo.java
@@ -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() {
diff --git a/src/org/apache/fop/fo/expr/PropertyParser.java b/src/org/apache/fop/fo/expr/PropertyParser.java
index aa113834a..50e16e8c9 100644
--- a/src/org/apache/fop/fo/expr/PropertyParser.java
+++ b/src/org/apache/fop/fo/expr/PropertyParser.java
@@ -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());
}
diff --git a/src/org/apache/fop/fo/expr/PropertyTokenizer.java b/src/org/apache/fop/fo/expr/PropertyTokenizer.java
index 025c68695..573670631 100644
--- a/src/org/apache/fop/fo/expr/PropertyTokenizer.java
+++ b/src/org/apache/fop/fo/expr/PropertyTokenizer.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fo/expr/RoundFunction.java b/src/org/apache/fop/fo/expr/RoundFunction.java
index 81d51b113..d5fcd23d9 100644
--- a/src/org/apache/fop/fo/expr/RoundFunction.java
+++ b/src/org/apache/fop/fo/expr/RoundFunction.java
@@ -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);
}
}
+
diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java
index 4360ce8e2..91a48bd84 100644
--- a/src/org/apache/fop/fo/flow/Block.java
+++ b/src/org/apache/fop/fo/flow/Block.java
@@ -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;
diff --git a/src/org/apache/fop/fo/flow/Character.java b/src/org/apache/fop/fo/flow/Character.java
index 632a8d678..3058af970 100644
--- a/src/org/apache/fop/fo/flow/Character.java
+++ b/src/org/apache/fop/fo/flow/Character.java
@@ -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;
diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java
index 5fe6caad1..80e0ccad6 100644
--- a/src/org/apache/fop/fo/flow/TableCell.java
+++ b/src/org/apache/fop/fo/flow/TableCell.java
@@ -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 {
}
}
-
}
+
diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java
index cc014323a..11fdb07b8 100644
--- a/src/org/apache/fop/fo/flow/TableColumn.java
+++ b/src/org/apache/fop/fo/flow/TableColumn.java
@@ -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();
diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java
index fdf2284d5..8ee0df005 100644
--- a/src/org/apache/fop/fo/flow/TableRow.java
+++ b/src/org/apache/fop/fo/flow/TableRow.java
@@ -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);
diff --git a/src/org/apache/fop/fo/pagination/PageNumberGenerator.java b/src/org/apache/fop/fo/pagination/PageNumberGenerator.java
index e025b4597..6cc0b1235 100644
--- a/src/org/apache/fop/fo/pagination/PageNumberGenerator.java
+++ b/src/org/apache/fop/fo/pagination/PageNumberGenerator.java
@@ -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++) {
diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java
index b37b7f24a..c96b2a617 100644
--- a/src/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/org/apache/fop/fo/pagination/PageSequence.java
@@ -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();
diff --git a/src/org/apache/fop/fo/pagination/Region.java b/src/org/apache/fop/fo/pagination/Region.java
index a259d7749..247984954 100644
--- a/src/org/apache/fop/fo/pagination/Region.java
+++ b/src/org/apache/fop/fo/pagination/Region.java
@@ -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() {
diff --git a/src/org/apache/fop/fo/pagination/RegionAfter.java b/src/org/apache/fop/fo/pagination/RegionAfter.java
index a44dd2569..6eac0d93f 100644
--- a/src/org/apache/fop/fo/pagination/RegionAfter.java
+++ b/src/org/apache/fop/fo/pagination/RegionAfter.java
@@ -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;
}
-
}
+
diff --git a/src/org/apache/fop/fo/pagination/RegionBA.java b/src/org/apache/fop/fo/pagination/RegionBA.java
index 7efb3c291..1820bcd3b 100644
--- a/src/org/apache/fop/fo/pagination/RegionBA.java
+++ b/src/org/apache/fop/fo/pagination/RegionBA.java
@@ -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);
+ }
}
}
+
diff --git a/src/org/apache/fop/fo/pagination/RegionBASE.java b/src/org/apache/fop/fo/pagination/RegionBASE.java
index 8ca69e7f1..d681039bb 100644
--- a/src/org/apache/fop/fo/pagination/RegionBASE.java
+++ b/src/org/apache/fop/fo/pagination/RegionBASE.java
@@ -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;
}
}
+
diff --git a/src/org/apache/fop/fo/pagination/RegionBefore.java b/src/org/apache/fop/fo/pagination/RegionBefore.java
index de79eb28e..734b11398 100644
--- a/src/org/apache/fop/fo/pagination/RegionBefore.java
+++ b/src/org/apache/fop/fo/pagination/RegionBefore.java
@@ -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;
}
}
+
diff --git a/src/org/apache/fop/fo/pagination/RegionEnd.java b/src/org/apache/fop/fo/pagination/RegionEnd.java
index 32cacef50..8f12f5dd8 100644
--- a/src/org/apache/fop/fo/pagination/RegionEnd.java
+++ b/src/org/apache/fop/fo/pagination/RegionEnd.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fo/pagination/RegionSE.java b/src/org/apache/fop/fo/pagination/RegionSE.java
index 92db1075d..799334486 100644
--- a/src/org/apache/fop/fo/pagination/RegionSE.java
+++ b/src/org/apache/fop/fo/pagination/RegionSE.java
@@ -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);
+ }
}
}
+
diff --git a/src/org/apache/fop/fo/pagination/RegionStart.java b/src/org/apache/fop/fo/pagination/RegionStart.java
index e74384837..6324db754 100644
--- a/src/org/apache/fop/fo/pagination/RegionStart.java
+++ b/src/org/apache/fop/fo/pagination/RegionStart.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/fonts/apps/PFMReader.java b/src/org/apache/fop/fonts/apps/PFMReader.java
index 5bf0f3e79..14fd89d7d 100644
--- a/src/org/apache/fop/fonts/apps/PFMReader.java
+++ b/src/org/apache/fop/fonts/apps/PFMReader.java
@@ -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);
diff --git a/src/org/apache/fop/fonts/apps/TTFReader.java b/src/org/apache/fop/fonts/apps/TTFReader.java
index 3015f6b59..ef2e45ef7 100644
--- a/src/org/apache/fop/fonts/apps/TTFReader.java
+++ b/src/org/apache/fop/fonts/apps/TTFReader.java
@@ -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");
diff --git a/src/org/apache/fop/image/AbstractFopImage.java b/src/org/apache/fop/image/AbstractFopImage.java
index f9999f4dd..ef9de7992 100644
--- a/src/org/apache/fop/image/AbstractFopImage.java
+++ b/src/org/apache/fop/image/AbstractFopImage.java
@@ -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;
diff --git a/src/org/apache/fop/image/BmpImage.java b/src/org/apache/fop/image/BmpImage.java
index 26cd3c5a5..583cc756e 100644
--- a/src/org/apache/fop/image/BmpImage.java
+++ b/src/org/apache/fop/image/BmpImage.java
@@ -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;
diff --git a/src/org/apache/fop/image/EPSImage.java b/src/org/apache/fop/image/EPSImage.java
index 29323c395..88b0582f3 100644
--- a/src/org/apache/fop/image/EPSImage.java
+++ b/src/org/apache/fop/image/EPSImage.java
@@ -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;
diff --git a/src/org/apache/fop/image/JimiImage.java b/src/org/apache/fop/image/JimiImage.java
index 11bb15c49..4cc780a6f 100644
--- a/src/org/apache/fop/image/JimiImage.java
+++ b/src/org/apache/fop/image/JimiImage.java
@@ -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 ==
diff --git a/src/org/apache/fop/image/JpegImage.java b/src/org/apache/fop/image/JpegImage.java
index 880de6aa2..2fa105b52 100644
--- a/src/org/apache/fop/image/JpegImage.java
+++ b/src/org/apache/fop/image/JpegImage.java
@@ -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;
diff --git a/src/org/apache/fop/layout/BorderAndPadding.java b/src/org/apache/fop/layout/BorderAndPadding.java
index d42b82cf6..3c3719d5d 100644
--- a/src/org/apache/fop/layout/BorderAndPadding.java
+++ b/src/org/apache/fop/layout/BorderAndPadding.java
@@ -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;
diff --git a/src/org/apache/fop/layout/FontState.java b/src/org/apache/fop/layout/FontState.java
index 3ff676bd7..dbf3ccc6d 100644
--- a/src/org/apache/fop/layout/FontState.java
+++ b/src/org/apache/fop/layout/FontState.java
@@ -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();
}
}
diff --git a/src/org/apache/fop/layout/hyphenation/ByteVector.java b/src/org/apache/fop/layout/hyphenation/ByteVector.java
index 66ce5fa9b..ecc9dd9a2 100644
--- a/src/org/apache/fop/layout/hyphenation/ByteVector.java
+++ b/src/org/apache/fop/layout/hyphenation/ByteVector.java
@@ -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;
/**
diff --git a/src/org/apache/fop/layout/hyphenation/CharVector.java b/src/org/apache/fop/layout/hyphenation/CharVector.java
index e2993a0b6..b91ae7dcb 100644
--- a/src/org/apache/fop/layout/hyphenation/CharVector.java
+++ b/src/org/apache/fop/layout/hyphenation/CharVector.java
@@ -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;
/**
diff --git a/src/org/apache/fop/layout/hyphenation/TernaryTree.java b/src/org/apache/fop/layout/hyphenation/TernaryTree.java
index 25dd7005c..11013f723 100644
--- a/src/org/apache/fop/layout/hyphenation/TernaryTree.java
+++ b/src/org/apache/fop/layout/hyphenation/TernaryTree.java
@@ -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();
diff --git a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 34682b143..64b052b7b 100644
--- a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -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);
+ // }
+ // }
// }
/**
diff --git a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 280963eb4..bbd68253f 100644
--- a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -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);
}
}
diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index 7c8fba848..89a7cbb26 100644
--- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -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;
}
diff --git a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
index a27d7f120..957d6edf5 100644
--- a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
@@ -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) {
diff --git a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
index 7ef504481..57b7e123f 100644
--- a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
@@ -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));
}
diff --git a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
index 4788edf9c..99efc8809 100644
--- a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
@@ -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;
}
diff --git a/src/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/org/apache/fop/layoutmgr/LineLayoutManager.java
index 36b798d59..445ce66cb 100644
--- a/src/org/apache/fop/layoutmgr/LineLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/LineLayoutManager.java
@@ -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
diff --git a/src/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/org/apache/fop/layoutmgr/PageLayoutManager.java
index b1d3e3cba..2e3199915 100644
--- a/src/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -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);
+ // }
+ // }
}
/**
diff --git a/src/org/apache/fop/layoutmgr/PositionIterator.java b/src/org/apache/fop/layoutmgr/PositionIterator.java
index 5e951a09f..5032f50a4 100644
--- a/src/org/apache/fop/layoutmgr/PositionIterator.java
+++ b/src/org/apache/fop/layoutmgr/PositionIterator.java
@@ -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()) {
diff --git a/src/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/org/apache/fop/layoutmgr/TextLayoutManager.java
index 0eb1b977e..a406d7e57 100644
--- a/src/org/apache/fop/layoutmgr/TextLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/TextLayoutManager.java
@@ -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;
diff --git a/src/org/apache/fop/layoutmgr/TraitSetter.java b/src/org/apache/fop/layoutmgr/TraitSetter.java
index 6244e1424..0e2cb4f53 100644
--- a/src/org/apache/fop/layoutmgr/TraitSetter.java
+++ b/src/org/apache/fop/layoutmgr/TraitSetter.java
@@ -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)));
diff --git a/src/org/apache/fop/layoutmgr/table/Body.java b/src/org/apache/fop/layoutmgr/table/Body.java
index ff69e1d05..784eaddc3 100644
--- a/src/org/apache/fop/layoutmgr/table/Body.java
+++ b/src/org/apache/fop/layoutmgr/table/Body.java
@@ -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());
diff --git a/src/org/apache/fop/pdf/DCTFilter.java b/src/org/apache/fop/pdf/DCTFilter.java
index 6f0abf5d6..47260b785 100644
--- a/src/org/apache/fop/pdf/DCTFilter.java
+++ b/src/org/apache/fop/pdf/DCTFilter.java
@@ -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
diff --git a/src/org/apache/fop/pdf/PDFCMap.java b/src/org/apache/fop/pdf/PDFCMap.java
index 4e339f162..728855d7a 100644
--- a/src/org/apache/fop/pdf/PDFCMap.java
+++ b/src/org/apache/fop/pdf/PDFCMap.java
@@ -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());
* }
* }
diff --git a/src/org/apache/fop/pdf/PDFColor.java b/src/org/apache/fop/pdf/PDFColor.java
index b1f589be6..116b2f328 100644
--- a/src/org/apache/fop/pdf/PDFColor.java
+++ b/src/org/apache/fop/pdf/PDFColor.java
@@ -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 {
}
}
+
diff --git a/src/org/apache/fop/pdf/PDFColorSpace.java b/src/org/apache/fop/pdf/PDFColorSpace.java
index 62992b4af..b8659ef2d 100644
--- a/src/org/apache/fop/pdf/PDFColorSpace.java
+++ b/src/org/apache/fop/pdf/PDFColorSpace.java
@@ -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) {
diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java
index 8dd9c0c86..aa672b79b 100644
--- a/src/org/apache/fop/pdf/PDFDocument.java
+++ b/src/org/apache/fop/pdf/PDFDocument.java
@@ -1527,3 +1527,4 @@ public class PDFDocument {
}
}
+
diff --git a/src/org/apache/fop/pdf/PDFFunction.java b/src/org/apache/fop/pdf/PDFFunction.java
index ad265ff91..62ecb25bc 100644
--- a/src/org/apache/fop/pdf/PDFFunction.java
+++ b/src/org/apache/fop/pdf/PDFFunction.java
@@ -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;
diff --git a/src/org/apache/fop/pdf/PDFGState.java b/src/org/apache/fop/pdf/PDFGState.java
index e535fcdfe..cc5766c71 100644
--- a/src/org/apache/fop/pdf/PDFGState.java
+++ b/src/org/apache/fop/pdf/PDFGState.java
@@ -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;
}
}
diff --git a/src/org/apache/fop/pdf/PDFICCStream.java b/src/org/apache/fop/pdf/PDFICCStream.java
index b3d6cf875..b3f9c140d 100644
--- a/src/org/apache/fop/pdf/PDFICCStream.java
+++ b/src/org/apache/fop/pdf/PDFICCStream.java
@@ -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");
diff --git a/src/org/apache/fop/pdf/PDFInfo.java b/src/org/apache/fop/pdf/PDFInfo.java
index bbef7a897..1004389f9 100644
--- a/src/org/apache/fop/pdf/PDFInfo.java
+++ b/src/org/apache/fop/pdf/PDFInfo.java
@@ -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";
}
diff --git a/src/org/apache/fop/pdf/PDFNumber.java b/src/org/apache/fop/pdf/PDFNumber.java
index 66a43d999..38b5675f2 100644
--- a/src/org/apache/fop/pdf/PDFNumber.java
+++ b/src/org/apache/fop/pdf/PDFNumber.java
@@ -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();
diff --git a/src/org/apache/fop/pdf/PDFPattern.java b/src/org/apache/fop/pdf/PDFPattern.java
index ba0296a4a..f7363b095 100644
--- a/src/org/apache/fop/pdf/PDFPattern.java
+++ b/src/org/apache/fop/pdf/PDFPattern.java
@@ -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;
}
diff --git a/src/org/apache/fop/pdf/PDFShading.java b/src/org/apache/fop/pdf/PDFShading.java
index fdbb2339e..07a033702 100644
--- a/src/org/apache/fop/pdf/PDFShading.java
+++ b/src/org/apache/fop/pdf/PDFShading.java
@@ -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;
diff --git a/src/org/apache/fop/pdf/PDFState.java b/src/org/apache/fop/pdf/PDFState.java
index d9500c1b2..264c702de 100644
--- a/src/org/apache/fop/pdf/PDFState.java
+++ b/src/org/apache/fop/pdf/PDFState.java
@@ -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);
}
diff --git a/src/org/apache/fop/pdf/PDFT1Stream.java b/src/org/apache/fop/pdf/PDFT1Stream.java
index c0f62380f..39f9d8b2d 100644
--- a/src/org/apache/fop/pdf/PDFT1Stream.java
+++ b/src/org/apache/fop/pdf/PDFT1Stream.java
@@ -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: ");
diff --git a/src/org/apache/fop/render/awt/FontMetricsMapper.java b/src/org/apache/fop/render/awt/FontMetricsMapper.java
index 251249bc0..49b0403d9 100644
--- a/src/org/apache/fop/render/awt/FontMetricsMapper.java
+++ b/src/org/apache/fop/render/awt/FontMetricsMapper.java
@@ -32,8 +32,8 @@ public class FontMetricsMapper implements org.apache.fop.layout.FontMetric {
/**
* The first and last non space-character
*/
- private final static int FIRST_CHAR = 32;
- private final static int LAST_CHAR = 255;
+ private static final int FIRST_CHAR = 32;
+ private static final int LAST_CHAR = 255;
/**
* This is a AWTFontMetrics that does the real calculation.
diff --git a/src/org/apache/fop/render/pdf/fonts/SingleByteFont.java b/src/org/apache/fop/render/pdf/fonts/SingleByteFont.java
index b29ea9b8c..3dda3490d 100644
--- a/src/org/apache/fop/render/pdf/fonts/SingleByteFont.java
+++ b/src/org/apache/fop/render/pdf/fonts/SingleByteFont.java
@@ -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.
*/
@@ -242,10 +242,11 @@ public class SingleByteFont extends Font implements FontDescriptor {
public char mapChar(char c) {
char d = mapping.mapChar(c);
- if(d != 0)
+ if(d != 0) {
return d;
- else
- return '#';
+ } else {
+ return '#';
+ }
}
}
diff --git a/src/org/apache/fop/render/txt/TXTStream.java b/src/org/apache/fop/render/txt/TXTStream.java
index 9b2704271..f195a93fd 100644
--- a/src/org/apache/fop/render/txt/TXTStream.java
+++ b/src/org/apache/fop/render/txt/TXTStream.java
@@ -1,5 +1,6 @@
/*
- * 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.
*/
@@ -21,7 +22,7 @@ public class TXTStream {
return;
try {
- byte buff[] = str.getBytes("UTF-8");
+ byte buff[] = str.getBytes("UTF-8");
out.write(buff);
} catch (IOException e) {
throw new RuntimeException(e.toString());
@@ -33,3 +34,4 @@ public class TXTStream {
}
}
+
diff --git a/src/org/apache/fop/traits/LayoutProps.java b/src/org/apache/fop/traits/LayoutProps.java
index 5aa34db96..e49150a08 100644
--- a/src/org/apache/fop/traits/LayoutProps.java
+++ b/src/org/apache/fop/traits/LayoutProps.java
@@ -32,13 +32,13 @@ public class LayoutProps {
}
// public static int higherBreak(int brkParent, int brkChild) {
- // if (brkParent == brkChild) return brkChild;
- // for (int i=0; i < s_breakPriorities.length; i++) {
- // int bp = s_breakPriorities[i];
- // if (bp == brkParent) return brkChild;
- // else if (bp == brkChild) return brkParent;
- // }
- // return brkChild;
+ // if (brkParent == brkChild) return brkChild;
+ // for (int i=0; i < s_breakPriorities.length; i++) {
+ // int bp = s_breakPriorities[i];
+ // if (bp == brkParent) return brkChild;
+ // else if (bp == brkChild) return brkParent;
+ // }
+ // return brkChild;
// }
public void combineWithParent(LayoutProps parentLP) {
@@ -48,11 +48,13 @@ public class LayoutProps {
if (bp == breakBefore) {
breakBefore = parentLP.breakBefore;
break;
- } else if (bp == parentLP.breakBefore)
+ } else if (bp == parentLP.breakBefore) {
break;
+ }
}
}
// Parent span always overrides child span
bIsSpan = parentLP.bIsSpan;
}
}
+
diff --git a/src/org/apache/fop/traits/SpaceVal.java b/src/org/apache/fop/traits/SpaceVal.java
index 3807a2aea..763ac00eb 100644
--- a/src/org/apache/fop/traits/SpaceVal.java
+++ b/src/org/apache/fop/traits/SpaceVal.java
@@ -23,29 +23,27 @@ public class SpaceVal {
public final int iPrecedence; // Numeric only, if forcing, set to 0
public SpaceVal(Space spaceprop) {
- space = new MinOptMax(
- spaceprop.getMinimum().getLength().mvalue(),
- spaceprop.getOptimum().getLength().mvalue(),
- spaceprop.getMaximum().getLength().mvalue());
- bConditional = (spaceprop.getConditionality().getEnum() ==
- Constants.DISCARD);
- Property precProp = spaceprop.getPrecedence();
- if (precProp.getNumber() != null) {
- iPrecedence = precProp.getNumber().intValue();
- bForcing = false;
- }
- else {
- bForcing = (precProp.getEnum() == Constants.FORCE);
- iPrecedence=0;
- }
+ space = new MinOptMax( spaceprop.getMinimum().getLength().mvalue(),
+ spaceprop.getOptimum().getLength().mvalue(),
+ spaceprop.getMaximum().getLength().mvalue());
+ bConditional = (spaceprop.getConditionality().getEnum() ==
+ Constants.DISCARD);
+ Property precProp = spaceprop.getPrecedence();
+ if (precProp.getNumber() != null) {
+ iPrecedence = precProp.getNumber().intValue();
+ bForcing = false;
+ } else {
+ bForcing = (precProp.getEnum() == Constants.FORCE);
+ iPrecedence = 0;
+ }
}
- public SpaceVal(MinOptMax space, boolean bConditional, boolean bForcing,
- int iPrecedence) {
- this.space = space;
- this.bConditional = bConditional;
- this.bForcing = bForcing;
- this.iPrecedence = iPrecedence;
+ public SpaceVal(MinOptMax space, boolean bConditional,
+ boolean bForcing, int iPrecedence) {
+ this.space = space;
+ this.bConditional = bConditional;
+ this.bForcing = bForcing;
+ this.iPrecedence = iPrecedence;
}
}
diff --git a/src/org/apache/fop/util/CharUtilities.java b/src/org/apache/fop/util/CharUtilities.java
index 7befd4656..318aee67e 100644
--- a/src/org/apache/fop/util/CharUtilities.java
+++ b/src/org/apache/fop/util/CharUtilities.java
@@ -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,13 @@ public class CharUtilities {
* inline content, such as an inline with borders and padding
* or a nested block object.
*/
- public static final char CODE_EOT=0;
+ public static final char CODE_EOT = 0;
- public static final int UCWHITESPACE=0; // unicode white space
- public static final int LINEFEED=1;
- public static final int EOT=2; // Boundary beteween text runs
- public static final int NONWHITESPACE=3;
- public static final int XMLWHITESPACE=4;
+ public static final int UCWHITESPACE = 0; // unicode white space
+ public static final int LINEFEED = 1;
+ public static final int EOT = 2; // Boundary beteween text runs
+ public static final int NONWHITESPACE = 3;
+ public static final int XMLWHITESPACE = 4;
/**
@@ -33,11 +33,11 @@ public class CharUtilities {
* of the passed character.
*/
public static int classOf(char c) {
- if (c == CODE_EOT) return EOT;
- if (c == '\n') return LINEFEED;
- if ( c==' '|| c == '\r' || c=='\t' ) return XMLWHITESPACE;
- if (isAnySpace(c)) return UCWHITESPACE;
- return NONWHITESPACE;
+ if (c == CODE_EOT) { return EOT; }
+ if (c == '\n') { return LINEFEED; }
+ if (c == ' '|| c == '\r' || c == '\t' ) { return XMLWHITESPACE; }
+ if (isAnySpace(c)) { return UCWHITESPACE; }
+ return NONWHITESPACE;
}
/**
@@ -58,41 +58,58 @@ public class CharUtilities {
// the font
int em = fs.width(fs.mapChar('m'));
int en = fs.width(fs.mapChar('n'));
- if (em <= 0)
+ if (em <= 0) {
em = 500 * fs.getFontSize();
- if (en <= 0)
+ }
+ if (en <= 0) {
en = em - 10;
+ }
- if (c == ' ')
+ if (c == ' ') {
width = em;
- if (c == '\u2000')
+ }
+ if (c == '\u2000') {
width = en;
- if (c == '\u2001')
+ }
+ if (c == '\u2001') {
width = em;
- if (c == '\u2002')
+ }
+ if (c == '\u2002') {
width = em / 2;
- if (c == '\u2003')
+ }
+ if (c == '\u2003') {
width = fs.getFontSize();
- if (c == '\u2004')
+ }
+ if (c == '\u2004') {
width = em / 3;
- if (c == '\u2005')
+ }
+ if (c == '\u2005') {
width = em / 4;
- if (c == '\u2006')
+ }
+ if (c == '\u2006') {
width = em / 6;
- if (c == '\u2007')
+ }
+ if (c == '\u2007') {
width = getCharWidth(' ', fs);
- if (c == '\u2008')
+ }
+ if (c == '\u2008') {
width = getCharWidth('.', fs);
- if (c == '\u2009')
+ }
+ if (c == '\u2009') {
width = em / 5;
- if (c == '\u200A')
+ }
+ if (c == '\u200A') {
width = 5;
- if (c == '\u200B')
+ }
+ if (c == '\u200B') {
width = 100;
- if (c == '\u202F')
+ }
+ if (c == '\u202F') {
width = getCharWidth(' ', fs) / 2;
- if (c == '\u3000')
+ }
+ if (c == '\u3000') {
width = getCharWidth(' ', fs) * 2;
+ }
}
}
@@ -105,8 +122,8 @@ public class CharUtilities {
* it's not non-breaking
*/
public static boolean isSpace(char c) {
- return (c == ' ' ||
- (c >= '\u2000' && c <= '\u200B'));
+ return (c == ' '
+ || (c >= '\u2000' && c <= '\u200B'));
// c == '\u2000' // en quad
// c == '\u2001' // em quad
// c == '\u2002' // en space
@@ -126,12 +143,13 @@ public class CharUtilities {
* space.
*/
public static boolean isNBSP(char c) {
- if (c == '\u00A0' || c == '\u202F' || // narrow no-break space
- c == '\u3000' || // ideographic space
- c == '\uFEFF') { // zero width no-break space
+ if (c == '\u00A0' || c == '\u202F' // narrow no-break space
+ || c == '\u3000' // ideographic space
+ || c == '\uFEFF') { // zero width no-break space
return true;
- } else
+ } else {
return false;
+ }
}
/**