/** 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;
}
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;
}
/** 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 {
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 */
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)
+ }
}