From: Peter Herweg Date: Tue, 20 Jan 2004 21:37:24 +0000 (+0000) Subject: Submitted by: Marc Wilhelm Kuester; added support for fo:list in fo:footnote; ensured... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~904 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59989e5fbecdfad6c7b0389ce9d19321406fe1a4;p=xmlgraphics-fop.git Submitted by: Marc Wilhelm Kuester; added support for fo:list in fo:footnote; ensured Word displays footnote, not endnote git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197228 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java index 3594655c1..67f583f86 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java @@ -60,23 +60,28 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun; /** Model of an RTF footnote * @author Peter Herweg, pherweg@web.de + * @author Marc Wilhelm Kuester */ public class RtfFootnote extends RtfContainer - implements IRtfTextrunContainer { + implements IRtfTextrunContainer, IRtfListContainer { RtfTextrun textrunInline = null; - RtfTextrun textrunBody = null; + RtfContainer body = null; + RtfList list = null; boolean bBody = false; /** Create an RTF list item as a child of given container with default attributes */ RtfFootnote(RtfContainer parent, Writer w) throws IOException { super(parent, w); textrunInline = new RtfTextrun(this, writer, null); - textrunBody = new RtfTextrun(this, writer, null); + body = new RtfContainer(this, writer); } public RtfTextrun getTextrun() throws IOException { if (bBody) { - return textrunBody; + RtfTextrun textrun = RtfTextrun.getTextrun(body, writer, null); + textrun.setSuppressLastPar(true); + + return textrun; } else { return textrunInline; } @@ -91,11 +96,23 @@ public class RtfFootnote extends RtfContainer writeGroupMark(true); writeControlWord("footnote"); - writeControlWord("ftnalt"); - textrunBody.writeRtfContent(); + writeControlWord("ftnallt"); + + body.writeRtfContent(); + writeGroupMark(false); } + public RtfList newList(RtfAttributes attrs) throws IOException { + if (list != null) { + list.close(); + } + + list = new RtfList(body, writer, attrs); + + return list; + } + public void startBody() { bBody = true; } diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java index 7051b195a..b30518d1c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java @@ -68,6 +68,7 @@ import java.io.IOException; /** RTF file header, contains style, font and other document-level information. * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch * @author Andreas Putz a.putz@skynamics.com + * @author Marc Wilhelm Kuester */ class RtfHeader extends RtfContainer { @@ -87,9 +88,9 @@ class RtfHeader extends RtfContainer { writeUserProperties(); RtfColorTable.getInstance().writeColors(this); super.writeRtfContent(); - RtfTemplate.getInstance().writeTemplate(this); - RtfStyleSheetTable.getInstance().writeStyleSheet(this); - + RtfTemplate.getInstance().writeTemplate(this); + RtfStyleSheetTable.getInstance().writeStyleSheet(this); + writeFootnoteProperties(); } /** write user properties if any */ @@ -127,4 +128,14 @@ class RtfHeader extends RtfContainer { void writeRtfString(String toWrite) throws IOException { RtfStringConverter.getInstance().writeRtfString(writer, toWrite); } + + /** + *write properties for footnote handling + */ + private void writeFootnoteProperties() throws IOException { + writeControlWord("fet0"); //footnotes, not endnotes + writeControlWord("ftnbj"); //place footnotes at the end of the + //page (should be the default, but + //Word 2000 thinks otherwise) + } }