From 1af5e562a64c85c0119dc9019619d5e89f0010ca Mon Sep 17 00:00:00 2001 From: William Victor Mote Date: Tue, 16 Sep 2003 14:50:16 +0000 Subject: [PATCH] make RtfColorTable.getColorNumber return an Integer instead of int, so that it can return a null value -- submitted by Peter Herweg, see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23082 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196915 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/rtf/renderer/RTFHandler.java | 4 +-- .../fop/rtf/rtflib/rtfdoc/RtfColorTable.java | 26 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java index f602dc90f..54386ca90 100644 --- a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java +++ b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java @@ -452,7 +452,7 @@ public class RTFHandler extends FOInputHandler { white. */ if ((fopValue.getRed() == 0) && (fopValue.getGreen() == 0) && (fopValue.getBlue() == 0) && (fopValue.getAlpha() == 0)) { - rtfColor = RtfColorTable.getInstance().getColorNumber("white"); + rtfColor = RtfColorTable.getInstance().getColorNumber("white").intValue(); } else { rtfColor = convertFOPColorToRTF(fopValue); } @@ -472,7 +472,7 @@ public class RTFHandler extends FOInputHandler { int greenComponent = ColorType.convertChannelToInteger (fopColor.getGreen()); int blueComponent = ColorType.convertChannelToInteger (fopColor.getBlue()); return RtfColorTable.getInstance().getColorNumber(redComponent, - greenComponent, blueComponent); + greenComponent, blueComponent).intValue(); } } diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java index ed5656a87..d8e64dce0 100755 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfColorTable.java @@ -131,14 +131,14 @@ public class RtfColorTable { * 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("black", getColorNumber (0, 0, 0).intValue()); + addNamedColor("white", getColorNumber (255, 255, 255).intValue()); + addNamedColor("red", getColorNumber (255, 0, 0).intValue()); + addNamedColor("green", getColorNumber (0, 255, 0).intValue()); + addNamedColor("blue", getColorNumber (0, 0, 255).intValue()); + addNamedColor("cyan", getColorNumber (0, 255, 255).intValue()); + addNamedColor("magenta", getColorNumber (255, 0, 255).intValue()); + addNamedColor("yellow", getColorNumber (255, 255, 0).intValue()); getColorNumber (0, 0, 128); getColorNumber (0, 128, 128); @@ -150,7 +150,7 @@ public class RtfColorTable { // Added by Normand Masse // Gray color added - addNamedColor("gray", getColorNumber(128, 128, 128)); + addNamedColor("gray", getColorNumber(128, 128, 128).intValue()); getColorNumber (192, 192, 192); } @@ -168,8 +168,8 @@ public class RtfColorTable { * @param name a named color * @return the RTF number of a named color, or null if name not found */ - public int getColorNumber (String name) { - return ((Integer)namedColors.get(name.toLowerCase())).intValue(); + public Integer getColorNumber (String name) { + return ((Integer)namedColors.get(name.toLowerCase())); } /** @@ -181,7 +181,7 @@ public class RtfColorTable { * * @return The number of the color in the table */ - public int getColorNumber (int red, int green, int blue) { + public Integer getColorNumber (int red, int green, int blue) { Integer identifier = new Integer (determineIdentifier (red, green, blue)); Object o = colorIndex.get (identifier); int retVal; @@ -194,7 +194,7 @@ public class RtfColorTable { retVal = ((Integer) o).intValue (); } - return retVal + 1; + return new Integer(retVal + 1); } /** -- 2.39.5