xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r369410 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf: TableAttributesConverter.java rtflib/rtfdoc/RtfTable.java rtflib/rtfdoc/RtfTableCell.java rtflib/rtfdoc/RtfTableRow.java
Date Mon, 16 Jan 2006 09:50:38 GMT
Author: jeremias
Date: Mon Jan 16 01:50:28 2006
New Revision: 369410

URL: http://svn.apache.org/viewcvs?rev=369410&view=rev
Log:
Code conventions please! No tab characters, spacing etc.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java?rev=369410&r1=369409&r2=369410&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
Mon Jan 16 01:50:28 2006
@@ -29,11 +29,9 @@
 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 @@
     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 @@
     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 @@
             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 @@
             RtfAttributes rtfatts)
     throws FOPException {
 
-        Property p;
-        RtfColorTable colorTable = RtfColorTable.getInstance();
+        //Property p;
+        //RtfColorTable colorTable = RtfColorTable.getInstance();
 
         RtfAttributes attrib = null;
 
@@ -237,8 +236,8 @@
             attrib = rtfatts;
         }
 
-        String attrValue;
-        boolean isBorderPresent = false;
+        //String attrValue;
+        //boolean isBorderPresent = false;
         //need to set a default width
 
         //check for keep-together row attribute

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java?rev=369410&r1=369409&r2=369410&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java Mon
Jan 16 01:50:28 2006
@@ -105,10 +105,10 @@
      * @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 @@
     protected void writeRtfSuffix() throws IOException {
         writeGroupMark(false);
         
-        if(isNestedTable()) {
-        	getRow().writeRowAndCellsDefintions();
+        if (isNestedTable()) {
+            getRow().writeRowAndCellsDefintions();
         }
     }
 
@@ -169,36 +169,37 @@
         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;  
     }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java?rev=369410&r1=369409&r2=369410&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java
Mon Jan 16 01:50:28 2006
@@ -35,9 +35,9 @@
  */
 
 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 @@
      * @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 @@
         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 @@
     }
     
     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;  
     }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java?rev=369410&r1=369409&r2=369410&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
Mon Jan 16 01:50:28 2006
@@ -132,26 +132,26 @@
      */
     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 @@
      * @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 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;  
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message