]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Submitted by: Marc Wilhelm Kuester; added support for fo:list in fo:footnote; ensured...
authorPeter Herweg <pherweg@apache.org>
Tue, 20 Jan 2004 21:37:24 +0000 (21:37 +0000)
committerPeter Herweg <pherweg@apache.org>
Tue, 20 Jan 2004 21:37:24 +0000 (21:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197228 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java

index 3594655c1d3414b45c84b5ec6394d8b5ee078499..67f583f86b8b9f5c81324b84096a15320c1806ca 100644 (file)
@@ -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;
     }
index 7051b195a551b22515a8119f30f1a42b5d54a8de..b30518d1ca049efc349702db083065524e7f28ca 100644 (file)
@@ -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)
+    }
 }