jeremias    2003/11/22 09:40:14

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to