include/editeng/unoprnms.hxx                          |    2 
 sw/CppunitTest_sw_core_theme.mk                       |   62 ++++++++++++++++++
 sw/Module_sw.mk                                       |    1 
 sw/qa/core/theme/ThemeTest.cxx                        |   35 ++++++++++
 sw/qa/core/theme/data/ThemeColorInHeading.docx        |binary
 sw/source/core/unocore/unomap.cxx                     |    4 -
 sw/source/core/unocore/unomap1.cxx                    |    6 +
 sw/source/core/unocore/unomapproperties.hxx           |    6 +
 sw/source/uibase/sidebar/ThemePanel.cxx               |   29 ++------
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   14 ++--
 writerfilter/source/dmapper/DomainMapper.cxx          |   16 ++++
 writerfilter/source/dmapper/PropertyIds.cxx           |    2 
 writerfilter/source/dmapper/PropertyIds.hxx           |    2 
 writerfilter/source/dmapper/TDefTableHandler.cxx      |   44 ++++++++++++
 writerfilter/source/dmapper/TDefTableHandler.hxx      |    1 
 xmloff/inc/XMLThemeColorHandler.hxx                   |   49 ++++++++++++++
 xmloff/inc/enummaps.hxx                               |    2 
 xmloff/source/draw/sdpropls.cxx                       |    3 
 xmloff/source/text/txtprhdl.cxx                       |    6 +
 19 files changed, 254 insertions(+), 30 deletions(-)

New commits:
commit df9f3f3fd81d4f81ee2ff984d1e19999abea2963
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Sep 20 19:27:09 2015 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Dec 25 02:06:58 2022 +0000

    sw: support for reading back theme color from OOXML
    
    OOXML supports theme colors and tint/shade value that additionally
    changed the theme color. Read back which theme color + tint/shade
    value was applied in the resulting color and add this attributes
    as properties to be used by writer.
    In sidebar theme panel the changing the theme colors now doesn't
    takes this into account and changes the colors correctly.
    
    Change-Id: I3a2d49d485fd37a1611483ee0bb5e6034ac5f88e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143697
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 0df739ee5285..8569a3370464 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -21,6 +21,8 @@
 #include <rtl/ustring.hxx>
 
 inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR = u"CharColor";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_THEME = u"CharColorTheme";
+inline constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_TINT_OR_SHADE = 
u"CharColorTintOrShade";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_HEIGHT = u"CharHeight";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_POSTURE = u"CharPosture";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_SHADOWED = u"CharShadowed";
diff --git a/sw/CppunitTest_sw_core_theme.mk b/sw/CppunitTest_sw_core_theme.mk
new file mode 100644
index 000000000000..84b462ea8245
--- /dev/null
+++ b/sw/CppunitTest_sw_core_theme.mk
@@ -0,0 +1,62 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_core_theme))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_theme))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_core_theme, \
+    sw/qa/core/theme/ThemeTest \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_core_theme, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    sfx \
+    subsequenttest \
+    sw \
+    swqahelper \
+    test \
+    unotest \
+    utl \
+    vcl \
+    svt \
+    tl \
+    svl \
+    svxcore \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_core_theme,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_core_theme,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/source/uibase/inc \
+    -I$(SRCDIR)/sw/qa/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_core_theme,\
+    udkapi \
+    offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_core_theme))
+$(eval $(call gb_CppunitTest_use_vcl,sw_core_theme))
+$(eval $(call gb_CppunitTest_use_rdb,sw_core_theme,services))
+$(eval $(call gb_CppunitTest_use_configuration,sw_core_theme))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 8a217a85fbf6..a15763330763 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -154,6 +154,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_filter_ww8 \
     CppunitTest_sw_filter_html \
     CppunitTest_sw_a11y \
+    CppunitTest_sw_core_theme \
 ))
 
 ifneq ($(DISABLE_GUI),TRUE)
diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx
new file mode 100644
index 000000000000..b20088460234
--- /dev/null
+++ b/sw/qa/core/theme/ThemeTest.cxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <memory>
+#include <docsh.hxx>
+
+class SwCoreThemeTest : public SwModelTestBase
+{
+public:
+    SwCoreThemeTest()
+        : SwModelTestBase("/sw/qa/core/theme/data/")
+    {
+    }
+};
+
+CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testThemeColorInHeading)
+{
+    createSwDoc("ThemeColorInHeading.docx");
+    SwDoc* pDoc = getSwDoc();
+    CPPUNIT_ASSERT(pDoc);
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(4), getProperty<sal_Int16>(getParagraph(1), 
"CharColorTheme"));
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/theme/data/ThemeColorInHeading.docx 
b/sw/qa/core/theme/data/ThemeColorInHeading.docx
new file mode 100644
index 000000000000..e350c2676d41
Binary files /dev/null and b/sw/qa/core/theme/data/ThemeColorInHeading.docx 
differ
diff --git a/sw/source/core/unocore/unomap.cxx 
b/sw/source/core/unocore/unomap.cxx
index 46d40d6b4a9a..ffff63747b61 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1437,7 +1437,9 @@ o3tl::span<const SfxItemPropertyMapEntry> 
SwUnoPropertyMapProvider::GetPropertyM
                     // SvxAdjustItem
                     { UNO_NAME_PARA_ADJUST,            RES_PARATR_ADJUST, 
cppu::UnoType<sal_Int16>::get(),PropertyAttribute::MAYBEVOID,  MID_PARA_ADJUST  
                    },
                     // SvxColorItem
-                    { UNO_NAME_CHAR_COLOR,             RES_CHRATR_COLOR,  
cppu::UnoType<sal_Int32>::get(),               PROPERTY_NONE,  0                
                    },
+                    { UNO_NAME_CHAR_COLOR,               RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE,  0 },
+                    { UNO_NAME_CHAR_COLOR_THEME,         RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_THEME_INDEX },
+                    { UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE },
                     // SvxShadowedItem
                     { UNO_NAME_CHAR_SHADOWED,          RES_CHRATR_SHADOWED,    
cppu::UnoType<bool>::get(),               PROPERTY_NONE,  0                     
               },
                     // SvxContouredItem
diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index fef42a508942..fee5e1dbe94b 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -178,7 +178,9 @@ o3tl::span<const SfxItemPropertyMapEntry> 
SwUnoPropertyMapProvider::GetCharStyle
         { UNO_NAME_CHAR_BACK_COLOR, RES_CHRATR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE ,MID_BACK_COLOR        
},
         { UNO_NAME_CHAR_HIGHLIGHT, RES_CHRATR_HIGHLIGHT, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_BACK_COLOR },
         { UNO_NAME_CHAR_CASE_MAP, RES_CHRATR_CASEMAP,     
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},
-        { UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},
+        { UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0 },
+        { UNO_NAME_CHAR_COLOR_THEME, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_THEME_INDEX },
+        { UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE },
         { UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA},
         { UNO_NAME_CHAR_STRIKEOUT, RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<sal_Int16>::get(),                  PropertyAttribute::MAYBEVOID, 
MID_CROSS_OUT},
         { UNO_NAME_CHAR_CROSSED_OUT, RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<bool>::get()  ,        PROPERTY_NONE, 0},
@@ -241,6 +243,8 @@ o3tl::span<const SfxItemPropertyMapEntry>  
SwUnoPropertyMapProvider::GetAutoChar
         { UNO_NAME_CHAR_HIGHLIGHT, RES_CHRATR_HIGHLIGHT, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_BACK_COLOR },
         { UNO_NAME_CHAR_CASE_MAP, RES_CHRATR_CASEMAP,     
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},
         { UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},
+        { UNO_NAME_CHAR_COLOR_THEME, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_THEME_INDEX },
+        { UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE },
         { UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA},
         { UNO_NAME_CHAR_STRIKEOUT, RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<sal_Int16>::get(),                  PropertyAttribute::MAYBEVOID, 
MID_CROSS_OUT},
         { UNO_NAME_CHAR_CROSSED_OUT, RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<bool>::get()  ,        PROPERTY_NONE, 0},
diff --git a/sw/source/core/unocore/unomapproperties.hxx 
b/sw/source/core/unocore/unomapproperties.hxx
index 11a326d185c5..de1a6aa1a2d6 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -125,6 +125,8 @@
         { UNO_NAME_PARA_BACK_COLOR,                     RES_BACKGROUND,        
        cppu::UnoType<sal_Int32>::get(),         PropertyAttribute::MAYBEVOID, 
MID_BACK_COLOR                         }, \
         { UNO_NAME_CHAR_CASE_MAP,                       RES_CHRATR_CASEMAP,    
        cppu::UnoType<sal_Int16>::get(),         PropertyAttribute::MAYBEVOID, 
0                                      }, \
         { UNO_NAME_CHAR_COLOR,                          RES_CHRATR_COLOR,      
        cppu::UnoType<sal_Int32>::get(),         PropertyAttribute::MAYBEVOID, 
0                                      }, \
+        { UNO_NAME_CHAR_COLOR_THEME,                    RES_CHRATR_COLOR,      
        cppu::UnoType<sal_Int16>::get(),         PropertyAttribute::MAYBEVOID, 
MID_COLOR_THEME_INDEX }, \
+        { UNO_NAME_CHAR_COLOR_TINT_OR_SHADE,            RES_CHRATR_COLOR,      
        cppu::UnoType<sal_Int16>::get(),         PropertyAttribute::MAYBEVOID, 
MID_COLOR_TINT_OR_SHADE }, \
         { UNO_NAME_CHAR_TRANSPARENCE,                   RES_CHRATR_COLOR,      
        cppu::UnoType<sal_Int16>::get(),         PropertyAttribute::MAYBEVOID, 
MID_COLOR_ALPHA }, \
         { UNO_NAME_CHAR_STRIKEOUT,                      RES_CHRATR_CROSSEDOUT, 
        cppu::UnoType<sal_Int16>::get(),         PropertyAttribute::MAYBEVOID, 
MID_CROSS_OUT                          }, \
         { UNO_NAME_CHAR_CROSSED_OUT,                    RES_CHRATR_CROSSEDOUT, 
        cppu::UnoType<bool>::get(),       PropertyAttribute::MAYBEVOID, 
MID_CROSSED_OUT                        }, \
@@ -369,6 +371,8 @@
                     { UNO_NAME_PARA_GRAPHIC_LOCATION, RES_BACKGROUND,         
cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE 
,MID_GRAPHIC_POSITION}, \
                     { UNO_NAME_CHAR_CASE_MAP, RES_CHRATR_CASEMAP,     
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},\
                     { UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},\
+                    { UNO_NAME_CHAR_COLOR_THEME,  RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, MID_COLOR_THEME_INDEX 
}, \
+                    { UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(),         PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE 
}, \
                     { UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, MID_COLOR_ALPHA},\
                     { UNO_NAME_CHAR_STRIKEOUT, RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<sal_Int16>::get(),                  PropertyAttribute::MAYBEVOID, 
MID_CROSS_OUT},\
                     { UNO_NAME_CHAR_CROSSED_OUT, RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<bool>::get()  ,        PROPERTY_NONE, 0},\
@@ -479,6 +483,8 @@
 #define COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE \
                     { UNO_NAME_CHAR_BACK_COLOR, RES_CHRATR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE ,MID_BACK_COLOR        
}, \
                     { UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},  \
+                    { UNO_NAME_CHAR_COLOR_THEME,  RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, MID_COLOR_THEME_INDEX 
}, \
+                    { UNO_NAME_CHAR_COLOR_TINT_OR_SHADE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(),         PROPERTY_NONE, MID_COLOR_TINT_OR_SHADE 
}, \
                     { UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, MID_COLOR_ALPHA },  \
                     { UNO_NAME_CHAR_CONTOURED, RES_CHRATR_CONTOUR,    
cppu::UnoType<bool>::get()  ,       PROPERTY_NONE, 0},  \
                     { UNO_NAME_CHAR_EMPHASIS, RES_CHRATR_EMPHASIS_MARK,        
   cppu::UnoType<sal_Int16>::get(),   PROPERTY_NONE, MID_EMPHASIS},   \
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx 
b/sw/source/uibase/sidebar/ThemePanel.cxx
index 5b17955dd77d..aabe27bb8bb0 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -75,21 +75,6 @@ public:
     {
         maVariable = aVariable;
     }
-
-    Color getColor(svx::ColorSet const & rColorSet)
-    {
-        Color aColor;
-        if (maVariable.mnIndex > -1)
-        {
-            aColor = rColorSet.getColor(maVariable.mnIndex);
-            aColor.ApplyTintOrShade(maVariable.mnTintShade);
-        }
-        else
-        {
-            aColor = COL_BLACK;
-        }
-        return aColor;
-    }
 };
 
 class StyleSet
@@ -229,13 +214,17 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet const 
* pStyle, FontSet const
     }
 }*/
 
-void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const & 
rColorSet, StyleRedefinition* pRedefinition)
+void changeColor(SwTextFormatColl* pCollection, svx::ColorSet const& 
rColorSet, StyleRedefinition* /*pRedefinition*/)
 {
-    Color aColor = pRedefinition->getColor(rColorSet);
-
     SvxColorItem aColorItem(pCollection->GetColor());
-    aColorItem.SetValue(aColor);
-    pCollection->SetFormatAttr(aColorItem);
+    auto nThemeIndex = aColorItem.GetThemeColor().GetThemeIndex();
+    if (nThemeIndex >= 0)
+    {
+        Color aColor = rColorSet.getColor(nThemeIndex);
+        aColor.ApplyTintOrShade(aColorItem.GetTintOrShade());
+        aColorItem.SetValue(aColor);
+        pCollection->SetFormatAttr(aColorItem);
+    }
 }
 
 std::vector<FontSet> initFontSets()
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index 5f861000296a..b0fc9b82ce1d 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -562,7 +562,12 @@ static void UpdateTree(SwDocShell& rDocSh, SwEditShell& 
rEditSh,
                                                    
UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE,
                                                    UNO_NAME_CHAR_STYLE_NAME,
                                                    UNO_NAME_NUMBERING_LEVEL,
-                                                   UNO_NAME_PARRSID };
+                                                   UNO_NAME_PARRSID,
+                                                   UNO_NAME_CHAR_COLOR_THEME,
+                                                   
UNO_NAME_CHAR_COLOR_TINT_OR_SHADE };
+
+    const std::vector<OUString> aHiddenCharacterProperties{ 
UNO_NAME_CHAR_COLOR_THEME,
+                                                            
UNO_NAME_CHAR_COLOR_TINT_OR_SHADE };
 
     InsertValues(xRange, aIsDefined, aCharDFNode, false, aHiddenProperties, 
aFieldsNode);
 
@@ -585,7 +590,8 @@ static void UpdateTree(SwDocShell& rDocSh, SwEditShell& 
rEditSh,
         aCurrentChild.sNodeName = sDisplayName;
         aCurrentChild.NodeType = svx::sidebar::TreeNode::ComplexProperty;
 
-        InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, false, {}, 
aFieldsNode);
+        InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, false, 
aHiddenCharacterProperties,
+                     aFieldsNode);
 
         aCharNode.children.push_back(aCurrentChild);
     }
@@ -615,8 +621,8 @@ static void UpdateTree(SwDocShell& rDocSh, SwEditShell& 
rEditSh,
         aCurrentChild.sNodeName = sDisplayName;
         aCurrentChild.NodeType = svx::sidebar::TreeNode::ComplexProperty;
 
-        InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, 
aParentParaStyle.isEmpty(), {},
-                     aFieldsNode);
+        InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, 
aParentParaStyle.isEmpty(),
+                     aHiddenCharacterProperties, aFieldsNode);
 
         aParaNode.children.push_back(aCurrentChild);
         sCurrentParaStyle = aParentParaStyle;
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 3d5762c82cdd..c0e4bdf6bae0 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1031,12 +1031,28 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
             // footnote or endnote reference id - not needed
         break;
         case NS_ooxml::LN_CT_Color_themeColor:
+            if (m_pImpl->GetTopContext())
+            {
+                sal_Int16 nIndex = 
TDefTableHandler::getThemeColorTypeIndex(nIntValue);
+                if (nIndex >= 0 && nIndex <= 11)
+                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_THEME_INDEX, uno::Any(nIndex));
+            }
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
         break;
         case NS_ooxml::LN_CT_Color_themeTint:
+            if (m_pImpl->GetTopContext())
+            {
+                if (nIntValue != 0)
+                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, 
uno::Any(sal_Int16((256 - nIntValue) * 10000 / 256)));
+            }
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeTint", 
OUString::number(nIntValue, 16));
         break;
         case NS_ooxml::LN_CT_Color_themeShade:
+            if (m_pImpl->GetTopContext())
+            {
+                if (nIntValue != 0)
+                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, 
uno::Any(sal_Int16((nIntValue - 256) * 10000 / 256)));
+            }
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"themeShade", OUString::number(nIntValue, 16));
         break;
         case NS_ooxml::LN_CT_DocGrid_linePitch:
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index 1c9bc314862b..3f966d41f18e 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -32,6 +32,8 @@ OUString getPropertyName( PropertyIds eId )
         case PROP_CHAR_SHADOWED:   sName = "CharShadowed"; break;
         case PROP_CHAR_CASE_MAP:   sName = "CharCaseMap"; break;
         case PROP_CHAR_COLOR:      sName = "CharColor"; break;
+        case PROP_CHAR_COLOR_THEME_INDEX: sName = "CharColorTheme"; break;
+        case PROP_CHAR_COLOR_TINT_OR_SHADE: sName = "CharColorTintOrShade"; 
break;
         case PROP_CHAR_RELIEF:     sName = "CharRelief"; break;
         case PROP_CHAR_UNDERLINE:  sName = "CharUnderline"; break;
         case PROP_CHAR_UNDERLINE_COLOR:  sName = "CharUnderlineColor"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index 6e45ca3f05eb..bddcbe56447a 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -54,6 +54,8 @@ enum PropertyIds
         ,PROP_CHAR_CASE_MAP
         ,PROP_CHAR_CHAR_KERNING
         ,PROP_CHAR_COLOR
+        ,PROP_CHAR_COLOR_THEME_INDEX
+        ,PROP_CHAR_COLOR_TINT_OR_SHADE
         ,PROP_CHAR_COMBINE_IS_ON
         ,PROP_CHAR_COMBINE_PREFIX
         ,PROP_CHAR_COMBINE_SUFFIX
diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx 
b/writerfilter/source/dmapper/TDefTableHandler.cxx
index c47ac7db8111..2dea73e65020 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -269,6 +269,50 @@ OUString 
TDefTableHandler::getThemeColorTypeString(sal_Int32 nType)
     return OUString();
 }
 
+sal_Int16 TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
+{
+    switch (nType)
+    {
+        case NS_ooxml::LN_Value_St_ThemeColor_dark1:
+                return 0;
+        case NS_ooxml::LN_Value_St_ThemeColor_light1:
+                return 1;
+        case NS_ooxml::LN_Value_St_ThemeColor_dark2:
+                return 2;
+        case NS_ooxml::LN_Value_St_ThemeColor_light2:
+                return 3;
+        case NS_ooxml::LN_Value_St_ThemeColor_accent1:
+                return 4;
+        case NS_ooxml::LN_Value_St_ThemeColor_accent2:
+                return 5;
+        case NS_ooxml::LN_Value_St_ThemeColor_accent3:
+                return 6;
+        case NS_ooxml::LN_Value_St_ThemeColor_accent4:
+                return 7;
+        case NS_ooxml::LN_Value_St_ThemeColor_accent5:
+                return 8;
+        case NS_ooxml::LN_Value_St_ThemeColor_accent6:
+                return 9;
+        case NS_ooxml::LN_Value_St_ThemeColor_hyperlink:
+                return 10;
+        case NS_ooxml::LN_Value_St_ThemeColor_followedHyperlink:
+                return 11;
+        case NS_ooxml::LN_Value_St_ThemeColor_none:
+                return -1;
+        case NS_ooxml::LN_Value_St_ThemeColor_background1:
+                return 0;
+        case NS_ooxml::LN_Value_St_ThemeColor_text1:
+                return 1;
+        case NS_ooxml::LN_Value_St_ThemeColor_background2:
+                return 2;
+        case NS_ooxml::LN_Value_St_ThemeColor_text2:
+                return 3;
+        default:
+                break;
+    }
+    return -1;
+}
+
 void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
 {
     sal_Int32 nIntValue = rVal.getInt();
diff --git a/writerfilter/source/dmapper/TDefTableHandler.hxx 
b/writerfilter/source/dmapper/TDefTableHandler.hxx
index 17e6f2ed4fab..f9ae47eb5390 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.hxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.hxx
@@ -66,6 +66,7 @@ public:
     css::beans::PropertyValue getInteropGrabBag(const OUString& aName = 
OUString());
     static OUString getBorderTypeString(sal_Int32 nType);
     static OUString getThemeColorTypeString(sal_Int32 nType);
+    static sal_Int16 getThemeColorTypeIndex(sal_Int32 nType);
 };
 }
 
diff --git a/xmloff/inc/XMLThemeColorHandler.hxx 
b/xmloff/inc/XMLThemeColorHandler.hxx
new file mode 100644
index 000000000000..e98ef725682c
--- /dev/null
+++ b/xmloff/inc/XMLThemeColorHandler.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <xmloff/xmlprhdl.hxx>
+
+using namespace ::xmloff::token;
+
+class XMLThemeColorHandler : public XMLPropertyHandler
+{
+public:
+    bool importXML(const OUString& rStrImpValue, css::uno::Any& rValue,
+                   const SvXMLUnitConverter&) const override
+    {
+        sal_Int16 nValue;
+        bool bReturn = SvXMLUnitConverter::convertEnum(nValue, rStrImpValue, 
pXML_ThemeColor_Enum);
+
+        if (bReturn)
+            rValue <<= nValue;
+
+        return bReturn;
+    }
+
+    bool exportXML(OUString& rStrExpValue, const css::uno::Any& rValue,
+                   const SvXMLUnitConverter&) const override
+    {
+        sal_Int16 nThemeIndex;
+        rValue >>= nThemeIndex;
+
+        if (nThemeIndex == -1) // Default
+            return false;
+
+        OUStringBuffer aOutBuffer;
+        bool bReturn = SvXMLUnitConverter::convertEnum(aOutBuffer, nThemeIndex,
+                                                       pXML_ThemeColor_Enum, 
XML_NONE);
+        rStrExpValue = aOutBuffer.makeStringAndClear();
+
+        return bReturn;
+    }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/enummaps.hxx b/xmloff/inc/enummaps.hxx
index a170559af996..4d061a736967 100644
--- a/xmloff/inc/enummaps.hxx
+++ b/xmloff/inc/enummaps.hxx
@@ -19,6 +19,6 @@ template <typename EnumT> struct SvXMLEnumMapEntry;
 extern SvXMLEnumMapEntry<css::drawing::FillStyle> const 
aXML_FillStyle_EnumMap[];
 extern SvXMLEnumMapEntry<css::drawing::RectanglePoint> const 
aXML_RefPoint_EnumMap[];
 extern SvXMLEnumMapEntry<css::drawing::BitmapMode> const 
aXML_BitmapMode_EnumMap[];
-extern SvXMLEnumMapEntry<sal_uInt16> const pXML_ThemeColor_Enum[];
+extern SvXMLEnumMapEntry<sal_Int16> const pXML_ThemeColor_Enum[];
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index e7223409b6f0..6c8731942782 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -60,6 +60,7 @@
 #include <XMLIsPercentagePropertyHandler.hxx>
 #include <XMLPercentOrMeasurePropertyHandler.hxx>
 #include <XMLTextColumnsPropertyHandler.hxx>
+#include <XMLThemeColorHandler.hxx>
 #include <animations.hxx>
 #include <sax/tools/converter.hxx>
 #include <xmlsdtypes.hxx>
@@ -1308,7 +1309,7 @@ const XMLPropertyHandler* 
XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
                 pHdl = new XMLTextColumnsPropertyHandler;
                 break;
             case XML_TYPE_THEME_COLOR:
-                pHdl = new XMLConstantsPropertyHandler(pXML_ThemeColor_Enum, 
XML_TOKEN_INVALID);
+                pHdl = new XMLThemeColorHandler;
                 break;
         }
 
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 22fbe4174dd6..a4450ce230f4 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -56,6 +56,7 @@
 #include <XMLFillBitmapSizePropertyHandler.hxx>
 #include <XMLBitmapLogicalSizePropertyHandler.hxx>
 #include <XMLBitmapRepeatOffsetPropertyHandler.hxx>
+#include <XMLThemeColorHandler.hxx>
 #include <vcl/graph.hxx>
 
 using namespace ::com::sun::star;
@@ -249,8 +250,9 @@ SvXMLEnumMapEntry<drawing::TextVerticalAdjust> const 
pXML_VerticalAlign_Enum[] =
     { XML_TOKEN_INVALID, drawing::TextVerticalAdjust(0) }
 };
 
-SvXMLEnumMapEntry<sal_uInt16> const pXML_ThemeColor_Enum[] =
+SvXMLEnumMapEntry<sal_Int16> const pXML_ThemeColor_Enum[] =
 {
+    { XML_NONE, -1 },
     { XML_DK1, 0 },
     { XML_LT1, 1 },
     { XML_DK2, 2 },
@@ -1430,7 +1432,7 @@ static const XMLPropertyHandler *GetPropertyHandler
         pHdl = new XMLGraphicPropertyHandler;
         break;
     case XML_TYPE_THEME_COLOR:
-        pHdl = new XMLConstantsPropertyHandler(pXML_ThemeColor_Enum, 
XML_TOKEN_INVALID);
+        pHdl = new XMLThemeColorHandler;
         break;
     default:
     {

Reply via email to