sc/source/filter/oox/condformatbuffer.cxx |   76 ++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

New commits:
commit 77a1441aaaa0c3faffb2e2b78c039a989987b0a8
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Mar 17 10:40:23 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Tue Jun 13 20:40:46 2023 +0200

    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 <hcas...@collabora.com>
    Change-Id: If7f6c8c902e4cd0d775f1014acad3dcd19f13f28
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149065
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152968
    Tested-by: Jenkins

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 63e75170a367..efff0ec62889 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 )
     ++mnCfvo;
 }
 
+// 
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 ?
+};
+
 namespace {
 
 ::Color importOOXColor(const AttributeList& rAttribs, const ThemeBuffer& 
rThemeBuffer, const GraphicHelper& rGraphicHelper)
@@ -191,6 +261,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);

Reply via email to