aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-11-22 17:40:14 +0000
committerJeremias Maerki <jeremias@apache.org>2003-11-22 17:40:14 +0000
commit086560195d5dab35f5501a1c5b0af23b30af4952 (patch)
tree00d83dfccd580ae38af76e920f9f6e24acdfff00
parent43361d3ec139336ba9b6e45a695203e40772cbe9 (diff)
downloadxmlgraphics-fop-086560195d5dab35f5501a1c5b0af23b30af4952.tar.gz
xmlgraphics-fop-086560195d5dab35f5501a1c5b0af23b30af4952.zip
Style fixes only
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197020 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/rtf/BuilderContext.java36
-rw-r--r--src/java/org/apache/fop/render/rtf/FoUnitsConverter.java16
-rw-r--r--src/java/org/apache/fop/render/rtf/ListAttributesConverter.java8
-rw-r--r--src/java/org/apache/fop/render/rtf/RTFHandler.java15
-rw-r--r--src/java/org/apache/fop/render/rtf/TableContext.java62
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java2
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java60
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java6
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java26
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java2
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java6
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java13
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java66
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java3
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java8
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java25
-rw-r--r--src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java7
17 files changed, 169 insertions, 192 deletions
diff --git a/src/java/org/apache/fop/render/rtf/BuilderContext.java b/src/java/org/apache/fop/render/rtf/BuilderContext.java
index a1b9ad1b6..80ecd2ab0 100644
--- a/src/java/org/apache/fop/render/rtf/BuilderContext.java
+++ b/src/java/org/apache/fop/render/rtf/BuilderContext.java
@@ -68,19 +68,19 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer;
class BuilderContext {
/** stack of RtfContainers */
- private final Stack m_containers = new Stack();
+ private final Stack containers = new Stack();
/** stack of TableContexts */
- private final Stack m_tableContexts = new Stack();
+ private final Stack tableContexts = new Stack();
/** stack of IBuilders */
- private final Stack m_builders = new Stack();
+ private final Stack builders = new Stack();
/** Rtf options */
- IRtfOptions m_options;
+ private IRtfOptions options;
BuilderContext(IRtfOptions rtfOptions) {
- m_options = rtfOptions;
+ options = rtfOptions;
}
/** find first object of given class from top of stack s
@@ -103,7 +103,7 @@ class BuilderContext {
Object getBuilder(Class builderClass,boolean required)
throws Exception
{
- final IBuilder result = (IBuilder)getObjectFromStack(m_builders,builderClass);
+ final IBuilder result = (IBuilder)getObjectFromStack(builders,builderClass);
if(result == null && required) {
throw new Exception(
"IBuilder of class '" + builderClass.getName() + "' not found on builders stack"
@@ -120,7 +120,7 @@ class BuilderContext {
Object /*IBuilder*/ forWhichBuilder) throws Exception {
// TODO what to do if the desired container is not at the top of the stack?
// close top-of-stack container?
- final RtfContainer result = (RtfContainer)getObjectFromStack(m_containers,
+ final RtfContainer result = (RtfContainer)getObjectFromStack(containers,
containerClass);
if (result == null && required) {
@@ -135,7 +135,7 @@ class BuilderContext {
/** push an RtfContainer on our stack */
void pushContainer(RtfContainer c) {
- m_containers.push(c);
+ containers.push(c);
}
/**
@@ -149,22 +149,22 @@ class BuilderContext {
void replaceContainer(RtfContainer oldC, RtfContainer newC)
throws Exception {
// treating the Stack as a Vector allows such manipulations (yes, I hear you screaming ;-)
- final int index = m_containers.indexOf(oldC);
+ final int index = containers.indexOf(oldC);
if (index < 0) {
throw new Exception("container to replace not found:" + oldC);
}
- m_containers.setElementAt(newC, index);
+ containers.setElementAt(newC, index);
}
/** pop the topmost RtfContainer from our stack */
void popContainer() {
- m_containers.pop();
+ containers.pop();
}
/* push an IBuilder to our stack /
void pushBuilder(IBuilder b)
{
- m_builders.push(b);
+ builders.push(b);
}*/
/** pop the topmost IBuilder from our stack and return previous builder on stack
@@ -173,26 +173,26 @@ class BuilderContext {
IBuilder popBuilderAndGetPreviousOne()
{
IBuilder result = null;
- m_builders.pop();
- if(!m_builders.isEmpty()) {
- result = (IBuilder)m_builders.peek();
+ builders.pop();
+ if(!builders.isEmpty()) {
+ result = (IBuilder)builders.peek();
}
return result;
}
*/
/** return the current TableContext */
TableContext getTableContext() {
- return (TableContext)m_tableContexts.peek();
+ return (TableContext)tableContexts.peek();
}
/** push a TableContext to our stack */
void pushTableContext(TableContext tc) {
- m_tableContexts.push(tc);
+ tableContexts.push(tc);
}
/** pop a TableContext from our stack */
void popTableContext() {
- m_tableContexts.pop();
+ tableContexts.pop();
}
} \ No newline at end of file
diff --git a/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java b/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java
index 04d1884e3..2d0ecfe33 100644
--- a/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java
+++ b/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java
@@ -68,7 +68,7 @@ import org.apache.fop.apps.FOPException;
*/
class FoUnitsConverter {
- private static final FoUnitsConverter m_instance = new FoUnitsConverter();
+ private static final FoUnitsConverter INSTANCE = new FoUnitsConverter();
/** points to twips: 1 twip is 1/20 of a point */
public static final float POINT_TO_TWIPS = 20f;
@@ -80,12 +80,12 @@ class FoUnitsConverter {
/** conversion factors keyed by xsl:fo units names */
- private static final Map m_twipFactors = new HashMap();
+ private static final Map TWIP_FACTORS = new HashMap();
static {
- m_twipFactors.put("mm", new Float(MM_TO_TWIPS));
- m_twipFactors.put("cm", new Float(CM_TO_TWIPS));
- m_twipFactors.put("pt", new Float(POINT_TO_TWIPS));
- m_twipFactors.put("in", new Float(IN_TO_TWIPS));
+ TWIP_FACTORS.put("mm", new Float(MM_TO_TWIPS));
+ TWIP_FACTORS.put("cm", new Float(CM_TO_TWIPS));
+ TWIP_FACTORS.put("pt", new Float(POINT_TO_TWIPS));
+ TWIP_FACTORS.put("in", new Float(IN_TO_TWIPS));
}
/** singleton pattern */
@@ -94,7 +94,7 @@ class FoUnitsConverter {
/** singleton pattern */
static FoUnitsConverter getInstance() {
- return m_instance;
+ return INSTANCE;
}
/** convert given value to RTF units
@@ -143,7 +143,7 @@ class FoUnitsConverter {
// find conversion factor
if (units != null && units.trim().length() > 0) {
- final Float factor = (Float)m_twipFactors.get(units.toLowerCase());
+ final Float factor = (Float)TWIP_FACTORS.get(units.toLowerCase());
if (factor == null) {
throw new FOPException("conversion factor not found for '" + units + "' units");
}
diff --git a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java b/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
index c4939d924..13b8051dc 100644
--- a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
@@ -75,12 +75,12 @@ public class ListAttributesConverter {
static RtfAttributes convertAttributes(PropertyList properties)
- throws FOPException{
+ throws FOPException {
RtfAttributes attrib = new RtfAttributes();
- Property prop=null;
- int iStartIndentInTwips=0;
+ Property prop = null;
+ int iStartIndentInTwips = 0;
//start-indent
if ((prop = properties.get("start-indent")) != null) {
@@ -106,7 +106,7 @@ public class ListAttributesConverter {
attrib.set(RtfText.LEFT_INDENT_BODY,
(int) FoUnitsConverter.getInstance().convertToTwips(sValue));
} else {
- if(iStartIndentInTwips >= 360) {
+ if (iStartIndentInTwips >= 360) {
//if the start indent is greater than default, set to the start indent
attrib.set(RtfText.LEFT_INDENT_BODY, iStartIndentInTwips);
} else {
diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java
index 63a5343d1..a112061d4 100644
--- a/src/java/org/apache/fop/render/rtf/RTFHandler.java
+++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java
@@ -97,7 +97,6 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem.RtfListItemLabel;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
@@ -531,7 +530,7 @@ public class RTFHandler extends FOInputHandler {
RtfAttributes atts = TableAttributesConverter.convertRowAttributes(tr.properties,
tbl.getHeaderAttribs());
- if(tr.getParent() instanceof TableHeader) {
+ if (tr.getParent() instanceof TableHeader) {
atts.set(ITableAttributes.ATTR_HEADER);
}
@@ -614,8 +613,11 @@ public class RTFHandler extends FOInputHandler {
public void startList(ListBlock lb) {
try {
// create an RtfList in the current list container
- final IRtfListContainer c = (IRtfListContainer)builderContext.getContainer(IRtfListContainer.class,true,this);
- final RtfList newList = c.newList(ListAttributesConverter.convertAttributes(lb.properties));
+ final IRtfListContainer c
+ = (IRtfListContainer)builderContext.getContainer(
+ IRtfListContainer.class, true, this);
+ final RtfList newList = c.newList(
+ ListAttributesConverter.convertAttributes(lb.properties));
builderContext.pushContainer(newList);
} catch (IOException ioe) {
log.error("startList: " + ioe.getMessage());
@@ -642,7 +644,8 @@ public class RTFHandler extends FOInputHandler {
public void startListItem(ListItem li) {
// create an RtfListItem in the current RtfList
try {
- final RtfList list = (RtfList)builderContext.getContainer(RtfList.class,true,this);
+ final RtfList list = (RtfList)builderContext.getContainer(
+ RtfList.class, true, this);
builderContext.pushContainer(list.newListItem());
} catch (IOException ioe) {
log.error("startList: " + ioe.getMessage());
@@ -671,7 +674,7 @@ public class RTFHandler extends FOInputHandler {
RtfListItem item
= (RtfListItem)builderContext.getContainer(RtfListItem.class, true, this);
- RtfListItemLabel label=item.new RtfListItemLabel(item);
+ RtfListItemLabel label = item.new RtfListItemLabel(item);
builderContext.pushContainer(label);
} catch (IOException ioe) {
log.error("startPageNumber:" + ioe.getMessage());
diff --git a/src/java/org/apache/fop/render/rtf/TableContext.java b/src/java/org/apache/fop/render/rtf/TableContext.java
index 2f2baa72e..6ade4fd1d 100644
--- a/src/java/org/apache/fop/render/rtf/TableContext.java
+++ b/src/java/org/apache/fop/render/rtf/TableContext.java
@@ -50,7 +50,7 @@
*/
package org.apache.fop.render.rtf;
-import java.util.ArrayList;
+import java.util.List;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
@@ -72,9 +72,9 @@ import org.apache.fop.render.rtf.rtflib.interfaces.ITableColumnsInfo;
class TableContext implements ITableColumnsInfo {
private final Logger log = new ConsoleLogger();
- private final BuilderContext m_context;
- private final ArrayList m_colWidths = new ArrayList();
- private int m_colIndex;
+ private final BuilderContext context;
+ private final List colWidths = new java.util.ArrayList();
+ private int colIndex;
/**
* Added by Peter Herweg on 2002-06-29
@@ -83,7 +83,7 @@ class TableContext implements ITableColumnsInfo {
* value > 0 means there is row-spanning
* Each value in the list is decreased by 1 after each finished table-row
*/
- private final ArrayList m_colRowSpanningNumber = new ArrayList();
+ private final List colRowSpanningNumber = new java.util.ArrayList();
/**
* Added by Peter Herweg on 2002-06-29
@@ -92,75 +92,75 @@ class TableContext implements ITableColumnsInfo {
* For this purpose the attributes of a cell are stored in this array, as soon
* as a number-rows-spanned attribute has been found.
*/
- private final ArrayList m_colRowSpanningAttrs = new ArrayList();
+ private final List colRowSpanningAttrs = new java.util.ArrayList();
- private boolean m_bNextRowBelongsToHeader = false;
+ private boolean bNextRowBelongsToHeader = false;
- public void setNextRowBelongsToHeader(boolean bNextRowBelongsToHeader) {
- m_bNextRowBelongsToHeader = bNextRowBelongsToHeader;
+ public void setNextRowBelongsToHeader(boolean value) {
+ this.bNextRowBelongsToHeader = value;
}
public boolean getNextRowBelongsToHeader() {
- return m_bNextRowBelongsToHeader;
+ return bNextRowBelongsToHeader;
}
TableContext(BuilderContext ctx) {
- m_context = ctx;
+ context = ctx;
}
void setNextColumnWidth(String strWidth)
throws Exception {
- m_colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)));
+ colWidths.add(new Float(FoUnitsConverter.getInstance().convertToTwips(strWidth)));
}
//Added by Peter Herweg on 2002-06-29
RtfAttributes getColumnRowSpanningAttrs() {
- return (RtfAttributes)m_colRowSpanningAttrs.get(m_colIndex);
+ return (RtfAttributes)colRowSpanningAttrs.get(colIndex);
}
//Added by Peter Herweg on 2002-06-29
Integer getColumnRowSpanningNumber() {
- return (Integer)m_colRowSpanningNumber.get(m_colIndex);
+ return (Integer)colRowSpanningNumber.get(colIndex);
}
//Added by Peter Herweg on 2002-06-29
void setCurrentColumnRowSpanning(Integer iRowSpanning, RtfAttributes attrs)
throws Exception {
- if (m_colIndex < m_colRowSpanningNumber.size()) {
- m_colRowSpanningNumber.set(m_colIndex, iRowSpanning);
- m_colRowSpanningAttrs.set(m_colIndex, attrs);
+ if (colIndex < colRowSpanningNumber.size()) {
+ colRowSpanningNumber.set(colIndex, iRowSpanning);
+ colRowSpanningAttrs.set(colIndex, attrs);
} else {
- m_colRowSpanningNumber.add(iRowSpanning);
- m_colRowSpanningAttrs.add(m_colIndex, attrs);
+ colRowSpanningNumber.add(iRowSpanning);
+ colRowSpanningAttrs.add(colIndex, attrs);
}
}
//Added by Peter Herweg on 2002-06-29
public void setNextColumnRowSpanning(Integer iRowSpanning,
RtfAttributes attrs) {
- m_colRowSpanningNumber.add(iRowSpanning);
- m_colRowSpanningAttrs.add(m_colIndex, attrs);
+ colRowSpanningNumber.add(iRowSpanning);
+ colRowSpanningAttrs.add(colIndex, attrs);
}
/**
* Added by Peter Herweg on 2002-06-29
* This function is called after each finished table-row.
- * It decreases all values in m_colRowSpanningNumber by 1. If a value
+ * It decreases all values in colRowSpanningNumber by 1. If a value
* reaches 0 row-spanning is finished, and the value won't be decreased anymore.
*/
public void decreaseRowSpannings() {
- for (int z = 0; z < m_colRowSpanningNumber.size(); ++z) {
- Integer i = (Integer)m_colRowSpanningNumber.get(z);
+ for (int z = 0; z < colRowSpanningNumber.size(); ++z) {
+ Integer i = (Integer)colRowSpanningNumber.get(z);
if (i.intValue() > 0) {
i = new Integer(i.intValue() - 1);
}
- m_colRowSpanningNumber.set(z, i);
+ colRowSpanningNumber.set(z, i);
if (i.intValue() == 0) {
- m_colRowSpanningAttrs.set(z, null);
+ colRowSpanningAttrs.set(z, null);
}
}
}
@@ -171,7 +171,7 @@ class TableContext implements ITableColumnsInfo {
* 'number-columns-spanned' processing
*/
public void selectFirstColumn() {
- m_colIndex = 0;
+ colIndex = 0;
}
/**
@@ -180,7 +180,7 @@ class TableContext implements ITableColumnsInfo {
* 'number-columns-spanned' processing
*/
public void selectNextColumn() {
- m_colIndex++;
+ colIndex++;
}
/**
@@ -191,7 +191,7 @@ class TableContext implements ITableColumnsInfo {
*/
public float getColumnWidth() {
try {
- return ((Float)m_colWidths.get(m_colIndex)).floatValue();
+ return ((Float)colWidths.get(colIndex)).floatValue();
} catch (IndexOutOfBoundsException ex) {
// this code contributed by Trembicki-Guy, Ed <GuyE@DNB.com>
log.warn("fo:table-column width not defined, using " + INVALID_COLUM_WIDTH);
@@ -201,13 +201,13 @@ class TableContext implements ITableColumnsInfo {
/** Added by Boris Poudérous on 07/22/2002 */
public int getColumnIndex() {
- return m_colIndex;
+ return colIndex;
}
/** - end - */
/** Added by Boris Poudérous on 07/22/2002 */
public int getNumberOfColumns() {
- return m_colWidths.size();
+ return colWidths.size();
}
/** - end - */
}
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java
index f9efe0e13..46a44daed 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java
@@ -77,7 +77,7 @@ public interface ITableAttributes {
String ATTR_ROW_LEFT_INDENT = "trleft";
/** table row header */
- public final String ATTR_HEADER = "trhdr";
+ String ATTR_HEADER = "trhdr";
// RTF 1.6 Row and table attributes
/** table row padding, top */
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java
index d4ac4d9fa..ea861511b 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java
@@ -161,10 +161,10 @@ public class RtfExternalGraphic extends RtfElement {
protected int graphicCompressionRate = 80;
/** The image data */
- private byte[] data = null;
+ private byte[] imagedata = null;
/** The image type */
- private int type;
+ private int imagetype;
//////////////////////////////////////////////////
// @@ Construction
@@ -244,11 +244,11 @@ public class RtfExternalGraphic extends RtfElement {
// getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
- data = null;
+ imagedata = null;
try {
final InputStream in = url.openStream();
try {
- data = IOUtil.toByteArray(url.openStream());
+ imagedata = IOUtil.toByteArray(url.openStream());
} finally {
IOUtil.shutdownStream(in);
}
@@ -258,17 +258,17 @@ public class RtfExternalGraphic extends RtfElement {
+ url + "' (" + e + ")");
}
- if (data == null) {
+ if (imagedata == null) {
return;
}
// Determine image file format
String file = url.getFile ();
- type = determineImageType(data, file.substring(file.lastIndexOf(".") + 1));
+ imagetype = determineImageType(imagedata, file.substring(file.lastIndexOf(".") + 1));
- if (type >= ImageConstants.I_TO_CONVERT_BASIS) {
+ if (imagetype >= ImageConstants.I_TO_CONVERT_BASIS) {
// convert
- int to = ImageConstants.CONVERT_TO [type - ImageConstants.I_TO_CONVERT_BASIS];
+ int to = ImageConstants.CONVERT_TO[imagetype - ImageConstants.I_TO_CONVERT_BASIS];
// if (to == ImageConstants.I_JPG) {
// ByteArrayOutputStream out = null;
@@ -276,8 +276,8 @@ public class RtfExternalGraphic extends RtfElement {
// //convert to jpeg
// out = new ByteArrayOutputStream();
// Encoder jpgEncoder = new Encoder(graphicCompressionRate, out);
-// jpgEncoder.encodeJPEG(data);
-// data = out.toByteArray();
+// jpgEncoder.encodeJPEG(imagedata);
+// imagedata = out.toByteArray();
// type = to;
// }
// catch (JPEGException e) {
@@ -288,19 +288,19 @@ public class RtfExternalGraphic extends RtfElement {
// out.close();
// }
// } else {
- type = ImageConstants.I_NOT_SUPPORTED;
+ imagetype = ImageConstants.I_NOT_SUPPORTED;
// }
}
- if (type == ImageConstants.I_NOT_SUPPORTED) {
+ if (imagetype == ImageConstants.I_NOT_SUPPORTED) {
throw new ExternalGraphicException("The tag <fo:external-graphic> "
+ "does not support "
+ file.substring(file.lastIndexOf(".") + 1)
+ " - image type.");
}
- String rtfImageCode = ImageConstants.RTF_TAGS [type];
+ String rtfImageCode = ImageConstants.RTF_TAGS[imagetype];
// Writes the beginning of the rtf image
@@ -309,15 +309,15 @@ public class RtfExternalGraphic extends RtfElement {
writeGroupMark(true);
writeControlWord("pict");
- StringBuffer buf = new StringBuffer(data.length * 3);
+ StringBuffer buf = new StringBuffer(imagedata.length * 3);
writeControlWord(rtfImageCode);
computeImageSize();
writeSizeInfo();
- for (int i = 0; i < data.length; i++) {
- int iData = data [i];
+ for (int i = 0; i < imagedata.length; i++) {
+ int iData = imagedata [i];
// Make positive byte
if (iData < 0) {
@@ -345,22 +345,22 @@ public class RtfExternalGraphic extends RtfElement {
}
private void computeImageSize () {
- if (type == ImageConstants.I_PNG) {
- width = ImageUtil.getIntFromByteArray(data, 16, 4, true);
- height = ImageUtil.getIntFromByteArray(data, 20, 4, true);
- } else if (type == ImageConstants.I_JPG) {
+ if (imagetype == ImageConstants.I_PNG) {
+ width = ImageUtil.getIntFromByteArray(imagedata, 16, 4, true);
+ height = ImageUtil.getIntFromByteArray(imagedata, 20, 4, true);
+ } else if (imagetype == ImageConstants.I_JPG) {
int basis = -1;
byte ff = (byte) 0xff;
byte c0 = (byte) 0xc0;
- for (int i = 0; i < data.length; i++) {
- byte b = data[i];
+ for (int i = 0; i < imagedata.length; i++) {
+ byte b = imagedata[i];
if (b != ff) {
continue;
}
- if (i == data.length - 1) {
+ if (i == imagedata.length - 1) {
continue;
}
- b = data[i + 1];
+ b = imagedata[i + 1];
if (b != c0) {
continue;
}
@@ -369,12 +369,12 @@ public class RtfExternalGraphic extends RtfElement {
}
if (basis != -1) {
- width = ImageUtil.getIntFromByteArray(data, basis + 2, 2, true);
- height = ImageUtil.getIntFromByteArray(data, basis, 2, true);
+ width = ImageUtil.getIntFromByteArray(imagedata, basis + 2, 2, true);
+ height = ImageUtil.getIntFromByteArray(imagedata, basis, 2, true);
}
- } else if (type == ImageConstants.I_EMF) {
- width = ImageUtil.getIntFromByteArray(data, 151, 4, false);
- height = ImageUtil.getIntFromByteArray(data, 155, 4, false);
+ } else if (imagetype == ImageConstants.I_EMF) {
+ width = ImageUtil.getIntFromByteArray(imagedata, 151, 4, false);
+ height = ImageUtil.getIntFromByteArray(imagedata, 155, 4, false);
}
}
@@ -511,7 +511,7 @@ public class RtfExternalGraphic extends RtfElement {
/**
* Determines wheter the image is a jpeg.
*
- * @param data Image
+ * @param imagedata Image
*
* @return
* true If JPEG type\n
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java
index 40963d910..462926d35 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java
@@ -132,11 +132,11 @@ extends RtfContainer {
public RtfListTable startListTable(RtfAttributes attr)
throws IOException {
listNum++;
- if(listTable != null) {
+ if (listTable != null) {
return listTable;
} else {
- listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
- listTableContainer.addChild(listTable);
+ listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
+ listTableContainer.addChild(listTable);
}
return listTable;
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java
index d03f6f129..5d4f0a245 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java
@@ -66,16 +66,15 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
* @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
* @author Andreas Putz a.putz@skynamics.com
*/
-public class RtfListItem
-extends RtfContainer
-implements IRtfTextrunContainer,
- IRtfListContainer,
- IRtfParagraphContainer {
+public class RtfListItem extends RtfContainer
+ implements IRtfTextrunContainer,
+ IRtfListContainer,
+ IRtfParagraphContainer {
private RtfList parentList;
private RtfParagraph paragraph;
private RtfListStyle listStyle;
- private int number=0;
+ private int number = 0;
/** special RtfParagraph that writes list item setup code before its content */
private class RtfListItemParagraph extends RtfParagraph {
@@ -92,12 +91,12 @@ implements IRtfTextrunContainer,
}
public class RtfListItemLabel extends RtfTextrun implements IRtfTextrunContainer {
- RtfListItem rtfListItem;
+ private RtfListItem rtfListItem;
public RtfListItemLabel(RtfListItem item) throws IOException {
super(null, item.writer, null);
- rtfListItem=item;
+ rtfListItem = item;
}
public RtfTextrun getTextrun() throws IOException {
@@ -107,7 +106,7 @@ implements IRtfTextrunContainer,
public void addString(String s) throws IOException {
final String label = s.trim();
- if(label.length() > 0 && Character.isDigit(label.charAt(0))) {
+ if (label.length() > 0 && Character.isDigit(label.charAt(0))) {
rtfListItem.setRtfListStyle(new RtfListStyleNumber());
} else {
rtfListItem.setRtfListStyle(new RtfListStyleText(label));
@@ -150,9 +149,8 @@ implements IRtfTextrunContainer,
parentList = parent;
}
- public RtfTextrun getTextrun()
- throws IOException {
- RtfTextrun textrun=RtfTextrun.getTextrun(this, writer, null);
+ public RtfTextrun getTextrun() throws IOException {
+ RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, null);
textrun.setRtfListItem(this);
return textrun;
}
@@ -191,7 +189,7 @@ implements IRtfTextrunContainer,
getRtfListStyle().writeListPrefix(this);
writeGroupMark(false);
- writeOneAttribute(RtfListTable.LIST_NUMBER,new Integer(number));
+ writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer(number));
}
/**
@@ -227,7 +225,7 @@ implements IRtfTextrunContainer,
* @return ListSytle of the List
*/
public RtfListStyle getRtfListStyle() {
- if(listStyle==null) {
+ if (listStyle == null) {
return parentList.getRtfListStyle();
} else {
return listStyle;
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java
index 666d8eecc..c0ae0583f 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java
@@ -70,7 +70,7 @@ public class RtfListStyle {
private RtfListItem rtfListItem;
public void setRtfListItem(RtfListItem item) {
- rtfListItem=item;
+ rtfListItem = item;
}
public RtfListItem getRtfListItem() {
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java
index 9d516108d..0c93c3fe5 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java
@@ -64,10 +64,10 @@ import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
public class RtfListStyleText extends RtfListStyle {
- String text;
+ private String text;
public RtfListStyleText(String s) {
- text=s;
+ text = s;
}
/**
@@ -114,7 +114,7 @@ public class RtfListStyleText extends RtfListStyle {
element.writeGroupMark(true);
String sCount;
- if(text.length()<10) {
+ if (text.length() < 10) {
sCount = "0" + String.valueOf(text.length());
} else {
sCount = String.valueOf(text.length());
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java
index c8fb40847..9d51433a5 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java
@@ -60,7 +60,6 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc;
import java.util.LinkedList;
import java.util.Iterator;
-import java.util.LinkedList;
import java.io.Writer;
import java.io.IOException;
//import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo;
@@ -138,7 +137,7 @@ public class RtfListTable extends RtfContainer {
throws IOException {
super(parent, w, attrs);
- styles=new LinkedList();
+ styles = new LinkedList();
}
/**
@@ -146,8 +145,8 @@ public class RtfListTable extends RtfContainer {
* @param list RtfList to add
*/
public int addList(RtfList list) {
- if(lists == null) {
- lists=new LinkedList();
+ if (lists == null) {
+ lists = new LinkedList();
}
lists.add(list);
@@ -160,7 +159,7 @@ public class RtfListTable extends RtfContainer {
* @throws IOException for I/O problems
*/
public void writeRtfContent() throws IOException {
- if(lists!=null) {
+ if (lists != null) {
//write '\listtable'
writeGroupMark(true);
writeStarControlWordNS(LIST_TABLE);
@@ -173,7 +172,7 @@ public class RtfListTable extends RtfContainer {
//write '\listoveridetable'
writeGroupMark(true);
writeStarControlWordNS(LIST_OVR_TABLE);
- int z=1;
+ int z = 1;
for (Iterator it = styles.iterator(); it.hasNext();) {
final RtfListStyle style = (RtfListStyle)it.next();
@@ -220,7 +219,7 @@ public class RtfListTable extends RtfContainer {
writeOneAttributeNS(LIST_SPACE, new Integer(0));
writeOneAttributeNS(LIST_INDENT, attrib.getValue(LIST_INDENT));
- RtfListItem item=(RtfListItem)list.getChildren().get(0);
+ RtfListItem item = (RtfListItem)list.getChildren().get(0);
item.getRtfListStyle().writeLevelGroup(this);
writeGroupMark(false);
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java
index 2d7f3507a..16b20d452 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java
@@ -81,29 +81,29 @@ public class RtfPageNumberCitation extends RtfContainer {
// The 'id' of the referenced page
private String id = null;
- /** Create an RTF page number citation as a child of given container with default attributes */
- RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String id)
- throws IOException {
- super((RtfContainer)parent, w);
- this.id = id;
- }
+ /** Create an RTF page number citation as a child of given container with default attributes */
+ RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String id)
+ throws IOException {
+ super((RtfContainer)parent, w);
+ this.id = id;
+ }
- /** Create an RTF page number citation as a child of given
- * paragraph, copying its attributes */
- RtfPageNumberCitation (RtfParagraph parent, Writer w, String id)
- throws IOException {
- // add the attributes ant text attributes of the parent paragraph
- super((RtfContainer)parent, w, parent.attrib);
- if (parent.getTextAttributes() != null) {
- attrib.set(parent.getTextAttributes());
- }
- this.id = id;
- }
+ /** Create an RTF page number citation as a child of given
+ * paragraph, copying its attributes */
+ RtfPageNumberCitation (RtfParagraph parent, Writer w, String id)
+ throws IOException {
+ // add the attributes ant text attributes of the parent paragraph
+ super((RtfContainer)parent, w, parent.attrib);
+ if (parent.getTextAttributes() != null) {
+ attrib.set(parent.getTextAttributes());
+ }
+ this.id = id;
+ }
- /**
- * Write the content
- * @throws IOException for I/O problems
- */
+ /**
+ * Write the content
+ * @throws IOException for I/O problems
+ */
protected void writeRtfContent() throws IOException {
// If we have a valid ID
if (isValid()) {
@@ -130,19 +130,15 @@ public class RtfPageNumberCitation extends RtfContainer {
}
}
- /** checks that the 'ref-id' attribute exists */
- private boolean isValid() {
- if (id != null) {
- return true;
- } else {
- return false;
+ /** checks that the 'ref-id' attribute exists */
+ private boolean isValid() {
+ return (id != null);
}
- }
- /**
- * @return true if this element would generate no "useful" RTF content
- */
- public boolean isEmpty() {
- return false;
- }
-}
+ /**
+ * @return true if this element would generate no "useful" RTF content
+ */
+ public boolean isEmpty() {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
index 798db3401..887a380a2 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
@@ -106,7 +106,8 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
id = idNum;
parentRow = parent;
this.cellWidth = cellWidth;
- setCenter = setRight = false;
+ setCenter = false;
+ setRight = false;
}
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
index b4e4246e3..9c362b07b 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
@@ -180,7 +180,7 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
final RtfTable parentTable = (RtfTable) parent;
adjustBorderProperties(parentTable);
- writeAttributes(attrib,new String[]{ITableAttributes.ATTR_HEADER});
+ writeAttributes(attrib, new String[]{ITableAttributes.ATTR_HEADER});
writeAttributes(attrib, ITableAttributes.ROW_BORDER);
writeAttributes(attrib, ITableAttributes.CELL_BORDER);
writeAttributes(attrib, BorderAttributesConverter.BORDERS);
@@ -384,11 +384,7 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
* @return true if the row is the first in the table
*/
public boolean isFirstRow() {
- if (id == 1) {
- return true;
- } else {
- return false;
- }
+ return (id == 1);
}
/**
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
index 484024374..87a14f8a4 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java
@@ -212,7 +212,7 @@ public class RtfText extends RtfElement {
RtfText(IRtfTextContainer parent, Writer w, String str, RtfAttributes attr)
throws IOException {
super((RtfContainer)parent, w);
- text = str;
+ this.text = str;
this.attr = attr;
}
@@ -306,22 +306,14 @@ public class RtfText extends RtfElement {
* @return true if the text is a tab character
*/
public boolean isTab() {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_TAB) {
- return true;
- } else {
- return false;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_TAB);
}
/**
* @return true if text is a newline character
*/
public boolean isNewLine() {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_NEW_LINE) {
- return true;
- } else {
- return false;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_NEW_LINE);
}
/**
@@ -330,17 +322,10 @@ public class RtfText extends RtfElement {
*/
public boolean isBold(boolean isStart) {
if (isStart) {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_START) {
- return true;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_START);
} else {
- if (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_END) {
- return true;
- } else {
- return false;
- }
+ return (text.trim().length() == 1 && text.charAt(0) == CHAR_BOLD_END);
}
- return false;
}
/** @return the attributes of our text */
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
index 8900303d2..161f29f52 100644
--- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
+++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
@@ -64,7 +64,6 @@ import java.util.Iterator;
// FOP
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
/**
* Class which contains a linear text run. It has methods to add attributes,
@@ -263,7 +262,7 @@ public class RtfTextrun extends RtfContainer {
//may contain for example \intbl
writeAttributes(attrib, null);
- if(rtfListItem!=null) {
+ if (rtfListItem != null) {
rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
}
@@ -293,7 +292,7 @@ public class RtfTextrun extends RtfContainer {
if (!bHide) {
e.writeRtf();
- if (rtfListItem!=null && e instanceof RtfParagraphBreak) {
+ if (rtfListItem != null && e instanceof RtfParagraphBreak) {
rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
}
}
@@ -312,7 +311,7 @@ public class RtfTextrun extends RtfContainer {
}
public void setRtfListItem(RtfListItem listItem) {
- rtfListItem=listItem;
+ rtfListItem = listItem;
}
public RtfListItem getRtfListItem() {