From: Glen Mazza Date: Sun, 9 Nov 2003 17:06:01 +0000 (+0000) Subject: Peter Herweg's latest patch applied: X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1014 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=79e31b059db22b84330ef22a91261f2b8baffbaa;p=xmlgraphics-fop.git Peter Herweg's latest patch applied: 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 --- diff --git a/src/java/org/apache/fop/fo/FOElementMapping.java b/src/java/org/apache/fop/fo/FOElementMapping.java index cb007c75c..17f01d51e 100644 --- a/src/java/org/apache/fop/fo/FOElementMapping.java +++ b/src/java/org/apache/fop/fo/FOElementMapping.java @@ -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) { diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index f299595ce..837ef549f 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -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)); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java index a4c562bb9..f9efe0e13 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java @@ -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 +} diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java index 09d4a9360..7b0fd6e06 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java @@ -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 +} diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java index 5342bdaf1..b4e4246e3 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java @@ -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); diff --git a/src/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java b/src/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java index 8590acc23..2708bf151 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java @@ -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 +}