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 je...@apache.org on 2003/11/22 18:11:15 UTC

cvs commit: xml-fop/src/java/org/apache/fop/render/rtf/rtflib/testdocs SimpleLists.java

jeremias    2003/11/22 09:11:14

  Modified:    src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
                        RtfList.java RtfTextrun.java RtfFile.java
                        RtfListItem.java RtfListTable.java
               src/java/org/apache/fop/render/rtf RTFHandler.java
               src/java/org/apache/fop/fo/flow ListItemLabel.java
                        ListItem.java ListBlock.java
               src/java/org/apache/fop/render/rtf/rtflib/testdocs
                        SimpleLists.java
  Added:       src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
                        RtfListStyleNumber.java RtfListStyleBullet.java
                        RtfListStyle.java RtfListStyleText.java
               src/java/org/apache/fop/render/rtf
                        ListAttributesConverter.java
  Log:
  RTF output: Support for fo:list-block
  Submitted by:	Peter Herweg <pherweg.at.web.de>
  
  Revision  Changes    Path
  1.2       +40 -117   xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java
  
  Index: RtfList.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfList.java	4 Nov 2003 23:59:11 -0000	1.1
  +++ RtfList.java	22 Nov 2003 17:11:14 -0000	1.2
  @@ -60,140 +60,42 @@
   
   import java.io.Writer;
   import java.io.IOException;
  +import java.util.Date;
  +import java.util.Random;
   
   /**
    * Model of an RTF list, which can contain RTF list items
    * @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
    * @author Christopher Scott, scottc@westinghouse.com
  + * @author Peter Herweg, pherweg@web.de
    */
   public class RtfList extends RtfContainer {
       private RtfListItem item;
       private RtfListTable listTable;
       private final boolean hasTableParent;
  -
  -    /** list numbering style.
  -     *  Could add more variables, for now we simply differentiate between bullets and numbering
  -     */
  -    private NumberingStyle numberingStyle;
  -
  -    /**
  -     * Inner static class to handle numbering styles.
  -     */
  -    public static class NumberingStyle {
  -        private boolean isBulletedList = true;
  -
  -        /**
  -         * accessor for isBulletedList
  -         * @return isBulletedList
  -         */
  -        public boolean getIsBulletedList() {
  -            return isBulletedList;
  -        }
  -
  -        /**
  -         * set isBulletedList
  -         * @param isBL boolean value to set
  -         */
  -        public void setIsBulletedList(boolean isBL) {
  -            isBulletedList = isBL;
  -        }
  -    }
  +    private RtfListStyle defaultListStyle;
  +    private Integer listTemplateId = null;
  +    private Integer listId = null;
   
       /** Create an RTF list as a child of given container with given attributes */
       RtfList(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException {
           super((RtfContainer)parent, w, attr);
  -        numberingStyle = new NumberingStyle();
  +
  +        //random number generator for ids
  +        Date runTime = new Date();
  +        Random listIdGenerator = new Random(runTime.getTime());
  +        listId = new Integer(listIdGenerator.nextInt());
  +        listTemplateId = new Integer(listIdGenerator.nextInt());
  +
           //create a new list table entry for the list
  -        listTable = (getRtfFile()).startListTable(attr);
  -        listTable.setParentList(this);
  +        listTable = getRtfFile().startListTable(attr);
  +        listTable.addList(this);
   
           // find out if we are nested in a table
           hasTableParent = this.getParentOfClass(RtfTable.class) != null;
       }
   
       /**
  -     * Change numbering style
  -     * @param ns NumberingSytle to set
  -     */
  -    public void setNumberingStyle(NumberingStyle ns) {
  -        numberingStyle = ns;
  -    }
  -
  -    /**
  -     * Overridden to setup the list: start a group with appropriate attributes
  -     * @throws IOException for I/O problems
  -     */
  -    protected void writeRtfPrefix() throws IOException {
  -        // pard causes word97 (and sometimes 2000 too) to crash if the list is nested in a table
  -        if (!hasTableParent) {
  -            writeControlWord("pard");
  -        }
  -
  -        writeOneAttribute(RtfText.LEFT_INDENT_FIRST, attrib.getValue(RtfListTable.LIST_INDENT));
  -        writeOneAttribute(RtfText.LEFT_INDENT_BODY, attrib.getValue(RtfText.LEFT_INDENT_BODY));
  -
  -        // put the whole list in a group
  -        writeGroupMark(true);
  -
  -        // group for list setup info
  -        writeGroupMark(true);
  -
  -        writeStarControlWord("pn");
  -        //Modified by Chris Scott
  -        //fixes second line indentation
  -
  -        if (numberingStyle.isBulletedList) {
  -            // bulleted list
  -            writeControlWord("pnlvlblt");
  -            writeControlWord("ilvl0");
  -            writeOneAttribute(RtfListTable.LIST_NUMBER,
  -            (listTable.getListNumber()).toString());
  -            writeOneAttribute("pnindent",
  -            attrib.getValue(RtfListTable.LIST_INDENT));
  -            writeControlWord("pnf1");
  -            writeGroupMark(true);
  -            writeControlWord("pndec");
  -            writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
  -            writeControlWord("pntxtb");
  -            writeControlWord("'b7");
  -            writeGroupMark(false);
  -        } else {
  -            // numbered list
  -            writeControlWord("pnlvlbody");
  -            writeControlWord("ilvl0");
  -            writeOneAttribute(RtfListTable.LIST_NUMBER,
  -            (numberingStyle.isBulletedList) ? "2" : "0");
  -            writeControlWord("pndec");
  -            writeOneAttribute("pnstart",
  -            attrib.getValue(RtfListTable.LIST_START_AT));
  -            writeOneAttribute("pnindent",
  -            attrib.getValue(RtfListTable.LIST_INDENT));
  -            writeControlWord("pntxta.");
  -        }
  -
  -        writeGroupMark(false);
  -        writeOneAttribute(RtfListTable.LIST_NUMBER,
  -        (listTable.getListNumber()).toString());
  -    }
  -
  -    /**
  -     * End the list group
  -     * @throws IOException for I/O problems
  -     */
  -    protected void writeRtfSuffix() throws IOException {
  -        // close group that encloses the whole list
  -        writeGroupMark(false);
  -
  -        /* reset paragraph defaults to make sure list ends
  -         * but pard causes word97 (and sometimes 2000 too) to crash if the list
  -         * is nested in a table
  -         */
  -        if (!hasTableParent) {
  -            writeControlWord("pard");
  -        }
  -    }
  -
  -    /**
        * Close current list item and start a new one
        * @return new RtfListItem
        * @throws IOException for I/O problems
  @@ -206,10 +108,31 @@
           return item;
       }
   
  +    public Integer getListId() {
  +        return listId;
  +    }
  +    
  +    public Integer getListTemplateId() {
  +        return listTemplateId;
  +    }
  +    
  +    /**
  +     * Change list style
  +     * @param ls ListStyle to set
  +     */
  +    public void setRtfListStyle(RtfListStyle ls) {
  +        defaultListStyle = ls;
  +    }
  +
       /**
  -     * @return true if this is a bulleted list (as opposed to numbered list)
  +     * Get list style
  +     * @return ListSytle of the List
        */
  -    public boolean isBulletedList() {
  -        return numberingStyle.isBulletedList;
  +    public RtfListStyle getRtfListStyle() {
  +        return defaultListStyle;
  +    }
  +    
  +    public boolean getHasTableParent() {
  +        return hasTableParent;
       }
   }
  
  
  
  1.5       +21 -0     xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java
  
  Index: RtfTextrun.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfTextrun.java	8 Nov 2003 19:58:03 -0000	1.4
  +++ RtfTextrun.java	22 Nov 2003 17:11:14 -0000	1.5
  @@ -56,11 +56,15 @@
   
   package org.apache.fop.render.rtf.rtflib.rtfdoc;
   
  +// Java
   import java.io.IOException;
   import java.io.Writer;
   import java.util.List;
   import java.util.Iterator;
  +
  +// FOP
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
   
   /** 
    * Class which contains a linear text run. It has methods to add attributes, 
  @@ -69,6 +73,7 @@
    */
   public class RtfTextrun extends RtfContainer {
       private boolean bSuppressLastPar = false;
  +    private RtfListItem rtfListItem;
       
       /**  Class which represents the opening of a RTF group mark.*/
       private class RtfOpenGroupMark extends RtfElement {
  @@ -258,6 +263,10 @@
           //may contain for example \intbl
           writeAttributes(attrib, null);
           
  +        if(rtfListItem!=null) {
  +            rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
  +        }
  +        
           //write all children
           boolean bPrevPar = false;
           boolean bFirst = true;
  @@ -283,6 +292,10 @@
                   
               if (!bHide) {
                   e.writeRtf(); 
  +                
  +                if (rtfListItem!=null && e instanceof RtfParagraphBreak) {
  +                    rtfListItem.getRtfListStyle().writeParagraphPrefix(this);
  +                }
               }
               
               if (e instanceof RtfParagraphBreak) {
  @@ -296,6 +309,14 @@
                   bFirst = bFirst && e.isEmpty();
               }
           }
  +    }
  +    
  +    public void setRtfListItem(RtfListItem listItem) {
  +        rtfListItem=listItem;
  +    }
  +    
  +    public RtfListItem getRtfListItem() {
  +        return rtfListItem;
       }
   }
   
  
  
  
  1.3       +14 -1     xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java
  
  Index: RtfFile.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfFile.java	8 Nov 2003 19:58:03 -0000	1.2
  +++ RtfFile.java	22 Nov 2003 17:11:14 -0000	1.3
  @@ -132,8 +132,21 @@
       public RtfListTable startListTable(RtfAttributes attr)
       throws IOException {
           listNum++;
  +        if(listTable != null) {
  +            return listTable;
  +        } else {
           listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
           listTableContainer.addChild(listTable);
  +        }
  +
  +        return listTable;
  +    }
  +    
  +    /**
  +     * Get the list table.
  +     * @return the RtfListTable
  +     */
  +    public RtfListTable getListTable() {
           return listTable;
       }
   
  
  
  
  1.2       +128 -20   xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java
  
  Index: RtfListItem.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfListItem.java	4 Nov 2003 23:59:11 -0000	1.1
  +++ RtfListItem.java	22 Nov 2003 17:11:14 -0000	1.2
  @@ -60,6 +60,7 @@
   
   import java.io.Writer;
   import java.io.IOException;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
   
   /**  Model of an RTF list item, which can contain RTF paragraphs
    *  @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
  @@ -67,9 +68,14 @@
    */
   public class RtfListItem
   extends RtfContainer
  -implements IRtfParagraphContainer {
  +implements IRtfTextrunContainer,
  +           IRtfListContainer,
  +           IRtfParagraphContainer {
  +
       private RtfList parentList;
       private RtfParagraph paragraph;
  +    private RtfListStyle listStyle;
  +    private int number=0;
   
       /** special RtfParagraph that writes list item setup code before its content */
       private class RtfListItemParagraph extends RtfParagraph {
  @@ -81,21 +87,32 @@
   
           protected void writeRtfPrefix() throws IOException {
               super.writeRtfPrefix();
  -            // for bulleted list, add list item setup group before paragraph contents
  -            if (parentList.isBulletedList()) {
  -                writeGroupMark(true);
  -                writeControlWord("pntext");
  -                writeControlWord("f" + RtfFontManager.getInstance().getFontNumber("Symbol"));
  -                writeControlWord("'b7");
  -                writeControlWord("tab");
  -                writeGroupMark(false);
  -            } else {
  -                writeGroupMark(true);
  -                writeControlWord("pntext");
  -                writeGroupMark(false);
  +            listStyle.writeParagraphPrefix(this);
  +        }
               }
  +
  +    public class RtfListItemLabel extends RtfTextrun implements IRtfTextrunContainer {
  +        RtfListItem rtfListItem;
  +        
  +        public RtfListItemLabel(RtfListItem item) throws IOException {
  +            super(null, item.writer, null); 
  +            
  +            rtfListItem=item;
           }
   
  +        public RtfTextrun getTextrun() throws IOException {
  +            return this;
  +        }
  +        
  +        public void addString(String s) throws IOException {
  +            
  +            final String label = s.trim();
  +            if(label.length() > 0 && Character.isDigit(label.charAt(0))) {
  +                rtfListItem.setRtfListStyle(new RtfListStyleNumber());
  +            } else {
  +                rtfListItem.setRtfListStyle(new RtfListStyleText(label));
  +            }
  +        }
       }
   
       /** Create an RTF list item as a child of given container with default attributes */
  @@ -104,12 +121,6 @@
           parentList = parent;
       }
   
  -    /** Create an RTF list item as a child of given container with given attributes */
  -    RtfListItem(RtfList parent, Writer w, RtfAttributes attr) throws IOException {
  -        super((RtfContainer)parent, w, attr);
  -        parentList = parent;
  -    }
  -
       /**
        * Close current paragraph if any and start a new one
        * @param attrs attributes of new paragraph
  @@ -133,4 +144,101 @@
           return newParagraph(null);
       }
   
  +    /** Create an RTF list item as a child of given container with given attributes */
  +    RtfListItem(RtfList parent, Writer w, RtfAttributes attr) throws IOException {
  +        super((RtfContainer)parent, w, attr);
  +        parentList = parent;
  +    }
  +
  +    public RtfTextrun getTextrun()
  +    throws IOException {
  +        RtfTextrun textrun=RtfTextrun.getTextrun(this, writer, null);
  +        textrun.setRtfListItem(this);
  +        return textrun;
  +    }
  +    
  +    /**
  +     * Start a new list after closing current paragraph, list and table
  +     * @param attrs attributes of new RftList object
  +     * @return new RtfList
  +     * @throws IOException for I/O problems
  +     */
  +    public RtfList newList(RtfAttributes attrs) throws IOException {
  +        RtfList list = new RtfList(this, writer, attrs);
  +        return list;
  +    }
  +    
  +    /**
  +     * Overridden to setup the list: start a group with appropriate attributes
  +     * @throws IOException for I/O problems
  +     */
  +    protected void writeRtfPrefix() throws IOException {
  +       
  +        // pard causes word97 (and sometimes 2000 too) to crash if the list is nested in a table
  +        if (!parentList.getHasTableParent()) {
  +            writeControlWord("pard");
  +        }
  +
  +        writeOneAttribute(RtfText.LEFT_INDENT_FIRST, attrib.getValue(RtfListTable.LIST_INDENT));
  +        writeOneAttribute(RtfText.LEFT_INDENT_BODY, attrib.getValue(RtfText.LEFT_INDENT_BODY));
  +
  +        // group for list setup info
  +        writeGroupMark(true);
  +
  +        writeStarControlWord("pn");
  +        //Modified by Chris Scott
  +        //fixes second line indentation
  +        getRtfListStyle().writeListPrefix(this);
  +
  +        writeGroupMark(false);
  +        writeOneAttribute(RtfListTable.LIST_NUMBER,new Integer(number));
  +    }
  +    
  +    /**
  +     * End the list group
  +     * @throws IOException for I/O problems
  +     */
  +    protected void writeRtfSuffix() throws IOException {
  +        super.writeRtfSuffix();
  +
  +        /* reset paragraph defaults to make sure list ends
  +         * but pard causes word97 (and sometimes 2000 too) to crash if the list
  +         * is nested in a table
  +         */ 
  +        if (!parentList.getHasTableParent()) {
  +            writeControlWord("pard");
  +        }
  +        
  +    }
  +       
  +    /**
  +     * Change list style
  +     * @param ls ListStyle to set
  +     */
  +    public void setRtfListStyle(RtfListStyle ls) {
  +        listStyle = ls;
  +        
  +        listStyle.setRtfListItem(this);
  +        number = getRtfFile().getListTable().addRtfListStyle(ls);
  +    }
  +
  +    /**
  +     * Get list style
  +     * @return ListSytle of the List
  +     */    
  +    public RtfListStyle getRtfListStyle() {
  +        if(listStyle==null) {
  +            return parentList.getRtfListStyle();
  +        } else {
  +            return listStyle;
  +        }
  +    }
  +  
  +    public RtfList getParentList() {
  +        return parentList;
  +    }
  +    
  +    public int getNumber() {
  +        return number;
  +    }
   }
  
  
  
  1.2       +77 -76    xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java
  
  Index: RtfListTable.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RtfListTable.java	4 Nov 2003 23:59:11 -0000	1.1
  +++ RtfListTable.java	22 Nov 2003 17:11:14 -0000	1.2
  @@ -58,8 +58,9 @@
   
   package org.apache.fop.render.rtf.rtflib.rtfdoc;
   
  -import java.util.Date;
  -import java.util.Random;
  +import java.util.LinkedList;
  +import java.util.Iterator;
  +import java.util.LinkedList;
   import java.io.Writer;
   import java.io.IOException;
   //import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo;
  @@ -71,13 +72,9 @@
    * @author Christopher Scott, scottc@westinghouse.com
    */
   public class RtfListTable extends RtfContainer {
  +    private LinkedList lists;
  +    private LinkedList styles;
   
  -    /** number of list in document */
  -    private Integer listNum;
  -    /** id of list */
  -    private Integer listId;
  -    private Integer listTemplateId;
  -    private RtfList parentList;
   //static data members
       /** constant for a list table */
       public static final String LIST_TABLE = "listtable";
  @@ -140,49 +137,22 @@
       public RtfListTable(RtfContainer parent, Writer w, Integer num, RtfAttributes attrs)
       throws IOException {
           super(parent, w, attrs);
  -        listNum = new Integer(num.intValue());
  -        //random number generator for ids
  -        Date runTime = new Date();
  -        Random listIdGenerator = new Random(runTime.getTime());
  -        listId = new Integer(listIdGenerator.nextInt());
  -        attrib.set(LIST_ID, listId.toString());
  -        listTemplateId = new Integer(listIdGenerator.nextInt());
  -        attrib.set(LIST_NUMBER_TYPE, 0);
  -    }
   
  -    /**
  -     * Set parentList
  -     * @param parent parentList to set
  -     */
  -    public void setParentList(RtfList parent) {
  -        parentList = parent;
  +        styles=new LinkedList();
       }
   
       /**
  -     * Accessor for listNum
  -     * @return listNum
  +     * Add List
  +     * @param list RtfList to add
        */
  -    public Integer getListNumber() {
  -        return listNum;
  -    }
  -
  -    /** Set whether the list is a bulleted list not, and set attributes
  -     * accordingly */
  -    private void setListType() {
  -        if (parentList.isBulletedList()) {
  -            // bullet definition for bulleted lists
  -            // Chris Scott's version was "\\\'01\\u-3913 ?;"
  -            // 'b7 is what was used in jfor V0.5.2
  -            attrib.set(LIST_TEXT_FORM, "\\\'01\\'b7 ?;");
  -            attrib.set(LIST_NUM_POSITION);
  -            attrib.set(LIST_NUMBER_TYPE, 23);
  -            attrib.set(LIST_FONT_TYPE, 2);
  -        } else {
  -            attrib.set(LIST_TEXT_FORM, "\\\'03\\\'00. ;");
  -            attrib.set(LIST_NUM_POSITION, "\\\'01;");
  -            attrib.set(LIST_NUMBER_TYPE, 0);
  -            attrib.set(LIST_FONT_TYPE, 0);
  +    public int addList(RtfList list) {
  +        if(lists == null) {
  +            lists=new LinkedList();
           }
  +
  +        lists.add(list);
  +        
  +        return lists.size();
       }
   
       /**
  @@ -190,55 +160,86 @@
        * @throws IOException for I/O problems
        */
       public void writeRtfContent() throws IOException {
  -        setListType();
  +        if(lists!=null) {
  +            //write '\listtable'
           writeGroupMark(true);
           writeStarControlWordNS(LIST_TABLE);
  -        writeGroupMark(true);
  +            for (Iterator it = lists.iterator(); it.hasNext();) {
  +                final RtfList list = (RtfList)it.next();
  +                writeListTableEntry(list);
  +            }
  +            writeGroupMark(false);
  +                
  +            //write '\listoveridetable'
  +        writeGroupMark(true);
  +            writeStarControlWordNS(LIST_OVR_TABLE);
  +            int z=1;
  +            
  +            for (Iterator it = styles.iterator(); it.hasNext();) {
  +                final RtfListStyle style = (RtfListStyle)it.next();
  +                        
  +                writeGroupMark(true);
  +                writeStarControlWordNS(LIST_OVR);
  +                writeGroupMark(true);
  +        
  +                writeOneAttributeNS(LIST_ID, style.getRtfList().getListId().toString());
  +                writeOneAttributeNS(LIST_OVR_COUNT, new Integer(0));
  +                writeOneAttributeNS(LIST_NUMBER, new Integer(z++));
  +
  +                writeGroupMark(false);
  +                writeGroupMark(false);
  +            }
  +            
  +            writeGroupMark(false);
  +        }
  +    }
   
  +    /**
  +     * Since this has no text content we have to overwrite isEmpty to print
  +     * the table
  +     * @return false (always)
  +     */
  +    public boolean isEmpty() {
  +        return false;
  +    }
  +    
  +    private void writeListTableEntry(RtfList list)
  +    throws IOException {
  +        //write list-specific attributes
  +        writeGroupMark(true);
           writeControlWordNS(LIST);
  -        writeOneAttributeNS(LIST_TEMPLATE_ID, listTemplateId.toString());
  +        writeOneAttributeNS(LIST_TEMPLATE_ID, list.getListTemplateId().toString());
           writeOneAttributeNS(LIST, attrib.getValue(LIST));
  +        
  +        // write level-specific attributes
           writeGroupMark(true);
           writeControlWordNS(LIST_LEVEL);
  -        writeOneAttributeNS(LIST_NUMBER_TYPE, attrib.getValue(LIST_NUMBER_TYPE));
  +        
           writeOneAttributeNS(LIST_JUSTIFICATION, attrib.getValue(LIST_JUSTIFICATION));
           writeOneAttributeNS(LIST_FOLLOWING_CHAR, attrib.getValue(LIST_FOLLOWING_CHAR));
  -        writeOneAttributeNS(LIST_START_AT, attrib.getValue(LIST_START_AT));
           writeOneAttributeNS(LIST_SPACE, new Integer(0));
           writeOneAttributeNS(LIST_INDENT, attrib.getValue(LIST_INDENT));
  -        writeGroupMark(true);
  -        writeOneAttributeNS(LIST_TEXT_FORM, attrib.getValue(LIST_TEXT_FORM));
  -        writeGroupMark(false);
  -        writeGroupMark(true);
  -        writeOneAttributeNS(LIST_NUM_POSITION, attrib.getValue(LIST_NUM_POSITION));
  -        writeGroupMark(false);
  -        writeOneAttributeNS(LIST_FONT_TYPE, attrib.getValue(LIST_FONT_TYPE));
  +        
  +        RtfListItem item=(RtfListItem)list.getChildren().get(0);
  +        item.getRtfListStyle().writeLevelGroup(this);
  +        
           writeGroupMark(false);
  +        
           writeGroupMark(true);
           writeControlWordNS(LIST_NAME);
           writeGroupMark(false);
  -        writeOneAttributeNS(LIST_ID, listId.toString());
  -        writeGroupMark(false);
  -        writeGroupMark(false);
  -        writeGroupMark(true);
  -        writeStarControlWordNS(LIST_OVR_TABLE);
  -        writeGroupMark(true);
  -        writeControlWordNS(LIST_OVR);
  -        writeOneAttributeNS(LIST_ID, listId.toString());
  -        writeOneAttributeNS(LIST_OVR_COUNT, new Integer(0));
  -        writeOneAttributeNS(LIST_NUMBER, listNum.toString());
  -        writeGroupMark(false);
  +        
  +        writeOneAttributeNS(LIST_ID, list.getListId().toString());
  +                
           writeGroupMark(false);
       }
   
       /**
  -     * Since this has no text content we have to overwrite isEmpty to print
  -     * the table
  -     * @return false (always)
  +     * Change list style
  +     * @param ls ListStyle to set
        */
  -    public boolean isEmpty() {
  -        return false;
  +    public int addRtfListStyle(RtfListStyle ls) {
  +        styles.add(ls);
  +        return styles.size();
       }
  -
  -
   }
  
  
  
  1.1                  xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java
  
  Index: RtfListStyleNumber.java
  ===================================================================
  /*
   * $Id: RtfListStyleNumber.java,v 1.1 2003/11/22 17:11:14 jeremias Exp $
   * ============================================================================
   *                    The Apache Software License, Version 1.1
   * ============================================================================
   *
   * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of source code must retain the above copyright notice,
   *    this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *    this list of conditions and the following disclaimer in the documentation
   *    and/or other materials provided with the distribution.
   *
   * 3. The end-user documentation included with the redistribution, if any, must
   *    include the following acknowledgment: "This product includes software
   *    developed by the Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself, if
   *    and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "FOP" and "Apache Software Foundation" must not be used to
   *    endorse or promote products derived from this software without prior
   *    written permission. For written permission, please contact
   *    apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache", nor may
   *    "Apache" appear in their name, without prior written permission of the
   *    Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * ============================================================================
   *
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation and was originally created by
   * James Tauber <jt...@jtauber.com>. For more information on the Apache
   * Software Foundation, please see <http://www.apache.org/>.
   */
  
  /*
   * This file is part of the RTF library of the FOP project, which was originally
   * created by Bertrand Delacretaz <bd...@codeconsult.ch> and by other
   * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
   * the FOP project.
   */
  package org.apache.fop.render.rtf.rtflib.rtfdoc;
  
  //Java
  import java.io.IOException;
  
  //FOP
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
  
  public class RtfListStyleNumber extends RtfListStyle {
      
      /**
       * Gets call before a RtfListItem has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeListPrefix()
       */
      public void writeListPrefix(RtfList list)
      throws IOException {
          list.writeControlWord("pnlvlbody");
          list.writeControlWord("ilvl0");
          list.writeOneAttribute(RtfListTable.LIST_NUMBER, "0");
          list.writeControlWord("pndec");
          list.writeOneAttribute("pnstart", new Integer(1));
          list.writeOneAttribute("pnindent",
                  list.attrib.getValue(RtfListTable.LIST_INDENT));
          list.writeControlWord("pntxta.");
      }
      
      /**
       * Gets call before a paragraph, which is contained by a RtfListItem has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix()
       */
      public void writeParagraphPrefix(RtfElement element)
      throws IOException {
          element.writeGroupMark(true);
          element.writeControlWord("pntext");
          element.writeControlWord("f" + RtfFontManager.getInstance().getFontNumber("Symbol"));
          element.writeControlWord("'b7");
          element.writeControlWord("tab");
          element.writeGroupMark(false);
      }
      
      /**
       * Gets call when the list table has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeLevelGroup()
       */
      public void writeLevelGroup(RtfElement element)
      throws IOException {
          element.writeOneAttributeNS(
                  RtfListTable.LIST_START_AT, new Integer(1));
          element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 0);
          
          element.writeGroupMark(true);
          element.writeOneAttributeNS(
                  RtfListTable.LIST_TEXT_FORM, "\\'03\\\'00. ;");
          element.writeGroupMark(false);
              
          element.writeGroupMark(true);
          element.writeOneAttributeNS(
                  RtfListTable.LIST_NUM_POSITION, "\\'01;");
          element.writeGroupMark(false);
              
          element.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, new Integer(0));
      }
  }
  
  
  
  1.1                  xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleBullet.java
  
  Index: RtfListStyleBullet.java
  ===================================================================
  /*
   * $Id: RtfListStyleBullet.java,v 1.1 2003/11/22 17:11:14 jeremias Exp $
   * ============================================================================
   *                    The Apache Software License, Version 1.1
   * ============================================================================
   *
   * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of source code must retain the above copyright notice,
   *    this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *    this list of conditions and the following disclaimer in the documentation
   *    and/or other materials provided with the distribution.
   *
   * 3. The end-user documentation included with the redistribution, if any, must
   *    include the following acknowledgment: "This product includes software
   *    developed by the Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself, if
   *    and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "FOP" and "Apache Software Foundation" must not be used to
   *    endorse or promote products derived from this software without prior
   *    written permission. For written permission, please contact
   *    apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache", nor may
   *    "Apache" appear in their name, without prior written permission of the
   *    Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * ============================================================================
   *
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation and was originally created by
   * James Tauber <jt...@jtauber.com>. For more information on the Apache
   * Software Foundation, please see <http://www.apache.org/>.
   */
  
  /*
   * This file is part of the RTF library of the FOP project, which was originally
   * created by Bertrand Delacretaz <bd...@codeconsult.ch> and by other
   * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
   * the FOP project.
   */
  package org.apache.fop.render.rtf.rtflib.rtfdoc;
  
  //Java
  import java.io.IOException;
  
  //FOP
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
  
  public class RtfListStyleBullet extends RtfListStyle {
      
      /**
       * Gets call before a RtfListItem has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeListPrefix()
       */
      public void writeListPrefix(RtfListItem item) throws IOException {
          // bulleted list
          item.writeControlWord("pnlvlblt");
          item.writeControlWord("ilvl0");
          item.writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer(item.getNumber()));
          item.writeOneAttribute("pnindent",
                  item.getParentList().attrib.getValue(RtfListTable.LIST_INDENT));
          item.writeControlWord("pnf1");
          item.writeGroupMark(true);
          item.writeControlWord("pndec");
          item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
          item.writeControlWord("pntxtb");
          item.writeControlWord("'b7");
          item.writeGroupMark(false);
      }
  
      /**
       * Gets call before a paragraph, which is contained by a RtfListItem has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix()
       */
      public void writeParagraphPrefix(RtfElement element) throws IOException {
          element.writeGroupMark(true);
          element.writeControlWord("pntext");
          element.writeGroupMark(false);
      }
  
      /**
       * Gets call when the list table has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeLevelGroup()
       */
      public void writeLevelGroup(RtfElement element) throws IOException {
          element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 23);
          element.writeGroupMark(true);
          element.writeOneAttributeNS(RtfListTable.LIST_TEXT_FORM, "\\'01\\'b7");
          element.writeGroupMark(false);
              
          element.writeGroupMark(true);
          element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION, null);
          element.writeGroupMark(false);
              
          element.attrib.set(RtfListTable.LIST_FONT_TYPE, 2);
      }
         
  }
  
  
  
  1.1                  xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java
  
  Index: RtfListStyle.java
  ===================================================================
  /*
   * $Id: RtfListStyle.java,v 1.1 2003/11/22 17:11:14 jeremias Exp $
   * ============================================================================
   *                    The Apache Software License, Version 1.1
   * ============================================================================
   *
   * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of source code must retain the above copyright notice,
   *    this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *    this list of conditions and the following disclaimer in the documentation
   *    and/or other materials provided with the distribution.
   *
   * 3. The end-user documentation included with the redistribution, if any, must
   *    include the following acknowledgment: "This product includes software
   *    developed by the Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself, if
   *    and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "FOP" and "Apache Software Foundation" must not be used to
   *    endorse or promote products derived from this software without prior
   *    written permission. For written permission, please contact
   *    apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache", nor may
   *    "Apache" appear in their name, without prior written permission of the
   *    Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * ============================================================================
   *
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation and was originally created by
   * James Tauber <jt...@jtauber.com>. For more information on the Apache
   * Software Foundation, please see <http://www.apache.org/>.
   */
  
  /*
   * This file is part of the RTF library of the FOP project, which was originally
   * created by Bertrand Delacretaz <bd...@codeconsult.ch> and by other
   * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
   * the FOP project.
   */
  package org.apache.fop.render.rtf.rtflib.rtfdoc;
  
  //Java
  import java.io.IOException;
  
  //FOP
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
  
  /**
   * Class to handle list styles.
   */
  public class RtfListStyle {
      private RtfListItem rtfListItem;
      
      public void setRtfListItem(RtfListItem item) {
          rtfListItem=item;
      }
      
      public RtfListItem getRtfListItem() {
          return rtfListItem;
      }
  
      public RtfList getRtfList() {
          return rtfListItem.getParentList();
      }
  
      /**
       * Gets call before a RtfListItem has to be written.
       */
      public void writeListPrefix(RtfListItem item)
      throws IOException {
      }
      /**
       * Gets call before a paragraph, which is contained by a RtfListItem has to be written.
       */
      public void writeParagraphPrefix(RtfElement element)
      throws IOException {
      }
  
      /**
       * Gets call when the list table has to be written.
       */        
      public void writeLevelGroup(RtfElement element)
      throws IOException {
      }
  }
  
  
  1.1                  xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java
  
  Index: RtfListStyleText.java
  ===================================================================
  /*
   * $Id: RtfListStyleText.java,v 1.1 2003/11/22 17:11:14 jeremias Exp $
   * ============================================================================
   *                    The Apache Software License, Version 1.1
   * ============================================================================
   *
   * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of source code must retain the above copyright notice,
   *    this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *    this list of conditions and the following disclaimer in the documentation
   *    and/or other materials provided with the distribution.
   *
   * 3. The end-user documentation included with the redistribution, if any, must
   *    include the following acknowledgment: "This product includes software
   *    developed by the Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself, if
   *    and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "FOP" and "Apache Software Foundation" must not be used to
   *    endorse or promote products derived from this software without prior
   *    written permission. For written permission, please contact
   *    apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache", nor may
   *    "Apache" appear in their name, without prior written permission of the
   *    Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * ============================================================================
   *
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation and was originally created by
   * James Tauber <jt...@jtauber.com>. For more information on the Apache
   * Software Foundation, please see <http://www.apache.org/>.
   */
  
  /*
   * This file is part of the RTF library of the FOP project, which was originally
   * created by Bertrand Delacretaz <bd...@codeconsult.ch> and by other
   * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
   * the FOP project.
   */
  package org.apache.fop.render.rtf.rtflib.rtfdoc;
  
  //Java
  import java.io.IOException;
  
  //FOP
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
  
  public class RtfListStyleText extends RtfListStyle {
      String text;
      
      public RtfListStyleText(String s) {
          text=s;    
      }
      
      /**
       * Gets call before a RtfListItem has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeListPrefix()
       */
      public void writeListPrefix(RtfListItem item)
      throws IOException {
          // bulleted list
          item.writeControlWord("pnlvlblt");
          item.writeControlWord("ilvl0");
          item.writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer(item.getNumber()));
          item.writeOneAttribute("pnindent",
                  item.getParentList().attrib.getValue(RtfListTable.LIST_INDENT));
          item.writeControlWord("pnf1");
          item.writeGroupMark(true);
          item.writeControlWord("pndec");
          item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
          item.writeControlWord("pntxtb " + text);
          item.writeGroupMark(false);
      }
      
      /**
       * Gets call before a paragraph, which is contained by a RtfListItem has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix()
       */
      public void writeParagraphPrefix(RtfElement element)
      throws IOException {
          element.writeGroupMark(true);
          element.writeControlWord("pntext");
          element.writeGroupMark(false);
      }
      
      /**
       * Gets call when the list table has to be written.
       * 
       * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeLevelGroup()
       */
      public void writeLevelGroup(RtfElement element)
      throws IOException {
          element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 23);
          element.writeGroupMark(true);
          
          String sCount;
          if(text.length()<10) {
              sCount = "0" + String.valueOf(text.length());
          } else {
              sCount = String.valueOf(text.length());
          }
          element.writeOneAttributeNS(
                  RtfListTable.LIST_TEXT_FORM, "\\'" + sCount + text);
          element.writeGroupMark(false);
              
          element.writeGroupMark(true);
          element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION, null);
          element.writeGroupMark(false);
              
          element.attrib.set(RtfListTable.LIST_FONT_TYPE, 2);
      }
  }
  
  
  
  1.6       +50 -1     xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java
  
  Index: RTFHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RTFHandler.java	9 Nov 2003 17:06:01 -0000	1.5
  +++ RTFHandler.java	22 Nov 2003 17:11:14 -0000	1.6
  @@ -85,6 +85,7 @@
   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.IRtfListContainer;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.IRtfTextrunContainer;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAfter;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
  @@ -93,6 +94,9 @@
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem.RtfListItemLabel;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
  @@ -608,36 +612,81 @@
        * @see org.apache.fop.fo.FOInputHandler#startList(ListBlock)
        */
       public void startList(ListBlock lb) {
  +        try  {
  +            // create an RtfList in the current list container
  +            final IRtfListContainer c = (IRtfListContainer)builderContext.getContainer(IRtfListContainer.class,true,this);
  +            final RtfList newList = c.newList(ListAttributesConverter.convertAttributes(lb.properties));
  +            builderContext.pushContainer(newList);
  +        } catch (IOException ioe) {
  +            log.error("startList: " + ioe.getMessage());
  +            throw new Error(ioe.getMessage());
  +        } catch (FOPException fe) {
  +            log.error("startList: " + fe.getMessage());
  +            throw new Error(fe.getMessage());
  +        } catch (Exception e) {
  +            log.error("startList: " + e.getMessage());
  +            throw new Error(e.getMessage());
  +        }
       }
   
       /**
        * @see org.apache.fop.fo.FOInputHandler#endList(ListBlock)
        */
       public void endList(ListBlock lb) {
  +        builderContext.popContainer();
       }
   
       /**
        * @see org.apache.fop.fo.FOInputHandler#startListItem(ListItem)
        */
       public void startListItem(ListItem li) {
  +        // create an RtfListItem in the current RtfList
  +        try {
  +            final RtfList list = (RtfList)builderContext.getContainer(RtfList.class,true,this);
  +            builderContext.pushContainer(list.newListItem());
  +        } catch (IOException ioe) {
  +            log.error("startList: " + ioe.getMessage());
  +            throw new Error(ioe.getMessage());
  +        } catch (FOPException fe) {
  +            log.error("startList: " + fe.getMessage());
  +            throw new Error(fe.getMessage());
  +        } catch (Exception e) {
  +            log.error("startList: " + e.getMessage());
  +            throw new Error(e.getMessage());
  +        }
       }
   
       /**
        * @see org.apache.fop.fo.FOInputHandler#endListItem(ListItem)
        */
       public void endListItem(ListItem li) {
  +        builderContext.popContainer();
       }
   
       /**
        * @see org.apache.fop.fo.FOInputHandler#startListLabel()
        */
       public void startListLabel() {
  +        try {
  +            RtfListItem item
  +                = (RtfListItem)builderContext.getContainer(RtfListItem.class, true, this);
  +                
  +            RtfListItemLabel label=item.new RtfListItemLabel(item);
  +            builderContext.pushContainer(label);
  +        } catch (IOException ioe) {
  +            log.error("startPageNumber:" + ioe.getMessage());
  +            throw new Error(ioe.getMessage());
  +        } catch (Exception e) {
  +            log.error("startPageNumber: " + e.getMessage());
  +            throw new Error(e.getMessage());
  +        }
       }
   
       /**
        * @see org.apache.fop.fo.FOInputHandler#endListLabel()
        */
       public void endListLabel() {
  +        builderContext.popContainer();
       }
   
       /**
  
  
  
  1.1                  xml-fop/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
  
  Index: ListAttributesConverter.java
  ===================================================================
  /*
   * ============================================================================
   *                    The Apache Software License, Version 1.1
   * ============================================================================
   *
   * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modifica-
   * tion, are permitted provided that the following conditions are met:
   *
   * 1. Redistributions of source code must retain the above copyright notice,
   *    this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright notice,
   *    this list of conditions and the following disclaimer in the documentation
   *    and/or other materials provided with the distribution.
   *
   * 3. The end-user documentation included with the redistribution, if any, must
   *    include the following acknowledgment: "This product includes software
   *    developed by the Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself, if
   *    and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "FOP" and "Apache Software Foundation" must not be used to
   *    endorse or promote products derived from this software without prior
   *    written permission. For written permission, please contact
   *    apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache", nor may
   *    "Apache" appear in their name, without prior written permission of the
   *    Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
   * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
   * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   * ============================================================================
   *
   * This software consists of voluntary contributions made by many individuals
   * on behalf of the Apache Software Foundation and was originally created by
   * James Tauber <jt...@jtauber.com>. For more information on the Apache
   * Software Foundation, please see <http://www.apache.org/>.
   */
  package org.apache.fop.render.rtf;
  
  //FOP
  import org.apache.fop.apps.FOPException;
  import org.apache.fop.fo.Property;
  import org.apache.fop.fo.LengthProperty;
  import org.apache.fop.fo.PropertyList;
  
  //RTF
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListTable;
  import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText;
  
   /**
    * @autor bdelacretaz, bdelacretaz@codeconsult.ch
    * @autor Christopher Scott, scottc@westinghouse.com
    * Portions created by Christopher Scott are Coypright (C) 2001
    * Westinghouse Electric Company. All Rights Reserved.
    * @autor Peter Herweg, pherweg@web.de
    */
  
  /**
   * Provides methods to convert list attributes to RtfAttributes.
   */
  public class ListAttributesConverter {
      
      
      static RtfAttributes convertAttributes(PropertyList properties)
      throws FOPException{
          
          RtfAttributes attrib = new RtfAttributes();
          
          Property prop=null;
          int iStartIndentInTwips=0;
          
          //start-indent
          if ((prop = properties.get("start-indent")) != null) {
              LengthProperty lengthprop = (LengthProperty)prop;
  
              Float f = new Float(lengthprop.getLength().getValue() / 1000f);
              String sValue = f.toString() + "pt";
              
              iStartIndentInTwips = (int) FoUnitsConverter.getInstance().convertToTwips(sValue);
          } else {
              //set default 
              iStartIndentInTwips = 360;
          }
          attrib.set(RtfListTable.LIST_INDENT, iStartIndentInTwips);
          
          //end-indent
          if ((prop = properties.get("end-indent")) != null) {
              LengthProperty lengthprop = (LengthProperty)prop;
  
              Float f = new Float(lengthprop.getLength().getValue() / 1000f);
              String sValue = f.toString() + "pt";
  
              attrib.set(RtfText.LEFT_INDENT_BODY,
                      (int) FoUnitsConverter.getInstance().convertToTwips(sValue));
          } else {
              if(iStartIndentInTwips >= 360) {
                  //if the start indent is greater than default, set to the start indent
                  attrib.set(RtfText.LEFT_INDENT_BODY, iStartIndentInTwips);
              } else {
                  //else set to default 
                  attrib.set(RtfText.LEFT_INDENT_BODY, 360);
              }
          }
          
          /*
           * set list table defaults
           */
  
          //set a simple list type
          attrib.set(RtfListTable.LIST, "simple");
          //set following char as tab
          attrib.set(RtfListTable.LIST_FOLLOWING_CHAR, 0);
          
          return attrib;
      }
  }
  
  
  1.10      +18 -0     xml-fop/src/java/org/apache/fop/fo/flow/ListItemLabel.java
  
  Index: ListItemLabel.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItemLabel.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ListItemLabel.java	16 Sep 2003 05:21:05 -0000	1.9
  +++ ListItemLabel.java	22 Nov 2003 17:11:14 -0000	1.10
  @@ -50,7 +50,11 @@
    */
   package org.apache.fop.fo.flow;
   
  +// XML
  +import org.xml.sax.Attributes;
  +
   // FOP
  +import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.FObj;
   import org.apache.fop.fo.FOTreeVisitor;
  @@ -103,5 +107,19 @@
           fotv.serveListItemLabel(this);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#handleAttrs
  +     */
  +    public void handleAttrs(Attributes attlist) throws FOPException {
  +        super.handleAttrs(attlist);
  +
  +        getFOTreeControl().getFOInputHandler().startListLabel();
  +    }
  +    
  +    protected void end() {
  +        super.end();
  +        
  +        getFOTreeControl().getFOInputHandler().endListLabel();
  +    }
   }
   
  
  
  
  1.8       +19 -0     xml-fop/src/java/org/apache/fop/fo/flow/ListItem.java
  
  Index: ListItem.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListItem.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ListItem.java	19 Sep 2003 14:33:15 -0000	1.7
  +++ ListItem.java	22 Nov 2003 17:11:14 -0000	1.8
  @@ -50,6 +50,11 @@
    */
   package org.apache.fop.fo.flow;
   
  +// XML
  +import org.xml.sax.Attributes;
  +
  +// FOP
  +import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.FOTreeVisitor;
   import org.apache.fop.fo.FObj;
  @@ -165,5 +170,19 @@
           fotv.serveListItem(this);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#handleAttrs
  +     */
  +    public void handleAttrs(Attributes attlist) throws FOPException {
  +        super.handleAttrs(attlist);
  +
  +        getFOTreeControl().getFOInputHandler().startListItem(this);
  +    }
  +    
  +    protected void end() {
  +        super.end();
  +        
  +        getFOTreeControl().getFOInputHandler().endListItem(this);
  +    }
   }
   
  
  
  
  1.7       +17 -0     xml-fop/src/java/org/apache/fop/fo/flow/ListBlock.java
  
  Index: ListBlock.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/ListBlock.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ListBlock.java	16 Sep 2003 05:21:05 -0000	1.6
  +++ ListBlock.java	22 Nov 2003 17:11:14 -0000	1.7
  @@ -50,6 +50,9 @@
    */
   package org.apache.fop.fo.flow;
   
  +// XML
  +import org.xml.sax.Attributes;
  +
   // FOP
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.datatypes.ColorType;
  @@ -157,5 +160,19 @@
           fotv.serveListBlock(this);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#handleAttrs
  +     */
  +    public void handleAttrs(Attributes attlist) throws FOPException {
  +        super.handleAttrs(attlist);
  +
  +        getFOTreeControl().getFOInputHandler().startList(this);
  +    }
  +    
  +    protected void end() {
  +        super.end();
  +        
  +        getFOTreeControl().getFOInputHandler().endList(this);
  +    }
   }
   
  
  
  
  1.2       +7 -7      xml-fop/src/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java
  
  Index: SimpleLists.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleLists.java	4 Nov 2003 23:59:13 -0000	1.1
  +++ SimpleLists.java	22 Nov 2003 17:11:14 -0000	1.2
  @@ -64,6 +64,8 @@
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle;
  +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyleNumber;
   import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
   
   /**  Generates a simple RTF test document for the jfor rtflib package.
  @@ -82,16 +84,14 @@
           sect.newParagraph().newText("Normal paragraph after list 2.");
   
           sect.newParagraph().newText("Now a numbered list (4 items):");
  -        final RtfList.NumberingStyle nn = new RtfList.NumberingStyle();
  -        nn.setIsBulletedList(false);
  -        makeList(sect, 3, 4, nn);
  +        makeList(sect, 3, 4, new RtfListStyleNumber());
       }
   
  -    private void makeList(RtfSection sect, int listIndex, int nItems, RtfList.NumberingStyle ns)
  +    private void makeList(RtfSection sect, int listIndex, int nItems, RtfListStyle ls)
       throws IOException {
           final RtfList list = sect.newList(null);
  -        if (ns != null) {
  -            list.setNumberingStyle(ns);
  +        if (ls != null) {
  +            list.setRtfListStyle(ls);
           }
           for (int i = 0; i < nItems; i++) {
               final RtfListItem item = list.newListItem();
  
  
  

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