diff options
author | Peter Herweg <pherweg@apache.org> | 2004-01-03 13:43:12 +0000 |
---|---|---|
committer | Peter Herweg <pherweg@apache.org> | 2004-01-03 13:43:12 +0000 |
commit | 5997aec0171a4b7b4ffe34f23cd611215f3e8acf (patch) | |
tree | 4f7e4dab34d8b23dfffcc27337066a293abb518c /src | |
parent | b6807ee509a58f675bc2e5ab227455f5c528edfd (diff) | |
download | xmlgraphics-fop-5997aec0171a4b7b4ffe34f23cd611215f3e8acf.tar.gz xmlgraphics-fop-5997aec0171a4b7b4ffe34f23cd611215f3e8acf.zip |
bug fixed: The first occurence of a custom color was displayed with wrong color
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197108 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java index 01f21baf9..53351b624 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java @@ -187,14 +187,21 @@ public class RtfColorTable { 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 @@ public class RtfColorTable { 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 (); |