aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ddf
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-03-14 00:42:59 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-03-14 00:42:59 +0000
commitfef2ce53cdc91280e89726e84affc634004e32e6 (patch)
tree801e45343a9093f8d0d26f8e1de94206ef3ced6f /src/java/org/apache/poi/ddf
parent8fccd72f9d0e98569a3f4ef6aae0daff83072b17 (diff)
downloadpoi-fef2ce53cdc91280e89726e84affc634004e32e6.tar.gz
poi-fef2ce53cdc91280e89726e84affc634004e32e6.zip
HSLF: Add support for system colors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ddf')
-rw-r--r--src/java/org/apache/poi/ddf/EscherColorRef.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/ddf/EscherColorRef.java b/src/java/org/apache/poi/ddf/EscherColorRef.java
index dd2626b11e..d48c5de256 100644
--- a/src/java/org/apache/poi/ddf/EscherColorRef.java
+++ b/src/java/org/apache/poi/ddf/EscherColorRef.java
@@ -243,7 +243,7 @@ public class EscherColorRef {
*/
public SysIndexProcedure getSysIndexProcedure() {
if (!hasSysIndexFlag()) return null;
- int val = FLAG_RED.getValue(colorRef);
+ int val = FLAG_GREEN.getValue(colorRef);
for (SysIndexProcedure sip : SysIndexProcedure.values()) {
if (sip == SysIndexProcedure.INVERT_AFTER || sip == SysIndexProcedure.INVERT_HIGHBIT_AFTER) continue;
if (sip.mask.isSet(val)) return sip;
@@ -277,7 +277,19 @@ public class EscherColorRef {
* @return index of current palette (color) or -1 if {@link #hasPaletteIndexFlag()} is {@code false}
*/
public int getPaletteIndex() {
- if (!hasPaletteIndexFlag()) return -1;
- return (FLAG_GREEN.getValue(colorRef) << 8) & FLAG_RED.getValue(colorRef);
+ return (hasPaletteIndexFlag()) ? getIndex() : -1;
+ }
+
+ /**
+ * @return index of system color table or -1 if {@link #hasSysIndexFlag()} is {@code false}
+ *
+ * @see org.apache.poi.sl.usermodel.PresetColor
+ */
+ public int getSysIndex() {
+ return (hasSysIndexFlag()) ? getIndex() : -1;
+ }
+
+ private int getIndex() {
+ return (FLAG_GREEN.getValue(colorRef) << 8) | FLAG_RED.getValue(colorRef);
}
}