summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2023-03-17 10:40:23 -0400
committerAndras Timar <andras.timar@collabora.com>2023-03-23 07:11:11 +0000
commitbda1d2e989e17917e37e188c6a2fa58808ea7cf1 (patch)
tree450697ff0e57acf4113900f2ff42383383f0b527
parent02880f9796a93bab73fa6f71f2d60155f786870d (diff)
sc: filter: oox: add missing attribute "indexed"
<x14:dataBar maxLength="100" minLength="0" axisPosition="automatic" direction="context" gradient="0" negativeBarBorderColorSameAsPositive="0"> <x14:cfvo type="autoMin"/> <x14:cfvo type="autoMax"/> <x14:fillColor rgb="FF638EC6"/> <x14:negativeFillColor indexed="2"/> <x14:axisColor indexed="64"/> </x14:dataBar> Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: If7f6c8c902e4cd0d775f1014acad3dcd19f13f28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149341 Tested-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx76
1 files changed, 76 insertions, 0 deletions
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 9f7512d912e7..3e5569ce5b9e 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -168,6 +168,76 @@ void ColorScaleRule::importCfvo( const AttributeList& rAttribs )
namespace {
+// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.indexedcolors?view=openxml-2.8.1
+static ::Color IndexedColors[] = {
+ 0x00000000,
+ 0x00FFFFFF,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ 0x00FFFF00,
+ 0x00FF00FF,
+ 0x0000FFFF,
+ 0x00000000,
+ 0x00FFFFFF,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ 0x00FFFF00,
+ 0x00FF00FF,
+ 0x0000FFFF,
+ 0x00800000,
+ 0x00008000,
+ 0x00000080,
+ 0x00808000,
+ 0x00800080,
+ 0x00008080,
+ 0x00C0C0C0,
+ 0x00808080,
+ 0x009999FF,
+ 0x00993366,
+ 0x00FFFFCC,
+ 0x00CCFFFF,
+ 0x00660066,
+ 0x00FF8080,
+ 0x000066CC,
+ 0x00CCCCFF,
+ 0x00000080,
+ 0x00FF00FF,
+ 0x00FFFF00,
+ 0x0000FFFF,
+ 0x00800080,
+ 0x00800000,
+ 0x00008080,
+ 0x000000FF,
+ 0x0000CCFF,
+ 0x00CCFFFF,
+ 0x00CCFFCC,
+ 0x00FFFF99,
+ 0x0099CCFF,
+ 0x00FF99CC,
+ 0x00CC99FF,
+ 0x00FFCC99,
+ 0x003366FF,
+ 0x0033CCCC,
+ 0x0099CC00,
+ 0x00FFCC00,
+ 0x00FF9900,
+ 0x00FF6600,
+ 0x00666699,
+ 0x00969696,
+ 0x00003366,
+ 0x00339966,
+ 0x00003300,
+ 0x00333300,
+ 0x00993300,
+ 0x00993366,
+ 0x00333399,
+ 0x00333333,
+ 0x00000000, // System Foreground ?
+ 0x00000000, // System Background ?
+};
+
::Color importOOXColor(const AttributeList& rAttribs, const ThemeBuffer& rThemeBuffer, const GraphicHelper& rGraphicHelper)
{
::Color nColor;
@@ -189,6 +259,12 @@ namespace {
nColor = rThemeBuffer.getColorByIndex( nThemeIndex );
}
+ else if (rAttribs.hasAttribute(XML_indexed))
+ {
+ sal_uInt32 nIndexed = rAttribs.getUnsigned(XML_indexed, 0);
+ if (nIndexed < sizeof(IndexedColors))
+ nColor = IndexedColors[nIndexed];
+ }
::Color aColor;
double nTint = rAttribs.getDouble(XML_tint, 0.0);