vmote 2003/06/30 10:45:33 Modified: src/java/org/apache/fop/rtf/rtflib/rtfdoc IRtfPageNumberCitationContainer.java IRtfPageNumberContainer.java IRtfParagraphContainer.java IRtfParagraphKeepTogetherContainer.java IRtfTableContainer.java IRtfTextContainer.java IrtfTemplateContainer.java ParagraphKeeptogetherContext.java RtfAfter.java RtfAfterBeforeBase.java src/java/org/apache/fop/rtf/rtflib/testdocs BasicLink.java CreateTestDocuments.java DummyTableColumnsInfo.java ExternalGraphic.java ListInTable.java MergedTableCells.java NestedTable.java ParagraphAlignment.java SimpleDocument.java SimpleLists.java SimpleTable.java TestDocument.java TextAttributes.java Whitespace.java src/java/org/apache/fop/rtf/rtflib/tools ImageConstants.java ImageUtil.java Log: style changes only. Revision Changes Path 1.3 +3 -4 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfPageNumberCitationContainer.java Index: IRtfPageNumberCitationContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfPageNumberCitationContainer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IRtfPageNumberCitationContainer.java 29 Jun 2003 22:56:29 -0000 1.2 +++ IRtfPageNumberCitationContainer.java 30 Jun 2003 17:45:32 -0000 1.3 @@ -60,7 +60,6 @@ import java.io.IOException; -public interface IRtfPageNumberCitationContainer -{ - public RtfPageNumberCitation newPageNumberCitation(String id) throws IOException; +public interface IRtfPageNumberCitationContainer { + RtfPageNumberCitation newPageNumberCitation(String id) throws IOException; } 1.3 +3 -4 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfPageNumberContainer.java Index: IRtfPageNumberContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfPageNumberContainer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IRtfPageNumberContainer.java 29 Jun 2003 22:56:29 -0000 1.2 +++ IRtfPageNumberContainer.java 30 Jun 2003 17:45:32 -0000 1.3 @@ -60,7 +60,6 @@ import java.io.IOException; -public interface IRtfPageNumberContainer -{ - public RtfPageNumber newPageNumber() throws IOException; +public interface IRtfPageNumberContainer { + RtfPageNumber newPageNumber() throws IOException; } 1.3 +4 -5 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfParagraphContainer.java Index: IRtfParagraphContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfParagraphContainer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IRtfParagraphContainer.java 29 Jun 2003 22:56:29 -0000 1.2 +++ IRtfParagraphContainer.java 30 Jun 2003 17:45:32 -0000 1.3 @@ -64,12 +64,11 @@ * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -public interface IRtfParagraphContainer -{ +public interface IRtfParagraphContainer { /** close current paragraph if any and start a new one with default attributes */ - public RtfParagraph newParagraph() throws IOException; + RtfParagraph newParagraph() throws IOException; /** close current paragraph if any and start a new one with specified attributes */ - public RtfParagraph newParagraph(RtfAttributes attr) throws IOException; + RtfParagraph newParagraph(RtfAttributes attr) throws IOException; } 1.3 +2 -2 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfParagraphKeepTogetherContainer.java Index: IRtfParagraphKeepTogetherContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfParagraphKeepTogetherContainer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IRtfParagraphKeepTogetherContainer.java 29 Jun 2003 22:56:29 -0000 1.2 +++ IRtfParagraphKeepTogetherContainer.java 30 Jun 2003 17:45:32 -0000 1.3 @@ -63,5 +63,5 @@ public interface IRtfParagraphKeepTogetherContainer { /** close current paragraph if any and start a new one */ - public RtfParagraphKeepTogether newParagraphKeepTogether() throws IOException; + RtfParagraphKeepTogether newParagraphKeepTogether() throws IOException; } 1.6 +6 -6 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfTableContainer.java Index: IRtfTableContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfTableContainer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- IRtfTableContainer.java 30 Jun 2003 00:20:07 -0000 1.5 +++ IRtfTableContainer.java 30 Jun 2003 17:45:32 -0000 1.6 @@ -65,13 +65,13 @@ * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -public interface IRtfTableContainer -{ +public interface IRtfTableContainer { /** close current table if any and start a new one */ - public RtfTable newTable(ITableColumnsInfo tc) throws IOException; + RtfTable newTable(ITableColumnsInfo tc) throws IOException; /** close current table if any and start a new one - * @param tc added by Boris Poudérous on july 2002 in order to process number-columns-spanned attribute + * @param tc added by Boris Poudérous on july 2002 in order to process + * number-columns-spanned attribute **/ - public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException; + RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException; } 1.3 +6 -7 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfTextContainer.java Index: IRtfTextContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfTextContainer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IRtfTextContainer.java 29 Jun 2003 22:56:29 -0000 1.2 +++ IRtfTextContainer.java 30 Jun 2003 17:45:32 -0000 1.3 @@ -64,23 +64,22 @@ * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -public interface IRtfTextContainer -{ +public interface IRtfTextContainer { /** close current text run if any and start a new one with specified attributes * @param str if not null, added to the RtfText created */ - public RtfText newText(String str,RtfAttributes attr) throws IOException; + RtfText newText(String str, RtfAttributes attr) throws IOException; /** close current text run if any and start a new one with default attributes * @param str if not null, added to the RtfText created */ - public RtfText newText(String str) throws IOException; + RtfText newText(String str) throws IOException; /** add a line break */ - public void newLineBreak() throws IOException; + void newLineBreak() throws IOException; /** text containers usually provide default attributes for all texts that they contain. * This returns a copy of the container's attributes */ - public RtfAttributes getTextContainerAttributes(); + RtfAttributes getTextContainerAttributes(); } 1.4 +2 -2 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java Index: IrtfTemplateContainer.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IrtfTemplateContainer.java 30 Jun 2003 00:20:07 -0000 1.3 +++ IrtfTemplateContainer.java 30 Jun 2003 17:45:32 -0000 1.4 @@ -68,7 +68,7 @@ * * @exception IOException on error */ - public RtfTemplate newTemplate (String str, RtfAttributes attr) throws IOException; + RtfTemplate newTemplate (String str, RtfAttributes attr) throws IOException; } 1.4 +14 -9 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java Index: ParagraphKeeptogetherContext.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ParagraphKeeptogetherContext.java 30 Jun 2003 00:20:07 -0000 1.3 +++ ParagraphKeeptogetherContext.java 30 Jun 2003 17:45:32 -0000 1.4 @@ -67,8 +67,8 @@ public class ParagraphKeeptogetherContext { - private static int m_paraKeepTogetherOpen=0; - private static boolean m_paraResetProperties=false; + private static int m_paraKeepTogetherOpen = 0; + private static boolean m_paraResetProperties = false; private static ParagraphKeeptogetherContext m_instance = null; ParagraphKeeptogetherContext() { @@ -81,11 +81,15 @@ * @return The instance of ParagraphKeeptogetherContext */ public static ParagraphKeeptogetherContext getInstance() { - if (m_instance==null) m_instance = new ParagraphKeeptogetherContext(); + if (m_instance == null) { + m_instance = new ParagraphKeeptogetherContext(); + } return m_instance; } - /** Return the level of current "keep whith next" paragraph */ + /** + * @return the level of current "keep whith next" paragraph + */ public static int getKeepTogetherOpenValue() { return m_paraKeepTogetherOpen; } @@ -97,12 +101,13 @@ /** Close a "keep whith next" paragraph */ public static void KeepTogetherClose() { - if(m_paraKeepTogetherOpen > 0) { + if (m_paraKeepTogetherOpen > 0) { m_paraKeepTogetherOpen--; - //If the \pard control word is not present, the current paragraph inherits all paragraph properties. + //If the \pard control word is not present, the current paragraph + //inherits all paragraph properties. //Also the next paragraph must reset the properties otherwise the \keepn don't stop. - m_paraResetProperties= (m_paraKeepTogetherOpen==0); + m_paraResetProperties = (m_paraKeepTogetherOpen == 0); } } @@ -113,7 +118,7 @@ /** Reset the flag if the paragraph properties have been resested */ public static void setParagraphResetPropertiesUsed() { - m_paraResetProperties=false; + m_paraResetProperties = false; } } 1.3 +5 -5 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfAfter.java Index: RtfAfter.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfAfter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RtfAfter.java 29 Jun 2003 22:56:29 -0000 1.2 +++ RtfAfter.java 30 Jun 2003 17:45:32 -0000 1.3 @@ -64,16 +64,16 @@ /** RtfContainer that encloses footers */ public class RtfAfter extends RtfAfterBeforeBase { /**RtfBefore attributes*/ - public final static String FOOTER = "footer"; - public final static String[] FOOTER_ATTR = new String[]{ + public static final String FOOTER = "footer"; + public static final String[] FOOTER_ATTR = new String[]{ FOOTER }; RtfAfter(RtfSection parent, Writer w, RtfAttributes attrs) throws IOException { - super(parent,w,attrs); + super(parent, w, attrs); } protected void writeMyAttributes() throws IOException { - writeAttributes(m_attrib,FOOTER_ATTR); + writeAttributes(m_attrib, FOOTER_ATTR); } } 1.5 +21 -16 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfAfterBeforeBase.java Index: RtfAfterBeforeBase.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfAfterBeforeBase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RtfAfterBeforeBase.java 29 Jun 2003 22:56:29 -0000 1.4 +++ RtfAfterBeforeBase.java 30 Jun 2003 17:45:32 -0000 1.5 @@ -59,8 +59,6 @@ package org.apache.fop.rtf.rtflib.rtfdoc; import java.io.Writer; -import java.io.*; -import java.util.*; import java.io.IOException; import org.apache.fop.rtf.rtflib.interfaces.ITableColumnsInfo; @@ -72,45 +70,51 @@ abstract class RtfAfterBeforeBase extends RtfContainer -implements IRtfParagraphContainer, IRtfExternalGraphicContainer,IRtfTableContainer { +implements IRtfParagraphContainer, IRtfExternalGraphicContainer, IRtfTableContainer { protected RtfAttributes m_attrib; private RtfParagraph m_para; private RtfExternalGraphic m_externalGraphic; private RtfTable m_table; RtfAfterBeforeBase(RtfSection parent, Writer w, RtfAttributes attrs) throws IOException { - super((RtfContainer)parent,w,attrs); + super((RtfContainer)parent, w, attrs); m_attrib = attrs; } public RtfParagraph newParagraph() throws IOException { closeAll(); - m_para = new RtfParagraph(this,m_writer); + m_para = new RtfParagraph(this, m_writer); return m_para; } public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException { closeAll(); - m_para = new RtfParagraph(this,m_writer,attrs); + m_para = new RtfParagraph(this, m_writer, attrs); return m_para; } public RtfExternalGraphic newImage() throws IOException { closeAll(); - m_externalGraphic = new RtfExternalGraphic(this,m_writer); + m_externalGraphic = new RtfExternalGraphic(this, m_writer); return m_externalGraphic; } private void closeCurrentParagraph() throws IOException { - if(m_para!=null) m_para.close(); + if (m_para != null) { + m_para.close(); + } } private void closeCurrentExternalGraphic() throws IOException { - if(m_externalGraphic!=null) m_externalGraphic.close(); + if (m_externalGraphic != null) { + m_externalGraphic.close(); + } } private void closeCurrentTable() throws IOException { - if(m_table != null) m_table.close(); + if (m_table != null) { + m_table.close(); + } } protected void writeRtfPrefix() throws IOException { @@ -119,13 +123,13 @@ } /** must be implemented to write the header or footer attributes */ - abstract protected void writeMyAttributes() throws IOException; + protected abstract void writeMyAttributes() throws IOException; protected void writeRtfSuffix() throws IOException { writeGroupMark(false); } - public RtfAttributes getAttributes(){ + public RtfAttributes getAttributes() { return m_attrib; } @@ -136,18 +140,19 @@ } /** close current table if any and start a new one - * @param tc added by Boris Poudérous on july 2002 in order to process number-columns-spanned attribute + * @param tc added by Boris Poudérous on july 2002 in order to process + * number-columns-spanned attribute */ public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException { closeAll(); - m_table = new RtfTable(this,m_writer,attrs,tc); + m_table = new RtfTable(this, m_writer, attrs, tc); return m_table; } /** close current table if any and start a new one */ public RtfTable newTable(ITableColumnsInfo tc) throws IOException { closeAll(); - m_table = new RtfTable(this,m_writer,tc); + m_table = new RtfTable(this, m_writer, tc); return m_table; } } 1.4 +9 -8 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/BasicLink.java Index: BasicLink.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/BasicLink.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- BasicLink.java 30 Jun 2003 00:20:08 -0000 1.3 +++ BasicLink.java 30 Jun 2003 17:45:33 -0000 1.4 @@ -58,7 +58,11 @@ package org.apache.fop.rtf.rtflib.testdocs; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfHyperLink; + import java.io.IOException; /** @@ -67,8 +71,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Putz</a> */ -public class BasicLink extends TestDocument -{ +public class BasicLink extends TestDocument { ////////////////////////////////////////////////// // @@ Construction ////////////////////////////////////////////////// @@ -76,13 +79,11 @@ /** * Default constructor. */ - public BasicLink() - { + public BasicLink() { } /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException - { + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { RtfParagraph p = sect.newParagraph (); p.newLineBreak(); p.newLineBreak(); 1.6 +10 -9 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/CreateTestDocuments.java Index: CreateTestDocuments.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/CreateTestDocuments.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CreateTestDocuments.java 30 Jun 2003 00:20:08 -0000 1.5 +++ CreateTestDocuments.java 30 Jun 2003 17:45:33 -0000 1.6 @@ -71,7 +71,7 @@ public static final String TESTDOCS_PACKAGE = "org.apache.fop.rtf.rtflib.testdocs"; /** List of all TestDocument subclasses from this package */ - private final static String [] classNames = { + private static final String [] classNames = { "SimpleDocument", "TextAttributes", "SimpleTable", @@ -87,24 +87,25 @@ CreateTestDocuments(File outDir) throws Exception { - if(!outDir.isDirectory() || !outDir.canWrite()) { + if (!outDir.isDirectory() || !outDir.canWrite()) { throw new IOException("output directory (" + outDir + ") must exist and be writable"); } - for(int i=0; i < classNames.length; i++) { - createOneTestDocument(classNames[i],outDir); + for (int i = 0; i < classNames.length; i++) { + createOneTestDocument(classNames[i], outDir); } } /** instantiate one TestDocument and let it generate its document */ - void createOneTestDocument(String className,File outDir) + void createOneTestDocument(String className, File outDir) throws Exception { className = TESTDOCS_PACKAGE + "." + className; TestDocument td = null; try { td = (TestDocument)Class.forName(className).newInstance(); - } catch(Exception e) { - throw new Exception("unable to instantiate '" + className + " as a TestDocument object: " + e); + } catch (Exception e) { + throw new Exception("unable to instantiate '" + className + + " as a TestDocument object: " + e); } td.setOutputDir(outDir); td.generateOutput(); @@ -113,7 +114,7 @@ /** execute this to create test documents from all classes listed in classNames array */ public static void main(String args[]) throws Exception { - if(args.length < 1) { + if (args.length < 1) { System.err.println("usage: CreateTestDocuments <output directory>"); System.exit(1); } 1.4 +2 -3 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/DummyTableColumnsInfo.java Index: DummyTableColumnsInfo.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/DummyTableColumnsInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DummyTableColumnsInfo.java 29 Jun 2003 22:56:31 -0000 1.3 +++ DummyTableColumnsInfo.java 30 Jun 2003 17:45:33 -0000 1.4 @@ -68,8 +68,7 @@ * @author [EMAIL PROTECTED] */ -class DummyTableColumnsInfo implements ITableColumnsInfo -{ +class DummyTableColumnsInfo implements ITableColumnsInfo { public float getColumnWidth() { return INVALID_COLUM_WIDTH; 1.4 +10 -13 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ExternalGraphic.java Index: ExternalGraphic.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ExternalGraphic.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ExternalGraphic.java 30 Jun 2003 00:20:08 -0000 1.3 +++ ExternalGraphic.java 30 Jun 2003 17:45:33 -0000 1.4 @@ -69,8 +69,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Putz</a> */ -class ExternalGraphic extends TestDocument -{ +class ExternalGraphic extends TestDocument { private String file = "file:///tmp/jfor-images/logo."; ////////////////////////////////////////////////// @@ -80,13 +79,11 @@ /** * Default constructor. */ - public ExternalGraphic () - { + public ExternalGraphic () { } /** generate the body of the test document */ - protected void generateDocument (RtfDocumentArea rda, RtfSection sect) throws IOException - { + protected void generateDocument (RtfDocumentArea rda, RtfSection sect) throws IOException { RtfParagraph p = sect.newParagraph (); p.newLineBreak(); p.newLineBreak(); @@ -99,7 +96,7 @@ p.newLineBreak(); p.close(); - p = sect.newParagraph( ); + p = sect.newParagraph(); p.newLineBreak(); p.newText ("PNG image with 150 % width"); p.newLineBreak(); @@ -109,7 +106,7 @@ p.newLineBreak(); p.close(); - p = sect.newParagraph( ); + p = sect.newParagraph(); p.newLineBreak(); p.newLineBreak(); p.newText ("JPG image with width = 200px and height = 20 px"); @@ -121,11 +118,11 @@ p.newLineBreak(); p.close(); - p = sect.newParagraph( ); + p = sect.newParagraph(); p.newLineBreak(); p.newLineBreak(); - p.newText ("GIF image with width = 200px and scaling = 'uniform', that means the image " + - "size will adjusted automatically"); + p.newText ("GIF image with width = 200px and scaling = 'uniform', that means the image " + + "size will adjusted automatically"); p.newLineBreak(); RtfExternalGraphic imageD = sect.newImage (); imageD.setURL (file + "gif"); @@ -134,7 +131,7 @@ p.newLineBreak(); p.close(); - p = sect.newParagraph( ); + p = sect.newParagraph(); p.newLineBreak(); p.newLineBreak(); p.newText ("GIF image"); 1.3 +25 -17 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ListInTable.java Index: ListInTable.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ListInTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ListInTable.java 29 Jun 2003 22:56:31 -0000 1.2 +++ ListInTable.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,43 +58,51 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfList; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableRow; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfListItem; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; /** Generates a simple RTF test document for the jfor rtflib package. */ -class ListInTable extends TestDocument -{ +class ListInTable extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { - sect.newParagraph().newText("There must be a table below where the second cell contains a bulleted list mixed with normal paragraphs"); + sect.newParagraph().newText("There must be a table below where the " + + "second cell contains a bulleted list mixed with normal paragraphs"); final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); final RtfTableRow row = tbl.newTableRow(); row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell A, simple"); final RtfTableCell c = row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH); - c.newParagraph().newText("cell B, contains this paragraph followed by a list and another paragraph"); - fillList(c.newList(null),1,3); + c.newParagraph().newText("cell B, contains this paragraph followed by " + + "a list and another paragraph"); + fillList(c.newList(null), 1, 3); c.newParagraph().newText("Normal paragraph, follows the list."); row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell C, simple"); } - private void fillList(RtfList list,int listIndex,int nItems) - throws IOException - { - for(int i=0; i < nItems; i++) { + private void fillList(RtfList list, int listIndex, int nItems) + throws IOException { + for (int i = 0; i < nItems; i++) { final RtfListItem item = list.newListItem(); - for(int j=0; j <= i; j++) { + for (int j = 0; j <= i; j++) { final RtfParagraph para = item.newParagraph(); para.newText("List " + listIndex + ", item " + i + ", paragraph " + j); - if(i==0 && j==0) { + if (i == 0 && j == 0) { final String txt = "This item takes more than one line to check word-wrapping."; - para.newText(". " + "This list must have " + nItems + " items. " + txt + " " + txt + " " + txt); + para.newText(". " + "This list must have " + nItems + + " items. " + txt + " " + txt + " " + txt); } } } 1.3 +14 -9 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/MergedTableCells.java Index: MergedTableCells.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/MergedTableCells.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MergedTableCells.java 29 Jun 2003 22:56:31 -0000 1.2 +++ MergedTableCells.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,18 +58,21 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableRow; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableCell; /** Generates an RTF test document containing merged table cells * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -class MergedTableCells extends TestDocument -{ +class MergedTableCells extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { sect.newParagraph().newText("This document contains a table with some merged cells."); @@ -81,7 +84,8 @@ RtfTableRow r = tbl.newTableRow(); RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); c.setHMerge(c.MERGE_START); - c.newParagraph().newText("cell 0,0, width 80mm, merge start, followed by two merged cells totalling 80mm width."); + c.newParagraph().newText("cell 0,0, width 80mm, merge start, " + + "followed by two merged cells totalling 80mm width."); c = r.newTableCell(40 * MM_TO_TWIPS); c.setHMerge(c.MERGE_WITH_PREVIOUS); @@ -137,7 +141,8 @@ // fifth row, just one cell { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(160 * MM_TO_TWIPS).newParagraph().newText("cell 4,0, width 160mm, only cell in this row"); + r.newTableCell(160 * MM_TO_TWIPS).newParagraph().newText + ("cell 4,0, width 160mm, only cell in this row"); } } } 1.3 +58 -30 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/NestedTable.java Index: NestedTable.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/NestedTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NestedTable.java 29 Jun 2003 22:56:31 -0000 1.2 +++ NestedTable.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,9 +58,15 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableRow; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableCell; + /** Generates an RTF document to test nested tables with the jfor rtflib package. * @author Bertrand Delacretaz [EMAIL PROTECTED] */ @@ -69,9 +75,10 @@ private static final int MM_TO_TWIPS = (int)(1440f / 25.4f); /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { - sect.newParagraph().newText("This document demonstrates pseudo-nested tables created using merged table cells"); + sect.newParagraph().newText("This document demonstrates pseudo-nested " + + "tables created using merged table cells"); firstTestTable(sect); RtfParagraph p = sect.newParagraph(); @@ -102,21 +109,27 @@ // second row contains nested table { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 1,0, width 40mm, to the left of nested table."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText + ("cell 1,0, width 40mm, to the left of nested table."); final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); - c.newParagraph().newText("cell 1,1, width 80mm, this text is followed by a nested table in the same cell, followed by text that says 'AFTER NESTED TABLE'."); - fillNestedTable(c.newTable(new DummyTableColumnsInfo()),1); + c.newParagraph().newText("cell 1,1, width 80mm, this text is " + + "followed by a nested table in the same cell, followed " + + "by text that says 'AFTER NESTED TABLE'."); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 1); c.newParagraph().newText("AFTER NESTED TABLE"); - r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 1,2, width 40mm, to the right of nested table."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText + ("cell 1,2, width 40mm, to the right of nested table."); } // third row, normal { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 2,0, width 80mm, this row has two cells."); - r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 2,1, width 80mm, last cell."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText + ("cell 2,0, width 80mm, this row has two cells."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText + ("cell 2,1, width 80mm, last cell."); } } @@ -129,65 +142,80 @@ { RtfTableRow r = tbl.newTableRow(); RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS); - c.newParagraph().newText("second test table: cell 0,0, width 160mm, only cell in this row."); + c.newParagraph().newText("second test table: cell 0,0, width 160mm, " + + "only cell in this row."); } // second row contains nested table { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 1,0, width 40mm, to the left of nested tables."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText + ("cell 1,0, width 40mm, to the left of nested tables."); final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); - c.newParagraph().newText("cell 1,1, width 80mm, this text is followed by a nested table in the same cell, followed by text that says 'BETWEEN', then another table, then 'AFTER'."); - fillNestedTable(c.newTable(new DummyTableColumnsInfo()),2); + c.newParagraph().newText("cell 1,1, width 80mm, this text is " + + "followed by a nested table in the same cell, followed " + + "by text that says 'BETWEEN', then another table, then 'AFTER'."); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 2); c.newParagraph().newText("BETWEEN"); - fillNestedTable(c.newTable(new DummyTableColumnsInfo()),3); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 3); c.newParagraph().newText("AFTER"); - r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 1,2, width 40mm, to the right of nested table."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText + ("cell 1,2, width 40mm, to the right of nested table."); } // third row, normal { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 2,0, width 80mm, this row has two cells."); - r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 2,1, width 80mm, last cell."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText + ("cell 2,0, width 80mm, this row has two cells."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText + ("cell 2,1, width 80mm, last cell."); } } private void thirdTestTable(RtfSection sect) throws IOException { - sect.newParagraph().newText("Third test: table with two nested tables in cell 1,1 and one nested table in cell 0,1"); + sect.newParagraph().newText("Third test: table with two nested tables " + + "in cell 1,1 and one nested table in cell 0,1"); final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); // first row, normal { RtfTableRow r = tbl.newTableRow(); RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); - c.newParagraph().newText("third test table: cell 0,0, width 40mm, the cell to its right contains a nested table with no other text."); + c.newParagraph().newText("third test table: cell 0,0, width 40mm, " + + "the cell to its right contains a nested table with no other text."); c = r.newTableCell(80 * MM_TO_TWIPS); - fillNestedTable(c.newTable(new DummyTableColumnsInfo()),4); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 4); } // second row contains nested table { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 1,0, width 40mm, to the left of nested tables."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText + ("cell 1,0, width 40mm, to the left of nested tables."); final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); - c.newParagraph().newText("cell 1,1, width 80mm, this text is followed by a nested table in the same cell, followed by text that says 'BETWEEN', then another table, then 'AFTER'."); - fillNestedTable(c.newTable(new DummyTableColumnsInfo()),5); + c.newParagraph().newText("cell 1,1, width 80mm, this text is " + + "followed by a nested table in the same cell, followed " + + "by text that says 'BETWEEN', then another table, then 'AFTER'."); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 5); c.newParagraph().newText("BETWEEN"); - fillNestedTable(c.newTable(new DummyTableColumnsInfo()),6); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 6); c.newParagraph().newText("AFTER"); - r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 1,2, width 40mm, to the right of nested table."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText + ("cell 1,2, width 40mm, to the right of nested table."); } // third row, normal { RtfTableRow r = tbl.newTableRow(); - r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 2,0, width 80mm, this row has two cells."); - r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 2,1, width 80mm, last cell."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText + ("cell 2,0, width 80mm, this row has two cells."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText + ("cell 2,1, width 80mm, last cell."); } } 1.4 +3 -6 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ParagraphAlignment.java Index: ParagraphAlignment.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ParagraphAlignment.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ParagraphAlignment.java 30 Jun 2003 00:20:09 -0000 1.3 +++ ParagraphAlignment.java 30 Jun 2003 17:45:33 -0000 1.4 @@ -60,7 +60,6 @@ import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; -import org.apache.fop.rtf.rtflib.rtfdoc.RtfExternalGraphic; import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; import org.apache.fop.rtf.rtflib.rtfdoc.RtfText; import org.apache.fop.rtf.rtflib.rtfdoc.RtfAttributes; @@ -68,11 +67,9 @@ /** Generates a simple RTF test document for the jfor rtflib package. * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -public class ParagraphAlignment extends TestDocument -{ +public class ParagraphAlignment extends TestDocument { - public ParagraphAlignment() - { + public ParagraphAlignment() { } protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws java.io.IOException { 1.3 +9 -8 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleDocument.java Index: SimpleDocument.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleDocument.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SimpleDocument.java 29 Jun 2003 22:56:31 -0000 1.2 +++ SimpleDocument.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,25 +58,26 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; /** Generates a simple RTF test document for the jfor rtflib package. * @author Bertrand Delacretaz [EMAIL PROTECTED] */ class SimpleDocument -extends TestDocument -{ +extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { sect.newParagraph().newText("First paragraph of the simple RTF test document."); final RtfParagraph para = sect.newParagraph(); para.newText("Second paragraph of simple RTF test document.\n"); - for(int i=0; i < 242; i++) { + for (int i = 0; i < 242; i++) { para.newText("This is string " + i); para.newLineBreak(); } 1.3 +23 -18 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java Index: SimpleLists.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleLists.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SimpleLists.java 29 Jun 2003 22:56:31 -0000 1.2 +++ SimpleLists.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,45 +58,50 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfList; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfListItem; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; /** Generates a simple RTF test document for the jfor rtflib package. * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -class SimpleLists extends TestDocument -{ +class SimpleLists extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { sect.newParagraph().newText("First paragraph of the 'SimpleLists' RTF test document."); sect.newParagraph().newText("First bulleted list with 5 items."); - makeList(sect,1,5,null); + makeList(sect, 1, 5, null); sect.newParagraph().newText("Normal paragraph between lists 1 and 2."); - makeList(sect,2,3,null); + makeList(sect, 2, 3, null); sect.newParagraph().newText("Normal paragraph after list 2."); sect.newParagraph().newText("Now a numbered list (4 items):"); final RtfList.NumberingStyle nn = new RtfList.NumberingStyle(); nn.isBulletedList = false; - makeList(sect,3,4,nn); + makeList(sect, 3, 4, nn); } - private void makeList(RtfSection sect,int listIndex,int nItems,RtfList.NumberingStyle ns) - throws IOException - { + private void makeList(RtfSection sect, int listIndex, int nItems, RtfList.NumberingStyle ns) + throws IOException { final RtfList list = sect.newList(null); - if(ns != null) list.setNumberingStyle(ns); - for(int i=0; i < nItems; i++) { + if (ns != null) { + list.setNumberingStyle(ns); + } + for (int i = 0; i < nItems; i++) { final RtfListItem item = list.newListItem(); - for(int j=0; j <= i; j++) { + for (int j = 0; j <= i; j++) { final RtfParagraph para = item.newParagraph(); para.newText("List " + listIndex + ", item " + i + ", paragraph " + j); - if(i==0 && j==0) { + if (i == 0 && j == 0) { final String txt = "This item takes more than one line to check word-wrapping."; - para.newText(". " + "This list should have " + nItems + " items. " + txt + " " + txt + " " + txt); + para.newText(". " + "This list should have " + nItems + + " items. " + txt + " " + txt + " " + txt); } } } 1.3 +17 -11 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleTable.java Index: SimpleTable.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/SimpleTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SimpleTable.java 29 Jun 2003 22:56:31 -0000 1.2 +++ SimpleTable.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,16 +58,20 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableRow; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfTableCell; /** Generates a simple RTF test document for the jfor rtflib package. * @author Bertrand Delacretaz [EMAIL PROTECTED] */ class SimpleTable extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); final int MAX_ROW = 2; @@ -75,18 +79,20 @@ final int INCH_TO_TWIPS = 1440; final int c1w = 4; - tbl.newTableRow().newTableCell(c1w * INCH_TO_TWIPS).newParagraph().newText("Here's a table row with just one cell, width " + c1w + "''"); + tbl.newTableRow().newTableCell(c1w * INCH_TO_TWIPS).newParagraph().newText + ("Here's a table row with just one cell, width " + c1w + "''"); - for(int row=0; row < MAX_ROW; row++) { + for (int row = 0; row < MAX_ROW; row++) { final RtfTableRow r = tbl.newTableRow(); - for(int col=0; col < MAX_COL; col++) { + for (int col = 0; col < MAX_COL; col++) { final float widthInInches = col / 2f + 1f; final int widthInTwips = (int)(widthInInches * INCH_TO_TWIPS); final RtfTableCell c = r.newTableCell(widthInTwips); - c.newParagraph().newText("(" + row + "," + col + "), width " + widthInInches + "''"); - if(row==0 && col==1) { - for(int i=0; i < 4; i++) { + c.newParagraph().newText("(" + row + "," + col + "), width " + + widthInInches + "''"); + if (row == 0 && col == 1) { + for (int i = 0; i < 4; i++) { c.newParagraph().newText("additional paragraph " + i + " of cell 0,1"); } } 1.5 +18 -16 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/TestDocument.java Index: TestDocument.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/TestDocument.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestDocument.java 29 Jun 2003 22:56:31 -0000 1.4 +++ TestDocument.java 30 Jun 2003 17:45:33 -0000 1.5 @@ -59,8 +59,14 @@ package org.apache.fop.rtf.rtflib.testdocs; import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.File; +import java.io.IOException; +import java.io.FileWriter; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfFile; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; //import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo; /** Base class for generating RTF documents used to test the jfor rtflib package. @@ -71,13 +77,11 @@ private File m_output; final void setOutputDir(File outDir) - throws IOException - { - m_output = new File(outDir,getRtfFilename()); + throws IOException { + m_output = new File(outDir, getRtfFilename()); } - final String getRtfFilename() - { + final String getRtfFilename() { // use class name for output filename final String name = getClass().getName(); final int pos = name.lastIndexOf('.'); @@ -85,26 +89,24 @@ } final void generateOutput() - throws IOException - { + throws IOException { debugMsg("Generating document " + m_output + "..."); final RtfFile f = new RtfFile(new FileWriter(m_output)); final RtfDocumentArea rda = f.startDocumentArea(); final RtfSection sect = rda.newSection(); addIntroComments(sect); - generateDocument(rda,sect); + generateDocument(rda, sect); f.flush(); } - protected abstract void generateDocument(RtfDocumentArea rda,RtfSection sect) throws IOException; + protected abstract void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException; - void debugMsg(String msg) - { + void debugMsg(String msg) { System.err.println(msg); } - protected void addIntroComments(RtfSection sect) throws IOException - { + protected void addIntroComments(RtfSection sect) throws IOException { final RtfParagraph para = sect.newParagraph(); para.newText("jfor RTF library test document."); 1.3 +16 -13 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/TextAttributes.java Index: TextAttributes.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/TextAttributes.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TextAttributes.java 29 Jun 2003 22:56:32 -0000 1.2 +++ TextAttributes.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,27 +58,30 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfText; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfAttributes; /** Generates a simple RTF test document for the jfor rtflib package. * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -class TextAttributes extends TestDocument -{ +class TextAttributes extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { final RtfParagraph para = sect.newParagraph(); para.newText("This is normal\n"); - para.newText("This is bold\n",new RtfAttributes().set(RtfText.ATTR_BOLD)); - para.newText("This is italic\n",new RtfAttributes().set(RtfText.ATTR_ITALIC)); - para.newText("This is underline\n",new RtfAttributes().set(RtfText.ATTR_UNDERLINE)); + para.newText("This is bold\n", new RtfAttributes().set(RtfText.ATTR_BOLD)); + para.newText("This is italic\n", new RtfAttributes().set(RtfText.ATTR_ITALIC)); + para.newText("This is underline\n", new RtfAttributes().set(RtfText.ATTR_UNDERLINE)); // RTF font sizes are in half-points - para.newText("This is size 48\n",new RtfAttributes().set(RtfText.ATTR_FONT_SIZE,96)); + para.newText("This is size 48\n", new RtfAttributes().set(RtfText.ATTR_FONT_SIZE, 96)); para.newText( "This is bold and italic\n", @@ -88,8 +91,8 @@ final RtfAttributes attr = new RtfAttributes(); attr.set(RtfText.ATTR_BOLD).set(RtfText.ATTR_ITALIC); attr.set(RtfText.ATTR_UNDERLINE); - attr.set(RtfText.ATTR_FONT_SIZE,72); - para.newText("This is bold, italic, underline and size 36\n",attr); + attr.set(RtfText.ATTR_FONT_SIZE, 72); + para.newText("This is bold, italic, underline and size 36\n", attr); para.newText("This is back to normal\n"); } 1.3 +12 -9 xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/Whitespace.java Index: Whitespace.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/Whitespace.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Whitespace.java 29 Jun 2003 22:56:32 -0000 1.2 +++ Whitespace.java 30 Jun 2003 17:45:33 -0000 1.3 @@ -58,21 +58,23 @@ package org.apache.fop.rtf.rtflib.testdocs; -import java.util.Date; -import java.io.*; -import org.apache.fop.rtf.rtflib.rtfdoc.*; +import java.io.IOException; + +import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph; /** Generates an RTF document to test the WhitespaceCollapser * @author Bertrand Delacretaz [EMAIL PROTECTED] */ -class Whitespace extends TestDocument -{ +class Whitespace extends TestDocument { /** generate the body of the test document */ - protected void generateDocument(RtfDocumentArea rda,RtfSection sect) + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { final RtfParagraph p1 = sect.newParagraph(); - p1.newText("\t Each word of this paragraph must be separated\tfrom\t\n\tthe next word with exactly\t \tone"); + p1.newText("\t Each word of this paragraph must be " + + "separated\tfrom\t\n\tthe next word with exactly\t \tone"); p1.newText(" space."); final RtfParagraph p2 = sect.newParagraph(); @@ -83,7 +85,8 @@ p2.newText(" there must\tbe \t"); p2.newText("exactly"); p2.newText(" one space "); - p2.newText("between each\tword and the next, and no spaces at the beginning or end of the paragraph."); + p2.newText("between each\tword and the next, and no spaces at the " + + "beginning or end of the paragraph."); final RtfParagraph p3 = sect.newParagraph(); p3.newText("The word 'boomerang' must be written after this with no funny spacing: "); 1.5 +5 -8 xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageConstants.java Index: ImageConstants.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageConstants.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ImageConstants.java 30 Jun 2003 00:20:09 -0000 1.4 +++ ImageConstants.java 30 Jun 2003 17:45:33 -0000 1.5 @@ -65,8 +65,7 @@ * @author [EMAIL PROTECTED] (Andreas Putz) */ -public class ImageConstants -{ +public class ImageConstants { ////////////////////////////////////////////////// // @@ Symbolic constants ////////////////////////////////////////////////// @@ -107,12 +106,11 @@ /** Defines the file extensions and the RTF property belongs to */ public static Hashtable SUPPORTED_IMAGE_TYPES = new Hashtable (); - static - { + static { SUPPORTED_IMAGE_TYPES.put (EMF_EXT, new Integer (I_EMF)); SUPPORTED_IMAGE_TYPES.put (PNG_EXT, new Integer (I_PNG)); SUPPORTED_IMAGE_TYPES.put (JPG_EXT, new Integer (I_JPG_C)); - SUPPORTED_IMAGE_TYPES.put (JPEG_EXT,new Integer (I_JPG_C)); + SUPPORTED_IMAGE_TYPES.put (JPEG_EXT, new Integer (I_JPG_C)); SUPPORTED_IMAGE_TYPES.put (GIF_EXT, new Integer (I_GIF)); } @@ -123,7 +121,6 @@ /** * Private constructor. */ - private ImageConstants() - { + private ImageConstants() { } } 1.5 +32 -60 xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageUtil.java Index: ImageUtil.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageUtil.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ImageUtil.java 30 Jun 2003 00:20:09 -0000 1.4 +++ ImageUtil.java 30 Jun 2003 17:45:33 -0000 1.5 @@ -62,8 +62,7 @@ * This class belongs to the <fo:external-graphic> tag processing. * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Putz</a> */ -public class ImageUtil -{ +public class ImageUtil { ////////////////////////////////////////////////// // @@ Construction @@ -72,8 +71,7 @@ /** * Private constructor. */ - private ImageUtil () - { + private ImageUtil () { } @@ -90,26 +88,20 @@ * -1 There is no digit\n * number The digits as integer */ - public static int getInt (String value) - { + public static int getInt (String value) { String retString = new String (); StringBuffer s = new StringBuffer (value); int len = s.length (); - for (int i = 0; i < len; i++) - { - if (Character.isDigit (s.charAt (i))) - { + for (int i = 0; i < len; i++) { + if (Character.isDigit (s.charAt (i))) { retString += s.charAt (i); } } - if (retString.length () == 0) - { + if (retString.length () == 0) { return -1; - } - else - { + } else { return Integer.parseInt (retString); } } @@ -123,10 +115,8 @@ * true The string contains a % value * false Other string */ - public static boolean isPercent (String value) - { - if (value.endsWith ("%")) - { + public static boolean isPercent (String value) { + if (value.endsWith ("%")) { return true; } @@ -147,46 +137,35 @@ * false If different */ public static boolean compareHexValues (byte[] pattern, byte[] data, int searchAt, - boolean searchForward) - { - if (searchAt >= data.length) - { + boolean searchForward) { + if (searchAt >= data.length) { return false; } int pLen = pattern.length; - if (searchForward) - { - if (pLen >= (data.length - searchAt)) - { + if (searchForward) { + if (pLen >= (data.length - searchAt)) { return false; } - for (int i = 0; i < pLen; i++) - { - if (pattern[i] != data[searchAt + i]) - { + for (int i = 0; i < pLen; i++) { + if (pattern[i] != data[searchAt + i]) { return false; } } return true; - } - else - { - if (pLen > (searchAt + 1)) - { + } else { + if (pLen > (searchAt + 1)) { return false; } - for (int i = 0; i < pLen; i++) - { - if (pattern[pLen - i - 1] != data[searchAt - i]) - { + for (int i = 0; i < pLen; i++) { + if (pattern[pLen - i - 1] != data[searchAt - i]) { return false; } } @@ -205,49 +184,42 @@ * @return A number */ public static int getIntFromByteArray (byte[] data, int startAt, int length, - boolean searchForward) - { + boolean searchForward) { int bit = 8; int bitMoving = length * bit; int retVal = 0; - if (startAt >= data.length) - { + if (startAt >= data.length) { return retVal; } - if (searchForward) - { - if (length >= (data.length - startAt)) - { + if (searchForward) { + if (length >= (data.length - startAt)) { return retVal; } - for (int i = 0; i < length; i++) - { + for (int i = 0; i < length; i++) { bitMoving -= bit; int iData = (int) data[startAt + i]; - if (iData < 0) + if (iData < 0) { iData += 256; + } retVal += iData << bitMoving; } - } - else - { - if (length > (startAt + 1)) - { + } else { + if (length > (startAt + 1)) { return retVal; } - for (int i = 0; i < length; i++) - { + for (int i = 0; i < length; i++) { bitMoving -= bit; int iData = (int) data[startAt - i]; - if (iData < 0) + if (iData < 0) { iData += 256; + } retVal += iData << bitMoving; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]