From 62e0b02e68248c8f81c8147a0c60d887c3fbd397 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Sat, 8 Nov 2003 19:58:03 +0000 Subject: [PATCH] Style fixes only git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197000 13f79535-47bb-0310-9956-ffa450edef68 --- .../render/rtf/PageAttributesConverter.java | 5 +- .../org/apache/fop/render/rtf/RTFHandler.java | 154 +++++++++--------- .../render/rtf/TableAttributesConverter.java | 6 +- .../render/rtf/TextAttributesConverter.java | 64 ++++---- .../rtflib/rtfdoc/IRtfTextrunContainer.java | 9 +- .../rtf/rtflib/rtfdoc/ITableAttributes.java | 84 +++++----- .../fop/render/rtf/rtflib/rtfdoc/RtfFile.java | 2 +- .../rtflib/rtfdoc/RtfPageNumberCitation.java | 8 +- .../rtf/rtflib/rtfdoc/RtfParagraph.java | 2 +- .../render/rtf/rtflib/rtfdoc/RtfString.java | 9 +- .../rtf/rtflib/rtfdoc/RtfTableCell.java | 6 +- .../render/rtf/rtflib/rtfdoc/RtfTableRow.java | 8 +- .../render/rtf/rtflib/rtfdoc/RtfTextrun.java | 104 ++++++------ .../rtflib/rtfdoc/WhitespaceCollapser.java | 10 +- .../rtflib/testdocs/CreateTestDocuments.java | 2 +- 15 files changed, 227 insertions(+), 246 deletions(-) diff --git a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java index f65b3bf0c..2a3734b32 100644 --- a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java @@ -114,8 +114,9 @@ class PageAttributesConverter { (int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt")); } } catch (FOPException e) { - log.error("Exception in convertPageAttributes: " + e.getMessage() + "- page attributes ignored"); - attrib=new RtfAttributes(); + log.error("Exception in convertPageAttributes: " + + e.getMessage() + "- page attributes ignored"); + attrib = new RtfAttributes(); } return attrib; diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index 3ef09ab21..f299595ce 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -58,7 +58,6 @@ import java.io.OutputStreamWriter; import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; import org.apache.fop.apps.FOPException; -import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.EnumProperty; import org.apache.fop.fo.FOInputHandler; import org.apache.fop.datatypes.FixedLength; @@ -81,26 +80,19 @@ import org.apache.fop.fo.pagination.SimplePageMaster; import org.apache.fop.fo.properties.Constants; import org.apache.fop.fo.Property; import org.apache.fop.fo.LengthProperty; -import org.apache.fop.fo.PropertyList; import org.apache.fop.apps.Document; import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfAfterContainer; import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfBeforeContainer; -import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfExternalGraphicContainer; -import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfPageNumberContainer; -import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfParagraphContainer; import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfTextrunContainer; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAfter; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfBefore; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile; -import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFontManager; 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.RtfText; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; @@ -125,7 +117,7 @@ public class RTFHandler extends FOInputHandler { private final Logger log = new ConsoleLogger(); private RtfSection sect; private RtfDocumentArea docArea; - private RtfParagraph para; + //private RtfParagraph para; //never used private boolean warned = false; private boolean bPrevHeaderSpecified = false;//true, if there has been a //header in any page-sequence @@ -188,17 +180,17 @@ public class RTFHandler extends FOInputHandler { //read page size and margins, if specified Property prop; - if((prop=pageSeq.properties.get("master-reference"))!=null) { - String reference=prop.getString(); + if ((prop = pageSeq.properties.get("master-reference")) != null) { + String reference = prop.getString(); - SimplePageMaster pagemaster= - pageSeq.getLayoutMasterSet().getSimplePageMaster(reference); + SimplePageMaster pagemaster + = pageSeq.getLayoutMasterSet().getSimplePageMaster(reference); //only simple-page-master supported, so pagemaster may be null - if(pagemaster!=null) { + if (pagemaster != null) { sect.getRtfAttributes().set( PageAttributesConverter.convertPageAttributes( - pagemaster.properties,null)); + pagemaster.properties, null)); } } @@ -232,8 +224,8 @@ public class RTFHandler extends FOInputHandler { RtfAttributes attr = new RtfAttributes(); attr.set(RtfBefore.HEADER); - final IRtfBeforeContainer contBefore = - (IRtfBeforeContainer)builderContext.getContainer + final IRtfBeforeContainer contBefore + = (IRtfBeforeContainer)builderContext.getContainer (IRtfBeforeContainer.class, true, this); contBefore.newBefore(attr); } @@ -244,8 +236,8 @@ public class RTFHandler extends FOInputHandler { RtfAttributes attr = new RtfAttributes(); attr.set(RtfAfter.FOOTER); - final IRtfAfterContainer contAfter = - (IRtfAfterContainer)builderContext.getContainer + final IRtfAfterContainer contAfter + = (IRtfAfterContainer)builderContext.getContainer (IRtfAfterContainer.class, true, this); contAfter.newAfter(attr); } @@ -259,8 +251,9 @@ public class RTFHandler extends FOInputHandler { bHeaderSpecified = true; bPrevHeaderSpecified = true; - final IRtfBeforeContainer c = - (IRtfBeforeContainer)builderContext.getContainer(IRtfBeforeContainer.class, + final IRtfBeforeContainer c + = (IRtfBeforeContainer)builderContext.getContainer( + IRtfBeforeContainer.class, true, this); RtfAttributes beforeAttributes = ((RtfElement)c).getRtfAttributes(); @@ -275,8 +268,9 @@ public class RTFHandler extends FOInputHandler { bFooterSpecified = true; bPrevFooterSpecified = true; - final IRtfAfterContainer c = - (IRtfAfterContainer)builderContext.getContainer(IRtfAfterContainer.class, + final IRtfAfterContainer c + = (IRtfAfterContainer)builderContext.getContainer( + IRtfAfterContainer.class, true, this); RtfAttributes afterAttributes = ((RtfElement)c).getRtfAttributes(); @@ -321,14 +315,15 @@ public class RTFHandler extends FOInputHandler { */ public void startBlock(Block bl) { try { - RtfAttributes rtfAttr = - TextAttributesConverter.convertAttributes(bl.properties, null); + RtfAttributes rtfAttr + = TextAttributesConverter.convertAttributes(bl.properties, null); - IRtfTextrunContainer container = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true,this); + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, + true, this); - RtfTextrun textrun=container.getTextrun(); + RtfTextrun textrun = container.getTextrun(); textrun.addParagraphBreak(); textrun.pushAttributes(rtfAttr); @@ -348,11 +343,12 @@ public class RTFHandler extends FOInputHandler { */ public void endBlock(Block bl) { try { - IRtfTextrunContainer container = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true,this); + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, + true, this); - RtfTextrun textrun=container.getTextrun(); + RtfTextrun textrun = container.getTextrun(); textrun.addParagraphBreak(); textrun.popAttributes(); @@ -374,12 +370,12 @@ public class RTFHandler extends FOInputHandler { TableContext tableContext = new TableContext(builderContext); try { - RtfAttributes atts = - TableAttributesConverter.convertTableAttributes(tbl.properties); + RtfAttributes atts + = TableAttributesConverter.convertTableAttributes(tbl.properties); - final IRtfTableContainer tc = - (IRtfTableContainer)builderContext.getContainer(IRtfTableContainer.class, - true, null); + final IRtfTableContainer tc + = (IRtfTableContainer)builderContext.getContainer( + IRtfTableContainer.class, true, null); builderContext.pushContainer(tc.newTable(atts, tableContext)); } catch (Exception e) { log.error("startTable:" + e.getMessage()); @@ -450,17 +446,17 @@ public class RTFHandler extends FOInputHandler { * * @param inl Inline that is starting. */ - public void startInline(Inline inl){ + public void startInline(Inline inl) { try { - RtfAttributes rtfAttr = - TextAttributesConverter.convertCharacterAttributes(inl.properties, null); + RtfAttributes rtfAttr + = TextAttributesConverter.convertCharacterAttributes(inl.properties, null); - IRtfTextrunContainer container = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true,this); + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, true, this); - RtfTextrun textrun=container.getTextrun(); + RtfTextrun textrun = container.getTextrun(); textrun.pushAttributes(rtfAttr); } catch (IOException ioe) { log.error("startInline:" + ioe.getMessage()); @@ -478,13 +474,13 @@ public class RTFHandler extends FOInputHandler { * * @param inl Inline that is ending. */ - public void endInline(Inline inl){ + public void endInline(Inline inl) { try { - IRtfTextrunContainer container = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true,this); + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, true, this); - RtfTextrun textrun=container.getTextrun(); + RtfTextrun textrun = container.getTextrun(); textrun.popAttributes(); } catch (IOException ioe) { log.error("startInline:" + ioe.getMessage()); @@ -703,16 +699,16 @@ public class RTFHandler extends FOInputHandler { try { - final IRtfTextrunContainer c = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true, this); + final IRtfTextrunContainer c + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, true, this); final RtfExternalGraphic newGraphic = c.getTextrun().newImage(); - Property p=null; + Property p = null; //get source file - if((p=eg.properties.get("src"))!=null) { + if ((p = eg.properties.get("src")) != null) { newGraphic.setURL (p.getString()); } else { log.error("The attribute 'src' of is required."); @@ -720,17 +716,17 @@ public class RTFHandler extends FOInputHandler { } //get scaling - if((p=eg.properties.get("scaling"))!=null) { - EnumProperty e=(EnumProperty)p; - if(p.getEnum()==Constants.UNIFORM) { + if ((p = eg.properties.get("scaling")) != null) { + EnumProperty e = (EnumProperty)p; + if (p.getEnum() == Constants.UNIFORM) { newGraphic.setScaling ("uniform"); } } //get width - if((p=eg.properties.get("width"))!=null) { - LengthProperty lengthProp=(LengthProperty)p; - if(lengthProp.getLength() instanceof FixedLength) { + if ((p = eg.properties.get("width")) != null) { + LengthProperty lengthProp = (LengthProperty)p; + if (lengthProp.getLength() instanceof FixedLength) { Float f = new Float(lengthProp.getLength().getValue() / 1000f); String sValue = f.toString() + "pt"; newGraphic.setWidth(sValue); @@ -738,9 +734,9 @@ public class RTFHandler extends FOInputHandler { } //get height - if((p=eg.properties.get("height"))!=null) { - LengthProperty lengthProp=(LengthProperty)p; - if(lengthProp.getLength() instanceof FixedLength) { + if ((p = eg.properties.get("height")) != null) { + LengthProperty lengthProp = (LengthProperty)p; + if (lengthProp.getLength() instanceof FixedLength) { Float f = new Float(lengthProp.getLength().getValue() / 1000f); String sValue = f.toString() + "pt"; newGraphic.setHeight(sValue); @@ -751,11 +747,12 @@ public class RTFHandler extends FOInputHandler { // int compression = m_context.m_options.getRtfExternalGraphicCompressionRate (); int compression = 0; if (compression != 0) { - if (! newGraphic.setCompressionRate (compression)) { - log.warn("The compression rate " + compression + " is invalid. The value has to be between 1 and 100 %."); + if (!newGraphic.setCompressionRate(compression)) { + log.warn("The compression rate " + compression + + " is invalid. The value has to be between 1 and 100 %."); } } - } catch(Exception e) { + } catch (Exception e) { log.error("image: " + e.getMessage()); } } @@ -787,13 +784,13 @@ public class RTFHandler extends FOInputHandler { /** * @see org.apache.fop.fo.FOInputHandler#characters(char[], int, int) */ - public void characters(char data[], int start, int length) { + public void characters(char[] data, int start, int length) { try { - IRtfTextrunContainer container = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true,this); + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, true, this); - RtfTextrun textrun=container.getTextrun(); + RtfTextrun textrun = container.getTextrun(); textrun.addString(new String(data, start, length)); } catch (IOException ioe) { // FIXME could we throw Exception in all FOInputHandler events? @@ -811,14 +808,15 @@ public class RTFHandler extends FOInputHandler { */ public void startPageNumber(PageNumber pagenum) { try { - RtfAttributes rtfAttr = - TextAttributesConverter.convertCharacterAttributes(pagenum.properties, null); + RtfAttributes rtfAttr + = TextAttributesConverter.convertCharacterAttributes( + pagenum.properties, null); - IRtfTextrunContainer container = - (IRtfTextrunContainer)builderContext.getContainer(IRtfTextrunContainer.class, - true,this); + IRtfTextrunContainer container + = (IRtfTextrunContainer)builderContext.getContainer( + IRtfTextrunContainer.class, true, this); - RtfTextrun textrun=container.getTextrun(); + RtfTextrun textrun = container.getTextrun(); textrun.addPageNumber(rtfAttr); } catch (IOException ioe) { log.error("startPageNumber:" + ioe.getMessage()); diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java index 650851e4b..037a45ec5 100644 --- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java @@ -115,12 +115,12 @@ public class TableAttributesConverter { * @throws ConverterException On convertion error */ static RtfAttributes convertTableAttributes(PropertyList properties) - throws FOPException { + throws FOPException { RtfAttributes attrib = new RtfAttributes(); - LengthProperty lengthProp=null; + LengthProperty lengthProp = null; // margin-left - lengthProp=(LengthProperty)properties.get("margin-left"); + lengthProp = (LengthProperty)properties.get("margin-left"); if (lengthProp != null) { Float f = new Float(lengthProp.getLength().getValue() / 1000f); final String sValue = f.toString() + "pt"; diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java index d8b8e0fab..4d71125cc 100644 --- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java @@ -50,23 +50,16 @@ package org.apache.fop.render.rtf; -//XML -import org.xml.sax.Attributes; - //FOP import org.apache.avalon.framework.logger.Logger; import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.EnumProperty; -import org.apache.fop.fo.expr.NCnameProperty; import org.apache.fop.fo.properties.Constants; import org.apache.fop.fo.LengthProperty; -import org.apache.fop.fo.ListProperty; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.Property; import org.apache.fop.fo.SpaceProperty; import org.apache.fop.fo.ColorTypeProperty; -import org.apache.fop.fo.NumberProperty; import org.apache.fop.datatypes.ColorType; //RTF @@ -123,8 +116,8 @@ class TextAttributesConverter { * @param props list of FO properites, which are to be converted * @param props list of default FO properites (usally null) */ - public static RtfAttributes convertCharacterAttributes(PropertyList props, PropertyList defProps) - throws FOPException { + public static RtfAttributes convertCharacterAttributes( + PropertyList props, PropertyList defProps) throws FOPException { RtfAttributes attrib = null; @@ -150,7 +143,8 @@ class TextAttributesConverter { String fopValue = properties.get("font-family").getString(); if (fopValue != null) { - rtfAttr.set(RtfText.ATTR_FONT_FAMILY, RtfFontManager.getInstance().getFontNumber(fopValue)); + rtfAttr.set(RtfText.ATTR_FONT_FAMILY, + RtfFontManager.getInstance().getFontNumber(fopValue)); } } @@ -161,8 +155,8 @@ class TextAttributesConverter { private static void attrBlockFontColor(PropertyList properties, RtfAttributes rtfAttr) { // Cell background color - ColorTypeProperty colorTypeProp=(ColorTypeProperty)properties.get("color"); - if(colorTypeProp != null) { + ColorTypeProperty colorTypeProp = (ColorTypeProperty)properties.get("color"); + if (colorTypeProp != null) { ColorType colorType = colorTypeProp.getColorType(); if (colorType != null) { if (colorType.getAlpha() != 0 @@ -192,7 +186,7 @@ class TextAttributesConverter { private static void attrBlockFontItalic(PropertyList properties, RtfAttributes rtfAttr) { String fopValue = properties.get("font-style").getString(); - if(fopValue.equals("italic")) { + if (fopValue.equals("italic")) { rtfAttr.set(RtfText.ATTR_ITALIC, 1); } else { rtfAttr.set(RtfText.ATTR_ITALIC, 0); @@ -200,8 +194,8 @@ class TextAttributesConverter { } private static void attrBlockFontUnderline(PropertyList properties, RtfAttributes rtfAttr) { - EnumProperty enumProp=(EnumProperty)properties.get("text-decoration"); - if(enumProp.getEnum()==Constants.UNDERLINE) { + EnumProperty enumProp = (EnumProperty)properties.get("text-decoration"); + if (enumProp.getEnum() == Constants.UNDERLINE) { rtfAttr.set(RtfText.ATTR_UNDERLINE, 1); } else { rtfAttr.set(RtfText.ATTR_UNDERLINE, 0); @@ -209,34 +203,36 @@ class TextAttributesConverter { } private static void attrBlockSpaceBeforeAfter(PropertyList properties, RtfAttributes rtfAttr) { - SpaceProperty spaceProp=null; + SpaceProperty spaceProp = null; //space-before - spaceProp=(SpaceProperty)properties.get("space-before"); - if(spaceProp!=null) { - Float f = new Float(spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f); + spaceProp = (SpaceProperty)properties.get("space-before"); + if (spaceProp != null) { + Float f = new Float( + spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f); String sValue = f.toString() + "pt"; try { rtfAttr.set( RtfText.SPACE_BEFORE, (int)FoUnitsConverter.getInstance().convertToTwips(sValue)); - } catch(FOPException fe) { + } catch (FOPException fe) { log.warn("attrBlockSpaceBeforeAfter: " + fe.getMessage()); } } //space-after - spaceProp=(SpaceProperty)properties.get("space-after"); - if(spaceProp!=null) { - Float f = new Float(spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f); + spaceProp = (SpaceProperty)properties.get("space-after"); + if (spaceProp != null) { + Float f = new Float( + spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f); String sValue = f.toString() + "pt"; try { rtfAttr.set( RtfText.SPACE_AFTER, (int)FoUnitsConverter.getInstance().convertToTwips(sValue)); - } catch(FOPException fe) { + } catch (FOPException fe) { log.warn("attrBlockSpaceBeforeAfter: " + fe.getMessage()); } } @@ -244,10 +240,10 @@ class TextAttributesConverter { private static void attrBlockMargins(PropertyList properties, RtfAttributes rtfAttr) { try { - LengthProperty lengthProp=null; + LengthProperty lengthProp = null; // margin-left - lengthProp=(LengthProperty)properties.get("margin-left"); + lengthProp = (LengthProperty)properties.get("margin-left"); if (lengthProp != null) { Float f = new Float(lengthProp.getLength().getValue() / 1000f); String sValue = f.toString() + "pt"; @@ -260,7 +256,7 @@ class TextAttributesConverter { } // margin-right - lengthProp=(LengthProperty)properties.get("margin-right"); + lengthProp = (LengthProperty)properties.get("margin-right"); if (lengthProp != null) { Float f = new Float(lengthProp.getLength().getValue() / 1000f); String sValue = f.toString() + "pt"; @@ -271,7 +267,7 @@ class TextAttributesConverter { } else { rtfAttr.set(RtfText.RIGHT_INDENT_BODY, 0); } - } catch(FOPException fe) { + } catch (FOPException fe) { log.warn("attrBlockSpaceBeforeAfter: " + fe.getMessage()); } } @@ -282,22 +278,18 @@ class TextAttributesConverter { int fopValue = properties.get("text-align").getEnum(); String rtfValue = null; switch (fopValue) { - case Constants.CENTER: { + case Constants.CENTER: rtfValue = RtfText.ALIGN_CENTER; break; - } - case Constants.END: { + case Constants.END: rtfValue = RtfText.ALIGN_RIGHT; break; - } - case Constants.JUSTIFY: { + case Constants.JUSTIFY: rtfValue = RtfText.ALIGN_JUSTIFIED; break; - } - default: { + default: rtfValue = RtfText.ALIGN_LEFT; break; - } } rtfAttr.set(rtfValue); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java index 93cae8e2c..01ee1326d 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java @@ -53,16 +53,9 @@ * This file is part of the RTF library of the FOP project. */ - package org.apache.fop.render.rtf.rtflib.rtfdoc; import java.io.IOException; -import java.io.Writer; -import java.util.LinkedList; -import java.util.List; -import java.util.Iterator; -import java.io.IOException; -import org.apache.fop.render.rtf.rtflib.exceptions.RtfStructureException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun; /** Interface which enables an implementing class to contain linear text runs. @@ -70,5 +63,5 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun; */ public interface IRtfTextrunContainer { - public RtfTextrun getTextrun() throws IOException; + RtfTextrun getTextrun() throws IOException; } 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 f46109b93..a4c562bb9 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 @@ -66,40 +66,40 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; */ public interface ITableAttributes { /** to process column spanning */ - public static final String COLUMN_SPAN = "number-columns-spanned"; + String COLUMN_SPAN = "number-columns-spanned"; /** to process row spanning */ - public static final String ROW_SPAN = "number-rows-spanned"; + String ROW_SPAN = "number-rows-spanned"; // RTF 1.5 attributes (word 97) /** half the space between the cells of a table row in twips */ - public static final String ATTR_RTF_15_TRGAPH = "trgaph"; - public static final String ATTR_ROW_LEFT_INDENT = "trleft"; + String ATTR_RTF_15_TRGAPH = "trgaph"; + String ATTR_ROW_LEFT_INDENT = "trleft"; // RTF 1.6 Row and table attributes /** table row padding, top */ - public static final String ATTR_ROW_PADDING_TOP = "trpaddt"; + String ATTR_ROW_PADDING_TOP = "trpaddt"; /** table row padding, bottom */ - public static final String ATTR_ROW_PADDING_BOTTOM = "trpaddb"; + String ATTR_ROW_PADDING_BOTTOM = "trpaddb"; /** table row padding, left */ - public static final String ATTR_ROW_PADDING_LEFT = "trpaddl"; + String ATTR_ROW_PADDING_LEFT = "trpaddl"; /** table row padding, right */ - public static final String ATTR_ROW_PADDING_RIGHT = "trpaddr"; + String ATTR_ROW_PADDING_RIGHT = "trpaddr"; /** table row padding, top */ - public static final String ATTR_ROW_U_PADDING_TOP = "trpaddft"; + String ATTR_ROW_U_PADDING_TOP = "trpaddft"; /** table row padding, bottom */ - public static final String ATTR_ROW_U_PADDING_BOTTOM = "trpaddfb"; + String ATTR_ROW_U_PADDING_BOTTOM = "trpaddfb"; /** table row padding, left */ - public static final String ATTR_ROW_U_PADDING_LEFT = "trpaddfl"; + String ATTR_ROW_U_PADDING_LEFT = "trpaddfl"; /** table row padding, right */ - public static final String ATTR_ROW_U_PADDING_RIGHT = "trpaddfr"; + String ATTR_ROW_U_PADDING_RIGHT = "trpaddfr"; /** * List of ALL ROW PADDING attributes, used to select them when writing * attributes */ - public static final String[] ATTRIB_ROW_PADDING = { + String[] ATTRIB_ROW_PADDING = { ATTR_ROW_PADDING_TOP, ATTR_ROW_U_PADDING_TOP, ATTR_ROW_PADDING_BOTTOM, ATTR_ROW_U_PADDING_BOTTOM, ATTR_ROW_PADDING_LEFT, ATTR_ROW_U_PADDING_LEFT, @@ -109,76 +109,76 @@ public interface ITableAttributes { // Cell attributes /** cell padding, top */ - public static final String ATTR_CELL_PADDING_TOP = "clpadt"; + String ATTR_CELL_PADDING_TOP = "clpadt"; /** cell padding, bottom */ - public static final String ATTR_CELL_PADDING_BOTTOM = "clpadb"; + String ATTR_CELL_PADDING_BOTTOM = "clpadb"; /** cell padding, left */ - public static final String ATTR_CELL_PADDING_LEFT = "clpadl"; + String ATTR_CELL_PADDING_LEFT = "clpadl"; /** cell padding, right */ - public static final String ATTR_CELL_PADDING_RIGHT = "clpadr"; + String ATTR_CELL_PADDING_RIGHT = "clpadr"; /** cell padding, top */ - public static final String ATTR_CELL_U_PADDING_TOP = "clpadft"; + String ATTR_CELL_U_PADDING_TOP = "clpadft"; /** cell padding, bottom */ - public static final String ATTR_CELL_U_PADDING_BOTTOM = "clpadfb"; + String ATTR_CELL_U_PADDING_BOTTOM = "clpadfb"; /** cell padding, left */ - public static final String ATTR_CELL_U_PADDING_LEFT = "clpadfl"; + String ATTR_CELL_U_PADDING_LEFT = "clpadfl"; /** cell padding, right */ - public static final String ATTR_CELL_U_PADDING_RIGHT = "clpadfr"; + String ATTR_CELL_U_PADDING_RIGHT = "clpadfr"; // for border style file /** cell border, top */ - public static final String CELL_BORDER_TOP = "clbrdrt"; + String CELL_BORDER_TOP = "clbrdrt"; /** cell border, bottom */ - public static final String CELL_BORDER_BOTTOM = "clbrdrb"; + String CELL_BORDER_BOTTOM = "clbrdrb"; /** cell border, left */ - public static final String CELL_BORDER_LEFT = "clbrdrl"; + String CELL_BORDER_LEFT = "clbrdrl"; /** cell border, right */ - public static final String CELL_BORDER_RIGHT = "clbrdrr"; + String CELL_BORDER_RIGHT = "clbrdrr"; //Table row border attributes /** row border, top */ - public static final String ROW_BORDER_TOP = "trbrdrt"; + String ROW_BORDER_TOP = "trbrdrt"; /** row border, bottom */ - public static final String ROW_BORDER_BOTTOM = "trbrdrb"; + String ROW_BORDER_BOTTOM = "trbrdrb"; /** row border, left */ - public static final String ROW_BORDER_LEFT = "trbrdrl"; + String ROW_BORDER_LEFT = "trbrdrl"; /** row border, right */ - public static final String ROW_BORDER_RIGHT = "trbrdrr"; + String ROW_BORDER_RIGHT = "trbrdrr"; /** row border, horizontal */ - public static final String ROW_BORDER_HORIZONTAL = "trbrdrh"; + String ROW_BORDER_HORIZONTAL = "trbrdrh"; /** row border, vertical */ - public static final String ROW_BORDER_VERTICAL = "trbrdrv"; + String ROW_BORDER_VERTICAL = "trbrdrv"; //Table row attributes /** row attribute, keep-together */ - public static final String ROW_KEEP_TOGETHER = "trkeep"; - public static final String ROW_HEIGHT = "trrh"; + String ROW_KEEP_TOGETHER = "trkeep"; + String ROW_HEIGHT = "trrh"; /** * This control word is nonexistent in RTF, used to simulate the * FO:keep-with-next attribute. */ - public static final String ROW_KEEP_WITH_NEXT = "knext"; + String ROW_KEEP_WITH_NEXT = "knext"; /** * This control word is nonexistent in RTF, used to simulate the * FO:keep-with-previous attribute. */ - public static final String ROW_KEEP_WITH_PREVIOUS = "kprevious"; + String ROW_KEEP_WITH_PREVIOUS = "kprevious"; /** cell shading, a unit-based attribute */ - public static final String CELL_SHADE = "clshdng"; + String CELL_SHADE = "clshdng"; /** cell background color, a unit-based attribute */ - public static final String CELL_COLOR_BACKGROUND = "clcbpat"; + String CELL_COLOR_BACKGROUND = "clcbpat"; /** cell foreground color, a unit-based attribute */ - public static final String CELL_COLOR_FOREGROUND = "clcfpat"; + String CELL_COLOR_FOREGROUND = "clcfpat"; /** * List of ALL CELL PADDING attributes, used to select them when writing * attributes */ - public static final String[] ATTRIB_CELL_PADDING = { + String[] ATTRIB_CELL_PADDING = { ATTR_CELL_PADDING_TOP, ATTR_CELL_U_PADDING_TOP, ATTR_CELL_PADDING_BOTTOM, ATTR_CELL_U_PADDING_BOTTOM, ATTR_CELL_PADDING_LEFT, ATTR_CELL_U_PADDING_LEFT, @@ -189,7 +189,7 @@ public interface ITableAttributes { * List of ALL CELL BORDER attributes, used to select them when writing * attributes */ - public static final String[] CELL_BORDER = { + String[] CELL_BORDER = { CELL_BORDER_TOP, CELL_BORDER_BOTTOM, CELL_BORDER_LEFT, CELL_BORDER_RIGHT }; @@ -198,7 +198,7 @@ public interface ITableAttributes { * List of ALL ROW BORDER attributes, used to select them when writing * attributes */ - public static final String[] ROW_BORDER = { + String[] ROW_BORDER = { ROW_BORDER_TOP, ROW_BORDER_BOTTOM, ROW_BORDER_LEFT, ROW_BORDER_RIGHT, ROW_BORDER_HORIZONTAL, ROW_BORDER_VERTICAL }; @@ -207,7 +207,7 @@ public interface ITableAttributes { * List of ALL CELL SHADING AND COLOR attributes, used to select them when * writing attributes */ - public static final String[] CELL_COLOR = { + String[] CELL_COLOR = { CELL_SHADE, CELL_COLOR_BACKGROUND, CELL_COLOR_FOREGROUND }; } \ No newline at end of file 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 f05f56b99..7d878c51f 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 @@ -244,7 +244,7 @@ extends RtfContainer { * @param args command-line arguments * @throws Exception for problems */ - public static void main(String args[]) + public static void main(String[] args) throws Exception { Writer w = null; if (args.length != 0) { 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 66a8a07c2..2d7f3507a 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 @@ -110,10 +110,10 @@ public class RtfPageNumberCitation extends RtfContainer { // Build page reference field String pageRef = RTF_FIELD_PAGEREF_MODEL; final int insertionIndex = pageRef.indexOf("}"); - pageRef = - pageRef.substring(0, insertionIndex) + "\"" + id + "\"" + " " - + pageRef.substring(insertionIndex, pageRef.length()) - ; + pageRef = pageRef.substring(0, insertionIndex) + + "\"" + id + + "\"" + " " + + pageRef.substring(insertionIndex, pageRef.length()); id = null; // Write RTF content diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java index 789199150..878542c83 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java @@ -90,7 +90,7 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, private boolean writeForBreak = false; /** Set of attributes that must be copied at the start of a paragraph */ - private static final String [] PARA_ATTRIBUTES = { "intbl" }; + private static final String[] PARA_ATTRIBUTES = {"intbl"}; /** Create an RTF paragraph as a child of given container with default attributes */ RtfParagraph(IRtfParagraphContainer parent, Writer w) throws IOException { diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java index 8ef95fe0c..ef8c7de6a 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java @@ -64,15 +64,14 @@ import java.io.Writer; * @author Peter Herweg, pherweg@web.de */ -public class RtfString extends RtfElement -{ - String text=""; +public class RtfString extends RtfElement { + private String text = ""; RtfString(RtfContainer parent, Writer w, String s) throws IOException { super(parent, w); - text=s; + text = s; } /** @@ -95,6 +94,6 @@ public class RtfString extends RtfElement } public void setText(String s) { - text=s; + text = s; } } \ 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 de11831ed..798db3401 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 @@ -130,8 +130,8 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer, if (parent.parent instanceof RtfTable) { // Get the context of the current table in order to get the width of each column - ITableColumnsInfo tableColumnsInfo = - ((RtfTable)parent.parent).getITableColumnsInfo(); + ITableColumnsInfo tableColumnsInfo + = ((RtfTable)parent.parent).getITableColumnsInfo(); tableColumnsInfo.selectFirstColumn(); // Reach the column index in table context corresponding to the current column cell @@ -481,7 +481,7 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer, RtfAttributes attrs = new RtfAttributes(); attrs.set("intbl"); - RtfTextrun textrun=RtfTextrun.getTextrun(this, writer, attrs); + RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, attrs); //Suppress the very last \par, because the closing \cell applies the //paragraph attributes. 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 d2031927d..5342bdaf1 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 @@ -184,7 +184,7 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes { writeAttributes(attrib, ITableAttributes.CELL_BORDER); writeAttributes(attrib, BorderAttributesConverter.BORDERS); - if(attrib.isSet(ITableAttributes.ROW_HEIGHT)) { + if (attrib.isSet(ITableAttributes.ROW_HEIGHT)) { writeOneAttribute( ITableAttributes.ROW_HEIGHT, attrib.getValue(ITableAttributes.ROW_HEIGHT)); @@ -214,9 +214,9 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes { nestedTableFound = true; indexesFound.addElement(new Integer(index)); } else if (subElement instanceof RtfParagraph) { - for (Iterator it3 = - ((RtfParagraph)subElement).getChildren().iterator(); it3.hasNext();) - { + for (Iterator it3 + = ((RtfParagraph)subElement).getChildren().iterator(); + it3.hasNext();) { final RtfElement subSubElement = (RtfElement)it3.next(); if (subSubElement instanceof RtfTable) { nestedTableFound = true; 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 aae0190d8..6279d997e 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 @@ -58,25 +58,23 @@ package org.apache.fop.render.rtf.rtflib.rtfdoc; import java.io.IOException; import java.io.Writer; -import java.util.LinkedList; import java.util.List; import java.util.Iterator; -import java.io.IOException; -import org.apache.fop.render.rtf.rtflib.exceptions.RtfStructureException; import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic; -/** Class which contains a linear text run. It has methods to add attributes, text, paragraph breaks.... - * @author Peter Herweg, pherweg@web.de +/** + * Class which contains a linear text run. It has methods to add attributes, + * text, paragraph breaks.... + * @author Peter Herweg, pherweg@web.de */ - public class RtfTextrun extends RtfContainer { - private boolean bSuppressLastPar=false; + private boolean bSuppressLastPar = false; /** Class which represents the opening of a RTF group mark.*/ - private class RtfOpenGroupMark extends RtfElement - { + private class RtfOpenGroupMark extends RtfElement { + RtfOpenGroupMark(RtfContainer parent, Writer w, RtfAttributes attr) - throws IOException { + throws IOException { super(parent, w, attr); } @@ -98,10 +96,10 @@ public class RtfTextrun extends RtfContainer { } /** Class which represents the closing of a RTF group mark.*/ - private class RtfCloseGroupMark extends RtfElement - { + private class RtfCloseGroupMark extends RtfElement { + RtfCloseGroupMark(RtfContainer parent, Writer w) - throws IOException { + throws IOException { super(parent, w); } @@ -122,10 +120,10 @@ public class RtfTextrun extends RtfContainer { } /** Class which represents a paragraph break.*/ - private class RtfParagraphBreak extends RtfElement - { + private class RtfParagraphBreak extends RtfElement { + RtfParagraphBreak(RtfContainer parent, Writer w) - throws IOException { + throws IOException { super(parent, w); } @@ -151,23 +149,23 @@ public class RtfTextrun extends RtfContainer { } public void pushAttributes(RtfAttributes attrs) throws IOException { - RtfOpenGroupMark r=new RtfOpenGroupMark(this, writer, attrs); + RtfOpenGroupMark r = new RtfOpenGroupMark(this, writer, attrs); } public void popAttributes() throws IOException { - RtfCloseGroupMark r=new RtfCloseGroupMark(this, writer); + RtfCloseGroupMark r = new RtfCloseGroupMark(this, writer); } public void addString(String s) throws IOException { - RtfString r=new RtfString(this, writer, s); + RtfString r = new RtfString(this, writer, s); } public void addParagraphBreak() throws IOException { - RtfParagraphBreak r=new RtfParagraphBreak(this, writer); + RtfParagraphBreak r = new RtfParagraphBreak(this, writer); } public void addPageNumber(RtfAttributes attr) throws IOException { - RtfPageNumber r=new RtfPageNumber(this, writer, attr); + RtfPageNumber r = new RtfPageNumber(this, writer, attr); } public RtfExternalGraphic newImage() throws IOException { @@ -182,23 +180,23 @@ public class RtfTextrun extends RtfContainer { * @throws IOException for I/O problems */ public static RtfTextrun getTextrun(RtfContainer container, Writer writer, RtfAttributes attrs) - throws IOException { + throws IOException { Object obj; - List list=container.getChildren(); + List list = container.getChildren(); - if(list.size()==0) { + if (list.size() == 0) { //add a new RtfTextrun - RtfTextrun textrun=new RtfTextrun(container, writer, attrs); + RtfTextrun textrun = new RtfTextrun(container, writer, attrs); list.add(textrun); return textrun; - } else if ((obj=list.get(list.size()-1)) instanceof RtfTextrun ) { + } else if ((obj = list.get(list.size() - 1)) instanceof RtfTextrun ) { //if the last child is a RtfTextrun, return it return (RtfTextrun)obj; } //add a new RtfTextrun as the last child - RtfTextrun textrun=new RtfTextrun(container, writer, attrs); + RtfTextrun textrun = new RtfTextrun(container, writer, attrs); list.add(textrun); return textrun; @@ -207,10 +205,9 @@ public class RtfTextrun extends RtfContainer { /** * specify, if the last paragraph control word (\par) should be suppressed. * @param bSuppress true, if the last \par should be suppressed - * @throws IOException for I/O problems */ public void setSuppressLastPar(boolean bSuppress) { - bSuppressLastPar=bSuppress; + bSuppressLastPar = bSuppress; } /** @@ -233,26 +230,26 @@ public class RtfTextrun extends RtfContainer { } //determine, if this RtfTextrun is the last child of its parent - boolean bLast=false; + boolean bLast = false; for (Iterator it = parent.getChildren().iterator(); it.hasNext();) { - if(it.next() == this) { - bLast=!it.hasNext(); + if (it.next() == this) { + bLast = !it.hasNext(); break; } } //get last RtfParagraphBreak, which is not followed by any visible child - RtfParagraphBreak lastParagraphBreak=null; - if(bLast) { + RtfParagraphBreak lastParagraphBreak = null; + if (bLast) { for (Iterator it = getChildren().iterator(); it.hasNext();) { final RtfElement e = (RtfElement)it.next(); - if(e instanceof RtfParagraphBreak) { - lastParagraphBreak=(RtfParagraphBreak)e; + if (e instanceof RtfParagraphBreak) { + lastParagraphBreak = (RtfParagraphBreak)e; } else { - if(!(e instanceof RtfOpenGroupMark) - && !(e instanceof RtfCloseGroupMark) - && e.isEmpty()) { - lastParagraphBreak=null; + if (!(e instanceof RtfOpenGroupMark) + && !(e instanceof RtfCloseGroupMark) + && e.isEmpty()) { + lastParagraphBreak = null; } } } @@ -276,26 +273,27 @@ public class RtfTextrun extends RtfContainer { * -If the RtfTextrun is the last child of its parent, write a * RtfParagraphBreak only, if it is not the last child. */ - boolean bHide=false; - bHide=bRtfParagraphBreak; - bHide=bHide && - (bPrevPar || bFirst || - (bSuppressLastPar && bLast && lastParagraphBreak!=null && e==lastParagraphBreak) - ); + boolean bHide = false; + bHide = bRtfParagraphBreak; + bHide = bHide + && (bPrevPar + || bFirst + || (bSuppressLastPar && bLast && lastParagraphBreak != null + && e == lastParagraphBreak)); - if( !bHide) { + if (!bHide) { e.writeRtf(); } - if(e instanceof RtfParagraphBreak) { - bPrevPar=true; - } else if(e instanceof RtfCloseGroupMark) { + if (e instanceof RtfParagraphBreak) { + bPrevPar = true; + } else if (e instanceof RtfCloseGroupMark) { //do nothing - } else if(e instanceof RtfOpenGroupMark) { + } else if (e instanceof RtfOpenGroupMark) { //do nothing } else { - bPrevPar=bPrevPar && e.isEmpty(); - bFirst=bFirst && e.isEmpty(); + bPrevPar = bPrevPar && e.isEmpty(); + bFirst = bFirst && e.isEmpty(); } } } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java index 98f1bed80..b0f58b8f9 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java @@ -89,16 +89,16 @@ class WhitespaceCollapser { /** process one RtfText from our container */ private void processText(RtfText txt) { - final String newString=processString(txt.getText()); - if(newString!=null) { + final String newString = processString(txt.getText()); + if (newString != null) { txt.setText(newString); } } /** process one RtfString from our container */ private void processString(RtfString txt) { - final String newString=processString(txt.getText()); - if(newString!=null) { + final String newString = processString(txt.getText()); + if (newString != null) { txt.setText(newString); } } @@ -109,7 +109,7 @@ class WhitespaceCollapser { // tokenize the text based on whitespace and regenerate it so as // to collapse multiple spaces into one - if(orig==null) { + if (orig == null) { return null; } else if (orig.length() > 0) { final boolean allSpaces = orig.trim().length() == 0; diff --git a/src/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java b/src/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java index c98ce3f51..8f398a80b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java @@ -119,7 +119,7 @@ public class CreateTestDocuments { * @param args String array of arguments * @throws Exception for errors */ - public static void main(String args[]) + public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("usage: CreateTestDocuments "); -- 2.39.5