You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ph...@apache.org on 2004/01/20 22:37:25 UTC

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc RtfHeader.java RtfFootnote.java

pherweg     2004/01/20 13:37:25

  Modified:    src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
                        RtfHeader.java RtfFootnote.java
  Log:
  Submitted by: Marc Wilhelm Kuester; added support for fo:list in fo:footnote; ensured Word displays footnote, not endnote
  
  Revision  Changes    Path
  1.2       +15 -4     xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java
  
  Index: RtfHeader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfHeader.java	4 Nov 2003 23:59:11 -0000	1.1
  +++ RtfHeader.java	20 Jan 2004 21:37:24 -0000	1.2
  @@ -68,6 +68,7 @@
   /**  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 @@
           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 */
  @@ -126,5 +127,15 @@
       /** write to our Writer using an RtfStringConverter */
       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)
       }
   }
  
  
  
  1.2       +24 -7     xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java
  
  Index: RtfFootnote.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfFootnote.java	10 Jan 2004 19:43:58 -0000	1.1
  +++ RtfFootnote.java	20 Jan 2004 21:37:24 -0000	1.2
  @@ -60,23 +60,28 @@
   
   /**  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,9 +96,21 @@
           
           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() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org