[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-cvs
Subject:    cvs commit: xml-fop/src/java/org/apache/fop/rtf/rtflib/tools ImageConstants.java ImageUtil.java
From:       vmote () apache ! org
Date:       2003-06-30 0:20:09
[Download RAW message or body]

vmote       2003/06/29 17:20:09

  Modified:    src/java/org/apache/fop/rtf/rtflib/rtfdoc
                        IRtfBookmarkContainer.java
                        IRtfExternalGraphicContainer.java
                        IRtfHyperLinkContainer.java
                        IRtfJforCmdContainer.java IRtfOptions.java
                        IRtfTableContainer.java ITableAttributes.java
                        IrtfTemplateContainer.java
                        ParagraphKeeptogetherContext.java RtfBookmark.java
                        RtfBookmarkContainerImpl.java RtfColorTable.java
                        RtfExternalGraphic.java RtfFile.java
                        RtfFontManager.java RtfFontTable.java
                        RtfHeader.java RtfHyperLink.java RtfJforCmd.java
                        RtfListItem.java RtfListTable.java RtfNull.java
                        RtfPage.java RtfPageArea.java RtfPageNumber.java
                        RtfPageNumberCitation.java RtfParagraph.java
                        RtfParagraphKeepTogether.java RtfSection.java
                        RtfStyleSheetTable.java RtfTable.java
                        RtfTableCell.java RtfTemplate.java RtfText.java
               src/java/org/apache/fop/rtf/rtflib/testdocs BasicLink.java
                        CreateTestDocuments.java ExternalGraphic.java
                        ParagraphAlignment.java
               src/java/org/apache/fop/rtf/rtflib/tools ImageConstants.java
                        ImageUtil.java
  Log:
  Convert all tab characters to spaces to comply with style requirements.
  
  Revision  Changes    Path
  1.3       +11 -11    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfBookmarkContainer.java  
  Index: IRtfBookmarkContainer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfBookmarkContainer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IRtfBookmarkContainer.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ IRtfBookmarkContainer.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -67,15 +67,15 @@
   public interface IRtfBookmarkContainer
   {
   
  -	/**
  -	 * Create a new RTF bookmark.
  -	 *
  -	 * @param bookmark Name of the bookmark
  -	 *
  -	 * @return RTF bookmark
  -	 *
  -	 * @throws IOException On eror
  -	 */
  -	RtfBookmark newBookmark (String bookmark) throws IOException;
  +    /**
  +     * Create a new RTF bookmark.
  +     *
  +     * @param bookmark Name of the bookmark
  +     *
  +     * @return RTF bookmark
  +     *
  +     * @throws IOException On eror
  +     */
  +    RtfBookmark newBookmark (String bookmark) throws IOException;
   }
   
  
  
  
  1.3       +7 -7      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfExternalGraphicContainer.java  
  Index: IRtfExternalGraphicContainer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfExternalGraphicContainer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IRtfExternalGraphicContainer.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ IRtfExternalGraphicContainer.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -63,10 +63,10 @@
   public interface IRtfExternalGraphicContainer
   {
   
  -	/**
  -	 * Creates a new image on external graphic base.
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	RtfExternalGraphic newImage () throws IOException;
  +    /**
  +     * Creates a new image on external graphic base.
  +     *
  +     * @exception IOException On error
  +     */
  +    RtfExternalGraphic newImage () throws IOException;
   }
  
  
  
  1.3       +7 -7      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfHyperLinkContainer.java  
  Index: IRtfHyperLinkContainer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfHyperLinkContainer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IRtfHyperLinkContainer.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ IRtfHyperLinkContainer.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -65,10 +65,10 @@
    */
   public interface IRtfHyperLinkContainer extends IRtfTextContainer
   {
  -	/**
  -	 * Creates a new hyperlink.
  -	 *
  -	 * @exception IOException on error
  -	 */
  -	public RtfHyperLink newHyperLink (String str, RtfAttributes attr) throws \
IOException;  +    /**
  +     * Creates a new hyperlink.
  +     *
  +     * @exception IOException on error
  +     */
  +    public RtfHyperLink newHyperLink (String str, RtfAttributes attr) throws \
IOException;  }
  
  
  
  1.3       +2 -2      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfJforCmdContainer.java  
  Index: IRtfJforCmdContainer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfJforCmdContainer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IRtfJforCmdContainer.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ IRtfJforCmdContainer.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -62,5 +62,5 @@
   import java.io.IOException;
   
   public interface IRtfJforCmdContainer {
  -	public RtfJforCmd newJforCmd(RtfAttributes attr) throws IOException;
  +    public RtfJforCmd newJforCmd(RtfAttributes attr) throws IOException;
   }
  
  
  
  1.3       +11 -11    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfOptions.java  
  Index: IRtfOptions.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfOptions.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IRtfOptions.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ IRtfOptions.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -63,15 +63,15 @@
    */
   public interface IRtfOptions
   {
  -	/**
  -	 * Sets  the compression rate for the external graphic in percent.
  -	 * @param percent Compression rate
  -	 */
  -	public void setRtfExternalGraphicCompressionRate (int percent);
  +    /**
  +     * Sets  the compression rate for the external graphic in percent.
  +     * @param percent Compression rate
  +     */
  +    public void setRtfExternalGraphicCompressionRate (int percent);
   
  -	/**
  -	 * Gets  the compression rate for the external graphic in percent.
  -	 * @return Compression rate
  -	 */
  -	public int getRtfExternalGraphicCompressionRate ();
  +    /**
  +     * Gets  the compression rate for the external graphic in percent.
  +     * @return Compression rate
  +     */
  +    public int getRtfExternalGraphicCompressionRate ();
   }
  
  
  
  1.5       +3 -3      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfTableContainer.java  
  Index: IRtfTableContainer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IRtfTableContainer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IRtfTableContainer.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ IRtfTableContainer.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -70,8 +70,8 @@
       /** close current table if any and start a new one */
       public RtfTable newTable(ITableColumnsInfo tc) throws IOException;
   
  -	/** close current table if any and start a new one
  +    /** close current table if any and start a new one
      *  @param tc added by Boris Poudérous on july 2002 in order to process \
                number-columns-spanned attribute
      **/
  -	public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws \
IOException;  +    public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo \
tc) throws IOException;  }
  
  
  
  1.3       +10 -10    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/ITableAttributes.java  
  Index: ITableAttributes.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/ITableAttributes.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ITableAttributes.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ ITableAttributes.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -122,12 +122,12 @@
       String ROW_KEEP_TOGETHER = "trkeep";
   
       //This control word is nonexistent in RTF, used
  -	//to simulate the FO:keep-with-next attribute.
  +    //to simulate the FO:keep-with-next attribute.
        String ROW_KEEP_WITH_NEXT = "knext";
   
  -	//This control word is nonexistent in RTF, used
  -	//to simulate the FO:keep-with-previous attribute.
  - 	 String ROW_KEEP_WITH_PREVIOUS = "kprevious";
  +    //This control word is nonexistent in RTF, used
  +    //to simulate the FO:keep-with-previous attribute.
  +      String ROW_KEEP_WITH_PREVIOUS = "kprevious";
   
       //shading and color, all are unit based attributes
       String CELL_SHADE = "clshdng";
  @@ -144,16 +144,16 @@
       };
   
       String[] CELL_BORDER = {
  -        CELL_BORDER_TOP,		CELL_BORDER_BOTTOM,
  -        CELL_BORDER_LEFT,		CELL_BORDER_RIGHT
  +        CELL_BORDER_TOP,        CELL_BORDER_BOTTOM,
  +        CELL_BORDER_LEFT,        CELL_BORDER_RIGHT
       };
   
       String[] ROW_BORDER = {
  -        ROW_BORDER_TOP, 		ROW_BORDER_BOTTOM, 		ROW_BORDER_LEFT,
  -        ROW_BORDER_RIGHT,	ROW_BORDER_HORIZONTAL,	ROW_BORDER_VERTICAL
  +        ROW_BORDER_TOP,         ROW_BORDER_BOTTOM,         ROW_BORDER_LEFT,
  +        ROW_BORDER_RIGHT,    ROW_BORDER_HORIZONTAL,    ROW_BORDER_VERTICAL
       };
   
       String[] CELL_COLOR = {
  -        CELL_SHADE,	CELL_COLOR_BACKGROUND,	CELL_COLOR_FOREGROUND
  +        CELL_SHADE,    CELL_COLOR_BACKGROUND,    CELL_COLOR_FOREGROUND
       };
   }
  
  
  
  1.3       +7 -7      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java  
  Index: IrtfTemplateContainer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IrtfTemplateContainer.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ IrtfTemplateContainer.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -63,12 +63,12 @@
   
   public interface IrtfTemplateContainer {
   
  -	/**
  -	 * Creates a new Template.
  -	 *
  -	 * @exception IOException on error
  -	 */
  -	public RtfTemplate newTemplate (String str, RtfAttributes attr) throws \
IOException;  +    /**
  +     * Creates a new Template.
  +     *
  +     * @exception IOException on error
  +     */
  +    public RtfTemplate newTemplate (String str, RtfAttributes attr) throws \
IOException;  
   
   }
  
  
  
  1.3       +45 -45    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java  
  Index: ParagraphKeeptogetherContext.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParagraphKeeptogetherContext.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ ParagraphKeeptogetherContext.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -60,7 +60,7 @@
   
   /**
    *
  - * 	This context is used to manage the "keepn" RTF attribute
  + *     This context is used to manage the "keepn" RTF attribute
    *  Used by ParagraphBuilder and JforCmd
    *
    */
  @@ -69,51 +69,51 @@
   
       private static int m_paraKeepTogetherOpen=0;
       private static boolean m_paraResetProperties=false;
  -	private static ParagraphKeeptogetherContext m_instance = null;
  +    private static ParagraphKeeptogetherContext m_instance = null;
   
  -	ParagraphKeeptogetherContext() {
  -	}
  +    ParagraphKeeptogetherContext() {
  +    }
   
   
  -	/**
  -	 * Singelton.
  -	 *
  -	 * @return The instance of ParagraphKeeptogetherContext
  -	 */
  -	public static ParagraphKeeptogetherContext getInstance() {
  -		if (m_instance==null) m_instance = new 	ParagraphKeeptogetherContext();
  -		return m_instance;
  -	}
  -
  -	/** Return the level of current "keep whith next" paragraph */
  -	public static int getKeepTogetherOpenValue() {
  -		return m_paraKeepTogetherOpen;
  -	}
  -
  -	/** Open a new "keep whith next" paragraph */
  -	public static void KeepTogetherOpen() {
  -		m_paraKeepTogetherOpen++;
  -	}
  -
  -	/** Close a "keep whith next" paragraph */
  -	public static void KeepTogetherClose() {
  -		if(m_paraKeepTogetherOpen > 0) {
  -			m_paraKeepTogetherOpen--;
  -
  -			//If the \pard control word is not present, the current paragraph inherits all \
                paragraph properties.
  -			//Also the next paragraph must reset the properties otherwise the \keepn don't \
                stop.
  -			m_paraResetProperties= (m_paraKeepTogetherOpen==0);
  -		}
  -	}
  -
  -	/** Determine if the next paragraph must reset the properites */
  -	public static boolean paragraphResetProperties() {
  -		return m_paraResetProperties;
  -	}
  -
  -	/** Reset the flag if the paragraph properties have been resested */
  -	public static void setParagraphResetPropertiesUsed() {
  -		m_paraResetProperties=false;
  -	}
  +    /**
  +     * Singelton.
  +     *
  +     * @return The instance of ParagraphKeeptogetherContext
  +     */
  +    public static ParagraphKeeptogetherContext getInstance() {
  +        if (m_instance==null) m_instance = new     ParagraphKeeptogetherContext();
  +        return m_instance;
  +    }
  +
  +    /** Return the level of current "keep whith next" paragraph */
  +    public static int getKeepTogetherOpenValue() {
  +        return m_paraKeepTogetherOpen;
  +    }
  +
  +    /** Open a new "keep whith next" paragraph */
  +    public static void KeepTogetherOpen() {
  +        m_paraKeepTogetherOpen++;
  +    }
  +
  +    /** Close a "keep whith next" paragraph */
  +    public static void KeepTogetherClose() {
  +        if(m_paraKeepTogetherOpen > 0) {
  +            m_paraKeepTogetherOpen--;
  +
  +            //If the \pard control word is not present, the current paragraph \
inherits all paragraph properties.  +            //Also the next paragraph must reset \
the properties otherwise the \keepn don't stop.  +            m_paraResetProperties= \
(m_paraKeepTogetherOpen==0);  +        }
  +    }
  +
  +    /** Determine if the next paragraph must reset the properites */
  +    public static boolean paragraphResetProperties() {
  +        return m_paraResetProperties;
  +    }
  +
  +    /** Reset the flag if the paragraph properties have been resested */
  +    public static void setParagraphResetPropertiesUsed() {
  +        m_paraResetProperties=false;
  +    }
   
   }
  
  
  
  1.4       +129 -129  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmark.java  
  Index: RtfBookmark.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmark.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfBookmark.java	29 Jun 2003 22:56:29 -0000	1.3
  +++ RtfBookmark.java	30 Jun 2003 00:20:07 -0000	1.4
  @@ -69,132 +69,132 @@
    */
   public class RtfBookmark extends RtfElement
   {
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -	/** Name of the bokkmark */
  -	private String bookmark = null;
  -	/** Word 2000 supports a length of 40 characters only */
  -	public static int maxBookmarkLength = 40;
  -	/** Word 2000 converts '.' in bookmarks to "_", thats why we control this \
                replacement. */
  -	public static char replaceCharacter = '_';
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Constructor.
  -	 *
  -	 * @param parent a <code>RtfBookmarkContainer</code> value
  -	 * @param writer a <code>Writer</code> value
  -	 * @param bookmark Name of the bookmark
  -	 */
  -	RtfBookmark (IRtfBookmarkContainer parent, Writer w, String bookmark) throws \
                IOException
  -	{
  -		super ((RtfContainer) parent, w);
  -
  -		int now = bookmark.length ();
  -
  -		this.bookmark = bookmark.substring (0, now < maxBookmarkLength ? now : \
                maxBookmarkLength);
  -		this.bookmark = this.bookmark.replace ('.',replaceCharacter);
  -		this.bookmark = this.bookmark.replace (' ',replaceCharacter);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ RtfElement implementation
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Is called before writing the Rtf content.
  -	 *
  -	 * @throws IOException On Error
  -	 */
  -	public void writeRtfPrefix () throws IOException
  -	{
  -		startBookmark ();
  -	}
  -
  -	/**
  -	 * Writes the RTF content to m_writer.
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	public void writeRtfContent () throws IOException
  -	{
  -//		this.getRtfFile ().getLog ().logInfo ("Write bookmark '" + bookmark + "'.");
  -		// No content to write
  -	}
  -
  -	/**
  -	 * Is called after writing the Rtf content.
  -	 *
  -	 * @throws IOException On Error
  -	 */
  -	public void writeRtfSuffix () throws IOException
  -	{
  -		endBookmark ();
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Private methods
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Writes RTF content to begin the bookmark.
  -	 *
  -	 * @throws IOException On error
  -	 */
  -	private void startBookmark () throws IOException
  -	{
  -
  -		// {\*\bkmkstart test}
  -		writeRtfBookmark ("bkmkstart");
  -	}
  -
  -	/**
  -	 * Writes RTF content to close the bookmark.
  -	 *
  -	 * @throws IOException On error
  -	 */
  -	private void endBookmark () throws IOException
  -	{
  -
  -		// {\*\bkmkend test}
  -		writeRtfBookmark ("bkmkend");
  -	}
  -
  -	/**
  -	 * Writes the rtf bookmark.
  -	 *
  -	 * @param tag Begin or close tag
  -	 *
  -	 * @throws IOException On error
  -	 */
  -	private void writeRtfBookmark (String tag) throws IOException
  -	{
  -		if (bookmark == null)
  -		{
  -			return;
  -
  -		}
  -
  -		this.writeGroupMark (true);
  -
  -		//changed. Now using writeStarControlWord
  -		this.writeStarControlWord (tag);
  -
  -		m_writer.write (bookmark);
  -		this.writeGroupMark (false);
  -	}
  -
  -		/** true if this element would generate no "useful" RTF content */
  -		public boolean isEmpty()
  -		{
  -			return bookmark==null || bookmark.trim().length() == 0;
  -		}
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +    /** Name of the bokkmark */
  +    private String bookmark = null;
  +    /** Word 2000 supports a length of 40 characters only */
  +    public static int maxBookmarkLength = 40;
  +    /** Word 2000 converts '.' in bookmarks to "_", thats why we control this \
replacement. */  +    public static char replaceCharacter = '_';
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Constructor.
  +     *
  +     * @param parent a <code>RtfBookmarkContainer</code> value
  +     * @param writer a <code>Writer</code> value
  +     * @param bookmark Name of the bookmark
  +     */
  +    RtfBookmark (IRtfBookmarkContainer parent, Writer w, String bookmark) throws \
IOException  +    {
  +        super ((RtfContainer) parent, w);
  +
  +        int now = bookmark.length ();
  +
  +        this.bookmark = bookmark.substring (0, now < maxBookmarkLength ? now : \
maxBookmarkLength);  +        this.bookmark = this.bookmark.replace \
('.',replaceCharacter);  +        this.bookmark = this.bookmark.replace (' \
',replaceCharacter);  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ RtfElement implementation
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Is called before writing the Rtf content.
  +     *
  +     * @throws IOException On Error
  +     */
  +    public void writeRtfPrefix () throws IOException
  +    {
  +        startBookmark ();
  +    }
  +
  +    /**
  +     * Writes the RTF content to m_writer.
  +     *
  +     * @exception IOException On error
  +     */
  +    public void writeRtfContent () throws IOException
  +    {
  +//        this.getRtfFile ().getLog ().logInfo ("Write bookmark '" + bookmark + \
"'.");  +        // No content to write
  +    }
  +
  +    /**
  +     * Is called after writing the Rtf content.
  +     *
  +     * @throws IOException On Error
  +     */
  +    public void writeRtfSuffix () throws IOException
  +    {
  +        endBookmark ();
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Private methods
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Writes RTF content to begin the bookmark.
  +     *
  +     * @throws IOException On error
  +     */
  +    private void startBookmark () throws IOException
  +    {
  +
  +        // {\*\bkmkstart test}
  +        writeRtfBookmark ("bkmkstart");
  +    }
  +
  +    /**
  +     * Writes RTF content to close the bookmark.
  +     *
  +     * @throws IOException On error
  +     */
  +    private void endBookmark () throws IOException
  +    {
  +
  +        // {\*\bkmkend test}
  +        writeRtfBookmark ("bkmkend");
  +    }
  +
  +    /**
  +     * Writes the rtf bookmark.
  +     *
  +     * @param tag Begin or close tag
  +     *
  +     * @throws IOException On error
  +     */
  +    private void writeRtfBookmark (String tag) throws IOException
  +    {
  +        if (bookmark == null)
  +        {
  +            return;
  +
  +        }
  +
  +        this.writeGroupMark (true);
  +
  +        //changed. Now using writeStarControlWord
  +        this.writeStarControlWord (tag);
  +
  +        m_writer.write (bookmark);
  +        this.writeGroupMark (false);
  +    }
  +
  +        /** true if this element would generate no "useful" RTF content */
  +        public boolean isEmpty()
  +        {
  +            return bookmark==null || bookmark.trim().length() == 0;
  +        }
   }
  
  
  
  1.3       +65 -65    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java  
  Index: RtfBookmarkContainerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfBookmarkContainerImpl.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfBookmarkContainerImpl.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -69,70 +69,70 @@
    */
   public class RtfBookmarkContainerImpl extends RtfContainer implements \
IRtfBookmarkContainer  {
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -	/** Rtf bookmark */
  -	RtfBookmark mBookmark = null;
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Constructor.
  -	 * Create an RTF container as a child of given container.
  -	 *
  -	 * @param parent The parent container
  -	 * @param w Writer
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	RtfBookmarkContainerImpl (RtfContainer parent, Writer w) throws IOException
  -	{
  -		super (parent, w, null);
  -	}
  -
  -	/**
  -	 * Constructor.
  -	 * Create an RTF container as a child of given container.
  -	 *
  -	 * @param parent The parent container
  -	 * @param w Writer
  -	 * @param attr Rtf attributes
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	RtfBookmarkContainerImpl (RtfContainer parent, Writer w, RtfAttributes attr) \
                throws IOException
  -	{
  -		super (parent, w, attr);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Public methods
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Create a new RTF bookmark.
  -	 *
  -	 * @param bookmark Name of the bookmark
  -	 *
  -	 * @return RTF bookmark
  -	 *
  -	 * @throws IOException On eror
  -	 */
  -	public RtfBookmark newBookmark (String bookmark) throws IOException
  -	{
  -		if (mBookmark != null)
  -		{
  -			mBookmark.close ();
  -		}
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +    /** Rtf bookmark */
  +    RtfBookmark mBookmark = null;
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Constructor.
  +     * Create an RTF container as a child of given container.
  +     *
  +     * @param parent The parent container
  +     * @param w Writer
  +     *
  +     * @exception IOException On error
  +     */
  +    RtfBookmarkContainerImpl (RtfContainer parent, Writer w) throws IOException
  +    {
  +        super (parent, w, null);
  +    }
  +
  +    /**
  +     * Constructor.
  +     * Create an RTF container as a child of given container.
  +     *
  +     * @param parent The parent container
  +     * @param w Writer
  +     * @param attr Rtf attributes
  +     *
  +     * @exception IOException On error
  +     */
  +    RtfBookmarkContainerImpl (RtfContainer parent, Writer w, RtfAttributes attr) \
throws IOException  +    {
  +        super (parent, w, attr);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Public methods
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Create a new RTF bookmark.
  +     *
  +     * @param bookmark Name of the bookmark
  +     *
  +     * @return RTF bookmark
  +     *
  +     * @throws IOException On eror
  +     */
  +    public RtfBookmark newBookmark (String bookmark) throws IOException
  +    {
  +        if (mBookmark != null)
  +        {
  +            mBookmark.close ();
  +        }
   
  -		mBookmark = new RtfBookmark (this, m_writer, bookmark);
  +        mBookmark = new RtfBookmark (this, m_writer, bookmark);
   
  -		return mBookmark;
  -	}
  +        return mBookmark;
  +    }
   }
  
  
  
  1.3       +190 -190  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java  
  Index: RtfColorTable.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfColorTable.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfColorTable.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -71,95 +71,95 @@
   
   public class RtfColorTable
   {
  -	//////////////////////////////////////////////////
  -	// @@ Symbolic constants
  -	//////////////////////////////////////////////////
  -
  -	// Defines the bit moving for the colors
  -	private static int RED = 16;
  -	private static int GREEN = 8;
  -	private static int BLUE = 0;
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -	/** Singelton instance */
  -	private static RtfColorTable instance = null;
  -
  -	/** Index table for the colors */
  -	private Hashtable colorIndex = null;
  -	/** Used colors to this vector */
  -	private Vector colorTable = null;
  +    //////////////////////////////////////////////////
  +    // @@ Symbolic constants
  +    //////////////////////////////////////////////////
  +
  +    // Defines the bit moving for the colors
  +    private static int RED = 16;
  +    private static int GREEN = 8;
  +    private static int BLUE = 0;
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +    /** Singelton instance */
  +    private static RtfColorTable instance = null;
  +
  +    /** Index table for the colors */
  +    private Hashtable colorIndex = null;
  +    /** Used colors to this vector */
  +    private Vector colorTable = null;
           /** Map of color names to color numbers */
           private Hashtable namedColors = null;
   
   
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Constructor.
  -	 */
  -	private RtfColorTable ()
  -	{
  -		colorTable = new Vector ();
  -		colorIndex = new Hashtable ();
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Constructor.
  +     */
  +    private RtfColorTable ()
  +    {
  +        colorTable = new Vector ();
  +        colorIndex = new Hashtable ();
                   namedColors = new Hashtable ();
   
  -		init ();
  -	}
  +        init ();
  +    }
   
  -	/**
  -	 * Singelton.
  -	 *
  -	 * @return The instance of RTFColorTable
  -	 */
  -	public static RtfColorTable getInstance ()
  -	{
  -		if (instance == null)
  -		{
  -			instance = new RtfColorTable ();
  -		}
  -
  -		return instance;
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Initializing
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Initialize the color table.
  -	 */
  -	private void init ()
  -	{
  -		addNamedColor("black",getColorNumber (0, 0, 0));
  -		addNamedColor("white",getColorNumber (255, 255, 255));
  -		addNamedColor("red",getColorNumber (255, 0, 0));
  -		addNamedColor("green",getColorNumber (0, 255, 0));
  +    /**
  +     * Singelton.
  +     *
  +     * @return The instance of RTFColorTable
  +     */
  +    public static RtfColorTable getInstance ()
  +    {
  +        if (instance == null)
  +        {
  +            instance = new RtfColorTable ();
  +        }
  +
  +        return instance;
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Initializing
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Initialize the color table.
  +     */
  +    private void init ()
  +    {
  +        addNamedColor("black",getColorNumber (0, 0, 0));
  +        addNamedColor("white",getColorNumber (255, 255, 255));
  +        addNamedColor("red",getColorNumber (255, 0, 0));
  +        addNamedColor("green",getColorNumber (0, 255, 0));
           addNamedColor("blue",getColorNumber (0, 0, 255));
           addNamedColor("cyan",getColorNumber (0, 255, 255));
  -		addNamedColor("magenta",getColorNumber (255, 0, 255));
  -		addNamedColor("yellow",getColorNumber (255, 255, 0));
  +        addNamedColor("magenta",getColorNumber (255, 0, 255));
  +        addNamedColor("yellow",getColorNumber (255, 255, 0));
   
  -		getColorNumber (0, 0, 128);
  -		getColorNumber (0, 128, 128);
  -		getColorNumber (0, 128, 0);
  -		getColorNumber (128, 0, 128);
  -		getColorNumber (128, 0, 0);
  -		getColorNumber (128, 128, 0);
  -		getColorNumber (128, 128, 128);
  +        getColorNumber (0, 0, 128);
  +        getColorNumber (0, 128, 128);
  +        getColorNumber (0, 128, 0);
  +        getColorNumber (128, 0, 128);
  +        getColorNumber (128, 0, 0);
  +        getColorNumber (128, 128, 0);
  +        getColorNumber (128, 128, 128);
   
  - 		// Added by Normand Masse
  -      	// Gray color added
  +         // Added by Normand Masse
  +          // Gray color added
           addNamedColor( "gray", getColorNumber( 128, 128, 128 ) );
   
  -		getColorNumber (192, 192, 192);
  -	}
  +        getColorNumber (192, 192, 192);
  +    }
   
           /** define a named color for getColorNumber(String) */
           private void addNamedColor(String name,int colorNumber)
  @@ -167,125 +167,125 @@
               namedColors.put(name.toLowerCase(),new Integer(colorNumber));
           }
   
  -	//////////////////////////////////////////////////
  -	// @@ Public methods
  -	//////////////////////////////////////////////////
  +    //////////////////////////////////////////////////
  +    // @@ Public methods
  +    //////////////////////////////////////////////////
   
           /** get the RTF number of a named color
            *  @return null if name not found
            */
  -	public Integer getColorNumber (String name)
  -	{
  +    public Integer getColorNumber (String name)
  +    {
               return (Integer)namedColors.get(name.toLowerCase());
           }
   
  -	/**
  -	 * Gets the number of color in the color table
  -	 *
  -	 * @param red Color level red
  -	 * @param green Color level green
  -	 * @param blue Color level blue
  -	 *
  -	 * @return The number of the color in the table
  -	 */
  -	public int getColorNumber (int red, int green, int blue)
  -	{
  -		Integer identifier = new Integer (determineIdentifier (red, green, blue));
  -		Object o = colorIndex.get (identifier);
  -		int retVal;
  -
  -		if (o == null)
  -		{
  -			addColor (identifier);
  -
  -			retVal = colorTable.size ();
  -		}
  -		else
  -		{
  -			retVal = ((Integer) o).intValue ();
  -		}
  -
  -		return retVal + 1;
  -	}
  -
  -	/**
  -	 * Writes the color table in the header.
  -	 *
  -	 * @param header The header container to write in
  -	 *
  -	 * @throws IOException On error
  -	 */
  -	public void writeColors (RtfHeader header) throws IOException
  -	{
  -		if (colorTable == null || colorTable.size () == 0)
  -		{
  -			return;
  -		}
  -
  -		header.writeGroupMark (true);
  -		header.writeControlWord ("colortbl;");
  -
  -		int len = colorTable.size ();
  -
  -		for (int i = 0; i < len; i++)
  -		{
  -			int identifier = ((Integer) colorTable.get (i)).intValue ();
  -
  -			header.write ("\\red" + determineColorLevel (identifier, RED));
  -			header.write ("\\green" + determineColorLevel (identifier, GREEN));
  -			header.write ("\\blue" + determineColorLevel (identifier, BLUE) + ";");
  -		}
  -
  -		header.writeGroupMark (false);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Private methods
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Adds a color to the table.
  -	 *
  -	 * @param i Identifier of color
  -	 */
  -	private void addColor (Integer i)
  -	{
  -		colorIndex.put (i, new Integer (colorTable.size () + 1));
  -		colorTable.addElement (i);
  -	}
  -
  -	/**
  -	 * Determines a identifier for the color.
  -	 *
  -	 * @param red Color level red
  -	 * @param green Color level green
  -	 * @param blue Color level blue
  -	 *
  -	 * @return Unique identifier of color
  -	 */
  -	private int determineIdentifier (int red, int green, int blue)
  -	{
  -		int c = red << RED;
  -
  -		c += green << GREEN;
  -		c += blue << BLUE;
  -
  -		return c;
  -	}
  -
  -	/**
  -	 * Determines the color level from the identifier.
  -	 *
  -	 * @param identifier Unique color identifier
  -	 * @param color One of the bit moving constants
  -	 *
  -	 * @return Color level in byte size
  -	 */
  -	private int determineColorLevel (int identifier, int color)
  -	{
  -		int retVal = (byte) (identifier >> color);
  +    /**
  +     * Gets the number of color in the color table
  +     *
  +     * @param red Color level red
  +     * @param green Color level green
  +     * @param blue Color level blue
  +     *
  +     * @return The number of the color in the table
  +     */
  +    public int getColorNumber (int red, int green, int blue)
  +    {
  +        Integer identifier = new Integer (determineIdentifier (red, green, blue));
  +        Object o = colorIndex.get (identifier);
  +        int retVal;
  +
  +        if (o == null)
  +        {
  +            addColor (identifier);
  +
  +            retVal = colorTable.size ();
  +        }
  +        else
  +        {
  +            retVal = ((Integer) o).intValue ();
  +        }
  +
  +        return retVal + 1;
  +    }
  +
  +    /**
  +     * Writes the color table in the header.
  +     *
  +     * @param header The header container to write in
  +     *
  +     * @throws IOException On error
  +     */
  +    public void writeColors (RtfHeader header) throws IOException
  +    {
  +        if (colorTable == null || colorTable.size () == 0)
  +        {
  +            return;
  +        }
  +
  +        header.writeGroupMark (true);
  +        header.writeControlWord ("colortbl;");
  +
  +        int len = colorTable.size ();
  +
  +        for (int i = 0; i < len; i++)
  +        {
  +            int identifier = ((Integer) colorTable.get (i)).intValue ();
  +
  +            header.write ("\\red" + determineColorLevel (identifier, RED));
  +            header.write ("\\green" + determineColorLevel (identifier, GREEN));
  +            header.write ("\\blue" + determineColorLevel (identifier, BLUE) + \
";");  +        }
  +
  +        header.writeGroupMark (false);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Private methods
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Adds a color to the table.
  +     *
  +     * @param i Identifier of color
  +     */
  +    private void addColor (Integer i)
  +    {
  +        colorIndex.put (i, new Integer (colorTable.size () + 1));
  +        colorTable.addElement (i);
  +    }
  +
  +    /**
  +     * Determines a identifier for the color.
  +     *
  +     * @param red Color level red
  +     * @param green Color level green
  +     * @param blue Color level blue
  +     *
  +     * @return Unique identifier of color
  +     */
  +    private int determineIdentifier (int red, int green, int blue)
  +    {
  +        int c = red << RED;
  +
  +        c += green << GREEN;
  +        c += blue << BLUE;
  +
  +        return c;
  +    }
  +
  +    /**
  +     * Determines the color level from the identifier.
  +     *
  +     * @param identifier Unique color identifier
  +     * @param color One of the bit moving constants
  +     *
  +     * @return Color level in byte size
  +     */
  +    private int determineColorLevel (int identifier, int color)
  +    {
  +        int retVal = (byte) (identifier >> color);
   
  -		return retVal < 0 ? retVal + 256 : retVal;
  -	}
  +        return retVal < 0 ? retVal + 256 : retVal;
  +    }
   }
  
  
  
  1.5       +517 -517  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfExternalGraphic.java  
  Index: RtfExternalGraphic.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfExternalGraphic.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfExternalGraphic.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfExternalGraphic.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -103,135 +103,135 @@
   
   public class RtfExternalGraphic extends RtfElement
   {
  -	/** Exception thrown when an image file/URL cannot be read */
  -	public static class ExternalGraphicException extends IOException
  -	{
  -		ExternalGraphicException(String reason)
  -		{
  -			super(reason);
  -		}
  -	}
  -
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -
  -	/**
  -	 * The url of the image
  -	 */
  -	protected URL url = null;
  -
  -	/**
  -	 * The height of the image
  -	 */
  -	protected int height = -1;
  -
  -	/**
  -	 * The desired percent value of the height
  -	 */
  -	protected int heightPercent = -1;
  -
  -	/**
  -	 * The desired height
  -	 */
  -	protected int heightDesired = -1;
  -
  -	/**
  -	 * Flag whether the desired height is a percentage
  -	 */
  -	protected boolean perCentH = false;
  -
  -	/**
  -	 * The width of the image
  -	 */
  -	protected int width = -1;
  -
  -	/**
  -	 * The desired percent value of the width
  -	 */
  -	protected int widthPercent = -1;
  -
  -	/**
  -	 * The desired width
  -	 */
  -	protected int widthDesired = -1;
  -
  -	/**
  -	 * Flag whether the desired width is a percentage
  -	 */
  -	protected boolean perCentW = false;
  -
  -	/**
  -	 * Flag whether the image size shall be adjusted
  -	 */
  -	protected boolean scaleUniform = false;
  -
  -	/**
  -	 * Graphic compression rate
  -	 */
  -	 protected int graphicCompressionRate = 80;
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -
  -	/**
  -	 * Default constructor.
  -	 * Create an RTF element as a child of given container.
  -	 *
  -	 * @param container a <code>RtfContainer</code> value
  -	 * @param writer a <code>Writer</code> value
  -	 */
  -	public RtfExternalGraphic(RtfContainer container, Writer writer) throws \
                IOException {
  -		super (container, writer);
  -	}
  -
  -	/**
  -	 * Default constructor.
  -	 *
  -	 * @param container a <code>RtfContainer</code> value
  -	 * @param writer a <code>Writer</code> value
  -	 * @param attributes a <code>RtfAttributes</code> value
  -	 */
  -	public RtfExternalGraphic(RtfContainer container, Writer writer,
  -	RtfAttributes attributes) throws IOException {
  -		super (container, writer, attributes);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ RtfElement implementation
  -	//////////////////////////////////////////////////
  -
  -		/** RtfElement override - catches ExternalGraphicException and writes a warning
  -		 *  message to the document if image cannot be read
  -		 */
  -	protected void writeRtfContent() throws IOException {
  -			try {
  -				writeRtfContentWithException();
  -			} catch(ExternalGraphicException ie) {
  -				writeExceptionInRtf(ie);
  -			}
  -		}
  -
  -	/**
  -	 * Writes the RTF content to m_writer - this one throws ExternalGraphicExceptions
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	protected void writeRtfContentWithException() throws IOException {
  -
  -		if (m_writer == null) {
  -			return;
  -		}
  -
  -
  -		if (url == null) {
  -			throw new ExternalGraphicException("The attribute 'url' of \
                <fo:external-graphic> is null.");
  -		}
  +    /** Exception thrown when an image file/URL cannot be read */
  +    public static class ExternalGraphicException extends IOException
  +    {
  +        ExternalGraphicException(String reason)
  +        {
  +            super(reason);
  +        }
  +    }
  +
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +
  +    /**
  +     * The url of the image
  +     */
  +    protected URL url = null;
  +
  +    /**
  +     * The height of the image
  +     */
  +    protected int height = -1;
  +
  +    /**
  +     * The desired percent value of the height
  +     */
  +    protected int heightPercent = -1;
  +
  +    /**
  +     * The desired height
  +     */
  +    protected int heightDesired = -1;
  +
  +    /**
  +     * Flag whether the desired height is a percentage
  +     */
  +    protected boolean perCentH = false;
  +
  +    /**
  +     * The width of the image
  +     */
  +    protected int width = -1;
  +
  +    /**
  +     * The desired percent value of the width
  +     */
  +    protected int widthPercent = -1;
  +
  +    /**
  +     * The desired width
  +     */
  +    protected int widthDesired = -1;
  +
  +    /**
  +     * Flag whether the desired width is a percentage
  +     */
  +    protected boolean perCentW = false;
  +
  +    /**
  +     * Flag whether the image size shall be adjusted
  +     */
  +    protected boolean scaleUniform = false;
  +
  +    /**
  +     * Graphic compression rate
  +     */
  +     protected int graphicCompressionRate = 80;
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +
  +    /**
  +     * Default constructor.
  +     * Create an RTF element as a child of given container.
  +     *
  +     * @param container a <code>RtfContainer</code> value
  +     * @param writer a <code>Writer</code> value
  +     */
  +    public RtfExternalGraphic(RtfContainer container, Writer writer) throws \
IOException {  +        super (container, writer);
  +    }
  +
  +    /**
  +     * Default constructor.
  +     *
  +     * @param container a <code>RtfContainer</code> value
  +     * @param writer a <code>Writer</code> value
  +     * @param attributes a <code>RtfAttributes</code> value
  +     */
  +    public RtfExternalGraphic(RtfContainer container, Writer writer,
  +    RtfAttributes attributes) throws IOException {
  +        super (container, writer, attributes);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ RtfElement implementation
  +    //////////////////////////////////////////////////
  +
  +        /** RtfElement override - catches ExternalGraphicException and writes a \
warning  +         *  message to the document if image cannot be read
  +         */
  +    protected void writeRtfContent() throws IOException {
  +            try {
  +                writeRtfContentWithException();
  +            } catch(ExternalGraphicException ie) {
  +                writeExceptionInRtf(ie);
  +            }
  +        }
  +
  +    /**
  +     * Writes the RTF content to m_writer - this one throws \
ExternalGraphicExceptions  +     *
  +     * @exception IOException On error
  +     */
  +    protected void writeRtfContentWithException() throws IOException {
  +
  +        if (m_writer == null) {
  +            return;
  +        }
  +
  +
  +        if (url == null) {
  +            throw new ExternalGraphicException("The attribute 'url' of \
<fo:external-graphic> is null.");  +        }
   
           String linkToRoot = System.getProperty( "jfor_link_to_root" );
           if (linkToRoot != null)
  @@ -244,396 +244,396 @@
               return;
           }
   
  -//		getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
  +//        getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
   
   
  -		byte[] data = null;
  -		try
  -		{
  -		// image reading patch provided by Michael Krause <michakurt@web.de>
  -		final BufferedInputStream bin = new BufferedInputStream(url.openStream());
  -		final ByteArrayOutputStream bout = new ByteArrayOutputStream();
  -          	while (true) {
  -          		final int datum = bin.read();
  -             	if (datum == -1) break;
  -              	bout.write(datum);
  +        byte[] data = null;
  +        try
  +        {
  +        // image reading patch provided by Michael Krause <michakurt@web.de>
  +        final BufferedInputStream bin = new BufferedInputStream(url.openStream());
  +        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
  +              while (true) {
  +                  final int datum = bin.read();
  +                 if (datum == -1) break;
  +                  bout.write(datum);
                }
                bout.flush();
                data = bout.toByteArray();
  -		}
  -		catch (Exception e) {
  -			throw new ExternalGraphicException("The attribute 'src' of \
                <fo:external-graphic> has a invalid value: '" + url + "' (" + e + \
                ")");
  -		}
  -
  -		if (data == null) {
  -			return;
  -		}
  -
  -		// Determine image file format
  -		String file = url.getFile ();
  -		int type = determineImageType(data, file.substring(file.lastIndexOf(".") + 1));
  -
  -		if (type >= ImageConstants.I_TO_CONVERT_BASIS) {
  -			// convert
  -			int to = ImageConstants.CONVERT_TO [type - ImageConstants.I_TO_CONVERT_BASIS];
  -
  -			if (to == ImageConstants.I_JPG) {
  -				ByteArrayOutputStream out = null;
  -//				try {
  -					//convert to jpeg
  -//					out = new ByteArrayOutputStream();
  -//					Encoder jpgEncoder = new Encoder(graphicCompressionRate, out);
  -//					jpgEncoder.encodeJPEG(data);
  -//					data = out.toByteArray();
  -//					type = to;
  -//				}
  -//				catch (JPEGException e) {
  -//					e.setMessage("Image from tag <fo:external-graphic> could not be created \
                (src = '" + url + "'");
  -//				}
  -//				finally {
  -					out.close();
  -//				}
  -			}
  -			else {
  -				type = ImageConstants.I_NOT_SUPPORTED;
  -			}
  -		}
  -
  -
  -		if (type == ImageConstants.I_NOT_SUPPORTED) {
  -			throw new ExternalGraphicException("The tag <fo:external-graphic> does not \
                support " + file.substring(file.lastIndexOf(".") + 1) + " - image \
                type.");
  -		}
  -
  -		String rtfImageCode = ImageConstants.RTF_TAGS [type];
  -
  -		// Writes the beginning of the rtf image
  -
  -		writeGroupMark(true);
  -		writeStarControlWord("shppict");
  -		writeGroupMark(true);
  -		writeControlWord("pict");
  -
  -		StringBuffer buf = new StringBuffer(data.length * 3);
  -
  -		writeControlWord(rtfImageCode);
  -
  -		if (type == ImageConstants.I_PNG) {
  -			width = ImageUtil.getIntFromByteArray(data, 16, 4, true);
  -			height = ImageUtil.getIntFromByteArray(data, 20, 4, true);
  -		}
  -		else if (type == ImageConstants.I_JPG) {
  -			int basis = -1;
  -			byte ff = (byte) 0xff;
  -			byte c0 = (byte) 0xc0;
  -			for (int i = 0; i < data.length; i++) {
  -				byte b = data[i];
  -				if (b != ff)
  -					continue;
  -				if (i == data.length - 1)
  -					continue;
  -				b = data[i + 1];
  -				if (b != c0)
  -					continue;
  -				basis = i + 5;
  -				break;
  -			}
  -
  -			if (basis != -1) {
  -				width = ImageUtil.getIntFromByteArray(data, basis + 2, 2, true);
  -				height = ImageUtil.getIntFromByteArray(data, basis, 2, true);
  -			}
  -		}
  -		else if (type == ImageConstants.I_EMF) {
  -			width = ImageUtil.getIntFromByteArray(data, 151, 4, false);
  -			height = ImageUtil.getIntFromByteArray(data, 155, 4, false);
  -		}
  -
  -		// Set image size
  -		if (width != -1) {
  -			writeControlWord("picw" + width);
  -		}
  -		if (height != -1) {
  -			writeControlWord("pich" + height);
  -		}
  -
  -		if (widthDesired != -1) {
  -			if (perCentW) {
  -				writeControlWord("picscalex" + widthDesired);
  -			}
  -			else {
  -				writeControlWord("picscalex" + widthDesired * 100 / width);
  -			}
  -
  -			writeControlWord("picwgoal" + widthDesired);
  -		}
  -		else if (scaleUniform && heightDesired != -1) {
  -			if (perCentH) {
  -				writeControlWord("picscalex" + heightDesired);
  -			}
  -			else {
  -				writeControlWord("picscalex" + heightDesired * 100 / height);
  -			}
  -		}
  -
  -		if (heightDesired != -1) {
  -			if (perCentH) {
  -				writeControlWord("picscaley" + heightDesired);
  -			}
  -			else {
  -				writeControlWord("picscaley" + heightDesired * 100 / height);
  -			}
  -
  -			writeControlWord("pichgoal" + heightDesired);
  -		}
  -		else if (scaleUniform && widthDesired != -1) {
  -			if (perCentW) {
  -				writeControlWord("picscaley" + widthDesired);
  -			}
  -			else {
  -				writeControlWord("picscaley" + widthDesired * 100 / width);
  -			}
  -		}
  -
  -		for (int i = 0; i < data.length; i++) {
  -			int iData = data [i];
  -
  -			// Make positive byte
  -			if (iData < 0)
  -				iData += 256;
  -
  -			if (iData < 16) {
  -				// Set leading zero and append
  -				buf.append('0');
  -			}
  -
  -			buf.append(Integer.toHexString(iData));
  -		}
  -
  -		int len = buf.length();
  -		char[] chars = new char[len];
  -
  -		buf.getChars(0, len, chars, 0);
  -		m_writer.write(chars);
  -
  -		// Writes the end of RTF image
  -
  -		writeGroupMark(false);
  -		writeGroupMark(false);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Member access
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Sets the desired height of the image.
  -	 *
  -	 * @param theHeight The desired image height
  -	 */
  -	public void setHeight(String theHeight) {
  -		this.heightDesired = ImageUtil.getInt(theHeight);
  -		this.perCentH = ImageUtil.isPercent(theHeight);
  -	}
  -
  -	/**
  -	 * Sets the desired width of the image.
  -	 *
  -	 * @param theWidth The desired image width
  -	 */
  -	public void setWidth(String theWidth) {
  -		this.widthDesired = ImageUtil.getInt(theWidth);
  -		this.perCentW = ImageUtil.isPercent(theWidth);
  -	}
  -
  -	/**
  -	 * Sets the flag whether the image size shall be adjusted.
  -	 *
  -	 * @param value
  -	 * true    image width or height shall be adjusted automatically\n
  -	 * false   no adjustment
  -	 */
  -	public void setScaling(String value) {
  -		if (value.equalsIgnoreCase("uniform")) {
  -			this.scaleUniform = true;
  -		}
  -	}
  -
  -	/**
  -	 * Sets the url of the image.
  -	 *
  -	 * @param urlString Image url like "file://..."
  -	 * @throws IOException On error
  -	 */
  -	public void setURL(String urlString) throws IOException
  -	{
  -		URL tmpUrl = null;
  -		try
  -		{
  -			tmpUrl = new URL (urlString);
  -		}
  -		catch (MalformedURLException e)
  -		{
  -			try
  -			{
  -				tmpUrl = new File (urlString).toURL ();
  -			}
  -			catch (MalformedURLException ee)
  -			{
  -				throw new ExternalGraphicException("The attribute 'src' of \
                <fo:external-graphic> has a invalid value: '" + urlString + "' (" + \
                ee + ")");
  -			}
  -		}
  -		this.url = tmpUrl;
  -	}
  -
  -	/**
  -	 * Gets  the compression rate for the image in percent.
  -	 * @return Compression rate
  -	 */
  -	public int getCompressionRate ()
  -	{
  -		return graphicCompressionRate;
  -	}
  -
  -	/**
  -	 * Sets the compression rate for the image in percent.
  -	 *
  -	 * @param percent Compression rate
  -	 * @return
  -	 *  true:   The compression rate is valid (0..100)\n
  -	 *  false:  The compression rate is invalid
  -	 */
  -	public boolean setCompressionRate (int percent)
  -	{
  -		if (percent < 1 || percent > 100)
  -			return false;
  -
  -		graphicCompressionRate = percent;
  -		return true;
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Helpers
  -	//////////////////////////////////////////////////
  -
  -
  -	/**
  -	 * Determines wheter the image is a jpeg.
  -	 *
  -	 * @param data Image
  -	 *
  -	 * @return
  -	 * true    If JPEG type\n
  -	 * false   Other type
  -	 */
  -	private boolean isJPEG(byte[] data) {
  -		// Indentifier "0xFFD8" on position 0
  -		byte [] pattern = new byte [] {(byte) 0xFF, (byte) 0xD8};
  -
  -		return ImageUtil.compareHexValues(pattern, data, 0, true);
  -	}
  -
  -	/**
  -	 * Determines wheter the image is a png.
  -	 *
  -	 * @param data Image
  -	 *
  -	 * @return
  -	 * true    If PNG type\n
  -	 * false   Other type
  -	 */
  -	private boolean isPNG(byte[] data) {
  -		// Indentifier "PNG" on position 1
  -		byte [] pattern = new byte [] {(byte) 0x50, (byte) 0x4E, (byte) 0x47};
  -
  -		return ImageUtil.compareHexValues(pattern, data, 1, true);
  -	}
  -
  -	/**
  -	 * Determines wheter the image is a emf.
  -	 *
  -	 * @param data Image
  -	 *
  -	 * @return
  -	 * true    If EMF type\n
  -	 * false   Other type
  -	 */
  -	private boolean isEMF(byte[] data) {
  -		// No offical Indentifier known
  -		byte [] pattern = new byte [] {(byte) 0x01, (byte) 0x00, (byte) 0x00};
  -
  -		return ImageUtil.compareHexValues(pattern, data, 0, true);
  -	}
  -
  -	/**
  -	 * Determines wheter the image is a gif.
  -	 *
  -	 * @param data Image
  -	 *
  -	 * @return
  -	 * true    If GIF type\n
  -	 * false   Other type
  -	 */
  -	private boolean isGIF(byte[] data) {
  -		// Indentifier "GIF8" on position 0
  -		byte [] pattern = new byte [] {(byte) 0x47, (byte) 0x49, (byte) 0x46, (byte) \
                0x38};
  -
  -		return ImageUtil.compareHexValues(pattern, data, 0, true);
  -	}
  -
  -	/**
  -	 * Determines wheter the image is a gif.
  -	 *
  -	 * @param data Image
  -	 *
  -	 * @return
  -	 * true    If BMP type\n
  -	 * false   Other type
  -	 */
  -	private boolean isBMP(byte[] data) {
  -		// Indentifier "BM" on position 0
  -		byte [] pattern = new byte [] {(byte) 0x42, (byte) 0x4D};
  -
  -		return ImageUtil.compareHexValues(pattern, data, 0, true);
  -	}
  -
  -	/**
  -	 * Determine image file format.
  -	 *
  -	 * @param data Image
  -	 * @param ext Image extension
  -	 *
  -	 * @return Image type by ImageConstants.java
  -	 */
  -	private int determineImageType(byte [] data, String ext) {
  -		int type = ImageConstants.I_NOT_SUPPORTED;
  -
  -		if (isPNG(data)) {
  -			type = ImageConstants.I_PNG;
  -		}
  -		else if (isJPEG(data)) {
  -			type = ImageConstants.I_JPG_C;
  -		}
  -		else if (isEMF(data)) {
  -			type = ImageConstants.I_EMF;
  -		}
  -		else if (isGIF(data)) {
  -			type = ImageConstants.I_GIF;
  -		}
  -		else {
  -			Object tmp = ImageConstants.SUPPORTED_IMAGE_TYPES.get(ext.toLowerCase());
  -			if (tmp != null) {
  -				type = ((Integer) tmp).intValue();
  -			}
  -		}
  -
  -		return type;
  -	}
  -
  -	/** true if this element would generate no "useful" RTF content */
  -	public boolean isEmpty()
  -	{
  -		return url==null;
  -	}
  +        }
  +        catch (Exception e) {
  +            throw new ExternalGraphicException("The attribute 'src' of \
<fo:external-graphic> has a invalid value: '" + url + "' (" + e + ")");  +        }
  +
  +        if (data == null) {
  +            return;
  +        }
  +
  +        // Determine image file format
  +        String file = url.getFile ();
  +        int type = determineImageType(data, file.substring(file.lastIndexOf(".") + \
1));  +
  +        if (type >= ImageConstants.I_TO_CONVERT_BASIS) {
  +            // convert
  +            int to = ImageConstants.CONVERT_TO [type - \
ImageConstants.I_TO_CONVERT_BASIS];  +
  +            if (to == ImageConstants.I_JPG) {
  +                ByteArrayOutputStream out = null;
  +//                try {
  +                    //convert to jpeg
  +//                    out = new ByteArrayOutputStream();
  +//                    Encoder jpgEncoder = new Encoder(graphicCompressionRate, \
out);  +//                    jpgEncoder.encodeJPEG(data);
  +//                    data = out.toByteArray();
  +//                    type = to;
  +//                }
  +//                catch (JPEGException e) {
  +//                    e.setMessage("Image from tag <fo:external-graphic> could not \
be created (src = '" + url + "'");  +//                }
  +//                finally {
  +                    out.close();
  +//                }
  +            }
  +            else {
  +                type = ImageConstants.I_NOT_SUPPORTED;
  +            }
  +        }
  +
  +
  +        if (type == ImageConstants.I_NOT_SUPPORTED) {
  +            throw new ExternalGraphicException("The tag <fo:external-graphic> does \
not support " + file.substring(file.lastIndexOf(".") + 1) + " - image type.");  +     \
}  +
  +        String rtfImageCode = ImageConstants.RTF_TAGS [type];
  +
  +        // Writes the beginning of the rtf image
  +
  +        writeGroupMark(true);
  +        writeStarControlWord("shppict");
  +        writeGroupMark(true);
  +        writeControlWord("pict");
  +
  +        StringBuffer buf = new StringBuffer(data.length * 3);
  +
  +        writeControlWord(rtfImageCode);
  +
  +        if (type == ImageConstants.I_PNG) {
  +            width = ImageUtil.getIntFromByteArray(data, 16, 4, true);
  +            height = ImageUtil.getIntFromByteArray(data, 20, 4, true);
  +        }
  +        else if (type == ImageConstants.I_JPG) {
  +            int basis = -1;
  +            byte ff = (byte) 0xff;
  +            byte c0 = (byte) 0xc0;
  +            for (int i = 0; i < data.length; i++) {
  +                byte b = data[i];
  +                if (b != ff)
  +                    continue;
  +                if (i == data.length - 1)
  +                    continue;
  +                b = data[i + 1];
  +                if (b != c0)
  +                    continue;
  +                basis = i + 5;
  +                break;
  +            }
  +
  +            if (basis != -1) {
  +                width = ImageUtil.getIntFromByteArray(data, basis + 2, 2, true);
  +                height = ImageUtil.getIntFromByteArray(data, basis, 2, true);
  +            }
  +        }
  +        else if (type == ImageConstants.I_EMF) {
  +            width = ImageUtil.getIntFromByteArray(data, 151, 4, false);
  +            height = ImageUtil.getIntFromByteArray(data, 155, 4, false);
  +        }
  +
  +        // Set image size
  +        if (width != -1) {
  +            writeControlWord("picw" + width);
  +        }
  +        if (height != -1) {
  +            writeControlWord("pich" + height);
  +        }
  +
  +        if (widthDesired != -1) {
  +            if (perCentW) {
  +                writeControlWord("picscalex" + widthDesired);
  +            }
  +            else {
  +                writeControlWord("picscalex" + widthDesired * 100 / width);
  +            }
  +
  +            writeControlWord("picwgoal" + widthDesired);
  +        }
  +        else if (scaleUniform && heightDesired != -1) {
  +            if (perCentH) {
  +                writeControlWord("picscalex" + heightDesired);
  +            }
  +            else {
  +                writeControlWord("picscalex" + heightDesired * 100 / height);
  +            }
  +        }
  +
  +        if (heightDesired != -1) {
  +            if (perCentH) {
  +                writeControlWord("picscaley" + heightDesired);
  +            }
  +            else {
  +                writeControlWord("picscaley" + heightDesired * 100 / height);
  +            }
  +
  +            writeControlWord("pichgoal" + heightDesired);
  +        }
  +        else if (scaleUniform && widthDesired != -1) {
  +            if (perCentW) {
  +                writeControlWord("picscaley" + widthDesired);
  +            }
  +            else {
  +                writeControlWord("picscaley" + widthDesired * 100 / width);
  +            }
  +        }
  +
  +        for (int i = 0; i < data.length; i++) {
  +            int iData = data [i];
  +
  +            // Make positive byte
  +            if (iData < 0)
  +                iData += 256;
  +
  +            if (iData < 16) {
  +                // Set leading zero and append
  +                buf.append('0');
  +            }
  +
  +            buf.append(Integer.toHexString(iData));
  +        }
  +
  +        int len = buf.length();
  +        char[] chars = new char[len];
  +
  +        buf.getChars(0, len, chars, 0);
  +        m_writer.write(chars);
  +
  +        // Writes the end of RTF image
  +
  +        writeGroupMark(false);
  +        writeGroupMark(false);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Member access
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Sets the desired height of the image.
  +     *
  +     * @param theHeight The desired image height
  +     */
  +    public void setHeight(String theHeight) {
  +        this.heightDesired = ImageUtil.getInt(theHeight);
  +        this.perCentH = ImageUtil.isPercent(theHeight);
  +    }
  +
  +    /**
  +     * Sets the desired width of the image.
  +     *
  +     * @param theWidth The desired image width
  +     */
  +    public void setWidth(String theWidth) {
  +        this.widthDesired = ImageUtil.getInt(theWidth);
  +        this.perCentW = ImageUtil.isPercent(theWidth);
  +    }
  +
  +    /**
  +     * Sets the flag whether the image size shall be adjusted.
  +     *
  +     * @param value
  +     * true    image width or height shall be adjusted automatically\n
  +     * false   no adjustment
  +     */
  +    public void setScaling(String value) {
  +        if (value.equalsIgnoreCase("uniform")) {
  +            this.scaleUniform = true;
  +        }
  +    }
  +
  +    /**
  +     * Sets the url of the image.
  +     *
  +     * @param urlString Image url like "file://..."
  +     * @throws IOException On error
  +     */
  +    public void setURL(String urlString) throws IOException
  +    {
  +        URL tmpUrl = null;
  +        try
  +        {
  +            tmpUrl = new URL (urlString);
  +        }
  +        catch (MalformedURLException e)
  +        {
  +            try
  +            {
  +                tmpUrl = new File (urlString).toURL ();
  +            }
  +            catch (MalformedURLException ee)
  +            {
  +                throw new ExternalGraphicException("The attribute 'src' of \
<fo:external-graphic> has a invalid value: '" + urlString + "' (" + ee + ")");  +     \
}  +        }
  +        this.url = tmpUrl;
  +    }
  +
  +    /**
  +     * Gets  the compression rate for the image in percent.
  +     * @return Compression rate
  +     */
  +    public int getCompressionRate ()
  +    {
  +        return graphicCompressionRate;
  +    }
  +
  +    /**
  +     * Sets the compression rate for the image in percent.
  +     *
  +     * @param percent Compression rate
  +     * @return
  +     *  true:   The compression rate is valid (0..100)\n
  +     *  false:  The compression rate is invalid
  +     */
  +    public boolean setCompressionRate (int percent)
  +    {
  +        if (percent < 1 || percent > 100)
  +            return false;
  +
  +        graphicCompressionRate = percent;
  +        return true;
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Helpers
  +    //////////////////////////////////////////////////
  +
  +
  +    /**
  +     * Determines wheter the image is a jpeg.
  +     *
  +     * @param data Image
  +     *
  +     * @return
  +     * true    If JPEG type\n
  +     * false   Other type
  +     */
  +    private boolean isJPEG(byte[] data) {
  +        // Indentifier "0xFFD8" on position 0
  +        byte [] pattern = new byte [] {(byte) 0xFF, (byte) 0xD8};
  +
  +        return ImageUtil.compareHexValues(pattern, data, 0, true);
  +    }
  +
  +    /**
  +     * Determines wheter the image is a png.
  +     *
  +     * @param data Image
  +     *
  +     * @return
  +     * true    If PNG type\n
  +     * false   Other type
  +     */
  +    private boolean isPNG(byte[] data) {
  +        // Indentifier "PNG" on position 1
  +        byte [] pattern = new byte [] {(byte) 0x50, (byte) 0x4E, (byte) 0x47};
  +
  +        return ImageUtil.compareHexValues(pattern, data, 1, true);
  +    }
  +
  +    /**
  +     * Determines wheter the image is a emf.
  +     *
  +     * @param data Image
  +     *
  +     * @return
  +     * true    If EMF type\n
  +     * false   Other type
  +     */
  +    private boolean isEMF(byte[] data) {
  +        // No offical Indentifier known
  +        byte [] pattern = new byte [] {(byte) 0x01, (byte) 0x00, (byte) 0x00};
  +
  +        return ImageUtil.compareHexValues(pattern, data, 0, true);
  +    }
  +
  +    /**
  +     * Determines wheter the image is a gif.
  +     *
  +     * @param data Image
  +     *
  +     * @return
  +     * true    If GIF type\n
  +     * false   Other type
  +     */
  +    private boolean isGIF(byte[] data) {
  +        // Indentifier "GIF8" on position 0
  +        byte [] pattern = new byte [] {(byte) 0x47, (byte) 0x49, (byte) 0x46, \
(byte) 0x38};  +
  +        return ImageUtil.compareHexValues(pattern, data, 0, true);
  +    }
  +
  +    /**
  +     * Determines wheter the image is a gif.
  +     *
  +     * @param data Image
  +     *
  +     * @return
  +     * true    If BMP type\n
  +     * false   Other type
  +     */
  +    private boolean isBMP(byte[] data) {
  +        // Indentifier "BM" on position 0
  +        byte [] pattern = new byte [] {(byte) 0x42, (byte) 0x4D};
  +
  +        return ImageUtil.compareHexValues(pattern, data, 0, true);
  +    }
  +
  +    /**
  +     * Determine image file format.
  +     *
  +     * @param data Image
  +     * @param ext Image extension
  +     *
  +     * @return Image type by ImageConstants.java
  +     */
  +    private int determineImageType(byte [] data, String ext) {
  +        int type = ImageConstants.I_NOT_SUPPORTED;
  +
  +        if (isPNG(data)) {
  +            type = ImageConstants.I_PNG;
  +        }
  +        else if (isJPEG(data)) {
  +            type = ImageConstants.I_JPG_C;
  +        }
  +        else if (isEMF(data)) {
  +            type = ImageConstants.I_EMF;
  +        }
  +        else if (isGIF(data)) {
  +            type = ImageConstants.I_GIF;
  +        }
  +        else {
  +            Object tmp = \
ImageConstants.SUPPORTED_IMAGE_TYPES.get(ext.toLowerCase());  +            if (tmp != \
null) {  +                type = ((Integer) tmp).intValue();
  +            }
  +        }
  +
  +        return type;
  +    }
  +
  +    /** true if this element would generate no "useful" RTF content */
  +    public boolean isEmpty()
  +    {
  +        return url==null;
  +    }
   }
  
  
  
  1.5       +140 -140  xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFile.java
  
  Index: RtfFile.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFile.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfFile.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfFile.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -71,143 +71,143 @@
   
   public class RtfFile
   extends RtfContainer {
  -	private RtfHeader m_header;
  -	private RtfPageArea m_pageArea;
  -	private RtfListTable m_listTable;
  -	private RtfDocumentArea m_docArea;
  -//	private ConverterLogChannel m_log;
  -	private RtfContainer m_listTableContainer;
  -	private int listNum=0;
  -
  -	/** Create an RTF file that outputs to the given Writer */
  -	public RtfFile(Writer w) throws IOException {
  -		super(null,w);
  -	}
  -
  -	/** optional log channel */
  -//	public void setLogChannel(ConverterLogChannel log)
  -//	{
  -//		m_log = log;
  -//	}
  -
  -	/**
  -	 * Gets the log channel.
  -	 * If logchannel not set, it will return a empty log channel.
  -	 * @return our log channel, it is never null */
  -//	ConverterLogChannel getLog()
  -//	{
  -//		if (m_log == null)
  -//			m_log = new ConverterLogChannel (null);
  -//		return m_log;
  -//	}
  -
  -	/** If called, must be called before startDocumentArea */
  -	public RtfHeader startHeader()
  -	throws IOException {
  -		if(m_header!=null) throw new RtfStructureException("startHeader called more than \
                once");
  -		m_header = new RtfHeader(this,m_writer);
  -		m_listTableContainer = new RtfContainer(this,m_writer);
  -		return m_header;
  -	}
  -
  -	/** Creates the list table.*/
  -	public RtfListTable startListTable(RtfAttributes attr)
  -	throws IOException{
  -		listNum++;
  -		m_listTable = new RtfListTable(this,m_writer,new Integer(listNum),attr);
  -		m_listTableContainer.addChild(m_listTable);
  -		return m_listTable;
  -	}
  -
  -	/** Closes the RtfHeader if not done yet, and starts the docment area.
  -		Like startDocumentArea, is only called once. This is not optimal,
  -		must be able to have multiple page definition, and corresponding
  -		Document areas */
  -	public RtfPageArea startPageArea()
  -	throws IOException,RtfStructureException {
  -		if(m_pageArea!=null) throw new RtfStructureException("startPageArea called more \
                than once");
  -		// create an empty header if there was none
  -		if(m_header==null) startHeader();
  -		m_header.close();
  -		m_pageArea = new RtfPageArea(this,m_writer);
  -		addChild(m_pageArea);
  -		return m_pageArea;
  -	}
  -
  -	/** Call startPageArea if needed and return the page area object. */
  -	public RtfPageArea getPageArea()
  -	throws IOException,RtfStructureException {
  -		if(m_pageArea== null) return startPageArea();
  -		return m_pageArea;
  -	}
  -
  -	/** Closes the RtfHeader if not done yet, and starts the document area.
  -	 *  Must be called once only.
  -	 */
  -	public RtfDocumentArea startDocumentArea()
  -	throws IOException,RtfStructureException {
  -		if(m_docArea!=null) throw new RtfStructureException("startDocumentArea called \
                more than once");
  -		// create an empty header if there was none
  -		if(m_header==null) startHeader();
  -		m_header.close();
  -		m_docArea = new RtfDocumentArea(this,m_writer);
  -		addChild(m_docArea);
  -		return m_docArea;
  -	}
  -
  -
  -
  -	/** Call startDocumentArea if needed and return the document area object. */
  -	public RtfDocumentArea getDocumentArea()
  -	throws IOException,RtfStructureException {
  -		if(m_docArea == null) return startDocumentArea();
  -		return m_docArea;
  -	}
  -
  -	/** overridden to write RTF prefix code, what comes before our children */
  -	protected void writeRtfPrefix() throws IOException
  -	{
  -		writeGroupMark(true);
  -		writeControlWord("rtf1");
  -	}
  -
  -	/** overridden to write RTF suffix code, what comes after our children */
  -	protected void writeRtfSuffix() throws IOException
  -	{
  -		writeGroupMark(false);
  -	}
  -
  -	/** must be called when done creating the document */
  -	public synchronized void flush() throws IOException {
  -		writeRtf();
  -		m_writer.flush();
  -	}
  -
  -	/** minimal test and usage example */
  -	public static void main(String args[])
  -	throws Exception {
  -		Writer w = null;
  -		if(args.length != 0) {
  -			final String outFile = args[0];
  -			System.err.println("Outputting RTF to file '" + outFile + "'");
  -			w = new BufferedWriter(new FileWriter(outFile));
  -		} else {
  -			System.err.println("Outputting RTF code to standard output");
  -			w = new BufferedWriter(new OutputStreamWriter(System.out));
  -		}
  -
  -		final RtfFile f = new RtfFile(w);
  -		final RtfSection sect = f.startDocumentArea().newSection();
  -
  -		final RtfParagraph p = sect.newParagraph();
  -		p.newText("Hello, RTF world.\n",null);
  -		final RtfAttributes attr = new RtfAttributes();
  -		attr.set(RtfText.ATTR_BOLD);
  -		attr.set(RtfText.ATTR_ITALIC);
  -		attr.set(RtfText.ATTR_FONT_SIZE,36);
  -		p.newText("This is bold, italic, 36 points",attr);
  -
  -		f.flush();
  -		System.err.println("RtfFile test: all done.");
  -	}
  +    private RtfHeader m_header;
  +    private RtfPageArea m_pageArea;
  +    private RtfListTable m_listTable;
  +    private RtfDocumentArea m_docArea;
  +//    private ConverterLogChannel m_log;
  +    private RtfContainer m_listTableContainer;
  +    private int listNum=0;
  +
  +    /** Create an RTF file that outputs to the given Writer */
  +    public RtfFile(Writer w) throws IOException {
  +        super(null,w);
  +    }
  +
  +    /** optional log channel */
  +//    public void setLogChannel(ConverterLogChannel log)
  +//    {
  +//        m_log = log;
  +//    }
  +
  +    /**
  +     * Gets the log channel.
  +     * If logchannel not set, it will return a empty log channel.
  +     * @return our log channel, it is never null */
  +//    ConverterLogChannel getLog()
  +//    {
  +//        if (m_log == null)
  +//            m_log = new ConverterLogChannel (null);
  +//        return m_log;
  +//    }
  +
  +    /** If called, must be called before startDocumentArea */
  +    public RtfHeader startHeader()
  +    throws IOException {
  +        if(m_header!=null) throw new RtfStructureException("startHeader called \
more than once");  +        m_header = new RtfHeader(this,m_writer);
  +        m_listTableContainer = new RtfContainer(this,m_writer);
  +        return m_header;
  +    }
  +
  +    /** Creates the list table.*/
  +    public RtfListTable startListTable(RtfAttributes attr)
  +    throws IOException{
  +        listNum++;
  +        m_listTable = new RtfListTable(this,m_writer,new Integer(listNum),attr);
  +        m_listTableContainer.addChild(m_listTable);
  +        return m_listTable;
  +    }
  +
  +    /** Closes the RtfHeader if not done yet, and starts the docment area.
  +        Like startDocumentArea, is only called once. This is not optimal,
  +        must be able to have multiple page definition, and corresponding
  +        Document areas */
  +    public RtfPageArea startPageArea()
  +    throws IOException,RtfStructureException {
  +        if(m_pageArea!=null) throw new RtfStructureException("startPageArea called \
more than once");  +        // create an empty header if there was none
  +        if(m_header==null) startHeader();
  +        m_header.close();
  +        m_pageArea = new RtfPageArea(this,m_writer);
  +        addChild(m_pageArea);
  +        return m_pageArea;
  +    }
  +
  +    /** Call startPageArea if needed and return the page area object. */
  +    public RtfPageArea getPageArea()
  +    throws IOException,RtfStructureException {
  +        if(m_pageArea== null) return startPageArea();
  +        return m_pageArea;
  +    }
  +
  +    /** Closes the RtfHeader if not done yet, and starts the document area.
  +     *  Must be called once only.
  +     */
  +    public RtfDocumentArea startDocumentArea()
  +    throws IOException,RtfStructureException {
  +        if(m_docArea!=null) throw new RtfStructureException("startDocumentArea \
called more than once");  +        // create an empty header if there was none
  +        if(m_header==null) startHeader();
  +        m_header.close();
  +        m_docArea = new RtfDocumentArea(this,m_writer);
  +        addChild(m_docArea);
  +        return m_docArea;
  +    }
  +
  +
  +
  +    /** Call startDocumentArea if needed and return the document area object. */
  +    public RtfDocumentArea getDocumentArea()
  +    throws IOException,RtfStructureException {
  +        if(m_docArea == null) return startDocumentArea();
  +        return m_docArea;
  +    }
  +
  +    /** overridden to write RTF prefix code, what comes before our children */
  +    protected void writeRtfPrefix() throws IOException
  +    {
  +        writeGroupMark(true);
  +        writeControlWord("rtf1");
  +    }
  +
  +    /** overridden to write RTF suffix code, what comes after our children */
  +    protected void writeRtfSuffix() throws IOException
  +    {
  +        writeGroupMark(false);
  +    }
  +
  +    /** must be called when done creating the document */
  +    public synchronized void flush() throws IOException {
  +        writeRtf();
  +        m_writer.flush();
  +    }
  +
  +    /** minimal test and usage example */
  +    public static void main(String args[])
  +    throws Exception {
  +        Writer w = null;
  +        if(args.length != 0) {
  +            final String outFile = args[0];
  +            System.err.println("Outputting RTF to file '" + outFile + "'");
  +            w = new BufferedWriter(new FileWriter(outFile));
  +        } else {
  +            System.err.println("Outputting RTF code to standard output");
  +            w = new BufferedWriter(new OutputStreamWriter(System.out));
  +        }
  +
  +        final RtfFile f = new RtfFile(w);
  +        final RtfSection sect = f.startDocumentArea().newSection();
  +
  +        final RtfParagraph p = sect.newParagraph();
  +        p.newText("Hello, RTF world.\n",null);
  +        final RtfAttributes attr = new RtfAttributes();
  +        attr.set(RtfText.ATTR_BOLD);
  +        attr.set(RtfText.ATTR_ITALIC);
  +        attr.set(RtfText.ATTR_FONT_SIZE,36);
  +        p.newText("This is bold, italic, 36 points",attr);
  +
  +        f.flush();
  +        System.err.println("RtfFile test: all done.");
  +    }
   }
  
  
  
  1.3       +144 -144  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFontManager.java  
  Index: RtfFontManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFontManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfFontManager.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfFontManager.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -68,154 +68,154 @@
    */
   public class RtfFontManager
   {
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -	/** Singelton instance */
  -	private static RtfFontManager instance = null;
  -
  -	/** Index table for the fonts */
  -	private Hashtable fontIndex = null;
  -	/** Used fonts to this vector */
  -	private Vector fontTable = null;
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Constructor.
  -	 */
  -	private RtfFontManager ()
  -	{
  -		fontTable = new Vector ();
  -		fontIndex = new Hashtable ();
  -
  -		init ();
  -	}
  -
  -	/**
  -	 * Singelton.
  -	 *
  -	 * @return The instance of RtfFontManager
  -	 */
  -	public static RtfFontManager getInstance ()
  -	{
  -		if (instance == null)
  -		{
  -			instance = new RtfFontManager ();
  -		}
  -
  -		return instance;
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Initializing
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Initialize the font table.
  -	 */
  -	private void init ()
  -	{
  -
  -//		getFontNumber ("Helvetica");
  -		//Chanded by R.Marra default font Arial
  -		getFontNumber ("Arial");
  -		getFontNumber ("Symbol"); // used by RtfListItem.java
  -		getFontNumber ("Times New Roman");
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +    /** Singelton instance */
  +    private static RtfFontManager instance = null;
  +
  +    /** Index table for the fonts */
  +    private Hashtable fontIndex = null;
  +    /** Used fonts to this vector */
  +    private Vector fontTable = null;
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Constructor.
  +     */
  +    private RtfFontManager ()
  +    {
  +        fontTable = new Vector ();
  +        fontIndex = new Hashtable ();
  +
  +        init ();
  +    }
  +
  +    /**
  +     * Singelton.
  +     *
  +     * @return The instance of RtfFontManager
  +     */
  +    public static RtfFontManager getInstance ()
  +    {
  +        if (instance == null)
  +        {
  +            instance = new RtfFontManager ();
  +        }
  +
  +        return instance;
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Initializing
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Initialize the font table.
  +     */
  +    private void init ()
  +    {
  +
  +//        getFontNumber ("Helvetica");
  +        //Chanded by R.Marra default font Arial
  +        getFontNumber ("Arial");
  +        getFontNumber ("Symbol"); // used by RtfListItem.java
  +        getFontNumber ("Times New Roman");
   
   /*
  -		{\\f0\\fswiss Helv;}
  +        {\\f0\\fswiss Helv;}
   
  -		// f1 is used by RtfList and RtfListItem for bullets
  +        // f1 is used by RtfList and RtfListItem for bullets
   
  -		{\\f1\\froman\\fcharset2 Symbol;}
  -		{\\f2\\froman\\fprq2 Times New Roman;}
  -		{\\f3\\froman Times New Roman;}
  +        {\\f1\\froman\\fcharset2 Symbol;}
  +        {\\f2\\froman\\fprq2 Times New Roman;}
  +        {\\f3\\froman Times New Roman;}
   */
  -	}
  +    }
   
   
  -	//////////////////////////////////////////////////
  -	// @@ Public methods
  -	//////////////////////////////////////////////////
  -
  -
  -	/**
  -	 * Gets the number of font in the font table
  -	 *
  -	 * @param family Font family name ('Helvetica')
  -	 *
  -	 * @return The number of the font in the table
  -	 */
  -	public int getFontNumber (String family)
  -	{
  -
  -		family = family.toLowerCase ();
  -		Object o = fontIndex.get (family);
  -		int retVal;
  -
  -		if (o == null)
  -		{
  -			addFont (family);
  -
  -			retVal = fontTable.size () - 1;
  -		}
  -		else
  -		{
  -			retVal = ((Integer) o).intValue ();
  -		}
  -
  -		return retVal;
  -	}
  -
  -	/**
  -	 * Writes the font table in the header.
  -	 *
  -	 * @param header The header container to write in
  -	 *
  -	 * @throws IOException On error
  -	 */
  -	public void writeFonts (RtfHeader header) throws IOException
  -	{
  -		if (fontTable == null || fontTable.size () == 0)
  -		{
  -			return;
  -		}
  -
  -		header.writeGroupMark (true);
  -		header.writeControlWord ("fonttbl;");
  -
  -		int len = fontTable.size ();
  -
  -		for (int i = 0; i < len; i++)
  -		{
  -			header.writeGroupMark (true);
  -			header.write ("\\f" + i);
  -			header.write (" " + (String) fontTable.elementAt (i));
  -			header.writeGroupMark (false);
  -		}
  -
  -		header.writeGroupMark (false);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Private methods
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Adds a font to the table.
  -	 *
  -	 * @param i Identifier of font
  -	 */
  -	private void addFont (String family)
  -	{
  -		fontIndex.put (family, new Integer (fontTable.size ()));
  -		fontTable.addElement (family);
  -	}
  +    //////////////////////////////////////////////////
  +    // @@ Public methods
  +    //////////////////////////////////////////////////
  +
  +
  +    /**
  +     * Gets the number of font in the font table
  +     *
  +     * @param family Font family name ('Helvetica')
  +     *
  +     * @return The number of the font in the table
  +     */
  +    public int getFontNumber (String family)
  +    {
  +
  +        family = family.toLowerCase ();
  +        Object o = fontIndex.get (family);
  +        int retVal;
  +
  +        if (o == null)
  +        {
  +            addFont (family);
  +
  +            retVal = fontTable.size () - 1;
  +        }
  +        else
  +        {
  +            retVal = ((Integer) o).intValue ();
  +        }
  +
  +        return retVal;
  +    }
  +
  +    /**
  +     * Writes the font table in the header.
  +     *
  +     * @param header The header container to write in
  +     *
  +     * @throws IOException On error
  +     */
  +    public void writeFonts (RtfHeader header) throws IOException
  +    {
  +        if (fontTable == null || fontTable.size () == 0)
  +        {
  +            return;
  +        }
  +
  +        header.writeGroupMark (true);
  +        header.writeControlWord ("fonttbl;");
  +
  +        int len = fontTable.size ();
  +
  +        for (int i = 0; i < len; i++)
  +        {
  +            header.writeGroupMark (true);
  +            header.write ("\\f" + i);
  +            header.write (" " + (String) fontTable.elementAt (i));
  +            header.writeGroupMark (false);
  +        }
  +
  +        header.writeGroupMark (false);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Private methods
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Adds a font to the table.
  +     *
  +     * @param i Identifier of font
  +     */
  +    private void addFont (String family)
  +    {
  +        fontIndex.put (family, new Integer (fontTable.size ()));
  +        fontTable.addElement (family);
  +    }
   }
  
  
  
  1.3       +12 -12    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFontTable.java  
  Index: RtfFontTable.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfFontTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfFontTable.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfFontTable.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -68,17 +68,17 @@
   
   class RtfFontTable extends RtfElement
   {
  -	/** Create an RTF header */
  -	RtfFontTable(RtfHeader h, Writer w) throws IOException
  -	{
  -		super(h,w);
  -	}
  +    /** Create an RTF header */
  +    RtfFontTable(RtfHeader h, Writer w) throws IOException
  +    {
  +        super(h,w);
  +    }
   
  -	/** write our contents to m_writer. */
  -	protected void writeRtfContent() throws IOException
  -	{
  -		RtfFontManager.getInstance ().writeFonts ((RtfHeader)m_parent);
  -	}
  +    /** write our contents to m_writer. */
  +    protected void writeRtfContent() throws IOException
  +    {
  +        RtfFontManager.getInstance ().writeFonts ((RtfHeader)m_parent);
  +    }
   
       /** true if this element would generate no "useful" RTF content */
       public boolean isEmpty()
  
  
  
  1.5       +4 -4      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHeader.java  
  Index: RtfHeader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHeader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfHeader.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfHeader.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -85,8 +85,8 @@
           writeUserProperties();
           RtfColorTable.getInstance().writeColors(this);
           super.writeRtfContent();
  - 		RtfTemplate.getInstance().writeTemplate(this);
  -       	RtfStyleSheetTable.getInstance().writeStyleSheet(this);
  +         RtfTemplate.getInstance().writeTemplate(this);
  +           RtfStyleSheetTable.getInstance().writeStyleSheet(this);
   
       }
   
  @@ -121,6 +121,6 @@
   
       /** write to our Writer using an RtfStringConverter */
       void writeRtfString(String toWrite) throws IOException {
  -	    RtfStringConverter.getInstance().writeRtfString(m_writer,toWrite);
  +        RtfStringConverter.getInstance().writeRtfString(m_writer,toWrite);
       }
   }
  
  
  
  1.3       +161 -161  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHyperLink.java  
  Index: RtfHyperLink.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfHyperLink.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfHyperLink.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfHyperLink.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -71,164 +71,164 @@
   public class RtfHyperLink extends RtfContainer implements IRtfTextContainer
   {
   
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -	/** The url of the image */
  -	protected String url = null;
  -
  -	/** RtfText */
  -	protected RtfText mText = null;
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -
  -	/**
  -	 * Default constructor.
  -	 *
  -	 * @param container a <code>RtfContainer</code> value
  -	 * @param writer a <code>Writer</code> value
  -	 * @param attributes a <code>RtfAttributes</code> value
  -	 */
  -	public RtfHyperLink (IRtfTextContainer parent, Writer writer, String str, \
                RtfAttributes attr)
  -		throws IOException
  -	{
  -		super ((RtfContainer) parent, writer, attr);
  -		new RtfText (this, writer, str, attr);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ RtfElement implementation
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Writes the RTF content to m_writer.
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	public void writeRtfPrefix () throws IOException
  -	{
  -		super.writeGroupMark (true);
  -		super.writeControlWord ("field");
  -
  -		super.writeGroupMark (true);
  -		super.writeStarControlWord ("fldinst");
  -
  -		m_writer.write ("HYPERLINK \"" + url + "\" ");
  -		super.writeGroupMark (false);
  -
  -		super.writeGroupMark (true);
  -		super.writeControlWord ("fldrslt");
  -
  -		// start a group for this paragraph and write our own attributes if needed
  -		if (m_attrib != null && m_attrib.isSet ("cs"))
  -		{
  -			writeGroupMark (true);
  -			writeAttributes(m_attrib, new String [] {"cs"});
  -		}
  -	}
  -
  -	/**
  -	 * Writes the RTF content to m_writer.
  -	 *
  -	 * @exception IOException On error
  -	 */
  -	public void writeRtfSuffix () throws IOException
  -	{
  -		if (m_attrib != null && m_attrib.isSet ("cs"))
  -		{
  -			writeGroupMark (false);
  -		}
  -		super.writeGroupMark (false);
  -		super.writeGroupMark (false);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ IRtfContainer implementation
  -	//////////////////////////////////////////////////
  -
  -	/** close current text run if any and start a new one with default attributes
  -	 *  @param str if not null, added to the RtfText created
  -	 */
  -	public RtfText newText (String str) throws IOException {
  -		return newText (str,null);
  -	}
  -
  -	/** close current text run if any and start a new one
  -	 *  @param str if not null, added to the RtfText created
  -	 */
  -	public RtfText newText (String str,RtfAttributes attr) throws IOException
  -	{
  -		closeAll ();
  -		mText = new RtfText (this, m_writer, str, attr);
  -		return mText;
  -	}
  -
  -	/** IRtfTextContainer requirement: return a copy of our attributes */
  -	public RtfAttributes getTextContainerAttributes()
  -	{
  -		if (m_attrib == null) return null;
  -		return (RtfAttributes) this.m_attrib.clone ();
  -	}
  -
  -
  -	/** add a line break */
  -	public void newLineBreak () throws IOException
  -	{
  -		new RtfLineBreak (this, m_writer);
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Common container methods
  -	//////////////////////////////////////////////////
  -
  -	private void closeCurrentText () throws IOException
  -	{
  -		if (mText != null) mText.close ();
  -	}
  -
  -	private void closeAll () throws IOException
  -	{
  -		closeCurrentText();
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Member access
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Sets the url of the external link.
  -	 *
  -	 * @param url Link url like "http://..."
  -	 */
  -	public void setExternalURL (String url)
  -	{
  -		this.url = url;
  -	}
  -
  -	/**
  -	 * Sets the url of the external link.
  -	 *
  -	 * @param jumpTo Name of the text mark
  -	 */
  -	public void setInternalURL (String jumpTo)
  -	{
  -		int now = jumpTo.length ();
  -		int max = RtfBookmark.maxBookmarkLength;
  -		this.url = "#" + jumpTo.substring (0, now > max ? max : now);
  -		this.url = this.url.replace ('.', RtfBookmark.replaceCharacter);
  -		this.url = this.url.replace (' ', RtfBookmark.replaceCharacter);
  -	}
  -
  -	public boolean isEmpty ()
  -	{
  -		return false;
  -	}
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +    /** The url of the image */
  +    protected String url = null;
  +
  +    /** RtfText */
  +    protected RtfText mText = null;
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +
  +    /**
  +     * Default constructor.
  +     *
  +     * @param container a <code>RtfContainer</code> value
  +     * @param writer a <code>Writer</code> value
  +     * @param attributes a <code>RtfAttributes</code> value
  +     */
  +    public RtfHyperLink (IRtfTextContainer parent, Writer writer, String str, \
RtfAttributes attr)  +        throws IOException
  +    {
  +        super ((RtfContainer) parent, writer, attr);
  +        new RtfText (this, writer, str, attr);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ RtfElement implementation
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Writes the RTF content to m_writer.
  +     *
  +     * @exception IOException On error
  +     */
  +    public void writeRtfPrefix () throws IOException
  +    {
  +        super.writeGroupMark (true);
  +        super.writeControlWord ("field");
  +
  +        super.writeGroupMark (true);
  +        super.writeStarControlWord ("fldinst");
  +
  +        m_writer.write ("HYPERLINK \"" + url + "\" ");
  +        super.writeGroupMark (false);
  +
  +        super.writeGroupMark (true);
  +        super.writeControlWord ("fldrslt");
  +
  +        // start a group for this paragraph and write our own attributes if needed
  +        if (m_attrib != null && m_attrib.isSet ("cs"))
  +        {
  +            writeGroupMark (true);
  +            writeAttributes(m_attrib, new String [] {"cs"});
  +        }
  +    }
  +
  +    /**
  +     * Writes the RTF content to m_writer.
  +     *
  +     * @exception IOException On error
  +     */
  +    public void writeRtfSuffix () throws IOException
  +    {
  +        if (m_attrib != null && m_attrib.isSet ("cs"))
  +        {
  +            writeGroupMark (false);
  +        }
  +        super.writeGroupMark (false);
  +        super.writeGroupMark (false);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ IRtfContainer implementation
  +    //////////////////////////////////////////////////
  +
  +    /** close current text run if any and start a new one with default attributes
  +     *  @param str if not null, added to the RtfText created
  +     */
  +    public RtfText newText (String str) throws IOException {
  +        return newText (str,null);
  +    }
  +
  +    /** close current text run if any and start a new one
  +     *  @param str if not null, added to the RtfText created
  +     */
  +    public RtfText newText (String str,RtfAttributes attr) throws IOException
  +    {
  +        closeAll ();
  +        mText = new RtfText (this, m_writer, str, attr);
  +        return mText;
  +    }
  +
  +    /** IRtfTextContainer requirement: return a copy of our attributes */
  +    public RtfAttributes getTextContainerAttributes()
  +    {
  +        if (m_attrib == null) return null;
  +        return (RtfAttributes) this.m_attrib.clone ();
  +    }
  +
  +
  +    /** add a line break */
  +    public void newLineBreak () throws IOException
  +    {
  +        new RtfLineBreak (this, m_writer);
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Common container methods
  +    //////////////////////////////////////////////////
  +
  +    private void closeCurrentText () throws IOException
  +    {
  +        if (mText != null) mText.close ();
  +    }
  +
  +    private void closeAll () throws IOException
  +    {
  +        closeCurrentText();
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Member access
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Sets the url of the external link.
  +     *
  +     * @param url Link url like "http://..."
  +     */
  +    public void setExternalURL (String url)
  +    {
  +        this.url = url;
  +    }
  +
  +    /**
  +     * Sets the url of the external link.
  +     *
  +     * @param jumpTo Name of the text mark
  +     */
  +    public void setInternalURL (String jumpTo)
  +    {
  +        int now = jumpTo.length ();
  +        int max = RtfBookmark.maxBookmarkLength;
  +        this.url = "#" + jumpTo.substring (0, now > max ? max : now);
  +        this.url = this.url.replace ('.', RtfBookmark.replaceCharacter);
  +        this.url = this.url.replace (' ', RtfBookmark.replaceCharacter);
  +    }
  +
  +    public boolean isEmpty ()
  +    {
  +        return false;
  +    }
   }
  
  
  
  1.4       +28 -28    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java  
  Index: RtfJforCmd.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfJforCmd.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfJforCmd.java	29 Jun 2003 22:56:29 -0000	1.3
  +++ RtfJforCmd.java	30 Jun 2003 00:20:07 -0000	1.4
  @@ -65,52 +65,52 @@
   import java.io.IOException;
   
   /*
  - *	RtfJforCmd process "jfor-cmd"
  + *    RtfJforCmd process "jfor-cmd"
    *
    */
   public class RtfJforCmd extends RtfContainer {
   
  -	private final String PARA_KEEP_ON ="para-keep:on";
  -	private final String PARA_KEEP_OFF ="para-keep:off";
  +    private final String PARA_KEEP_ON ="para-keep:on";
  +    private final String PARA_KEEP_OFF ="para-keep:off";
   
  -	private final RtfAttributes m_attrib;
  -	private ParagraphKeeptogetherContext m_paragraphKeeptogetherContext;
  +    private final RtfAttributes m_attrib;
  +    private ParagraphKeeptogetherContext m_paragraphKeeptogetherContext;
   
   
   
  -	RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException \
                {
  -		super((RtfContainer)parent,w);
  -		m_attrib = attrs;
  -		m_paragraphKeeptogetherContext=ParagraphKeeptogetherContext.getInstance();
  -	}
  +    RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws \
IOException {  +        super((RtfContainer)parent,w);
  +        m_attrib = attrs;
  +        m_paragraphKeeptogetherContext=ParagraphKeeptogetherContext.getInstance();
  +    }
   
   
   
  -	public boolean isEmpty() {
  -		return true;
  -	}
  +    public boolean isEmpty() {
  +        return true;
  +    }
   
   
  -	public void process() {
  +    public void process() {
   
  -		//Execute all jfor-cmd commands
  -		//TODO create one class for each jfor command ?
  +        //Execute all jfor-cmd commands
  +        //TODO create one class for each jfor command ?
   
  -		for(Iterator it = m_attrib.nameIterator(); it.hasNext(); ) {
  -			final String cmd = (String)it.next();
  +        for(Iterator it = m_attrib.nameIterator(); it.hasNext(); ) {
  +            final String cmd = (String)it.next();
   
  -			if (cmd.equals(PARA_KEEP_ON)) {
  -				m_paragraphKeeptogetherContext.KeepTogetherOpen();
  -			}else if (cmd.equals(PARA_KEEP_OFF)) {
  -			  	m_paragraphKeeptogetherContext.KeepTogetherClose();
  -		    }else  {
  -//		   		this.getRtfFile ().getLog ().logInfo ("JFOR-CMD ignored, command not \
                recognised:"+cmd);
  -		    }
  +            if (cmd.equals(PARA_KEEP_ON)) {
  +                m_paragraphKeeptogetherContext.KeepTogetherOpen();
  +            }else if (cmd.equals(PARA_KEEP_OFF)) {
  +                  m_paragraphKeeptogetherContext.KeepTogetherClose();
  +            }else  {
  +//                   this.getRtfFile ().getLog ().logInfo ("JFOR-CMD ignored, \
command not recognised:"+cmd);  +            }
   
  -	 	}
  +         }
   
   
  -	}
  +    }
   
   
   
  
  
  
  1.3       +6 -6      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java  
  Index: RtfListItem.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListItem.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfListItem.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfListItem.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -86,15 +86,15 @@
               if(m_parentList.isBulletedList()) {
                   writeGroupMark(true);
                   writeControlWord("pntext");
  -				writeControlWord("f" + RtfFontManager.getInstance().getFontNumber("Symbol"));
  +                writeControlWord("f" + \
RtfFontManager.getInstance().getFontNumber("Symbol"));  writeControlWord("'b7");
                   writeControlWord("tab");
                   writeGroupMark(false);
               }else{
  -            	writeGroupMark(true);
  -        		writeControlWord("pntext");
  -        		writeGroupMark(false);
  -        	}
  +                writeGroupMark(true);
  +                writeControlWord("pntext");
  +                writeGroupMark(false);
  +            }
           }
   
       }
  
  
  
  1.5       +7 -7      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListTable.java  
  Index: RtfListTable.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfListTable.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfListTable.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfListTable.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -99,12 +99,12 @@
       public static final String LIST_NUMBER = "ls";
   
       public static final String [] LIST_TABLE_ATTR = {
  -        LIST_TABLE,				LIST,				LIST_TEMPLATE_ID,
  -        LIST_NUMBER_TYPE,		LIST_JUSTIFICATION,	LIST_FOLLOWING_CHAR,
  -        LIST_START_AT,			LIST_SPACE,			LIST_INDENT,
  -        LIST_TEXT_FORM,			LIST_NUM_POSITION,	LIST_ID,
  -        LIST_OVR_TABLE,			LIST_OVR,			LIST_OVR_COUNT,
  -        LIST_NUMBER,			LIST_LEVEL
  +        LIST_TABLE,             LIST,                   LIST_TEMPLATE_ID,
  +        LIST_NUMBER_TYPE,       LIST_JUSTIFICATION,     LIST_FOLLOWING_CHAR,
  +        LIST_START_AT,          LIST_SPACE,             LIST_INDENT,
  +        LIST_TEXT_FORM,         LIST_NUM_POSITION,      LIST_ID,
  +        LIST_OVR_TABLE,         LIST_OVR,               LIST_OVR_COUNT,
  +        LIST_NUMBER,            LIST_LEVEL
       };
   
       /**RtfListTable Constructor: sets the number of the list, and allocates
  
  
  
  1.3       +4 -4      xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfNull.java
  
  Index: RtfNull.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfNull.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfNull.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfNull.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -68,7 +68,7 @@
   public class RtfNull
   extends RtfContainer{
   
  -	RtfNull(RtfPage parent, Writer w) throws IOException {
  -		super((RtfContainer)parent,w);
  -	}
  +    RtfNull(RtfPage parent, Writer w) throws IOException {
  +        super((RtfContainer)parent,w);
  +    }
   }
  
  
  
  1.3       +41 -41    xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPage.java
  
  Index: RtfPage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPage.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfPage.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfPage.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -63,39 +63,39 @@
   import java.util.*;
   import java.io.IOException;
   /** Specifies rtf control words.  Is the container for page attributes.
  - *	Overrides okToWriteRtf.
  + *    Overrides okToWriteRtf.
    *  @author Christopher Scott, scottc@westinghouse.com
    */
   
   public class RtfPage
   extends RtfContainer{
  -	private final RtfAttributes m_attrib;
  +    private final RtfAttributes m_attrib;
   
  -	/**RtfPage attributes*/
  -	public final static String PAGE_WIDTH = "paperw";
  -	public final static String PAGE_HEIGHT = "paperh";
  -
  -	public final static String MARGIN_TOP = "margt";
  -	public final static String MARGIN_BOTTOM = "margb";
  -	public final static String MARGIN_LEFT = "margl";
  -	public final static String MARGIN_RIGHT = "margr";
  -
  -	public final static String[] PAGE_ATTR = new String[]{
  -		PAGE_WIDTH, PAGE_HEIGHT, MARGIN_TOP, MARGIN_BOTTOM,
  -		MARGIN_LEFT, MARGIN_RIGHT
  -	};
  -
  -	/**	RtfPage creates new page attributes with the parent container, the writer
  -	   	and the attributes*/
  -	RtfPage(RtfPageArea parent, Writer w, RtfAttributes attrs) throws IOException {
  -		super((RtfContainer)parent,w);
  -		m_attrib = attrs;
  -	}
  -
  -	/** RtfPage writes the attributes the attributes contained in the string
  -		PAGE_ATTR, if not null */
  -		protected void writeRtfContent() throws IOException {
  -		writeAttributes(m_attrib, PAGE_ATTR);
  +    /**RtfPage attributes*/
  +    public final static String PAGE_WIDTH = "paperw";
  +    public final static String PAGE_HEIGHT = "paperh";
  +
  +    public final static String MARGIN_TOP = "margt";
  +    public final static String MARGIN_BOTTOM = "margb";
  +    public final static String MARGIN_LEFT = "margl";
  +    public final static String MARGIN_RIGHT = "margr";
  +
  +    public final static String[] PAGE_ATTR = new String[]{
  +        PAGE_WIDTH, PAGE_HEIGHT, MARGIN_TOP, MARGIN_BOTTOM,
  +        MARGIN_LEFT, MARGIN_RIGHT
  +    };
  +
  +    /**    RtfPage creates new page attributes with the parent container, the \
writer  +           and the attributes*/
  +    RtfPage(RtfPageArea parent, Writer w, RtfAttributes attrs) throws IOException \
{  +        super((RtfContainer)parent,w);
  +        m_attrib = attrs;
  +    }
  +
  +    /** RtfPage writes the attributes the attributes contained in the string
  +        PAGE_ATTR, if not null */
  +        protected void writeRtfContent() throws IOException {
  +        writeAttributes(m_attrib, PAGE_ATTR);
   
           if (m_attrib != null)
           {
  @@ -108,19 +108,19 @@
                   writeControlWord( "landscape" );
               }
           }
  -	}
  +    }
   
  -	/** RtfPage - attributes accessor */
  -	public RtfAttributes getAttributes(){
  -		return m_attrib;
  -	}
  -
  -	/** RtfPage - is overwritten here because page attributes have no content
  -		only attributes. RtfContainer is defined not to write when empty.
  -		Therefore must make this true to print.*/
  -	protected boolean okToWriteRtf()
  -	{
  -		return true;
  -	}
  +    /** RtfPage - attributes accessor */
  +    public RtfAttributes getAttributes(){
  +        return m_attrib;
  +    }
  +
  +    /** RtfPage - is overwritten here because page attributes have no content
  +        only attributes. RtfContainer is defined not to write when empty.
  +        Therefore must make this true to print.*/
  +    protected boolean okToWriteRtf()
  +    {
  +        return true;
  +    }
   
   }
  
  
  
  1.3       +6 -6      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPageArea.java  
  Index: RtfPageArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPageArea.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfPageArea.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfPageArea.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -81,15 +81,15 @@
       public RtfPage newPage(RtfAttributes attr) throws IOException
       {
           if(m_currentPage != null){
  -        	m_currentPage.close();
  +            m_currentPage.close();
           }
           m_currentPage = new RtfPage(this,m_writer,attr);
   
           return m_currentPage;
       }
   
  -	protected boolean okToWriteRtf()
  -	{
  -		return true;
  -	}
  +    protected boolean okToWriteRtf()
  +    {
  +        return true;
  +    }
   }
  
  
  
  1.4       +7 -9      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPageNumber.java  
  Index: RtfPageNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPageNumber.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfPageNumber.java	29 Jun 2003 22:56:29 -0000	1.3
  +++ RtfPageNumber.java	30 Jun 2003 00:20:07 -0000	1.4
  @@ -65,12 +65,12 @@
   public class RtfPageNumber extends RtfContainer
   {
       /** RtfText attributes: fields */
  -	//must be carefull of group markings and star control
  -	//ie page field:
  -	//  "{\field {\*\fldinst {PAGE}} {\fldrslt}}"
  -	public static String RTF_FIELD = "field";
  -	public static String RTF_FIELD_PAGE = "fldinst { PAGE }";
  -	public static String RTF_FIELD_RESULT = "fldrslt";
  +    //must be carefull of group markings and star control
  +    //ie page field:
  +    //  "{\field {\*\fldinst {PAGE}} {\fldrslt}}"
  +    public static String RTF_FIELD = "field";
  +    public static String RTF_FIELD_PAGE = "fldinst { PAGE }";
  +    public static String RTF_FIELD_RESULT = "fldrslt";
   
       /** Create an RTF paragraph as a child of given container with default \
                attributes */
       RtfPageNumber(IRtfPageNumberContainer parent, Writer w) throws IOException
  @@ -113,5 +113,3 @@
           return false;
       }
   }
  -
  -	
  \ No newline at end of file
  
  
  
  1.4       +9 -9      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java  
  Index: RtfPageNumberCitation.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfPageNumberCitation.java	29 Jun 2003 22:56:29 -0000	1.3
  +++ RtfPageNumberCitation.java	30 Jun 2003 00:20:07 -0000	1.4
  @@ -68,15 +68,15 @@
   
   public class RtfPageNumberCitation extends RtfContainer
   {
  -  // Page field :
  -	//  "{\field {\*\fldinst {PAGEREF xx}} {\fldrslt}}" where xx represents the
  -  // 'id' of the referenced page
  -	public static final String RTF_FIELD = "field";
  -	public static final String RTF_FIELD_PAGEREF_MODEL = "fldinst { PAGEREF }";
  -	public static final String RTF_FIELD_RESULT = "fldrslt";
  +    // Page field :
  +    //  "{\field {\*\fldinst {PAGEREF xx}} {\fldrslt}}" where xx represents the
  +    // 'id' of the referenced page
  +    public static final String RTF_FIELD = "field";
  +    public static final String RTF_FIELD_PAGEREF_MODEL = "fldinst { PAGEREF }";
  +    public static final String RTF_FIELD_RESULT = "fldrslt";
   
  -  // The 'id' of the referenced page
  -  private String id = null;
  +    // The 'id' of the referenced page
  +    private String id = null;
   
     /** Create an RTF page number citation as a child of given container with \
                default attributes */
     RtfPageNumberCitation (IRtfPageNumberCitationContainer parent, Writer w, String \
id) throws IOException  
  
  
  1.4       +7 -7      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java  
  Index: RtfParagraph.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RtfParagraph.java	29 Jun 2003 22:56:29 -0000	1.3
  +++ RtfParagraph.java	30 Jun 2003 00:20:07 -0000	1.4
  @@ -77,7 +77,7 @@
       private RtfPageNumber m_pageNumber;
       private RtfPageNumberCitation m_pageNumberCitation; // Line added by Boris \
POUDEROUS on 2002/07/09  private boolean m_keepn=false;
  -	private boolean m_resetProperties=false;
  +    private boolean m_resetProperties=false;
   
       /* needed for importing Rtf into FrameMaker
          FrameMaker is not as forgiving as word in rtf
  @@ -106,12 +106,12 @@
   
       /** Set the keepn attribute for this paragraph */
       public void setKeepn() {
  -    	this.m_keepn=true;
  +        this.m_keepn=true;
       }
   
       /** Force reset properties */
       public void setResetProperties() {
  -    	this.m_resetProperties=true;
  +        this.m_resetProperties=true;
       }
   
       /** IRtfTextContainer requirement: return a copy of our attributes */
  @@ -131,9 +131,9 @@
           }
   
           //Reset paragraph properties if needed
  -       	if(m_resetProperties) {
  -       		writeControlWord("pard");
  -       	}
  +           if(m_resetProperties) {
  +               writeControlWord("pard");
  +           }
   
           // do not write text attributes here, they are handled
           // by RtfText
  
  
  
  1.3       +28 -28    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java  
  Index: RtfParagraphKeepTogether.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfParagraphKeepTogether.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfParagraphKeepTogether.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -66,45 +66,45 @@
   
   public class RtfParagraphKeepTogether extends RtfContainer{
   
  -	public static final int STATUS_NULL=0;
  -	public static final int STATUS_OPEN_PARAGRAPH=1;
  -	public static final int STATUS_CLOSE_PARAGRAPH=2;
  -	private int m_status =STATUS_NULL;
  +    public static final int STATUS_NULL=0;
  +    public static final int STATUS_OPEN_PARAGRAPH=1;
  +    public static final int STATUS_CLOSE_PARAGRAPH=2;
  +    private int m_status =STATUS_NULL;
   
   
  -	/**	RtfParagraphKeepTogether*/
  -	RtfParagraphKeepTogether(IRtfParagraphContainer parent, Writer w) throws \
                IOException {
  -		super((RtfContainer)parent,w);
  -	}
  +    /**    RtfParagraphKeepTogether*/
  +    RtfParagraphKeepTogether(IRtfParagraphContainer parent, Writer w) throws \
IOException {  +        super((RtfContainer)parent,w);
  +    }
   
   
  -	protected void writeRtfContent() throws IOException {
  +    protected void writeRtfContent() throws IOException {
   
  -		//First reet paragraph properties
  -		// create a new one with keepn
  -		if (m_status==STATUS_OPEN_PARAGRAPH) {
  -			writeControlWord("pard");
  -			writeControlWord("par");
  -			writeControlWord("keepn");
  -			writeGroupMark(true);
  -			m_status = STATUS_NULL;
  -		}
  +        //First reet paragraph properties
  +        // create a new one with keepn
  +        if (m_status==STATUS_OPEN_PARAGRAPH) {
  +            writeControlWord("pard");
  +            writeControlWord("par");
  +            writeControlWord("keepn");
  +            writeGroupMark(true);
  +            m_status = STATUS_NULL;
  +        }
   
   
  -		if (m_status == STATUS_CLOSE_PARAGRAPH) {
  -			writeGroupMark(false);
  -			m_status = STATUS_NULL;
  -		}
  +        if (m_status == STATUS_CLOSE_PARAGRAPH) {
  +            writeGroupMark(false);
  +            m_status = STATUS_NULL;
  +        }
   
  -	}
  +    }
   
   
   
  -	public void setStatus(int status) {
  -		m_status = status;
  -	}
  +    public void setStatus(int status) {
  +        m_status = status;
  +    }
   
  - 	/** true if this element would generate no "useful" RTF content */
  +    /** true if this element would generate no "useful" RTF content */
       public boolean isEmpty()
       {
           return false;
  
  
  
  1.5       +108 -108  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java  
  Index: RtfSection.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfSection.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfSection.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -80,127 +80,127 @@
       IRtfAfterContainer,
       IRtfJforCmdContainer
   {
  -	private RtfParagraph m_paragraph;
  -	private RtfTable m_table;
  -	private RtfList m_list;
  -	private RtfExternalGraphic m_externalGraphic;
  -	private RtfBefore m_before;
  +    private RtfParagraph m_paragraph;
  +    private RtfTable m_table;
  +    private RtfList m_list;
  +    private RtfExternalGraphic m_externalGraphic;
  +    private RtfBefore m_before;
       private RtfAfter m_after;
       private RtfJforCmd m_jforCmd;
   
  -	/** Create an RTF container as a child of given container */
  -	RtfSection(RtfDocumentArea parent, Writer w) throws IOException {
  -		super(parent,w);
  -	}
  -
  -	/** start a new external graphic after closing current paragraph, list and table \
                */
  -	public RtfExternalGraphic newImage() throws IOException {
  -		closeAll();
  -		m_externalGraphic = new RtfExternalGraphic(this,m_writer);
  -		return m_externalGraphic;
  -	}
  -
  -	/** start a new paragraph after closing current paragraph, list and table */
  -	public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
  -		closeAll();
  -		m_paragraph = new RtfParagraph(this,m_writer,attrs);
  -		return m_paragraph;
  -	}
  -
  -	/** close current paragraph if any and start a new one with default attributes */
  -	public RtfParagraph newParagraph() throws IOException {
  -		return newParagraph(null);
  -	}
  -
  -	/** close current paragraph if any and start a new one */
  -	public RtfParagraphKeepTogether newParagraphKeepTogether() throws IOException {
  -		return new RtfParagraphKeepTogether(this,m_writer);
  -	}
  +    /** Create an RTF container as a child of given container */
  +    RtfSection(RtfDocumentArea parent, Writer w) throws IOException {
  +        super(parent,w);
  +    }
  +
  +    /** start a new external graphic after closing current paragraph, list and \
table */  +    public RtfExternalGraphic newImage() throws IOException {
  +        closeAll();
  +        m_externalGraphic = new RtfExternalGraphic(this,m_writer);
  +        return m_externalGraphic;
  +    }
  +
  +    /** start a new paragraph after closing current paragraph, list and table */
  +    public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
  +        closeAll();
  +        m_paragraph = new RtfParagraph(this,m_writer,attrs);
  +        return m_paragraph;
  +    }
  +
  +    /** close current paragraph if any and start a new one with default attributes \
*/  +    public RtfParagraph newParagraph() throws IOException {
  +        return newParagraph(null);
  +    }
  +
  +    /** close current paragraph if any and start a new one */
  +    public RtfParagraphKeepTogether newParagraphKeepTogether() throws IOException \
{  +        return new RtfParagraphKeepTogether(this,m_writer);
  +    }
   
  -	/** start a new table after closing current paragraph, list and table
  +    /** start a new table after closing current paragraph, list and table
      * @param tc Table context used for number-columns-spanned attribute (added by \
                Boris Poudérous on july 2002)
      */
  -	public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
  -		closeAll();
  -		m_table = new RtfTable(this,m_writer,tc);
  -		return m_table;
  -	}
  +    public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
  +        closeAll();
  +        m_table = new RtfTable(this,m_writer,tc);
  +        return m_table;
  +    }
   
  -	/** start a new table after closing current paragraph, list and table
  +    /** start a new table after closing current paragraph, list and table
      * @param tc Table context used for number-columns-spanned attribute (added by \
                Boris Poudérous on july 2002)
      */
  -	public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws \
                IOException
  -	{
  -		closeAll();
  -		m_table = new RtfTable(this,m_writer, attrs, tc);
  -		return m_table;
  -	}
  -
  -	/** start a new list after closing current paragraph, list and table */
  -	public RtfList newList(RtfAttributes attrs) throws IOException {
  -		closeAll();
  -		m_list = new RtfList(this,m_writer, attrs);
  -		return m_list;
  -	}
  +    public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws \
IOException  +    {
  +        closeAll();
  +        m_table = new RtfTable(this,m_writer, attrs, tc);
  +        return m_table;
  +    }
  +
  +    /** start a new list after closing current paragraph, list and table */
  +    public RtfList newList(RtfAttributes attrs) throws IOException {
  +        closeAll();
  +        m_list = new RtfList(this,m_writer, attrs);
  +        return m_list;
  +    }
   
       /** IRtfBeforeContainer */
  -	public RtfBefore newBefore(RtfAttributes attrs) throws IOException {
  -		closeAll();
  -		m_before = new RtfBefore(this,m_writer,attrs);
  -		return m_before;
  -	}
  +    public RtfBefore newBefore(RtfAttributes attrs) throws IOException {
  +        closeAll();
  +        m_before = new RtfBefore(this,m_writer,attrs);
  +        return m_before;
  +    }
   
       /** IRtfAfterContainer */
  -	public RtfAfter newAfter(RtfAttributes attrs) throws IOException {
  -		closeAll();
  -		m_after = new RtfAfter(this,m_writer,attrs);
  -		return m_after;
  -	}
  -
  -
  -	public RtfJforCmd newJforCmd(RtfAttributes attrs) throws IOException {
  -		m_jforCmd  = new RtfJforCmd(this,m_writer,attrs);
  -		return m_jforCmd;
  -	}
  +    public RtfAfter newAfter(RtfAttributes attrs) throws IOException {
  +        closeAll();
  +        m_after = new RtfAfter(this,m_writer,attrs);
  +        return m_after;
  +    }
  +
  +
  +    public RtfJforCmd newJforCmd(RtfAttributes attrs) throws IOException {
  +        m_jforCmd  = new RtfJforCmd(this,m_writer,attrs);
  +        return m_jforCmd;
  +    }
   
   
   
  -	/** can be overridden to write RTF prefix code, what comes before our children */
  -	protected void writeRtfPrefix() throws IOException {
  -		writeControlWord("sectd");
  -	}
  -
  -	/** can be overridden to write RTF suffix code, what comes after our children */
  -	protected void writeRtfSuffix() throws IOException {
  -		writeControlWord("sect");
  -	}
  -
  -	private void closeCurrentTable() throws IOException {
  -		if(m_table != null) m_table.close();
  -	}
  -
  -	private void closeCurrentParagraph() throws IOException {
  -		if(m_paragraph!=null) m_paragraph.close();
  -	}
  -
  -	private void closeCurrentList() throws IOException {
  -		if(m_list!=null) m_list.close();
  -	}
  -
  -	private void closeCurrentExternalGraphic() throws IOException {
  -		if(m_externalGraphic!=null) m_externalGraphic.close();
  -	}
  -
  -	private void closeCurrentBefore() throws IOException {
  -		if(m_before!=null) m_before.close();
  -	}
  -
  -	private void closeAll()
  -	throws IOException {
  -		closeCurrentTable();
  -		closeCurrentParagraph();
  -		closeCurrentList();
  -		closeCurrentExternalGraphic();
  -		closeCurrentBefore();
  -	}
  +    /** can be overridden to write RTF prefix code, what comes before our children \
*/  +    protected void writeRtfPrefix() throws IOException {
  +        writeControlWord("sectd");
  +    }
  +
  +    /** can be overridden to write RTF suffix code, what comes after our children \
*/  +    protected void writeRtfSuffix() throws IOException {
  +        writeControlWord("sect");
  +    }
  +
  +    private void closeCurrentTable() throws IOException {
  +        if(m_table != null) m_table.close();
  +    }
  +
  +    private void closeCurrentParagraph() throws IOException {
  +        if(m_paragraph!=null) m_paragraph.close();
  +    }
  +
  +    private void closeCurrentList() throws IOException {
  +        if(m_list!=null) m_list.close();
  +    }
  +
  +    private void closeCurrentExternalGraphic() throws IOException {
  +        if(m_externalGraphic!=null) m_externalGraphic.close();
  +    }
  +
  +    private void closeCurrentBefore() throws IOException {
  +        if(m_before!=null) m_before.close();
  +    }
  +
  +    private void closeAll()
  +    throws IOException {
  +        closeCurrentTable();
  +        closeCurrentParagraph();
  +        closeCurrentList();
  +        closeCurrentExternalGraphic();
  +        closeCurrentBefore();
  +    }
   }
  
  
  
  1.3       +217 -217  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java  
  Index: RtfStyleSheetTable.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfStyleSheetTable.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfStyleSheetTable.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -70,220 +70,220 @@
    */
   public class RtfStyleSheetTable
   {
  -	//////////////////////////////////////////////////
  -	// @@ Symbolic constants
  -	//////////////////////////////////////////////////
  -
  -	/** Start index number for the stylesheet reference table */
  -	private static int startIndex = 15;
  -
  -	/** OK status value for attribute handling */
  -	public static int STATUS_OK = 0;
  -	/** Status value for attribute handling, if the stylesheet not found and
  -	 *  the stylesheet set to the default stylesheet */
  -	public static int STATUS_DEFAULT = 1;
  -
  -	/** Standard style name */
  -	private static String STANDARD_STYLE = "Standard";
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Singleton
  -	//////////////////////////////////////////////////
  -
  -	/** Singelton instance */
  -	private static RtfStyleSheetTable instance = null;
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Members
  -	//////////////////////////////////////////////////
  -
  -
  -	/** Table of styles */
  -	private Hashtable styles = null;
  -
  -	/** Used, style attributes to this vector */
  -	private Hashtable attrTable = null;
  -
  -	/** Used, style names to this vector */
  -	private Vector nameTable = null;
  -
  -	/** Default style */
  -	private String defaultStyleName = STANDARD_STYLE;
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Constructor.
  -	 */
  -	private RtfStyleSheetTable ()
  -	{
  -		styles = new Hashtable ();
  -		attrTable = new Hashtable ();
  -		nameTable = new Vector ();
  -	}
  -
  -	/**
  -	 * Singelton.
  -	 *
  -	 * @return The instance of RtfStyleSheetTable
  -	 */
  -	public static RtfStyleSheetTable getInstance ()
  -	{
  -		if (instance == null)
  -		{
  -			instance = new RtfStyleSheetTable ();
  -		}
  -
  -		return instance;
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Member access
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Sets the default style.
  -	 * @param styleName Name of the default style, defined in the stylesheet
  -	 */
  -	public void setDefaultStyle (String styleName)
  -	{
  -		this.defaultStyleName = styleName;
  -	}
  -
  -	/**
  -	 * Gets the name of the default style.
  -	 * @return Default style name.
  -	 */
  -	public String getDefaultStyleName ()
  -	{
  -		if (attrTable.get (defaultStyleName) != null)
  -			return defaultStyleName;
  -
  -		if (attrTable.get (STANDARD_STYLE) != null)
  -		{
  -			defaultStyleName = STANDARD_STYLE;
  -			return defaultStyleName;
  -		}
  -
  -		return null;
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Public methods
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Adds a style to the table.
  -	 * @param name Name of style to add
  -	 * @param attrs Rtf attributes which defines the style
  -	 */
  -	public void addStyle (String name, RtfAttributes attrs)
  -	{
  -		nameTable.addElement (name);
  -		if (attrs != null)
  -			attrTable.put (name, attrs);
  -		styles.put (name, new Integer (nameTable.size () - 1 + startIndex));
  -	}
  -
  -	/**
  -	 * Adds the style attributes to the given attributes.
  -	 * @param name Name of style, of which the attributes will copied to attr
  -	 * @param attrs Default rtf attributes
  -	 * @return Status value
  -	 */
  -	public int addStyleToAttributes (String name, RtfAttributes attr)
  -	{
  -		// Sets status to ok
  -		int status = STATUS_OK;
  -
  -		// Gets the style number from table
  -		Integer style  = (Integer) styles.get (name);
  -
  -		if (style == null && !name.equals (defaultStyleName))
  -		{
  -			// If style not found, and style was not the default style, try the default \
                style
  -			name = defaultStyleName;
  -			style = (Integer) styles.get (name);
  -			// set status for default style setting
  -			status = STATUS_DEFAULT;
  -		}
  -
  -		// Returns the status for invalid styles
  -		if (style == null)
  -			return status;
  -
  -		// Adds the attributes to default attributes, if not available in default \
                attributes
  -		attr.set ("cs", style.intValue ());
  -
  -		Object o = attrTable.get (name);
  -		if (o != null)
  -		{
  -			RtfAttributes rtfAttr = (RtfAttributes) o;
  -
  -			for (Iterator names = rtfAttr.nameIterator (); names.hasNext ();)
  -			{
  -				String attrName = (String) names.next ();
  -				if (! attr.isSet (attrName))
  -				{
  -					Integer i = (Integer) rtfAttr.getValue (attrName);
  -					if (i == null)
  -						attr.set (attrName);
  -					else
  -						attr.set (attrName, i.intValue ());
  -				}
  -			}
  -		}
  -		return status;
  -	}
  -
  -	/**
  -	 * Writes the rtf style sheet table.
  -	 * @param header Rtf header is the parent
  -	 * @throws IOException On write error
  -	 */
  -	public void writeStyleSheet (RtfHeader header) throws IOException
  -	{
  -		if (styles == null || styles.size () == 0)
  -		{
  -			return;
  -		}
  -		header.writeGroupMark (true);
  -		header.writeControlWord ("stylesheet");
  -
  -		int number = nameTable.size ();
  -		for (int i = 0; i < number; i++)
  -		{
  -			String name = (String) nameTable.elementAt (i);
  -			header.writeGroupMark (true);
  -			header.writeControlWord ("*\\" + this.getRtfStyleReference (name));
  -
  -			Object o = attrTable.get (name);
  -			if (o != null)
  -			{
  -				header.writeAttributes ((RtfAttributes) o, RtfText.ATTR_NAMES);
  -				header.writeAttributes ((RtfAttributes) o, RtfText.ALIGNMENT);
  -			}
  -
  -			header.write (name + ";");
  -			header.writeGroupMark (false);
  -		}
  -		header.writeGroupMark (false);
  -	}
  -
  -	/**
  -	 * Gets the rtf style reference from the table.
  -	 * @param name Name of Style
  -	 * @return Rtf attribute of the style reference
  -	 */
  -	private String getRtfStyleReference (String name)
  -	{
  -		return "cs" + styles.get (name).toString ();
  -	}
  +    //////////////////////////////////////////////////
  +    // @@ Symbolic constants
  +    //////////////////////////////////////////////////
  +
  +    /** Start index number for the stylesheet reference table */
  +    private static int startIndex = 15;
  +
  +    /** OK status value for attribute handling */
  +    public static int STATUS_OK = 0;
  +    /** Status value for attribute handling, if the stylesheet not found and
  +     *  the stylesheet set to the default stylesheet */
  +    public static int STATUS_DEFAULT = 1;
  +
  +    /** Standard style name */
  +    private static String STANDARD_STYLE = "Standard";
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Singleton
  +    //////////////////////////////////////////////////
  +
  +    /** Singelton instance */
  +    private static RtfStyleSheetTable instance = null;
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Members
  +    //////////////////////////////////////////////////
  +
  +
  +    /** Table of styles */
  +    private Hashtable styles = null;
  +
  +    /** Used, style attributes to this vector */
  +    private Hashtable attrTable = null;
  +
  +    /** Used, style names to this vector */
  +    private Vector nameTable = null;
  +
  +    /** Default style */
  +    private String defaultStyleName = STANDARD_STYLE;
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Constructor.
  +     */
  +    private RtfStyleSheetTable ()
  +    {
  +        styles = new Hashtable ();
  +        attrTable = new Hashtable ();
  +        nameTable = new Vector ();
  +    }
  +
  +    /**
  +     * Singelton.
  +     *
  +     * @return The instance of RtfStyleSheetTable
  +     */
  +    public static RtfStyleSheetTable getInstance ()
  +    {
  +        if (instance == null)
  +        {
  +            instance = new RtfStyleSheetTable ();
  +        }
  +
  +        return instance;
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Member access
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Sets the default style.
  +     * @param styleName Name of the default style, defined in the stylesheet
  +     */
  +    public void setDefaultStyle (String styleName)
  +    {
  +        this.defaultStyleName = styleName;
  +    }
  +
  +    /**
  +     * Gets the name of the default style.
  +     * @return Default style name.
  +     */
  +    public String getDefaultStyleName ()
  +    {
  +        if (attrTable.get (defaultStyleName) != null)
  +            return defaultStyleName;
  +
  +        if (attrTable.get (STANDARD_STYLE) != null)
  +        {
  +            defaultStyleName = STANDARD_STYLE;
  +            return defaultStyleName;
  +        }
  +
  +        return null;
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Public methods
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Adds a style to the table.
  +     * @param name Name of style to add
  +     * @param attrs Rtf attributes which defines the style
  +     */
  +    public void addStyle (String name, RtfAttributes attrs)
  +    {
  +        nameTable.addElement (name);
  +        if (attrs != null)
  +            attrTable.put (name, attrs);
  +        styles.put (name, new Integer (nameTable.size () - 1 + startIndex));
  +    }
  +
  +    /**
  +     * Adds the style attributes to the given attributes.
  +     * @param name Name of style, of which the attributes will copied to attr
  +     * @param attrs Default rtf attributes
  +     * @return Status value
  +     */
  +    public int addStyleToAttributes (String name, RtfAttributes attr)
  +    {
  +        // Sets status to ok
  +        int status = STATUS_OK;
  +
  +        // Gets the style number from table
  +        Integer style  = (Integer) styles.get (name);
  +
  +        if (style == null && !name.equals (defaultStyleName))
  +        {
  +            // If style not found, and style was not the default style, try the \
default style  +            name = defaultStyleName;
  +            style = (Integer) styles.get (name);
  +            // set status for default style setting
  +            status = STATUS_DEFAULT;
  +        }
  +
  +        // Returns the status for invalid styles
  +        if (style == null)
  +            return status;
  +
  +        // Adds the attributes to default attributes, if not available in default \
attributes  +        attr.set ("cs", style.intValue ());
  +
  +        Object o = attrTable.get (name);
  +        if (o != null)
  +        {
  +            RtfAttributes rtfAttr = (RtfAttributes) o;
  +
  +            for (Iterator names = rtfAttr.nameIterator (); names.hasNext ();)
  +            {
  +                String attrName = (String) names.next ();
  +                if (! attr.isSet (attrName))
  +                {
  +                    Integer i = (Integer) rtfAttr.getValue (attrName);
  +                    if (i == null)
  +                        attr.set (attrName);
  +                    else
  +                        attr.set (attrName, i.intValue ());
  +                }
  +            }
  +        }
  +        return status;
  +    }
  +
  +    /**
  +     * Writes the rtf style sheet table.
  +     * @param header Rtf header is the parent
  +     * @throws IOException On write error
  +     */
  +    public void writeStyleSheet (RtfHeader header) throws IOException
  +    {
  +        if (styles == null || styles.size () == 0)
  +        {
  +            return;
  +        }
  +        header.writeGroupMark (true);
  +        header.writeControlWord ("stylesheet");
  +
  +        int number = nameTable.size ();
  +        for (int i = 0; i < number; i++)
  +        {
  +            String name = (String) nameTable.elementAt (i);
  +            header.writeGroupMark (true);
  +            header.writeControlWord ("*\\" + this.getRtfStyleReference (name));
  +
  +            Object o = attrTable.get (name);
  +            if (o != null)
  +            {
  +                header.writeAttributes ((RtfAttributes) o, RtfText.ATTR_NAMES);
  +                header.writeAttributes ((RtfAttributes) o, RtfText.ALIGNMENT);
  +            }
  +
  +            header.write (name + ";");
  +            header.writeGroupMark (false);
  +        }
  +        header.writeGroupMark (false);
  +    }
  +
  +    /**
  +     * Gets the rtf style reference from the table.
  +     * @param name Name of Style
  +     * @return Rtf attribute of the style reference
  +     */
  +    private String getRtfStyleReference (String name)
  +    {
  +        return "cs" + styles.get (name).toString ();
  +    }
   }
  
  
  
  1.5       +6 -6      \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfTable.java  
  Index: RtfTable.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfTable.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfTable.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfTable.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -82,15 +82,15 @@
           m_table_context = tc;
       }
   
  -	/** Create an RTF element as a child of given container
  +    /** Create an RTF element as a child of given container
      * Modified by Boris Poudérous in order to process 'number-columns-spanned' \
                attribute
      */
     RtfTable(IRtfTableContainer parent, Writer w, RtfAttributes attrs, \
                ITableColumnsInfo tc) throws IOException
  -	{
  -		super((RtfContainer)parent,w,attrs);
  +    {
  +        super((RtfContainer)parent,w,attrs);
       // Line added by Boris Poudérous on 07/22/2002
       m_table_context = tc;
  -	}
  +    }
   
       /** close current row if any and start a new one */
       public RtfTableRow newTableRow() throws IOException
  @@ -135,7 +135,7 @@
   
       public boolean isHighestRow(int id)
       {
  -    	return (highestRow == id) ? true : false;
  +        return (highestRow == id) ? true : false;
       }
   
       /** Added by Boris Poudérous on 07/22/2002 */
  
  
  
  1.5       +20 -20    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfTableCell.java  
  Index: RtfTableCell.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfTableCell.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RtfTableCell.java	29 Jun 2003 22:56:29 -0000	1.4
  +++ RtfTableCell.java	30 Jun 2003 00:20:07 -0000	1.5
  @@ -75,7 +75,7 @@
       private RtfExternalGraphic m_externalGraphic;
       private final RtfTableRow m_parentRow;
       private boolean set_center;
  -	private boolean set_right;
  +    private boolean set_right;
       private int id;
   
       public static final int DEFAULT_CELL_WIDTH = 2000;
  @@ -165,20 +165,20 @@
           m_paragraph = new RtfParagraph(this,m_writer,attrs);
   
           if(m_paragraph.m_attrib.isSet("qc"))
  -		{
  -			set_center=true;
  +        {
  +            set_center=true;
               attrs.set("qc");
  -		}
  -		else if(m_paragraph.m_attrib.isSet("qr"))
  -		{
  -			set_right=true;
  +        }
  +        else if(m_paragraph.m_attrib.isSet("qr"))
  +        {
  +            set_right=true;
               attrs.set("qr");
  -		}
  +        }
           else
           {
               attrs.set("ql");
           }
  -		attrs.set("intbl");
  +        attrs.set("intbl");
   
   
           //lines modified by Chris Scott, Westinghouse
  @@ -256,10 +256,10 @@
   
           //these lines added by Chris Scott, Westinghouse
           //some attributes need to be writting before opening block
  -		if(set_center)
  -		{
  -			writeControlWord("qc");
  -		}
  +        if(set_center)
  +        {
  +            writeControlWord("qc");
  +        }
           else if (set_right)
           {
               writeControlWord("qr");
  @@ -269,11 +269,11 @@
               writeControlWord("ql");
           }
   
  -		writeControlWord("cellx" + xPos);
  +        writeControlWord("cellx" + xPos);
   
           writeControlWord( "ql" );
   
  -		return xPos;
  +        return xPos;
   
       }
   
  @@ -284,9 +284,9 @@
           // but if is not here we generate invalid RTF for word97
   
           if(set_center)
  -		{
  -			writeControlWord("qc");
  -		}
  +        {
  +            writeControlWord("qc");
  +        }
           else if (set_right)
           {
               writeControlWord("qr");
  @@ -303,7 +303,7 @@
   
               //R.Marra this create useless paragraph
               //Seem working into Word97 with the "intbl" only
  -//			writeControlWord("par");
  +//            writeControlWord("par");
           }
   
           writeControlWord("cell");
  
  
  
  1.3       +60 -60    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfTemplate.java  
  Index: RtfTemplate.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfTemplate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfTemplate.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfTemplate.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -70,67 +70,67 @@
   
   public class RtfTemplate  {
   
  -	/** Singelton instance */
  -	private static RtfTemplate instance = null;
  +    /** Singelton instance */
  +    private static RtfTemplate instance = null;
   
  -	private String templateFilePath = null;
  +    private String templateFilePath = null;
   
  -	/**
  -	 * Constructor.
  -	 */
  -	private RtfTemplate ()
  -	{
  -
  -	}
  -
  -
  -	/**
  -	 * Singelton.
  -	 *
  -	 * @return The instance of RtfTemplate
  -	 */
  -	public static RtfTemplate getInstance ()
  -	{
  -		if (instance == null) {
  -			instance = new RtfTemplate();
  -		}
  -
  -		return instance;
  -	}
  -
  -
  -	/**
  -	 *Set the template file and adjust tha path separator
  -	 *
  -	 *@param templateFilePath The full path of the template
  -	 **/
  -	public void setTemplateFilePath(String templateFilePath) throws IOException {
  -		// no validity checks here - leave this to the RTF client
  -		if(templateFilePath == null) {
  -			this.templateFilePath = null;
  -		} else {
  -			this.templateFilePath = templateFilePath.trim();
  -		}
  -	}
  -
  -	/**
  -	 * Write the rtf template
  -	 * @param header Rtf header is the parent
  -	 * @throws IOException On write error
  -	 */
  -	public void writeTemplate (RtfHeader header) throws IOException
  -	{
  -		if (templateFilePath == null || templateFilePath.length() == 0) return;
  -
  -		header.writeGroupMark (true);
  -		header.writeControlWord ("template");
  -		header.writeRtfString(this.templateFilePath);
  -		header.writeGroupMark (false);
  -
  -		header.writeGroupMark (true);
  -		header.writeControlWord ("linkstyles");
  -		header.writeGroupMark (false);
  -	}
  +    /**
  +     * Constructor.
  +     */
  +    private RtfTemplate ()
  +    {
  +
  +    }
  +
  +
  +    /**
  +     * Singelton.
  +     *
  +     * @return The instance of RtfTemplate
  +     */
  +    public static RtfTemplate getInstance ()
  +    {
  +        if (instance == null) {
  +            instance = new RtfTemplate();
  +        }
  +
  +        return instance;
  +    }
  +
  +
  +    /**
  +     *Set the template file and adjust tha path separator
  +     *
  +     *@param templateFilePath The full path of the template
  +     **/
  +    public void setTemplateFilePath(String templateFilePath) throws IOException {
  +        // no validity checks here - leave this to the RTF client
  +        if(templateFilePath == null) {
  +            this.templateFilePath = null;
  +        } else {
  +            this.templateFilePath = templateFilePath.trim();
  +        }
  +    }
  +
  +    /**
  +     * Write the rtf template
  +     * @param header Rtf header is the parent
  +     * @throws IOException On write error
  +     */
  +    public void writeTemplate (RtfHeader header) throws IOException
  +    {
  +        if (templateFilePath == null || templateFilePath.length() == 0) return;
  +
  +        header.writeGroupMark (true);
  +        header.writeControlWord ("template");
  +        header.writeRtfString(this.templateFilePath);
  +        header.writeGroupMark (false);
  +
  +        header.writeGroupMark (true);
  +        header.writeControlWord ("linkstyles");
  +        header.writeGroupMark (false);
  +    }
   }
   
   
  
  
  
  1.3       +200 -200  xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfText.java
  
  Index: RtfText.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfText.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfText.java	29 Jun 2003 22:56:29 -0000	1.2
  +++ RtfText.java	30 Jun 2003 00:20:07 -0000	1.3
  @@ -80,139 +80,139 @@
           private static final int CHAR_BOLD_START = 130;
           private static final int CHAR_BOLD_END = 131;
   
  -	/** members */
  -	private String m_text;
  -	private final RtfAttributes m_attr;
  -
  -
  -	/** RtfText attributes: attribute names are RTF control word names to avoid \
                additional mapping */
  -	public static final String ATTR_BOLD = "b";
  -	public static final String ATTR_ITALIC = "i";
  -	public static final String ATTR_UNDERLINE = "ul";
  -	public static final String ATTR_FONT_SIZE = "fs";
  -	public static final String ATTR_FONT_FAMILY = "f";
  -	public static final String ATTR_FONT_COLOR = "cf";
  -	public static final String ATTR_BACKGROUND_COLOR = "chcbpat"; // Added by Boris \
                on 06/25//02
  -
  -	/** RtfText attributes: alignment attributes */
  -	public static String ALIGN_CENTER = "qc";
  -	public static String ALIGN_LEFT = "ql";
  -	public static String ALIGN_RIGHT = "qr";
  -	public static String ALIGN_JUSTIFIED = "qj";
  -	public static String ALIGN_DISTRIBUTED = "qd";
  -
  -	/** RtfText attributes: border attributes */
  -	//added by Chris Scott
  -	public static String BDR_BOTTOM_SINGLE = "brdrb\\brsp40\\brdrs";
  -	public static String BDR_BOTTOM_DOUBLE = "brdrb\\brsp40\\brdrdb";
  -	public static String BDR_BOTTOM_EMBOSS = "brdrb\\brsp40\\brdremboss";
  -	public static String BDR_BOTTOM_DOTTED = "brdrb\\brsp40\\brdrdot";
  -	public static String BDR_BOTTOM_DASH = "brdrb\\brsp40\\brdrdash";
  -
  -	/** RtfText attributes: fields */
  -	//must be carefull of group markings and star control
  -	//ie page field:
  -	//  "{\field {\*\fldinst {PAGE}} {\fldrslt}}"
  -	public static String RTF_FIELD = "field";
  -	public static String RTF_FIELD_PAGE = "fldinst { PAGE }";
  -	public static String RTF_FIELD_RESULT = "fldrslt";
  -
  -	/**RtfText attributes: indentation attributes */
  -	//added by Chris Scott
  -	public static String LEFT_INDENT_BODY = "li";
  -	public static String LEFT_INDENT_FIRST = "fi-";
  -
  -	public static String TAB_CENTER = "tqc\\tx";
  -	public static String TAB_RIGHT = "tqr\\tx";
  -	public static String TAB_LEADER_DOTS = "tldot";
  -	public static String TAB_LEADER_HYPHEN = "tlhyph";
  -	public static String TAB_LEADER_UNDER = "tlul";
  -	public static String TAB_LEADER_THICK = "tlth";
  -	public static String TAB_LEADER_EQUALS = "tleq";
  -
  -	/** Space before/after a paragraph */
  -	//these lines were added by Boris Pouderous
  -	public static final String SPACE_BEFORE = "sb";
  -  	public static final String SPACE_AFTER = "sa";
  -
  -	/** RtfText attributes: this must contain all allignment attributes names */
  -	public static String[] ALIGNMENT = new String []
  -	{
  -		ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_JUSTIFIED, ALIGN_DISTRIBUTED
  -	};
  -
  -	/** RtfText attributes:: this must contain all border attribute names*/
  -	//this line added by Chris Scott, Westinghouse
  -	public static String[] BORDER = new String []
  -	{
  -		BDR_BOTTOM_SINGLE,BDR_BOTTOM_DOUBLE,BDR_BOTTOM_EMBOSS,BDR_BOTTOM_DOTTED,BDR_BOTTOM_DASH
                
  -	};
  -
  -	public static String[] INDENT = new String []
  -	{
  -		LEFT_INDENT_BODY, LEFT_INDENT_FIRST
  -	};
  -
  -	public static String[] TABS = new String []
  -	{
  -		TAB_CENTER ,TAB_RIGHT,TAB_LEADER_DOTS,TAB_LEADER_HYPHEN,TAB_LEADER_UNDER,
  -		TAB_LEADER_THICK,TAB_LEADER_EQUALS
  -	};
  -
  -
  -	/** RtfText attributes: this must contain all attribute names */
  -	public static final String [] ATTR_NAMES = {
  -		ATTR_BOLD,
  -		ATTR_ITALIC,
  -		ATTR_UNDERLINE,
  -		ATTR_FONT_SIZE,
  -		ATTR_FONT_FAMILY,
  -		ATTR_FONT_COLOR,
  -		ATTR_BACKGROUND_COLOR
  -	};
  -
  -	/** Create an RtfText in given IRtfTextContainer.
  -	 *  @param str optional initial text content
  -	 */
  -	RtfText(IRtfTextContainer parent,Writer w,String str,RtfAttributes attr) throws \
                IOException
  -	{
  -		super((RtfContainer)parent,w);
  -		m_text = str;
  -		m_attr = attr;
  -	}
  -
  -	/** write our text to the RTF stream */
  -	public void writeRtfContent() throws IOException
  -	{
  +    /** members */
  +    private String m_text;
  +    private final RtfAttributes m_attr;
  +
  +
  +    /** RtfText attributes: attribute names are RTF control word names to avoid \
additional mapping */  +    public static final String ATTR_BOLD = "b";
  +    public static final String ATTR_ITALIC = "i";
  +    public static final String ATTR_UNDERLINE = "ul";
  +    public static final String ATTR_FONT_SIZE = "fs";
  +    public static final String ATTR_FONT_FAMILY = "f";
  +    public static final String ATTR_FONT_COLOR = "cf";
  +    public static final String ATTR_BACKGROUND_COLOR = "chcbpat"; // Added by \
Boris on 06/25//02  +
  +    /** RtfText attributes: alignment attributes */
  +    public static String ALIGN_CENTER = "qc";
  +    public static String ALIGN_LEFT = "ql";
  +    public static String ALIGN_RIGHT = "qr";
  +    public static String ALIGN_JUSTIFIED = "qj";
  +    public static String ALIGN_DISTRIBUTED = "qd";
  +
  +    /** RtfText attributes: border attributes */
  +    //added by Chris Scott
  +    public static String BDR_BOTTOM_SINGLE = "brdrb\\brsp40\\brdrs";
  +    public static String BDR_BOTTOM_DOUBLE = "brdrb\\brsp40\\brdrdb";
  +    public static String BDR_BOTTOM_EMBOSS = "brdrb\\brsp40\\brdremboss";
  +    public static String BDR_BOTTOM_DOTTED = "brdrb\\brsp40\\brdrdot";
  +    public static String BDR_BOTTOM_DASH = "brdrb\\brsp40\\brdrdash";
  +
  +    /** RtfText attributes: fields */
  +    //must be carefull of group markings and star control
  +    //ie page field:
  +    //  "{\field {\*\fldinst {PAGE}} {\fldrslt}}"
  +    public static String RTF_FIELD = "field";
  +    public static String RTF_FIELD_PAGE = "fldinst { PAGE }";
  +    public static String RTF_FIELD_RESULT = "fldrslt";
  +
  +    /**RtfText attributes: indentation attributes */
  +    //added by Chris Scott
  +    public static String LEFT_INDENT_BODY = "li";
  +    public static String LEFT_INDENT_FIRST = "fi-";
  +
  +    public static String TAB_CENTER = "tqc\\tx";
  +    public static String TAB_RIGHT = "tqr\\tx";
  +    public static String TAB_LEADER_DOTS = "tldot";
  +    public static String TAB_LEADER_HYPHEN = "tlhyph";
  +    public static String TAB_LEADER_UNDER = "tlul";
  +    public static String TAB_LEADER_THICK = "tlth";
  +    public static String TAB_LEADER_EQUALS = "tleq";
  +
  +    /** Space before/after a paragraph */
  +    //these lines were added by Boris Pouderous
  +    public static final String SPACE_BEFORE = "sb";
  +    public static final String SPACE_AFTER = "sa";
  +
  +    /** RtfText attributes: this must contain all allignment attributes names */
  +    public static String[] ALIGNMENT = new String []
  +    {
  +        ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_JUSTIFIED, ALIGN_DISTRIBUTED
  +    };
  +
  +    /** RtfText attributes:: this must contain all border attribute names*/
  +    //this line added by Chris Scott, Westinghouse
  +    public static String[] BORDER = new String []
  +    {
  +        BDR_BOTTOM_SINGLE,BDR_BOTTOM_DOUBLE,BDR_BOTTOM_EMBOSS,BDR_BOTTOM_DOTTED,BDR_BOTTOM_DASH
  +    };
  +
  +    public static String[] INDENT = new String []
  +    {
  +        LEFT_INDENT_BODY, LEFT_INDENT_FIRST
  +    };
  +
  +    public static String[] TABS = new String []
  +    {
  +        TAB_CENTER ,TAB_RIGHT,TAB_LEADER_DOTS,TAB_LEADER_HYPHEN,TAB_LEADER_UNDER,
  +        TAB_LEADER_THICK,TAB_LEADER_EQUALS
  +    };
  +
  +
  +    /** RtfText attributes: this must contain all attribute names */
  +    public static final String [] ATTR_NAMES = {
  +        ATTR_BOLD,
  +        ATTR_ITALIC,
  +        ATTR_UNDERLINE,
  +        ATTR_FONT_SIZE,
  +        ATTR_FONT_FAMILY,
  +        ATTR_FONT_COLOR,
  +        ATTR_BACKGROUND_COLOR
  +    };
  +
  +    /** Create an RtfText in given IRtfTextContainer.
  +     *  @param str optional initial text content
  +     */
  +    RtfText(IRtfTextContainer parent,Writer w,String str,RtfAttributes attr) \
throws IOException  +    {
  +        super((RtfContainer)parent,w);
  +        m_text = str;
  +        m_attr = attr;
  +    }
  +
  +    /** write our text to the RTF stream */
  +    public void writeRtfContent() throws IOException
  +    {
               writeChars: {
   
  -            	//these lines were added by Boris Pouderous
  -          		if (m_attr != null) {
  +                //these lines were added by Boris Pouderous
  +                  if (m_attr != null) {
                     writeAttributes(m_attr,new String[] {RtfText.SPACE_BEFORE});
                     writeAttributes(m_attr,new String[] {RtfText.SPACE_AFTER});
                   }
   
  -	            if(isTab()){
  -	            	writeControlWord("tab");
  -	            }else if(isNewLine()){
  -	            	break writeChars;
  -	            }else if(isBold(true)){
  -	            	writeControlWord("b");
  -	            }else if(isBold(false)){
  -	            	writeControlWord("b0");
  -	            }
  -	            // TODO not optimal, consecutive RtfText with same attributes could \
                be written without group marks
  -	            else{
  -		            writeGroupMark(true);
  -		            if(m_attr != null && mustWriteAttributes()) {
  -		                writeAttributes(m_attr,RtfText.ATTR_NAMES);
  -		            }
  -		            RtfStringConverter.getInstance().writeRtfString(m_writer,m_text);
  -		            writeGroupMark(false);
  -		        }
  +                if(isTab()){
  +                    writeControlWord("tab");
  +                }else if(isNewLine()){
  +                    break writeChars;
  +                }else if(isBold(true)){
  +                    writeControlWord("b");
  +                }else if(isBold(false)){
  +                    writeControlWord("b0");
  +                }
  +                // TODO not optimal, consecutive RtfText with same attributes \
could be written without group marks  +                else{
  +                    writeGroupMark(true);
  +                    if(m_attr != null && mustWriteAttributes()) {
  +                        writeAttributes(m_attr,RtfText.ATTR_NAMES);
  +                    }
  +                    \
RtfStringConverter.getInstance().writeRtfString(m_writer,m_text);  +                  \
writeGroupMark(false);  +                }
   
  -	      }
  -	}
  +          }
  +    }
   
           /** true if our text attributes must be written */
           private boolean mustWriteAttributes()
  @@ -220,81 +220,81 @@
               return !isEmpty() && !isNbsp();
           }
   
  -	/** IRtfTextContainer requirement: return a copy of our attributes */
  -	public RtfAttributes getTextContainerAttributes() {
  -		if(m_attrib == null) return null;
  -		return (RtfAttributes)this.m_attrib.clone();
  -	}
  -
  -	/** direct access to our text */
  -	String getText()
  -	{
  -		return m_text;
  -	}
  -
  -	/** direct access to our text */
  -	void setText(String str)
  -	{
  -		m_text = str;
  -	}
  -
  -	/**
  -	 * Checks whether the text is empty.
  -	 *
  -	 * @return
  -	 *  true    If m_text is null\n
  -	 *  false   m_text is set
  -	 */
  -	public boolean isEmpty ()
  -	{
  -		return m_text == null || m_text.trim().length() == 0;
  -	}
  +    /** IRtfTextContainer requirement: return a copy of our attributes */
  +    public RtfAttributes getTextContainerAttributes() {
  +        if(m_attrib == null) return null;
  +        return (RtfAttributes)this.m_attrib.clone();
  +    }
  +
  +    /** direct access to our text */
  +    String getText()
  +    {
  +        return m_text;
  +    }
  +
  +    /** direct access to our text */
  +    void setText(String str)
  +    {
  +        m_text = str;
  +    }
  +
  +    /**
  +     * Checks whether the text is empty.
  +     *
  +     * @return
  +     *  true    If m_text is null\n
  +     *  false   m_text is set
  +     */
  +    public boolean isEmpty ()
  +    {
  +        return m_text == null || m_text.trim().length() == 0;
  +    }
   
  -	/**
  -	 *  True if text contains a single non-breaking space (#160).
  +    /**
  +     *  True if text contains a single non-breaking space (#160).
            *  TODO make this more general and/or merge with isEmpty? <-- what happen \
                with empty paragraphs, if they will be removed, than NO, else ok
  -	 *
  -	 * @return
  -	 *  true    If m_text is character 160\n
  -	 *  false   m_text is not a nbsp
  -	 */
  -	public boolean isNbsp ()
  -	{
  -		if (! isEmpty ())
  -			if (m_text.trim ().length () == 1 && m_text.charAt (0) == CHAR_NBSP)
  -				return true;
  -		return false;
  -	}
  -
  -	public boolean isTab()
  -	{
  -		if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_TAB)
  -			return true;
  -		else
  -			return false;
  -	}
  -
  -	public boolean isNewLine()
  -	{
  -		if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_NEW_LINE)
  -			return true;
  -		else
  -			return false;
  -	}
  -
  -	public boolean isBold(boolean isStart)
  -	{
  -		if(isStart){
  -			if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_BOLD_START)
  -				return true;
  -		}else{
  -			if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_BOLD_END)
  -				return true;
  -			else
  -				return false;
  -		}
  -		return false;
  -	}
  +     *
  +     * @return
  +     *  true    If m_text is character 160\n
  +     *  false   m_text is not a nbsp
  +     */
  +    public boolean isNbsp ()
  +    {
  +        if (! isEmpty ())
  +            if (m_text.trim ().length () == 1 && m_text.charAt (0) == CHAR_NBSP)
  +                return true;
  +        return false;
  +    }
  +
  +    public boolean isTab()
  +    {
  +        if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_TAB)
  +            return true;
  +        else
  +            return false;
  +    }
  +
  +    public boolean isNewLine()
  +    {
  +        if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_NEW_LINE)
  +            return true;
  +        else
  +            return false;
  +    }
  +
  +    public boolean isBold(boolean isStart)
  +    {
  +        if(isStart){
  +            if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_BOLD_START)
  +                return true;
  +        }else{
  +            if(m_text.trim().length()==1 && m_text.charAt(0)== CHAR_BOLD_END)
  +                return true;
  +            else
  +                return false;
  +        }
  +        return false;
  +    }
   
       /** get the attributes of our text */
       public RtfAttributes getTextAttributes(){
  
  
  
  1.3       +41 -41    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/BasicLink.java  
  Index: BasicLink.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/BasicLink.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicLink.java	29 Jun 2003 22:56:31 -0000	1.2
  +++ BasicLink.java	30 Jun 2003 00:20:08 -0000	1.3
  @@ -69,44 +69,44 @@
   
   public class BasicLink extends TestDocument
   {
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
   
  -	/**
  -	 * Default constructor.
  -	 */
  -	public BasicLink()
  -	{
  -	}
  +    /**
  +     * Default constructor.
  +     */
  +    public BasicLink()
  +    {
  +    }
   
  -	/** generate the body of the test document */
  -	protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws \
                IOException
  -	{
  -		RtfParagraph p = sect.newParagraph ();
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newText ("external link: ");
  -		RtfHyperLink link = p.newHyperLink ("click here to go to the hompage", null);
  -		link.setExternalURL ("http://www.skynamics.com");
  -		p.close();
  +    /** generate the body of the test document */
  +    protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws \
IOException  +    {
  +        RtfParagraph p = sect.newParagraph ();
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newText ("external link: ");
  +        RtfHyperLink link = p.newHyperLink ("click here to go to the hompage", \
null);  +        link.setExternalURL ("http://www.skynamics.com");
  +        p.close();
   
  -		p = sect.newParagraph ();
  -		p.newLineBreak();
  -		p.newText ("here we will demonstrate internal link to a bookmark");
  -		p.newLineBreak();
  -		p.newText ("internal link: ");
  -		link = p.newHyperLink ("click here to go to the bookmark", null);
  -		link.setInternalURL ("testBookmark");
  -		p.close();
  +        p = sect.newParagraph ();
  +        p.newLineBreak();
  +        p.newText ("here we will demonstrate internal link to a bookmark");
  +        p.newLineBreak();
  +        p.newText ("internal link: ");
  +        link = p.newHyperLink ("click here to go to the bookmark", null);
  +        link.setInternalURL ("testBookmark");
  +        p.close();
   
  -		p = sect.newParagraph();
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newPageBreak();
  -		p.newBookmark("testBookmark");
  -		p.newText("testBookmark");
  -	}
  +        p = sect.newParagraph();
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newPageBreak();
  +        p.newBookmark("testBookmark");
  +        p.newText("testBookmark");
  +    }
   }
  
  
  
  1.5       +57 -57    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/CreateTestDocuments.java  
  Index: CreateTestDocuments.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/CreateTestDocuments.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CreateTestDocuments.java	29 Jun 2003 22:56:31 -0000	1.4
  +++ CreateTestDocuments.java	30 Jun 2003 00:20:08 -0000	1.5
  @@ -68,61 +68,61 @@
    */
   
   public class CreateTestDocuments {
  -	public static final String TESTDOCS_PACKAGE = \
"org.apache.fop.rtf.rtflib.testdocs";  +    public static final String \
TESTDOCS_PACKAGE = "org.apache.fop.rtf.rtflib.testdocs";  
  -	/** List of all TestDocument subclasses from this package */
  -	private final static String [] classNames = {
  -		"SimpleDocument",
  -		"TextAttributes",
  -		"SimpleTable",
  -		"SimpleLists",
  -		"ListInTable",
  -		"Whitespace",
  -		"MergedTableCells",
  -		"NestedTable",
  -		"ExternalGraphic",
  -		"BasicLink",
  -		"ParagraphAlignment"
  -	};
  -
  -	CreateTestDocuments(File outDir)
  -	throws Exception {
  -		if(!outDir.isDirectory() || !outDir.canWrite()) {
  -			throw new IOException("output directory (" + outDir + ") must exist and be \
                writable");
  -		}
  -
  -		for(int i=0; i < classNames.length; i++) {
  -			createOneTestDocument(classNames[i],outDir);
  -		}
  -	}
  -
  -	/** instantiate one TestDocument and let it generate its document */
  -	void createOneTestDocument(String className,File outDir)
  -	throws Exception {
  -		className = TESTDOCS_PACKAGE + "." + className;
  -		TestDocument td = null;
  -		try {
  -			td = (TestDocument)Class.forName(className).newInstance();
  -		} catch(Exception e) {
  -			throw new Exception("unable to instantiate '" + className + " as a TestDocument \
                object: " + e);
  -		}
  -		td.setOutputDir(outDir);
  -		td.generateOutput();
  -	}
  -
  -	/** execute this to create test documents from all classes listed in classNames \
                array */
  -	public static void main(String args[])
  -	throws Exception {
  -		if(args.length < 1) {
  -			System.err.println("usage: CreateTestDocuments <output directory>");
  -			System.exit(1);
  -		}
  -
  -//		System.err.println("CreateTestDocuments - using " + \
                JForVersionInfo.getLongVersionInfo());
  -		System.err.println("Generates documents to test the jfor RTF library.");
  -		final File outDir = new File(args[0]);
  -		new CreateTestDocuments(outDir);
  -		System.err.println("CreateTestDocuments - all done.");
  -		System.exit(0);
  -	}
  +    /** List of all TestDocument subclasses from this package */
  +    private final static String [] classNames = {
  +        "SimpleDocument",
  +        "TextAttributes",
  +        "SimpleTable",
  +        "SimpleLists",
  +        "ListInTable",
  +        "Whitespace",
  +        "MergedTableCells",
  +        "NestedTable",
  +        "ExternalGraphic",
  +        "BasicLink",
  +        "ParagraphAlignment"
  +    };
  +
  +    CreateTestDocuments(File outDir)
  +    throws Exception {
  +        if(!outDir.isDirectory() || !outDir.canWrite()) {
  +            throw new IOException("output directory (" + outDir + ") must exist \
and be writable");  +        }
  +
  +        for(int i=0; i < classNames.length; i++) {
  +            createOneTestDocument(classNames[i],outDir);
  +        }
  +    }
  +
  +    /** instantiate one TestDocument and let it generate its document */
  +    void createOneTestDocument(String className,File outDir)
  +    throws Exception {
  +        className = TESTDOCS_PACKAGE + "." + className;
  +        TestDocument td = null;
  +        try {
  +            td = (TestDocument)Class.forName(className).newInstance();
  +        } catch(Exception e) {
  +            throw new Exception("unable to instantiate '" + className + " as a \
TestDocument object: " + e);  +        }
  +        td.setOutputDir(outDir);
  +        td.generateOutput();
  +    }
  +
  +    /** execute this to create test documents from all classes listed in \
classNames array */  +    public static void main(String args[])
  +    throws Exception {
  +        if(args.length < 1) {
  +            System.err.println("usage: CreateTestDocuments <output directory>");
  +            System.exit(1);
  +        }
  +
  +//        System.err.println("CreateTestDocuments - using " + \
JForVersionInfo.getLongVersionInfo());  +        System.err.println("Generates \
documents to test the jfor RTF library.");  +        final File outDir = new \
File(args[0]);  +        new CreateTestDocuments(outDir);
  +        System.err.println("CreateTestDocuments - all done.");
  +        System.exit(0);
  +    }
   }
  
  
  
  1.3       +73 -73    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ExternalGraphic.java  
  Index: ExternalGraphic.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ExternalGraphic.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExternalGraphic.java	29 Jun 2003 22:56:31 -0000	1.2
  +++ ExternalGraphic.java	30 Jun 2003 00:20:08 -0000	1.3
  @@ -71,80 +71,80 @@
    */
   class ExternalGraphic extends TestDocument
   {
  -	private String file = "file:///tmp/jfor-images/logo.";
  +    private String file = "file:///tmp/jfor-images/logo.";
   
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Default constructor.
  -	 */
  -	public ExternalGraphic ()
  -	{
  -
  -	}
  -	/** generate the body of the test document */
  -	protected void generateDocument (RtfDocumentArea rda, RtfSection sect) throws \
                IOException
  -	{
  -		RtfParagraph p = sect.newParagraph ();
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newText ("EMF image with 150 % height");
  -		p.newLineBreak();
  -		RtfExternalGraphic imageA = p.newImage ();
  -		imageA.setURL (file + "emf");
  -		imageA.setHeight ("150%");
  -		p.newLineBreak();
  -		p.close();
  -
  -		p = sect.newParagraph( );
  -		p.newLineBreak();
  -		p.newText ("PNG image with 150 % width");
  -		p.newLineBreak();
  -		RtfExternalGraphic imageB = sect.newImage ();
  -		imageB.setURL (file + "png");
  -		imageB.setWidth ("150%");
  -		p.newLineBreak();
  -		p.close();
  -
  -		p = sect.newParagraph( );
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newText ("JPG image with width = 200px and height = 20 px");
  -		p.newLineBreak();
  -		RtfExternalGraphic imageC = sect.newImage ();
  -		imageC.setURL (file + "jpg");
  -		imageC.setWidth ("200");
  -		imageC.setHeight ("20");
  -		p.newLineBreak();
  -		p.close();
  -
  -		p = sect.newParagraph( );
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newText ("GIF image with width = 200px and scaling = 'uniform', that means the \
                image " +
  -					"size will adjusted automatically");
  -		p.newLineBreak();
  -		RtfExternalGraphic imageD = sect.newImage ();
  -		imageD.setURL (file + "gif");
  -		imageD.setWidth ("200");
  -		imageD.setScaling ("uniform");
  -		p.newLineBreak();
  -		p.close();
  -
  -		p = sect.newParagraph( );
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newText ("GIF image");
  -		p.newLineBreak();
  -		RtfExternalGraphic imageE = sect.newImage ();
  -		imageE.setURL (file + "gif");
  -		p.newLineBreak();
  -		p.close();
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Default constructor.
  +     */
  +    public ExternalGraphic ()
  +    {
  +
  +    }
  +    /** generate the body of the test document */
  +    protected void generateDocument (RtfDocumentArea rda, RtfSection sect) throws \
IOException  +    {
  +        RtfParagraph p = sect.newParagraph ();
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newText ("EMF image with 150 % height");
  +        p.newLineBreak();
  +        RtfExternalGraphic imageA = p.newImage ();
  +        imageA.setURL (file + "emf");
  +        imageA.setHeight ("150%");
  +        p.newLineBreak();
  +        p.close();
  +
  +        p = sect.newParagraph( );
  +        p.newLineBreak();
  +        p.newText ("PNG image with 150 % width");
  +        p.newLineBreak();
  +        RtfExternalGraphic imageB = sect.newImage ();
  +        imageB.setURL (file + "png");
  +        imageB.setWidth ("150%");
  +        p.newLineBreak();
  +        p.close();
  +
  +        p = sect.newParagraph( );
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newText ("JPG image with width = 200px and height = 20 px");
  +        p.newLineBreak();
  +        RtfExternalGraphic imageC = sect.newImage ();
  +        imageC.setURL (file + "jpg");
  +        imageC.setWidth ("200");
  +        imageC.setHeight ("20");
  +        p.newLineBreak();
  +        p.close();
  +
  +        p = sect.newParagraph( );
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newText ("GIF image with width = 200px and scaling = 'uniform', that \
means the image " +  +                    "size will adjusted automatically");
  +        p.newLineBreak();
  +        RtfExternalGraphic imageD = sect.newImage ();
  +        imageD.setURL (file + "gif");
  +        imageD.setWidth ("200");
  +        imageD.setScaling ("uniform");
  +        p.newLineBreak();
  +        p.close();
  +
  +        p = sect.newParagraph( );
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newText ("GIF image");
  +        p.newLineBreak();
  +        RtfExternalGraphic imageE = sect.newImage ();
  +        imageE.setURL (file + "gif");
  +        p.newLineBreak();
  +        p.close();
   
  -	}
  +    }
   
   
   
  
  
  
  1.3       +31 -31    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ParagraphAlignment.java  
  Index: ParagraphAlignment.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/testdocs/ParagraphAlignment.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParagraphAlignment.java	29 Jun 2003 22:56:31 -0000	1.2
  +++ ParagraphAlignment.java	30 Jun 2003 00:20:09 -0000	1.3
  @@ -71,34 +71,34 @@
   public class ParagraphAlignment extends TestDocument
   {
   
  -	public ParagraphAlignment()
  -	{
  -	}
  -	protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws \
                java.io.IOException
  -	{
  -		RtfAttributes attr = new RtfAttributes ();
  -		attr.set(RtfText.ALIGN_CENTER);
  -		RtfParagraph p = sect.newParagraph (attr);
  -		p.newLineBreak();
  -		p.newLineBreak();
  -		p.newText ("Centered title");
  -		p.newLineBreak();
  -		p.close();
  +    public ParagraphAlignment()
  +    {
  +    }
  +    protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws \
java.io.IOException  +    {
  +        RtfAttributes attr = new RtfAttributes ();
  +        attr.set(RtfText.ALIGN_CENTER);
  +        RtfParagraph p = sect.newParagraph (attr);
  +        p.newLineBreak();
  +        p.newLineBreak();
  +        p.newText ("Centered title");
  +        p.newLineBreak();
  +        p.close();
   
  -		attr = new RtfAttributes ();
  -		attr.set(RtfText.ALIGN_LEFT);
  -		p = sect.newParagraph (attr);
  -		p.newLineBreak();
  -		p.newText ("This is the left aligned text.");
  -		p.newLineBreak();
  -		p.close();
  +        attr = new RtfAttributes ();
  +        attr.set(RtfText.ALIGN_LEFT);
  +        p = sect.newParagraph (attr);
  +        p.newLineBreak();
  +        p.newText ("This is the left aligned text.");
  +        p.newLineBreak();
  +        p.close();
   
  -		attr = new RtfAttributes ();
  -		attr.set(RtfText.ALIGN_RIGHT);
  -		p = sect.newParagraph (attr);
  -		p.newLineBreak();
  -		p.newText ("This is the right aligned text.");
  -		p.newLineBreak();
  -		p.close();
  -	}
  +        attr = new RtfAttributes ();
  +        attr.set(RtfText.ALIGN_RIGHT);
  +        p = sect.newParagraph (attr);
  +        p.newLineBreak();
  +        p.newText ("This is the right aligned text.");
  +        p.newLineBreak();
  +        p.close();
  +    }
   }
  
  
  
  1.4       +60 -60    \
xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageConstants.java  
  Index: ImageConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageConstants.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ImageConstants.java	29 Jun 2003 22:56:32 -0000	1.3
  +++ ImageConstants.java	30 Jun 2003 00:20:09 -0000	1.4
  @@ -67,63 +67,63 @@
   
   public class ImageConstants
   {
  -	//////////////////////////////////////////////////
  -	// @@ Symbolic constants
  -	//////////////////////////////////////////////////
  -
  -	/** Defines the case, if image is not supported */
  -	public static int I_NOT_SUPPORTED = -1;
  -
  -	public static int I_EMF = 0;
  -	public static int I_PNG = 1;
  -	public static int I_JPG = 2;
  -
  -	/** Defines the RTF properties */
  -	public static String [] RTF_TAGS = new String []
  -		{
  -			"emfblip", "pngblip", "jpegblip"
  -		};
  -
  -	public static int I_TO_CONVERT_BASIS = 50;
  -	public static int I_GIF = 50;
  -	public static int I_JPG_C = 51;
  -
  -	/** Defines the types for converting rtf supported image types */
  -	public static int [] CONVERT_TO = new int []
  -		{
  -			I_JPG, I_JPG
  -		};
  -
  -	/** EMF file extension */
  -	public static String EMF_EXT = "emf";
  -	/** PNG file extension */
  -	public static String PNG_EXT = "png";
  -	/** JPG file extension */
  -	public static String JPG_EXT = "jpg";
  -	/** JPEG file extension */
  -	public static String JPEG_EXT = "jpeg";
  -	/** GIF file extension */
  -	public static String GIF_EXT = "gif";
  -
  -	/** Defines the file extensions and the RTF property belongs to */
  -	public static Hashtable SUPPORTED_IMAGE_TYPES = new Hashtable ();
  -	static
  -	{
  -		SUPPORTED_IMAGE_TYPES.put (EMF_EXT, new Integer (I_EMF));
  -		SUPPORTED_IMAGE_TYPES.put (PNG_EXT, new Integer (I_PNG));
  -		SUPPORTED_IMAGE_TYPES.put (JPG_EXT, new Integer (I_JPG_C));
  -		SUPPORTED_IMAGE_TYPES.put (JPEG_EXT,new Integer (I_JPG_C));
  -		SUPPORTED_IMAGE_TYPES.put (GIF_EXT, new Integer (I_GIF));
  -	}
  -
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Private constructor.
  -	 */
  -	private ImageConstants()
  -	{
  -	}
  +    //////////////////////////////////////////////////
  +    // @@ Symbolic constants
  +    //////////////////////////////////////////////////
  +
  +    /** Defines the case, if image is not supported */
  +    public static int I_NOT_SUPPORTED = -1;
  +
  +    public static int I_EMF = 0;
  +    public static int I_PNG = 1;
  +    public static int I_JPG = 2;
  +
  +    /** Defines the RTF properties */
  +    public static String [] RTF_TAGS = new String []
  +        {
  +            "emfblip", "pngblip", "jpegblip"
  +        };
  +
  +    public static int I_TO_CONVERT_BASIS = 50;
  +    public static int I_GIF = 50;
  +    public static int I_JPG_C = 51;
  +
  +    /** Defines the types for converting rtf supported image types */
  +    public static int [] CONVERT_TO = new int []
  +        {
  +            I_JPG, I_JPG
  +        };
  +
  +    /** EMF file extension */
  +    public static String EMF_EXT = "emf";
  +    /** PNG file extension */
  +    public static String PNG_EXT = "png";
  +    /** JPG file extension */
  +    public static String JPG_EXT = "jpg";
  +    /** JPEG file extension */
  +    public static String JPEG_EXT = "jpeg";
  +    /** GIF file extension */
  +    public static String GIF_EXT = "gif";
  +
  +    /** Defines the file extensions and the RTF property belongs to */
  +    public static Hashtable SUPPORTED_IMAGE_TYPES = new Hashtable ();
  +    static
  +    {
  +        SUPPORTED_IMAGE_TYPES.put (EMF_EXT, new Integer (I_EMF));
  +        SUPPORTED_IMAGE_TYPES.put (PNG_EXT, new Integer (I_PNG));
  +        SUPPORTED_IMAGE_TYPES.put (JPG_EXT, new Integer (I_JPG_C));
  +        SUPPORTED_IMAGE_TYPES.put (JPEG_EXT,new Integer (I_JPG_C));
  +        SUPPORTED_IMAGE_TYPES.put (GIF_EXT, new Integer (I_GIF));
  +    }
  +
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Private constructor.
  +     */
  +    private ImageConstants()
  +    {
  +    }
   }
  
  
  
  1.4       +190 -190  \
xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageUtil.java  
  Index: ImageUtil.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/tools/ImageUtil.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ImageUtil.java	29 Jun 2003 22:56:32 -0000	1.3
  +++ ImageUtil.java	30 Jun 2003 00:20:09 -0000	1.4
  @@ -65,192 +65,192 @@
   public class ImageUtil
   {
   
  -	//////////////////////////////////////////////////
  -	// @@ Construction
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Private constructor.
  -	 */
  -	private ImageUtil ()
  -	{
  -	}
  -
  -
  -	//////////////////////////////////////////////////
  -	// @@ Public static methods
  -	//////////////////////////////////////////////////
  -
  -	/**
  -	 * Determines the digits from a string.
  -	 *
  -	 * @param value String with digits
  -	 *
  -	 * @return
  -	 *  -1      There is no digit\n
  -	 *  number  The digits as integer
  -	 */
  -	public static int getInt (String value)
  -	{
  -		String retString = new String ();
  -		StringBuffer s = new StringBuffer (value);
  -		int len = s.length ();
  -
  -		for (int i = 0; i < len; i++)
  -		{
  -			if (Character.isDigit (s.charAt (i)))
  -			{
  -				retString += s.charAt (i);
  -			}
  -		}
  -
  -		if (retString.length () == 0)
  -		{
  -			return -1;
  -		}
  -		else
  -		{
  -			return Integer.parseInt (retString);
  -		}
  -	}
  -
  -	/**
  -	 * Checks the string for percent character at the end of string.
  -	 *
  -	 * @param value String with digits
  -	 *
  -	 * @return
  -	 * true    The string contains a % value
  -	 * false   Other string
  -	 */
  -	public static boolean isPercent (String value)
  -	{
  -		if (value.endsWith ("%"))
  -		{
  -			return true;
  -
  -		}
  -
  -		return false;
  -	}
  -
  -	/**
  -	 * Compares two hexadecimal values.
  -	 *
  -	 * @param pattern Target
  -	 * @param data Data
  -	 * @param searchAt Position to start compare
  -	 * @param searchForward Direction to compare byte arrays
  -	 *
  -	 * @return
  -	 *  true    If equal\n
  -	 *  false   If different
  -	 */
  -	public static boolean compareHexValues (byte[] pattern, byte[] data, int \
                searchAt,
  -											boolean searchForward)
  -	{
  -		if (searchAt >= data.length)
  -		{
  -			return false;
  -
  -		}
  -
  -		int pLen = pattern.length;
  -
  -		if (searchForward)
  -		{
  -			if (pLen >= (data.length - searchAt))
  -			{
  -				return false;
  -
  -			}
  -
  -			for (int i = 0; i < pLen; i++)
  -			{
  -				if (pattern[i] != data[searchAt + i])
  -				{
  -					return false;
  -				}
  -			}
  -
  -			return true;
  -		}
  -		else
  -		{
  -			if (pLen > (searchAt + 1))
  -			{
  -				return false;
  -
  -			}
  -
  -			for (int i = 0; i < pLen; i++)
  -			{
  -				if (pattern[pLen - i - 1] != data[searchAt - i])
  -				{
  -					return false;
  -				}
  -			}
  -
  -			return true;
  -		}
  -	}
  -
  -	/**
  -	 * Determines a integer value from a hexadecimal byte array.
  -	 *
  -	 * @param data Image
  -	 * @param start Start index to read from
  -	 * @param end End index until to read
  -	 *
  -	 * @return A number
  -	 */
  -	public static int getIntFromByteArray (byte[] data, int startAt, int length,
  -										   boolean searchForward)
  -	{
  -		int bit = 8;
  -		int bitMoving = length * bit;
  -		int retVal = 0;
  -
  -		if (startAt >= data.length)
  -		{
  -			return retVal;
  -
  -		}
  -
  -		if (searchForward)
  -		{
  -			if (length >= (data.length - startAt))
  -			{
  -				return retVal;
  -
  -			}
  -
  -			for (int i = 0; i < length; i++)
  -			{
  -				bitMoving -= bit;
  -				int iData = (int) data[startAt + i];
  -				if (iData < 0)
  -					iData += 256;
  -				retVal += iData << bitMoving;
  -			}
  -		}
  -		else
  -		{
  -			if (length > (startAt + 1))
  -			{
  -				return retVal;
  -
  -			}
  -
  -			for (int i = 0; i < length; i++)
  -			{
  -				bitMoving -= bit;
  -				int iData = (int) data[startAt - i];
  -				if (iData < 0)
  -					iData += 256;
  -				retVal += iData << bitMoving;			}
  -		}
  -
  -		return retVal;
  -	}
  -}
  \ No newline at end of file
  +    //////////////////////////////////////////////////
  +    // @@ Construction
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Private constructor.
  +     */
  +    private ImageUtil ()
  +    {
  +    }
  +
  +
  +    //////////////////////////////////////////////////
  +    // @@ Public static methods
  +    //////////////////////////////////////////////////
  +
  +    /**
  +     * Determines the digits from a string.
  +     *
  +     * @param value String with digits
  +     *
  +     * @return
  +     *  -1      There is no digit\n
  +     *  number  The digits as integer
  +     */
  +    public static int getInt (String value)
  +    {
  +        String retString = new String ();
  +        StringBuffer s = new StringBuffer (value);
  +        int len = s.length ();
  +
  +        for (int i = 0; i < len; i++)
  +        {
  +            if (Character.isDigit (s.charAt (i)))
  +            {
  +                retString += s.charAt (i);
  +            }
  +        }
  +
  +        if (retString.length () == 0)
  +        {
  +            return -1;
  +        }
  +        else
  +        {
  +            return Integer.parseInt (retString);
  +        }
  +    }
  +
  +    /**
  +     * Checks the string for percent character at the end of string.
  +     *
  +     * @param value String with digits
  +     *
  +     * @return
  +     * true    The string contains a % value
  +     * false   Other string
  +     */
  +    public static boolean isPercent (String value)
  +    {
  +        if (value.endsWith ("%"))
  +        {
  +            return true;
  +
  +        }
  +
  +        return false;
  +    }
  +
  +    /**
  +     * Compares two hexadecimal values.
  +     *
  +     * @param pattern Target
  +     * @param data Data
  +     * @param searchAt Position to start compare
  +     * @param searchForward Direction to compare byte arrays
  +     *
  +     * @return
  +     *  true    If equal\n
  +     *  false   If different
  +     */
  +    public static boolean compareHexValues (byte[] pattern, byte[] data, int \
searchAt,  +                                            boolean searchForward)
  +    {
  +        if (searchAt >= data.length)
  +        {
  +            return false;
  +
  +        }
  +
  +        int pLen = pattern.length;
  +
  +        if (searchForward)
  +        {
  +            if (pLen >= (data.length - searchAt))
  +            {
  +                return false;
  +
  +            }
  +
  +            for (int i = 0; i < pLen; i++)
  +            {
  +                if (pattern[i] != data[searchAt + i])
  +                {
  +                    return false;
  +                }
  +            }
  +
  +            return true;
  +        }
  +        else
  +        {
  +            if (pLen > (searchAt + 1))
  +            {
  +                return false;
  +
  +            }
  +
  +            for (int i = 0; i < pLen; i++)
  +            {
  +                if (pattern[pLen - i - 1] != data[searchAt - i])
  +                {
  +                    return false;
  +                }
  +            }
  +
  +            return true;
  +        }
  +    }
  +
  +    /**
  +     * Determines a integer value from a hexadecimal byte array.
  +     *
  +     * @param data Image
  +     * @param start Start index to read from
  +     * @param end End index until to read
  +     *
  +     * @return A number
  +     */
  +    public static int getIntFromByteArray (byte[] data, int startAt, int length,
  +                                           boolean searchForward)
  +    {
  +        int bit = 8;
  +        int bitMoving = length * bit;
  +        int retVal = 0;
  +
  +        if (startAt >= data.length)
  +        {
  +            return retVal;
  +
  +        }
  +
  +        if (searchForward)
  +        {
  +            if (length >= (data.length - startAt))
  +            {
  +                return retVal;
  +
  +            }
  +
  +            for (int i = 0; i < length; i++)
  +            {
  +                bitMoving -= bit;
  +                int iData = (int) data[startAt + i];
  +                if (iData < 0)
  +                    iData += 256;
  +                retVal += iData << bitMoving;
  +            }
  +        }
  +        else
  +        {
  +            if (length > (startAt + 1))
  +            {
  +                return retVal;
  +
  +            }
  +
  +            for (int i = 0; i < length; i++)
  +            {
  +                bitMoving -= bit;
  +                int iData = (int) data[startAt - i];
  +                if (iData < 0)
  +                    iData += 256;
  +                retVal += iData << bitMoving;            }
  +        }
  +
  +        return retVal;
  +    }
  +}
  
  
  

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic