]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Peter Herweg's latest patch applied:
authorGlen Mazza <gmazza@apache.org>
Sun, 9 Nov 2003 17:06:01 +0000 (17:06 +0000)
committerGlen Mazza <gmazza@apache.org>
Sun, 9 Nov 2003 17:06:01 +0000 (17:06 +0000)
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24533

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197002 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/FOElementMapping.java
src/java/org/apache/fop/render/rtf/RTFHandler.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
src/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java

index cb007c75c18ac1e4c087fd9a9ecab6e61e1ac7ce..17f01d51e66aa0bd3412720ace2147e223a325e4 100644 (file)
@@ -124,7 +124,7 @@ public class FOElementMapping extends ElementMapping {
             foObjs.put("table", new Ta());
             foObjs.put("table-column", new TC());
             foObjs.put("table-caption", new TCaption());
-            foObjs.put("table-header", new TB());
+            foObjs.put("table-header", new TH());
             foObjs.put("table-footer", new TB());
             foObjs.put("table-body", new TB());
             foObjs.put("table-row", new TR());
@@ -373,6 +373,12 @@ public class FOElementMapping extends ElementMapping {
             return new org.apache.fop.fo.flow.TableBody(parent);
         }
     }
+    
+    static class TH extends ElementMapping.Maker {
+        public FONode make(FONode parent) {
+            return new org.apache.fop.fo.flow.TableHeader(parent);
+        }
+    }
 
     static class TR extends ElementMapping.Maker {
         public FONode make(FONode parent) {
index f299595ce5607a837299e87f1bb3a6db6e4285ad..837ef549f59ef3704707a76d685169f2e9fa9d97 100644 (file)
@@ -73,6 +73,7 @@ import org.apache.fop.fo.flow.Table;
 import org.apache.fop.fo.flow.TableColumn;
 import org.apache.fop.fo.flow.TableBody;
 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.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
@@ -81,6 +82,7 @@ import org.apache.fop.fo.properties.Constants;
 import org.apache.fop.fo.Property;
 import org.apache.fop.fo.LengthProperty;
 import org.apache.fop.apps.Document;
+import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableAttributes;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfAfterContainer;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfBeforeContainer;
 import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfTextrunContainer;
@@ -117,8 +119,6 @@ public class RTFHandler extends FOInputHandler {
     private final Logger log = new ConsoleLogger();
     private RtfSection sect;
     private RtfDocumentArea docArea;
-    //private RtfParagraph para; //never used
-    private boolean warned = false;
     private boolean bPrevHeaderSpecified = false;//true, if there has been a
                                                  //header in any page-sequence
     private boolean bPrevFooterSpecified = false;//true, if there has been a
@@ -242,11 +242,6 @@ public class RTFHandler extends FOInputHandler {
                     contAfter.newAfter(attr);
                 }
 
-                // print ALPHA_WARNING
-                if (!warned) {
-                    sect.newParagraph().newText(ALPHA_WARNING);
-                    warned = true;
-                }
             } else if (fl.getFlowName().equals("xsl-region-before")) {
                 bHeaderSpecified = true;
                 bPrevHeaderSpecified = true;
@@ -529,10 +524,12 @@ public class RTFHandler extends FOInputHandler {
             final RtfTable tbl = (RtfTable)builderContext.getContainer(RtfTable.class,
                     true, null);
 
-            RtfAttributes tblAttribs = tbl.getRtfAttributes();
-            RtfAttributes tblRowAttribs = new RtfAttributes();
             RtfAttributes atts = TableAttributesConverter.convertRowAttributes(tr.properties,
                     tbl.getHeaderAttribs());
+                    
+            if(tr.getParent() instanceof TableHeader) {
+                atts.set(ITableAttributes.ATTR_HEADER);
+            }
 
             builderContext.pushContainer(tbl.newTableRow(atts));
 
index a4c562bb91401e34576f11bdfb243745286a9800..f9efe0e13c124d6169b8ddf21211fd20539a81b5 100644 (file)
@@ -75,6 +75,9 @@ public interface ITableAttributes {
     /** half the space between the cells of a table row in twips */
     String ATTR_RTF_15_TRGAPH = "trgaph";
     String ATTR_ROW_LEFT_INDENT = "trleft";
+    
+    /** table row header */
+    public final String ATTR_HEADER = "trhdr";
 
 // RTF 1.6 Row and table attributes
     /** table row padding, top */
@@ -210,4 +213,4 @@ public interface ITableAttributes {
     String[] CELL_COLOR = {
         CELL_SHADE,    CELL_COLOR_BACKGROUND,    CELL_COLOR_FOREGROUND
     };
-}
\ No newline at end of file
+}
index 09d4a9360ca75e3c44e17dc81aab0c280708e23c..7b0fd6e06f0b9fe8760abbf28b509dddd23b4b13 100644 (file)
@@ -100,9 +100,9 @@ public class RtfJforCmd extends RtfContainer {
             final String cmd = (String)it.next();
 
             if (cmd.equals(PARA_KEEP_ON)) {
-                paragraphKeeptogetherContext.keepTogetherOpen();
+                ParagraphKeeptogetherContext.keepTogetherOpen();
             } else if (cmd.equals(PARA_KEEP_OFF)) {
-                  paragraphKeeptogetherContext.keepTogetherClose();
+                ParagraphKeeptogetherContext.keepTogetherClose();
             } else {
 //                this.getRtfFile ().getLog ().logInfo
 //                        ("JFOR-CMD ignored, command not recognised:"+cmd);
@@ -113,4 +113,4 @@ public class RtfJforCmd extends RtfContainer {
 
     }
 
-}
\ No newline at end of file
+}
index 5342bdaf14b829115a711edea875c88348bb91ef..b4e4246e32b1975e4e0451a06f7cd47cc5bed3ba 100644 (file)
@@ -180,6 +180,7 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
         final RtfTable parentTable = (RtfTable) parent;
         adjustBorderProperties(parentTable);
 
+        writeAttributes(attrib,new String[]{ITableAttributes.ATTR_HEADER});
         writeAttributes(attrib, ITableAttributes.ROW_BORDER);
         writeAttributes(attrib, ITableAttributes.CELL_BORDER);
         writeAttributes(attrib, BorderAttributesConverter.BORDERS);
index 8590acc23c56a4c613828a94f85631363b987808..2708bf151ea3ccf05e998b6a1f24c173872c2ff1 100644 (file)
@@ -84,16 +84,16 @@ class MergedTableCells extends TestDocument {
         {
             RtfTableRow r = tbl.newTableRow();
             RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
-            c.setHMerge(c.MERGE_START);
+            c.setHMerge(RtfTableCell.MERGE_START);
             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);
+            c.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
             c.newParagraph().newText("THIS IS IN AN HMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
 
             c = r.newTableCell(40 * MM_TO_TWIPS);
-            c.setHMerge(c.MERGE_WITH_PREVIOUS);
+            c.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
             c.newParagraph().newText("THIS IS IN AN HMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
         }
 
@@ -101,13 +101,13 @@ class MergedTableCells extends TestDocument {
         {
             RtfTableRow r = tbl.newTableRow();
             RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS);
-            c.setVMerge(c.MERGE_START);
+            c.setVMerge(RtfTableCell.MERGE_START);
             c.newParagraph().newText("cell 1,0, vertical merge start, 40mm, spans three rows.");
 
             r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 1,1, no merge, 80mm");
 
             c = r.newTableCell(40 * MM_TO_TWIPS);
-            c.setVMerge(c.MERGE_START);
+            c.setVMerge(RtfTableCell.MERGE_START);
             c.newParagraph().newText("cell 1,2, vertical merge start, 40mm, spans two rows.");
         }
 
@@ -115,14 +115,14 @@ class MergedTableCells extends TestDocument {
         {
             RtfTableRow r = tbl.newTableRow();
             RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS);
-            c.setVMerge(c.MERGE_WITH_PREVIOUS);
+            c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
             c.newParagraph().newText("cell 2,0, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
 
             r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 2,1, no merge, 40mm");
             r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 2,2, no merge, 40mm");
 
             c = r.newTableCell(40 * MM_TO_TWIPS);
-            c.setVMerge(c.MERGE_WITH_PREVIOUS);
+            c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
             c.newParagraph().newText("cell 2,3, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
         }
 
@@ -130,7 +130,7 @@ class MergedTableCells extends TestDocument {
         {
             RtfTableRow r = tbl.newTableRow();
             RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS);
-            c.setVMerge(c.MERGE_WITH_PREVIOUS);
+            c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
             c.newParagraph().newText("cell 3,0, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
 
             r.newTableCell(10 * MM_TO_TWIPS).newParagraph().newText("cell 3,1, no merge, 10mm");
@@ -146,4 +146,4 @@ class MergedTableCells extends TestDocument {
                     ("cell 4,0, width 160mm, only cell in this row");
         }
     }
-}
\ No newline at end of file
+}