pherweg     2004/01/03 05:43:12

  Modified:    src/java/org/apache/fop/render/rtf/rtflib/rtfdoc
                        RtfColorTable.java
  Log:
  bug fixed: The first occurence of a custom color was displayed with wrong color
  
  Revision  Changes    Path
  1.3       +12 -3     
xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java
  
  Index: RtfColorTable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RtfColorTable.java        15 Nov 2003 23:45:34 -0000      1.2
  +++ RtfColorTable.java        3 Jan 2004 13:43:12 -0000       1.3
  @@ -187,14 +187,21 @@
           int retVal;
   
           if (o == null) {
  +            //The color currently does not exist, so add it to the table.
  +            //First add it, then read the size as index (to return it).
  +            //So the first added color gets index 1. That is OK, because
  +            //index 0 is reserved for auto-colored. 
               addColor (identifier);
   
               retVal = colorTable.size ();
           } else {
  -            retVal = ((Integer) o).intValue ();
  +            //The color was found. Before returning the index, increment
  +            //it by one. Because index 0 is reserved for auto-colored, but
  +            //is not contained in colorTable.
  +            retVal = ((Integer) o).intValue () + 1;
           }
   
  -        return new Integer(retVal + 1);
  +        return new Integer(retVal);
       }
   
       /**
  @@ -212,6 +219,8 @@
           header.writeGroupMark (true);
           //Don't use writeControlWord, because it appends a blank,
           //which may confuse Wordpad.
  +        //This also implicitly writes the first color (=index 0), which
  +        //is reserved for auto-colored.
           header.write ("\\colortbl;");
   
           int len = colorTable.size ();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to