]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Code conventions please! No tab characters, spacing etc.
authorJeremias Maerki <jeremias@apache.org>
Mon, 16 Jan 2006 09:50:28 +0000 (09:50 +0000)
committerJeremias Maerki <jeremias@apache.org>
Mon, 16 Jan 2006 09:50:28 +0000 (09:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@369410 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java

index 90d1cac21bfb69efa4bf7c060b966479f0d884b5..f1e4b4e86c28c05702c22d863d3a7129f3249321 100644 (file)
@@ -29,11 +29,9 @@ import org.apache.fop.fo.flow.TableCell;
 import org.apache.fop.fo.flow.TableHeader;
 import org.apache.fop.fo.flow.TableRow;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.apache.fop.fo.properties.Property;
 import org.apache.fop.render.rtf.BorderAttributesConverter;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableAttributes;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
-import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable;
 
 /**
  * Contributor(s):
@@ -80,7 +78,8 @@ public class TableAttributesConverter {
     static RtfAttributes convertTableAttributes(Table fobj)
             throws FOPException {
         FOPRtfAttributes attrib = new FOPRtfAttributes();
-        attrib.setTwips(ITableAttributes.ATTR_ROW_LEFT_INDENT, fobj.getCommonMarginBlock().marginLeft);
+        attrib.setTwips(ITableAttributes.ATTR_ROW_LEFT_INDENT, 
+                fobj.getCommonMarginBlock().marginLeft);
         return attrib;
     }
 
@@ -111,12 +110,12 @@ public class TableAttributesConverter {
     static RtfAttributes convertCellAttributes(TableCell fobj)
     throws FOPException {
 
-        Property p;
-        RtfColorTable colorTable = RtfColorTable.getInstance();
+        //Property p;
+        //RtfColorTable colorTable = RtfColorTable.getInstance();
         
         FOPRtfAttributes attrib = new FOPRtfAttributes();
 
-        boolean isBorderPresent = false;
+        //boolean isBorderPresent = false;
         CommonBorderPaddingBackground border = fobj.getCommonBorderPaddingBackground();
 
         // Cell background color
@@ -127,23 +126,23 @@ public class TableAttributesConverter {
             CommonBorderPaddingBackground brd = null;
             
             if (fobj.getParent() instanceof TableRow) {
-                TableRow parentRow=(TableRow)fobj.getParent();
+                TableRow parentRow = (TableRow)fobj.getParent();
                 brd = parentRow.getCommonBorderPaddingBackground();
                 color = brd.backgroundColor;
             } else if (fobj.getParent() instanceof TableHeader) {
-                TableHeader parentHeader=(TableHeader)fobj.getParent();
+                TableHeader parentHeader = (TableHeader)fobj.getParent();
                 brd = parentHeader.getCommonBorderPaddingBackground();
                 color = brd.backgroundColor;
             }
             
             if (color == null
-                               && fobj.getParent()!=null 
-                               && fobj.getParent().getParent()!=null 
-                               && fobj.getParent().getParent().getParent() instanceof Table) {
-               
-               Table table = (Table)fobj.getParent().getParent().getParent();
-               brd = table.getCommonBorderPaddingBackground();
-               color = brd.backgroundColor;
+                    && fobj.getParent() != null 
+                    && fobj.getParent().getParent() != null 
+                    && fobj.getParent().getParent().getParent() instanceof Table) {
+
+                Table table = (Table)fobj.getParent().getParent().getParent();
+                brd = table.getCommonBorderPaddingBackground();
+                color = brd.backgroundColor;
             }
             
             
@@ -226,8 +225,8 @@ public class TableAttributesConverter {
             RtfAttributes rtfatts)
     throws FOPException {
 
-        Property p;
-        RtfColorTable colorTable = RtfColorTable.getInstance();
+        //Property p;
+        //RtfColorTable colorTable = RtfColorTable.getInstance();
 
         RtfAttributes attrib = null;
 
@@ -237,8 +236,8 @@ public class TableAttributesConverter {
             attrib = rtfatts;
         }
 
-        String attrValue;
-        boolean isBorderPresent = false;
+        //String attrValue;
+        //boolean isBorderPresent = false;
         //need to set a default width
 
         //check for keep-together row attribute
index 65ac2eb49375ecaa77d25815d388653584ff6b80..e5a0bc1221ff6e76a9ef060f7c8e2e9e5c747d03 100644 (file)
@@ -105,10 +105,10 @@ public class RtfTable extends RtfContainer {
      * @throws IOException for I/O problems
      */
     protected void writeRtfPrefix() throws IOException {
-       if (isNestedTable()) {
-               writeControlWordNS("pard");
-       }
-       
+        if (isNestedTable()) {
+            writeControlWordNS("pard");
+        }
+
         writeGroupMark(true);   
     }
     
@@ -119,8 +119,8 @@ public class RtfTable extends RtfContainer {
     protected void writeRtfSuffix() throws IOException {
         writeGroupMark(false);
         
-        if(isNestedTable()) {
-               getRow().writeRowAndCellsDefintions();
+        if (isNestedTable()) {
+            getRow().writeRowAndCellsDefintions();
         }
     }
 
@@ -169,36 +169,37 @@ public class RtfTable extends RtfContainer {
         return super.getRtfAttributes();
     }
     
+    /** @return true if the the table is a nested table */
     public boolean isNestedTable() {
-       if (isNestedTable == null) {
-               RtfElement e=this;
-               while(e.parent != null) {
-                       if (e.parent instanceof RtfTableCell) {
-                               isNestedTable=new Boolean(true);
-                               return true;
-                       }
-                       
-                       e = e.parent;
-               }
-               
-               isNestedTable=new Boolean(false);
-       } else {
-               return isNestedTable.booleanValue();
-       }
-       
-       return false;
+        if (isNestedTable == null) {
+            RtfElement e = this;
+            while (e.parent != null) {
+                if (e.parent instanceof RtfTableCell) {
+                    isNestedTable = Boolean.TRUE;
+                    return true;
+                }
+
+                e = e.parent;
+            }
+
+            isNestedTable = Boolean.FALSE;
+        } else {
+            return isNestedTable.booleanValue();
+        }
+
+        return false;
     }
     
     public RtfTableRow getRow() {
-       RtfElement e=this;
-       while(e.parent != null) {
-               if (e.parent instanceof RtfTableRow) {
-                       return (RtfTableRow) e.parent;
-               }
-               
-               e = e.parent;
-       }
-       
-       return null;  
+        RtfElement e = this;
+        while (e.parent != null) {
+            if (e.parent instanceof RtfTableRow) {
+                return (RtfTableRow) e.parent;
+            }
+
+            e = e.parent;
+        }
+
+        return null;  
     }
 }
index 49fe9fd092c68e43fb3ccd38c7235a553267b4c3..11930b0a0163b044944e526c4b87cfc82fe46128 100644 (file)
@@ -35,9 +35,9 @@ import java.util.Iterator;
  */
 
 public class RtfTableCell
-extends RtfContainer
-implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
-       IRtfExternalGraphicContainer, IRtfTextrunContainer {
+        extends RtfContainer
+        implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
+            IRtfExternalGraphicContainer, IRtfTextrunContainer {
     private RtfParagraph paragraph;
     private RtfList list;
     private RtfTable table;
@@ -281,39 +281,37 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
      * @throws IOException for I/O problems
      */
     protected void writeRtfSuffix() throws IOException {
-       if (getRow().getTable().isNestedTable()) {
-               //nested table
-               writeControlWordNS("nestcell");
-               writeGroupMark(true);
-               writeControlWord("nonesttables");
-               writeControlWord("par");
-               writeGroupMark(false);
-       } else {
-               // word97 hangs if cell does not contain at least one "par" control word
-               // TODO this is what causes the extra spaces in nested table of test
-               //      004-spacing-in-tables.fo,
-               // but if is not here we generate invalid RTF for word97
-       
-               if (setCenter) {
-                   writeControlWord("qc");
-               } else if (setRight) {
-                   writeControlWord("qr");
-               } else {
-                   writeControlWord("ql");
-               }
-       
-       
-               
-               if (!containsText()) {
-                   writeControlWord("intbl");
-       
-                   //R.Marra this create useless paragraph
-                   //Seem working into Word97 with the "intbl" only
-       //            writeControlWord("par");
-               }
-       
-               writeControlWord("cell");
-       }
+        if (getRow().getTable().isNestedTable()) {
+            //nested table
+            writeControlWordNS("nestcell");
+            writeGroupMark(true);
+            writeControlWord("nonesttables");
+            writeControlWord("par");
+            writeGroupMark(false);
+        } else {
+            // word97 hangs if cell does not contain at least one "par" control word
+            // TODO this is what causes the extra spaces in nested table of test
+            //      004-spacing-in-tables.fo,
+            // but if is not here we generate invalid RTF for word97
+
+            if (setCenter) {
+                writeControlWord("qc");
+            } else if (setRight) {
+                writeControlWord("qr");
+            } else {
+                writeControlWord("ql");
+            }
+
+            if (!containsText()) {
+                writeControlWord("intbl");
+
+                //R.Marra this create useless paragraph
+                //Seem working into Word97 with the "intbl" only
+                //writeControlWord("par");
+            }
+
+            writeControlWord("cell");
+        }
     }
 
 
@@ -457,12 +455,11 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
         return result;
     }
     
-    public RtfTextrun getTextrun()
-    throws IOException {
+    public RtfTextrun getTextrun() throws IOException {
         RtfAttributes attrs = new RtfAttributes();
         
-        if(!getRow().getTable().isNestedTable()) {
-               attrs.set("intbl");
+        if (!getRow().getTable().isNestedTable()) {
+            attrs.set("intbl");
         }
         
         RtfTextrun textrun = RtfTextrun.getTextrun(this, writer, attrs);
@@ -475,15 +472,15 @@ implements IRtfParagraphContainer, IRtfListContainer, IRtfTableContainer,
     }
     
     public RtfTableRow getRow() {
-       RtfElement e=this;
-       while(e.parent != null) {
-               if (e.parent instanceof RtfTableRow) {
-                       return (RtfTableRow) e.parent;
-               }
-               
-               e = e.parent;
-       }
-       
-       return null;  
+        RtfElement e = this;
+        while (e.parent != null) {
+            if (e.parent instanceof RtfTableRow) {
+                return (RtfTableRow) e.parent;
+            }
+
+            e = e.parent;
+        }
+
+        return null;  
     }
 }
index d43cecc4aa21c9fecfdbd3c8d602bce8b9196da2..2c6402061a6b1de0a85c9eab368c753294d260a7 100644 (file)
@@ -132,26 +132,26 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
      */
     protected void writeRtfContent() throws IOException {
 
-       if (getTable().isNestedTable()) {
-               //nested table
-               writeControlWord("intbl");
-               writeControlWord("itap2");
-       } else {
-               //normal (not nested) table
-               writeRowAndCellsDefintions();
-       }
+        if (getTable().isNestedTable()) {
+            //nested table
+            writeControlWord("intbl");
+            writeControlWord("itap2");
+        } else {
+            //normal (not nested) table
+            writeRowAndCellsDefintions();
+        }
         // now children can write themselves, we have the correct RTF prefix code
         super.writeRtfContent();
     }
     
     public void writeRowAndCellsDefintions() throws IOException {
-//      render the row and cells definitions
+        // render the row and cells definitions
         writeControlWord("trowd");
         
         if (!getTable().isNestedTable()) {
-               writeControlWord("itap0");
+            writeControlWord("itap0");
         }
-               
+
         //check for keep-together
         if (attrib != null && attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
             writeControlWord(ROW_KEEP_TOGETHER);
@@ -251,22 +251,21 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
      * @throws IOException for I/O problems
      */
     protected void writeRtfSuffix() throws IOException {
-       if (getTable().isNestedTable()) {
-               //nested table
-               writeGroupMark(true);
-               writeStarControlWord("nesttableprops");
-               writeRowAndCellsDefintions();
-               writeControlWordNS("nestrow");
-               writeGroupMark(false);
-               
-               
-               writeGroupMark(true);
-               writeControlWord("nonesttables");
-               writeControlWord("par");
-               writeGroupMark(false);
-       } else {
-               writeControlWord("row");
-       }
+        if (getTable().isNestedTable()) {
+            //nested table
+            writeGroupMark(true);
+            writeStarControlWord("nesttableprops");
+            writeRowAndCellsDefintions();
+            writeControlWordNS("nestrow");
+            writeGroupMark(false);
+
+            writeGroupMark(true);
+            writeControlWord("nonesttables");
+            writeControlWord("par");
+            writeGroupMark(false);
+        } else {
+            writeControlWord("row");
+        }
 
         writeGroupMark(false);
     }
@@ -322,15 +321,15 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
     }
     
     public RtfTable getTable() {
-       RtfElement e=this;
-       while(e.parent != null) {
-               if (e.parent instanceof RtfTable) {
-                       return (RtfTable) e.parent;
-               }
-               
-               e = e.parent;
-       }
-       
-       return null;  
+        RtfElement e = this;
+        while (e.parent != null) {
+            if (e.parent instanceof RtfTable) {
+                return (RtfTable) e.parent;
+            }
+
+            e = e.parent;
+        }
+
+        return null;  
     }
 }