include/oox/drawingml/color.hxx                  |    2 ++
 oox/source/drawingml/color.cxx                   |   15 +++++++++++++++
 oox/source/drawingml/textcharacterproperties.cxx |    2 ++
 oox/source/token/properties.txt                  |    2 ++
 4 files changed, 21 insertions(+)

New commits:
commit f394e2519c99cd1514c859cda67b1c09e68e6c19
Author:     Sarper Akdemir <[email protected]>
AuthorDate: Fri Aug 20 00:45:55 2021 +0300
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Nov 17 18:00:39 2021 +0100

    implement initial pptx theme color import
    
    [ Miklos: this only handles colors as-is, without any effects. ]
    
    (cherry picked from commit ec68ca0b5fb6773f42600f6a5825b4794cdb0990,
    from the feature/themesupport2 branch)
    Change-Id: I89890cf7ba6ec758698011752b63d7a60872bef2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125404
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 59f417cfac52..f213dba9a973 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -98,6 +98,8 @@ public:
 
     /** Returns the scheme name from the a:schemeClr element for 
interoperability purposes */
     const OUString&     getSchemeName() const { return msSchemeName; }
+    sal_Int16           getSchemeIndex() const;
+
     /** Returns the unaltered list of transformations for interoperability 
purposes */
     const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
 
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 3c9ac2f6ac44..9f4026727b56 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -661,6 +661,21 @@ sal_Int16 Color::getTransparency() const
     return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / 
PER_PERCENT) );
 }
 
+sal_Int16 Color::getSchemeIndex() const
+{
+    static std::map<OUString, sal_Int32> const aSchemeColorNameToIndex{
+        { "dk1", 0 },     { "lt1", 1 },     { "dk2", 2 },     { "lt2", 3 },
+        { "accent1", 4 }, { "accent2", 5 }, { "accent3", 6 }, { "accent4", 7 },
+        { "accent5", 8 }, { "accent6", 9 }, { "hlink", 10 },  { "folHlink", 11 
}
+    };
+
+    auto aIt = aSchemeColorNameToIndex.find(msSchemeName);
+    if( aIt == aSchemeColorNameToIndex.end() )
+        return -1;
+    else
+        return aIt->second;
+}
+
 // private --------------------------------------------------------------------
 
 void Color::setResolvedRgb( ::Color nRgb ) const
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 4eb5acaffb56..9cbc331d05fa 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
     {
         Color aColor = maFillProperties.getBestSolidColor();
         rPropMap.setProperty(PROP_CharColor, 
aColor.getColor(rFilter.getGraphicHelper()));
+        // set color theme index
+        rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeIndex());
 
         if (aColor.hasTransparency())
         {
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 2c56d0f46804..951a03e7eba0 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -54,6 +54,8 @@ CharBackColor
 CharCaseMap
 CharColor
 CharContoured
+CharColorTheme
+CharColorTintOrShade
 CharEscapement
 CharEscapementHeight
 CharFontCharSet

Reply via email to