Repository.mk                                     |    1 
 RepositoryModule_build.mk                         |    1 
 RepositoryModule_host.mk                          |    1 
 bin/update_pch                                    |   31 ++--
 cui/Library_cui.mk                                |    1 
 cui/inc/pch/precompiled_cui.hxx                   |   14 +-
 cui/source/tabpages/chardlg.cxx                   |   12 +
 cui/source/tabpages/tpcolor.cxx                   |   10 -
 docmodel/Library_docmodel.mk                      |   39 +++++
 docmodel/Makefile                                 |    7 +
 docmodel/Module_docmodel.mk                       |   18 ++
 docmodel/README.md                                |    5 
 docmodel/inc/pch/precompiled_docmodel.cxx         |   12 +
 docmodel/inc/pch/precompiled_docmodel.hxx         |   34 +++++
 docmodel/source/uno/UnoThemeColor.cxx             |   40 ++++++
 editeng/CppunitTest_editeng_core.mk               |    1 
 editeng/Library_editeng.mk                        |    1 
 editeng/inc/pch/precompiled_editeng.hxx           |    7 -
 editeng/source/items/textitem.cxx                 |  124 +++++++++++-------
 editeng/source/uno/unotext.cxx                    |   28 +++-
 forms/qa/unoapi/knownissues.xcl                   |    2 
 include/docmodel/dllapi.h                         |   21 +++
 include/docmodel/theme/ThemeColor.hxx             |  146 ++++++++++++++++++++++
 include/docmodel/theme/ThemeColorType.hxx         |   42 ++++++
 include/docmodel/uno/UnoThemeColor.hxx            |   55 ++++++++
 include/editeng/colritem.hxx                      |   54 --------
 include/editeng/memberids.h                       |    1 
 include/editeng/unoprnms.hxx                      |    3 
 include/editeng/unotext.hxx                       |    1 
 include/svx/ColorSets.hxx                         |   35 +----
 include/svx/unoshprp.hxx                          |    1 
 include/svx/xcolit.hxx                            |    9 -
 offapi/UnoApi_offapi.mk                           |    1 
 offapi/com/sun/star/util/XThemeColor.idl          |   26 +++
 oox/CppunitTest_oox_drawingml.mk                  |    1 
 oox/CppunitTest_oox_shape.mk                      |    1 
 oox/CppunitTest_oox_tokenmap.mk                   |    1 
 oox/Library_oox.mk                                |    2 
 oox/inc/pch/precompiled_oox.hxx                   |   69 +++++++---
 oox/qa/unit/drawingml.cxx                         |   71 ++++++----
 oox/qa/unit/shape.cxx                             |   12 +
 oox/source/drawingml/fillproperties.cxx           |   21 ++-
 oox/source/drawingml/textcharacterproperties.cxx  |   23 ++-
 oox/source/export/ThemeExport.cxx                 |   28 ++--
 oox/source/export/drawingml.cxx                   |   99 +++++++-------
 oox/source/token/properties.txt                   |    2 
 sd/CppunitTest_sd_uiimpress.mk                    |    1 
 sd/CppunitTest_sd_uimpress.mk                     |    1 
 sd/Library_sd.mk                                  |    1 
 sd/inc/pch/precompiled_sd.hxx                     |   68 +++++++++-
 sd/qa/unit/uiimpress.cxx                          |   61 ++++-----
 sd/source/core/stlsheet.cxx                       |   27 +++-
 sd/source/filter/eppt/pptx-epptooxml.cxx          |    2 
 sd/source/ui/func/fuconstr.cxx                    |    4 
 sd/source/ui/view/drtxtob1.cxx                    |   29 ++--
 sd/source/ui/view/drviews2.cxx                    |    7 -
 solenv/gbuild/extensions/pre_MergedLibsList.mk    |    1 
 solenv/qa/python/gbuildtojson.py                  |    2 
 svx/CppunitTest_svx_removewhichrange.mk           |    1 
 svx/CppunitTest_svx_styles.mk                     |    1 
 svx/CppunitTest_svx_unit.mk                       |    1 
 svx/Library_svxcore.mk                            |    1 
 svx/inc/pch/precompiled_svx.hxx                   |   29 ++--
 svx/qa/unit/styles.cxx                            |   43 +++---
 svx/qa/unit/xoutdev.cxx                           |   47 +++----
 svx/source/styles/ColorSets.cxx                   |   68 ++++------
 svx/source/table/cell.cxx                         |   28 +++-
 svx/source/unodraw/unoprov.cxx                    |    1 
 svx/source/unodraw/unoshap2.cxx                   |    1 
 svx/source/unodraw/unoshape.cxx                   |   27 +++-
 svx/source/xoutdev/xattr.cxx                      |   62 +++++++--
 sw/CppunitTest_sw_apitests.mk                     |    1 
 sw/CppunitTest_sw_core_draw.mk                    |    1 
 sw/CppunitTest_sw_core_theme.mk                   |    1 
 sw/CppunitTest_sw_macros_test.mk                  |    1 
 sw/CppunitTest_sw_ooxmlimport.mk                  |    1 
 sw/CppunitTest_sw_ooxmlimport2.mk                 |    1 
 sw/CppunitTest_sw_tiledrendering.mk               |    1 
 sw/CppunitTest_sw_uwriter.mk                      |    1 
 sw/Library_sw.mk                                  |    1 
 sw/layoutwriter_setup.mk                          |    1 
 sw/ooxmlexport_setup.mk                           |    1 
 sw/qa/core/theme/ThemeTest.cxx                    |   29 ++--
 sw/source/core/unocore/unomap.cxx                 |    1 
 sw/source/core/unocore/unomap1.cxx                |    2 
 sw/source/core/unocore/unomapproperties.hxx       |    3 
 sw/source/uibase/sidebar/ThemePanel.cxx           |   13 +
 sw/uiwriter_setup.mk                              |    1 
 sw/ww8export_setup.mk                             |    1 
 writerfilter/Library_writerfilter.mk              |    1 
 writerfilter/source/dmapper/DomainMapper.cxx      |  119 +++++++++--------
 writerfilter/source/dmapper/PropertyIds.cxx       |    3 
 writerfilter/source/dmapper/PropertyIds.hxx       |    3 
 writerfilter/source/dmapper/TDefTableHandler.cxx  |   38 ++---
 writerfilter/source/dmapper/TDefTableHandler.hxx  |    4 
 writerfilter/source/dmapper/ThemeColorHandler.hxx |   68 ++++++++++
 96 files changed, 1372 insertions(+), 553 deletions(-)

New commits:
commit 8749a56d868f66fac2628720d7b40eeedddadc54
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sun Jan 1 23:25:38 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Jan 20 07:13:24 2023 +0000

    introduce {Char,Fill}ColorThemeReference which uses XThemeColor
    
    Adds a unified UNO property for theme colors *ColorTheme
    (CharColorTheme and FillColorTheme) which uses XThemeColor, that
    replaces the properties *Theme, *TintOrShade, *LumOff, *LumMod.
    The properties are still present for backwards compatibility and
    to keep ODF support working in tests as that needs a bigger change.
    
    Reactor the code and tests to accomodate for this change.
    
    Change-Id: If7983decb4ba528b49fe7b5968aa9efc696a9efc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144783
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit 197e5f81213d14fdcbff40edf73385ecd4cd9815)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145845
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index bf6017cdcf6d..5a53d6a8e14c 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -77,6 +77,7 @@
 #include <editeng/charreliefitem.hxx>
 #include <editeng/itemtype.hxx>
 #include <editeng/eerdll.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 #include <libxml/xmlwriter.h>
 
 using namespace ::com::sun::star;
@@ -1435,6 +1436,12 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 
nMemberId ) const
             rVal <<= nValue;
             break;
         }
+       case MID_COLOR_THEME_REFERENCE:
+        {
+            auto xThemeColor = model::theme::createXThemeColor(maThemeColor);
+            rVal <<= xThemeColor;
+            break;
+        }
         default:
         {
             rVal <<= mColor;
@@ -1509,6 +1516,18 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
             maThemeColor.addTransformation({model::TransformationType::LumOff, 
nLumOff});
         }
         break;
+        case MID_COLOR_THEME_REFERENCE:
+        {
+            css::uno::Reference<css::util::XThemeColor> xThemeColor;
+            if (!(rVal >>= xThemeColor))
+                return false;
+
+            if (xThemeColor.is())
+            {
+                model::theme::setFromXThemeColor(maThemeColor, xThemeColor);
+            }
+        }
+        break;
         default:
         {
             return rVal >>= mColor;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index e5877a7d2e5a..82a399f00e26 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1175,6 +1175,12 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const 
SfxItemSet* pSet, const Sf
                     }
                     break;
                 }
+                case MID_COLOR_THEME_REFERENCE:
+                    if (pColor->GetThemeColor().getType() == 
model::ThemeColorType::Unknown)
+                    {
+                        eItemState = SfxItemState::DEFAULT;
+                    }
+                    break;
             }
         }
 
diff --git a/forms/qa/unoapi/knownissues.xcl b/forms/qa/unoapi/knownissues.xcl
index 2e8f013ee79b..5d81d139d797 100644
--- a/forms/qa/unoapi/knownissues.xcl
+++ b/forms/qa/unoapi/knownissues.xcl
@@ -147,3 +147,5 @@ 
forms.OGridControlModel::com::sun::star::view::XSelectionSupplier
 
 ### i111333 ###
 forms.OImageControlControl::com::sun::star::awt::XControl
+
+forms.OEditModel::com::sun::star::io::XPersistObject
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index 9b89ebafaefb..0b110cb52c5d 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -188,6 +188,7 @@
 #define MID_COLOR_TINT_OR_SHADE 5
 #define MID_COLOR_LUM_MOD       6
 #define MID_COLOR_LUM_OFF       7
+#define MID_COLOR_THEME_REFERENCE 8
 
 
 #endif
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 8569a3370464..7f82cd0b1fea 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -23,6 +23,7 @@
 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_COLOR_THEME_REFERENCE = 
u"CharColorThemeReference";
 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";
@@ -34,6 +35,7 @@ inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR = 
u"FillColor";
 inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_THEME = u"FillColorTheme";
 inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_LUM_MOD = 
u"FillColorLumMod";
 inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_LUM_OFF = 
u"FillColorLumOff";
+inline constexpr OUStringLiteral UNO_NAME_FILLCOLOR_THEME_REFERENCE = 
u"FillColorThemeReference";
 inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENT = u"FillGradient";
 inline constexpr OUStringLiteral UNO_NAME_FILLGRADIENTNAME = 
u"FillGradientName";
 inline constexpr OUStringLiteral UNO_NAME_FILLHATCH = u"FillHatch";
@@ -334,6 +336,7 @@ inline constexpr OUStringLiteral 
UNO_NAME_EDIT_CHAR_COLOR_THEME = u"CharColorThe
 inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE = 
u"CharColorTintOrShade";
 inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD = 
u"CharColorLumMod";
 inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF = 
u"CharColorLumOff";
+inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE = 
u"CharColorThemeReference";
 inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_TRANSPARENCE = 
u"CharTransparence";
 inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_CROSSEDOUT = 
u"CharCrossedOut";
 inline constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_STRIKEOUT = 
u"CharStrikeout";
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 1d6743a0e410..dec8c4cc50a5 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -91,6 +91,7 @@ struct SfxItemPropertyMapEntry;
     { UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, EE_CHAR_COLOR, 
::cppu::UnoType<sal_Int16>::get(),     0, MID_COLOR_TINT_OR_SHADE }, \
     { UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD,       EE_CHAR_COLOR, 
::cppu::UnoType<sal_Int16>::get(),     0, MID_COLOR_LUM_MOD }, \
     { UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF,       EE_CHAR_COLOR, 
::cppu::UnoType<sal_Int16>::get(),     0, MID_COLOR_LUM_OFF }, \
+    { UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE, EE_CHAR_COLOR,    
::cppu::UnoType<css::uno::XInterface>::get(), 0, MID_COLOR_THEME_REFERENCE }, \
     { u"CharBackColor",                EE_CHAR_BKGCOLOR,   
::cppu::UnoType<sal_Int32>::get(),        0, 0 }, \
     { u"CharBackTransparent",          EE_CHAR_BKGCOLOR,   
::cppu::UnoType<bool>::get(),             0, MID_GRAPHIC_TRANSPARENT }, \
     { UNO_NAME_EDIT_CHAR_ESCAPEMENT,  EE_CHAR_ESCAPEMENT, 
::cppu::UnoType<sal_Int16>::get(),        0, MID_ESC }, \
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 010cbbcd4b36..8af8142c1d43 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -292,6 +292,7 @@
     { UNO_NAME_FILLCOLOR_THEME,   XATTR_FILLCOLOR, 
::cppu::UnoType<sal_Int16>::get(),          0,     MID_COLOR_THEME_INDEX}, \
     { UNO_NAME_FILLCOLOR_LUM_MOD, XATTR_FILLCOLOR, 
::cppu::UnoType<sal_Int16>::get(),          0,     MID_COLOR_LUM_MOD}, \
     { UNO_NAME_FILLCOLOR_LUM_OFF, XATTR_FILLCOLOR, 
::cppu::UnoType<sal_Int16>::get(),          0,     MID_COLOR_LUM_OFF}, \
+    { UNO_NAME_FILLCOLOR_THEME_REFERENCE,   XATTR_FILLCOLOR, 
::cppu::UnoType<css::uno::XInterface>::get(),          0,     
MID_COLOR_THEME_REFERENCE}, \
     { UNO_NAME_GRAPHIC_GRAPHICCROP, SDRATTR_GRAFCROP      , 
::cppu::UnoType<css::text::GraphicCrop>::get(), 0, 0 }, \
     { UNO_NAME_FILLUSESLIDEBACKGROUND, XATTR_FILLUSESLIDEBACKGROUND, 
cppu::UnoType<bool>::get(), 0,   0},
 
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 45d10afe8beb..ac130d90350c 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,oox,\
     cppu \
     cppuhelper \
     editeng \
+    docmodel \
     expwrap \
     drawinglayer \
     docmodel \
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index ab1a73a150c9..2faf2b28e909 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -29,6 +29,8 @@
 #include <com/sun/star/text/XTextRange.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
 
+#include <docmodel/uno/UnoThemeColor.hxx>
+
 #include <comphelper/sequenceashashmap.hxx>
 
 using namespace ::com::sun::star;
@@ -393,24 +395,22 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testPptxTheme)
                                                         uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> 
xPortion(xPara->createEnumeration()->nextElement(),
                                                  uno::UNO_QUERY);
-    // 4 is accent1, see oox::drawingml::Color::getSchemeColorIndex().
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4),
-                         
xPortion->getPropertyValue("CharColorTheme").get<sal_Int32>());
-    // 60000 in the file, just 100th vs 1000th percents.
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 6000
-    // - Actual  : 10000
-    // i.e. we had the default 100% value, not the value from the file.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6000),
-                         
xPortion->getPropertyValue("CharColorLumMod").get<sal_Int32>());
 
-    // 40000 in the file, just 100th vs 1000th percents.
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 4000
-    // - Actual  : 0
-    // i.e. we had the default 0% value, not the value from the file.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4000),
-                         
xPortion->getPropertyValue("CharColorLumOff").get<sal_Int32>());
+    // Check the theme colors are as expected
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xPortion->getPropertyValue("CharColorThemeReference") 
>>= xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod,
+                             aThemeColor.getTransformations()[0].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), 
aThemeColor.getTransformations()[0].mnValue);
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff,
+                             aThemeColor.getTransformations()[1].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), 
aThemeColor.getTransformations()[1].mnValue);
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf132557_footerCustomShapes)
@@ -453,18 +453,31 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint)
     uno::Reference<table::XCellRange> xTable;
     CPPUNIT_ASSERT(xShape->getPropertyValue("Model") >>= xTable);
     uno::Reference<beans::XPropertySet> xA1(xTable->getCellByPosition(0, 0), 
uno::UNO_QUERY);
-    sal_Int16 nFillColorTheme{};
-    CPPUNIT_ASSERT(xA1->getPropertyValue("FillColorTheme") >>= 
nFillColorTheme);
-    // This is OK, no problematic effects:
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nFillColorTheme);
-    uno::Reference<beans::XPropertySet> xA2(xTable->getCellByPosition(0, 1), 
uno::UNO_QUERY);
-    CPPUNIT_ASSERT(xA2->getPropertyValue("FillColorTheme") >>= 
nFillColorTheme);
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: -1
-    // - Actual  : 4
-    // i.e. we remembered the theme index, without being able to remember the 
tint effect, leading
-    // to a bad background color.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(-1), nFillColorTheme);
+    // check theme color
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xA1->getPropertyValue("FillColorThemeReference") >>= 
xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        // This is OK, no problematic effects:
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+    }
+
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        uno::Reference<beans::XPropertySet> xA2(xTable->getCellByPosition(0, 
1), uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xA2->getPropertyValue("FillColorThemeReference") >>= 
xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        // Without the accompanying fix in place, this test would have failed 
with:
+        // - Expected: -1
+        // - Actual  : 4
+        // i.e. we remembered the theme index, without being able to remember 
the tint effect, leading
+        // to a bad background color.
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Unknown, 
aThemeColor.getType());
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testVert270AndTextRot)
diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx
index 21261dc39930..f267c43c797f 100644
--- a/oox/qa/unit/shape.cxx
+++ b/oox/qa/unit/shape.cxx
@@ -23,6 +23,8 @@
 #include <officecfg/Office/Common.hxx>
 #include <rtl/math.hxx>
 #include <svx/svdoashp.hxx>
+#include <tools/color.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 
 using namespace ::com::sun::star;
 
@@ -298,11 +300,15 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, 
testTdf54095_SmartArtThemeTextColor)
     // - Actual  : 16777215 (0xFFFFFF), that is text was white
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x1F497D), nActualColor);
 
-    // clrScheme. For map between name in docx and index from CharColorTheme 
see
+    // clrScheme. For map between name in docx and index from 
CharColorThemeReference see
     // oox::drawingml::Color::getSchemeColorIndex()
     // Without fix the color scheme was "lt1" (1) but should be "dk2" (2).
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(2),
-                         
xPortion->getPropertyValue("CharColorTheme").get<sal_Int16>());
+    uno::Reference<util::XThemeColor> xThemeColor;
+    CPPUNIT_ASSERT(xPortion->getPropertyValue("CharColorThemeReference") >>= 
xThemeColor);
+    CPPUNIT_ASSERT(xThemeColor.is());
+    model::ThemeColor aThemeColor;
+    model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+    CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Dark2, aThemeColor.getType());
 
     if (!bUseGroup)
     {
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 2627a1861850..c58feef0b859 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -26,6 +26,7 @@
 #include <vcl/graph.hxx>
 #include <vcl/BitmapFilter.hxx>
 #include <vcl/BitmapMonochromeFilter.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/awt/Gradient.hpp>
@@ -448,15 +449,27 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
                 if( maFillColor.hasTransparency() )
                     rPropMap.setProperty( ShapeProperty::FillTransparency, 
maFillColor.getTransparency() );
 
+                model::ThemeColor aThemeColor;
                 if (aFillColor == nPhClr)
                 {
-                    rPropMap.setProperty(PROP_FillColorTheme, nPhClrTheme);
+                    
aThemeColor.setType(model::convertToThemeColorType(nPhClrTheme));
+                    rPropMap.setProperty(PROP_FillColorThemeReference, 
model::theme::createXThemeColor(aThemeColor));
                 }
                 else if (maFillColor.getTintOrShade() == 0)
                 {
-                    rPropMap.setProperty(PROP_FillColorTheme, 
maFillColor.getSchemeColorIndex());
-                    rPropMap.setProperty(PROP_FillColorLumMod, 
maFillColor.getLumMod());
-                    rPropMap.setProperty(PROP_FillColorLumOff, 
maFillColor.getLumOff());
+                    
aThemeColor.setType(model::convertToThemeColorType(maFillColor.getSchemeColorIndex()));
+                    if (maFillColor.getLumMod() != 10000)
+                        
aThemeColor.addTransformation({model::TransformationType::LumMod, 
maFillColor.getLumMod()});
+                    if (maFillColor.getLumOff() != 0)
+                        
aThemeColor.addTransformation({model::TransformationType::LumOff, 
maFillColor.getLumOff()});
+                    if (maFillColor.getTintOrShade() > 0)
+                        
aThemeColor.addTransformation({model::TransformationType::Tint, 
maFillColor.getTintOrShade()});
+                    if (maFillColor.getTintOrShade() < 0)
+                    {
+                        sal_Int16 nShade = 
o3tl::narrowing<sal_Int16>(-maFillColor.getTintOrShade());
+                        
aThemeColor.addTransformation({model::TransformationType::Shade, nShade});
+                    }
+                    rPropMap.setProperty(PROP_FillColorThemeReference, 
model::theme::createXThemeColor(aThemeColor));
                 }
 
                 eFillStyle = FillStyle_SOLID;
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 3bc65ec1bb3d..a22606ef106c 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -26,6 +26,7 @@
 #include <i18nlangtag/languagetag.hxx>
 #include <i18nlangtag/mslangid.hxx>
 #include <editeng/escapementitem.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 #include <oox/helper/helper.hxx>
 #include <oox/helper/propertyset.hxx>
 #include <oox/core/xmlfilterbase.hxx>
@@ -133,11 +134,23 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
                 aColor = aLineColor;
         }
         rPropMap.setProperty(PROP_CharColor, 
aColor.getColor(rFilter.getGraphicHelper()));
-        // set color theme index
-        rPropMap.setProperty(PROP_CharColorTheme, 
aColor.getSchemeColorIndex());
-        rPropMap.setProperty(PROP_CharColorTintOrShade, 
aColor.getTintOrShade());
-        rPropMap.setProperty(PROP_CharColorLumMod, aColor.getLumMod());
-        rPropMap.setProperty(PROP_CharColorLumOff, aColor.getLumOff());
+
+        // set theme color
+        model::ThemeColor aThemeColor;
+        
aThemeColor.setType(model::convertToThemeColorType(aColor.getSchemeColorIndex()));
+        if (aColor.getTintOrShade() > 0)
+            aThemeColor.addTransformation({model::TransformationType::Tint, 
aColor.getTintOrShade()});
+        if (aColor.getTintOrShade() < 0)
+        {
+            sal_Int16 nShade = 
o3tl::narrowing<sal_Int16>(-aColor.getTintOrShade());
+            aThemeColor.addTransformation({model::TransformationType::Shade, 
nShade});
+        }
+        if (aColor.getLumMod() != 10000)
+            aThemeColor.addTransformation({model::TransformationType::LumMod, 
aColor.getLumMod()});
+        if (aColor.getLumOff() != 0)
+            aThemeColor.addTransformation({model::TransformationType::LumOff, 
aColor.getLumOff()});
+
+        rPropMap.setProperty(PROP_CharColorThemeReference, 
model::theme::createXThemeColor(aThemeColor));
         rPropMap.setProperty(PROP_CharContoured, bContoured);
 
         if (aColor.hasTransparency())
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 86b9b5ac91dc..08b6f53bc07a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -125,6 +125,7 @@
 #include <editeng/flditem.hxx>
 #include <editeng/escapementitem.hxx>
 #include <editeng/unonrule.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 #include <svx/svdoashp.hxx>
 #include <svx/svdomedia.hxx>
 #include <svx/svdtrans.hxx>
@@ -433,44 +434,41 @@ void DrawingML::WriteColorTransformations( const 
Sequence< PropertyValue >& aTra
 
 bool DrawingML::WriteCharColor(const 
css::uno::Reference<css::beans::XPropertySet>& xPropertySet)
 {
-    if 
(!xPropertySet->getPropertySetInfo()->hasPropertyByName("CharColorTheme"))
-    {
+    if 
(!xPropertySet->getPropertySetInfo()->hasPropertyByName("CharColorThemeReference"))
         return false;
-    }
 
-    sal_Int32 nCharColorTheme = -1;
-    xPropertySet->getPropertyValue("CharColorTheme") >>= nCharColorTheme;
-    if (nCharColorTheme < 0 || nCharColorTheme > 11)
-    {
+    uno::Reference<util::XThemeColor> xThemeColor;
+    xPropertySet->getPropertyValue("CharColorThemeReference") >>= xThemeColor;
+    if (!xThemeColor.is())
         return false;
-    }
-
-    const char* pColorName = g_aPredefinedClrNames[nCharColorTheme];
 
-    sal_Int32 nCharColorTintOrShade{};
-    xPropertySet->getPropertyValue("CharColorTintOrShade") >>= 
nCharColorTintOrShade;
-    if (nCharColorTintOrShade != 0)
-    {
+    model::ThemeColor aThemeColor;
+    model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+    if (aThemeColor.getType() == model::ThemeColorType::Unknown)
         return false;
-    }
-
+    const char* pColorName = 
g_aPredefinedClrNames[sal_Int16(aThemeColor.getType())];
     mpFS->startElementNS(XML_a, XML_solidFill);
     mpFS->startElementNS(XML_a, XML_schemeClr, XML_val, pColorName);
-
-    sal_Int32 nCharColorLumMod{};
-    xPropertySet->getPropertyValue("CharColorLumMod") >>= nCharColorLumMod;
-    if (nCharColorLumMod != 10000)
+    for (auto const& rTransform : aThemeColor.getTransformations())
     {
-        mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, 
OString::number(nCharColorLumMod * 10));
-    }
-
-    sal_Int32 nCharColorLumOff{};
-    xPropertySet->getPropertyValue("CharColorLumOff") >>= nCharColorLumOff;
-    if (nCharColorLumOff != 0)
-    {
-        mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, 
OString::number(nCharColorLumOff * 10));
+        switch (rTransform.meType)
+        {
+            case model::TransformationType::LumMod:
+                mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, 
OString::number(rTransform.mnValue * 10));
+                break;
+            case model::TransformationType::LumOff:
+                mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, 
OString::number(rTransform.mnValue * 10));
+                break;
+            case model::TransformationType::Tint:
+                mpFS->singleElementNS(XML_a, XML_tint, XML_val, 
OString::number(rTransform.mnValue * 10));
+                break;
+            case model::TransformationType::Shade:
+                mpFS->singleElementNS(XML_a, XML_shade, XML_val, 
OString::number(rTransform.mnValue * 10));
+                break;
+            default:
+                break;
+        }
     }
-
     mpFS->endElementNS(XML_a, XML_schemeClr);
     mpFS->endElementNS(XML_a, XML_solidFill);
 
@@ -589,35 +587,34 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 
 bool DrawingML::WriteFillColor(const uno::Reference<beans::XPropertySet>& 
xPropertySet)
 {
-    if 
(!xPropertySet->getPropertySetInfo()->hasPropertyByName("FillColorTheme"))
-    {
+    if 
(!xPropertySet->getPropertySetInfo()->hasPropertyByName("FillColorThemeReference"))
         return false;
-    }
 
-    sal_Int32 nFillColorTheme = -1;
-    xPropertySet->getPropertyValue("FillColorTheme") >>= nFillColorTheme;
-    if (nFillColorTheme < 0 || nFillColorTheme > 11)
-    {
+    uno::Reference<util::XThemeColor> xThemeColor;
+    xPropertySet->getPropertyValue("FillColorThemeReference") >>= xThemeColor;
+    if (!xThemeColor.is())
         return false;
-    }
-
-    const char* pColorName = g_aPredefinedClrNames[nFillColorTheme];
 
+    model::ThemeColor aThemeColor;
+    model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+    if (aThemeColor.getType() == model::ThemeColorType::Unknown)
+        return false;
+    const char* pColorName = 
g_aPredefinedClrNames[sal_Int16(aThemeColor.getType())];
     mpFS->startElementNS(XML_a, XML_solidFill);
     mpFS->startElementNS(XML_a, XML_schemeClr, XML_val, pColorName);
-
-    sal_Int32 nFillColorLumMod{};
-    xPropertySet->getPropertyValue("FillColorLumMod") >>= nFillColorLumMod;
-    if (nFillColorLumMod != 10000)
+    for (auto const& rTransform : aThemeColor.getTransformations())
     {
-        mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, 
OString::number(nFillColorLumMod * 10));
-    }
-
-    sal_Int32 nFillColorLumOff{};
-    xPropertySet->getPropertyValue("FillColorLumOff") >>= nFillColorLumOff;
-    if (nFillColorLumOff != 0)
-    {
-        mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, 
OString::number(nFillColorLumOff * 10));
+        switch (rTransform.meType)
+        {
+            case model::TransformationType::LumMod:
+                mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, 
OString::number(rTransform.mnValue * 10));
+                break;
+            case model::TransformationType::LumOff:
+                mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, 
OString::number(rTransform.mnValue * 10));
+                break;
+            default:
+                break;
+        }
     }
 
     mpFS->endElementNS(XML_a, XML_schemeClr);
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 5df793846a50..439ecc9cd8a0 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -53,6 +53,7 @@ Change
 CharBackColor
 CharCaseMap
 CharColor
+CharColorThemeReference
 CharContoured
 CharColorTheme
 CharColorTintOrShade
@@ -176,6 +177,7 @@ FillColor
 FillColorTheme
 FillColorLumMod
 FillColorLumOff
+FillColorThemeReference
 FillGradient
 FillGradientName
 FillHatch
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 13f072cf2488..bcd78977890b 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -43,6 +43,7 @@
 #include <svl/stritem.hxx>
 #include <undo/undomanager.hxx>
 #include <vcl/scheduler.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 
@@ -1021,19 +1022,20 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testCharColorTheme)
         xShapeParaAccess->createEnumeration()->nextElement(), uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> 
xPortion(xPara->createEnumeration()->nextElement(),
                                                  uno::UNO_QUERY);
-    sal_Int16 nCharColorTheme{};
-    xPortion->getPropertyValue("CharColorTheme") >>= nCharColorTheme;
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 4
-    // - Actual  : -1
-    // i.e. the theme index (accent1) was not set.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nCharColorTheme);
-    sal_Int16 nCharColorLumMod{};
-    xPortion->getPropertyValue("CharColorLumMod") >>= nCharColorLumMod;
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2000), nCharColorLumMod);
-    sal_Int16 nCharColorLumOff{};
-    xPortion->getPropertyValue("CharColorLumOff") >>= nCharColorLumOff;
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(8000), nCharColorLumOff);
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xPortion->getPropertyValue("CharColorThemeReference") 
>>= xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod,
+                             aThemeColor.getTransformations()[0].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(2000), 
aThemeColor.getTransformations()[0].mnValue);
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff,
+                             aThemeColor.getTransformations()[1].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), 
aThemeColor.getTransformations()[1].mnValue);
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorTheme)
@@ -1060,25 +1062,20 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testFillColorTheme)
     Scheduler::ProcessEventsToIdle();
 
     // Then make sure the theme index is not lost when the sidebar sets it:
-    sal_Int16 nFillColorTheme{};
-    xShape->getPropertyValue("FillColorTheme") >>= nFillColorTheme;
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 4
-    // - Actual  : -1
-    // i.e. the theme index was lost during the dispatch of the command.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nFillColorTheme);
-
-    // Then also verify the effects:
-    sal_Int16 nFillColorLumMod = 10000;
-    xShape->getPropertyValue("FillColorLumMod") >>= nFillColorLumMod;
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 4000
-    // - Actual  : 10000
-    // i.e. the theme index was set, but not the effects.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4000), nFillColorLumMod);
-    sal_Int16 nFillColorLumOff = 0;
-    xShape->getPropertyValue("FillColorLumOff") >>= nFillColorLumOff;
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(6000), nFillColorLumOff);
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xShape->getPropertyValue("FillColorThemeReference") >>= 
xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod,
+                             aThemeColor.getTransformations()[0].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), 
aThemeColor.getTransformations()[0].mnValue);
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff,
+                             aThemeColor.getTransformations()[1].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), 
aThemeColor.getTransformations()[1].mnValue);
+    }
 }
 
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testFillColorNoColor)
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index b12e280f231f..9575169356c4 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -1391,6 +1391,15 @@ PropertyState SAL_CALL SdStyleSheet::getPropertyState( 
const OUString& PropertyN
                         eState = PropertyState_DEFAULT_VALUE;
                     }
                 }
+                else if (pEntry->nMemberId == MID_COLOR_THEME_REFERENCE)
+                {
+                    const XFillColorItem* pColor = 
rStyleSet.GetItem<XFillColorItem>(pEntry->nWID);
+                    if (pColor->GetThemeColor().getType() == 
model::ThemeColorType::Unknown)
+                    {
+                        eState = PropertyState_DEFAULT_VALUE;
+                    }
+                }
+                break;
                 break;
             }
         }
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index e2b356529ca5..3a4aff375fc7 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -13,6 +13,7 @@
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
 #include <com/sun/star/text/XTextRange.hpp>
+#include <docmodel/uno/UnoThemeColor.hxx>
 
 using namespace ::com::sun::star;
 
@@ -71,28 +72,34 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
     uno::Reference<beans::XPropertySet> 
xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY);
     // Blue.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x4472c4), 
GetShapeFillColor(xShape4));
-    // The theme index of this filled shape is set by the PPTX import:
-    sal_Int16 nColorTheme = -1;
-    xShape4->getPropertyValue("FillColorTheme") >>= nColorTheme;
-    // 4 means accent1, this was -1 without the PPTX import bit in place.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nColorTheme);
+
+    // The theme color of this filled shape is set by the PPTX import:
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xShape4->getPropertyValue("FillColorThemeReference") 
>>= xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+    }
     uno::Reference<beans::XPropertySet> 
xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY);
     // Blue, lighter.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xb4c7e7), 
GetShapeFillColor(xShape5));
     // The theme index, and effects (lum mod, lum off) are set by the PPTX 
import:
-    nColorTheme = -1;
-    xShape5->getPropertyValue("FillColorTheme") >>= nColorTheme;
-    // 4 means accent1, this was -1 without the PPTX import bit in place.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nColorTheme);
-    sal_Int16 nColorLumMod = 10000;
-    xShape5->getPropertyValue("FillColorLumMod") >>= nColorLumMod;
-    // This was 10000 without the PPTX import bit in place.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4000), nColorLumMod);
-    sal_Int16 nColorLumOff = 0;
-    xShape5->getPropertyValue("FillColorLumOff") >>= nColorLumOff;
-    // This was 0 without the PPTX import bit in place.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(6000), nColorLumOff);
-
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xShape5->getPropertyValue("FillColorThemeReference") 
>>= xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod,
+                             aThemeColor.getTransformations()[0].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), 
aThemeColor.getTransformations()[0].mnValue);
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff,
+                             aThemeColor.getTransformations()[1].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), 
aThemeColor.getTransformations()[1].mnValue);
+    }
     // When changing the master slide of slide 1 to use the theme of the 
second master slide:
     uno::Reference<drawing::XMasterPageTarget> xDrawPage2(
         xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY);
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index 22b304e00579..6cd68a0c8172 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -19,6 +19,7 @@
 #include <vcl/graphicfilter.hxx>
 #include <svx/xoutbmp.hxx>
 #include <vcl/filter/PDFiumLibrary.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 
 using namespace com::sun::star;
 
@@ -100,31 +101,31 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, 
testFillColorThemeUnoApi)
     uno::Reference<drawing::XDrawPage> 
xPage(xPagesSupplier->getDrawPages()->getByIndex(0),
                                              uno::UNO_QUERY);
     uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), 
uno::UNO_QUERY);
-    sal_Int16 nExpected = 4; // Accent 1
-    xShape->setPropertyValue("FillColorTheme", uno::Any(nExpected));
-
-    // 80% lighter
-    sal_Int16 nExpectedLumMod = 2000;
-    xShape->setPropertyValue("FillColorLumMod", uno::Any(nExpectedLumMod));
-    sal_Int16 nExpectedLumOff = 8000;
-    xShape->setPropertyValue("FillColorLumOff", uno::Any(nExpectedLumOff));
+    // Set theme color
+    {
+        model::ThemeColor aThemeColor;
+        aThemeColor.setType(model::ThemeColorType::Accent1);
+        aThemeColor.addTransformation({ model::TransformationType::LumMod, 
2000 });
+        aThemeColor.addTransformation({ model::TransformationType::LumOff, 
8000 });
+        xShape->setPropertyValue("FillColorThemeReference",
+                                 
uno::Any(model::theme::createXThemeColor(aThemeColor)));
+    }
 
     // Then make sure the value we read back is the expected one:
-    sal_Int16 nActual = -1;
-    xShape->getPropertyValue("FillColorTheme") >>= nActual;
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 4
-    // - Actual  : -1
-    // i.e. setting the value was broken.
-    CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
-    xShape->getPropertyValue("FillColorLumMod") >>= nActual;
-    // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 2000
-    // - Actual  : 8000
-    // i.e. FillColorLumOff was set as FillColor, then getting FillColorLumMod 
returned FillColor.
-    CPPUNIT_ASSERT_EQUAL(nExpectedLumMod, nActual);
-    xShape->getPropertyValue("FillColorLumOff") >>= nActual;
-    CPPUNIT_ASSERT_EQUAL(nExpectedLumOff, nActual);
+    {
+        uno::Reference<util::XThemeColor> xThemeColor;
+        CPPUNIT_ASSERT(xShape->getPropertyValue("FillColorThemeReference") >>= 
xThemeColor);
+        CPPUNIT_ASSERT(xThemeColor.is());
+        model::ThemeColor aThemeColor;
+        model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+        CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod,
+                             aThemeColor.getTransformations()[0].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(2000), 
aThemeColor.getTransformations()[0].mnValue);
+        CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff,
+                             aThemeColor.getTransformations()[1].meType);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), 
aThemeColor.getTransformations()[1].mnValue);
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 00ffdae3b031..b8a4fa08e157 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -26,6 +26,7 @@
 #include <svx/svdpage.hxx>
 #include <svx/svditer.hxx>
 #include <editeng/unoprnms.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
 #include <o3tl/enumrange.hxx>
 #include <utility>
 
@@ -37,57 +38,44 @@ namespace
 void UpdateTextPortionColorSet(const uno::Reference<beans::XPropertySet>& 
xPortion,
                                const svx::ColorSet& rColorSet)
 {
-    sal_Int16 nCharColorTheme = -1;
-    xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_THEME) >>= 
nCharColorTheme;
-    model::ThemeColorType eColorThemeType = 
model::convertToThemeColorType(nCharColorTheme);
+    if 
(!xPortion->getPropertySetInfo()->hasPropertyByName(UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE))
+        return;
 
-    if (eColorThemeType == model::ThemeColorType::Unknown)
+    uno::Reference<util::XThemeColor> xThemeColor;
+    xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE) >>= 
xThemeColor;
+    if (!xThemeColor.is())
         return;
 
-    Color aColor = rColorSet.getColor(eColorThemeType);
-    sal_Int32 nCharColorLumMod{};
-    xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_LUM_MOD) >>= 
nCharColorLumMod;
-    sal_Int32 nCharColorLumOff{};
-    xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_LUM_OFF) >>= 
nCharColorLumOff;
-    if (nCharColorLumMod != 10000 || nCharColorLumOff != 0)
-    {
-        aColor.ApplyLumModOff(nCharColorLumMod, nCharColorLumOff);
-    }
+    model::ThemeColor aThemeColor;
+    model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
 
-    sal_Int32 nCharColorTintOrShade{};
-    xPortion->getPropertyValue(UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE) >>= 
nCharColorTintOrShade;
-    if (nCharColorTintOrShade != 0)
-    {
-        aColor.ApplyTintOrShade(nCharColorTintOrShade);
-    }
+    if (aThemeColor.getType() == model::ThemeColorType::Unknown)
+        return;
+
+    Color aColor = rColorSet.getColor(aThemeColor.getType());
+    aColor = aThemeColor.applyTransformations(aColor);
 
-    xPortion->setPropertyValue(UNO_NAME_EDIT_CHAR_COLOR,
-                               uno::Any(static_cast<sal_Int32>(aColor)));
+    xPortion->setPropertyValue(UNO_NAME_EDIT_CHAR_COLOR, 
uno::Any(static_cast<sal_Int32>(aColor)));
 }
 
 void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, 
const svx::ColorSet& rColorSet)
 {
-    if 
(!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME))
-    {
+    if 
(!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME_REFERENCE))
         return;
-    }
 
-    sal_Int16 nFillColorTheme = -1;
-    xShape->getPropertyValue(UNO_NAME_FILLCOLOR_THEME) >>= nFillColorTheme;
-    model::ThemeColorType eColorThemeType = 
model::convertToThemeColorType(nFillColorTheme);
-    if (eColorThemeType == model::ThemeColorType::Unknown)
+    uno::Reference<util::XThemeColor> xThemeColor;
+    xShape->getPropertyValue(UNO_NAME_FILLCOLOR_THEME_REFERENCE) >>= 
xThemeColor;
+    if (!xThemeColor.is())
         return;
 
-    Color aColor = rColorSet.getColor(eColorThemeType);
-    sal_Int32 nFillColorLumMod{};
-    xShape->getPropertyValue(UNO_NAME_FILLCOLOR_LUM_MOD) >>= nFillColorLumMod;
-    sal_Int32 nFillColorLumOff{};
-    xShape->getPropertyValue(UNO_NAME_FILLCOLOR_LUM_OFF) >>= nFillColorLumOff;
-    if (nFillColorLumMod != 10000 || nFillColorLumOff != 0)
-    {
-        aColor.ApplyLumModOff(nFillColorLumMod, nFillColorLumOff);
-    }
+    model::ThemeColor aThemeColor;
+    model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+
+    if (aThemeColor.getType() == model::ThemeColorType::Unknown)
+        return;
 
+    Color aColor = rColorSet.getColor(aThemeColor.getType());
+    aColor = aThemeColor.applyTransformations(aColor);
     xShape->setPropertyValue(UNO_NAME_FILLCOLOR, 
uno::Any(static_cast<sal_Int32>(aColor)));
 }
 
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 4d200239c2e0..b8ca46ce9921 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -1487,6 +1487,15 @@ PropertyState SAL_CALL Cell::getPropertyState( const 
OUString& PropertyName )
                             eState = PropertyState_DEFAULT_VALUE;
                         }
                     }
+                    else if (pMap->nMemberId == MID_COLOR_THEME_REFERENCE)
+                    {
+                        const XFillColorItem* pColor = 
rSet.GetItem<XFillColorItem>(pMap->nWID);
+                        if (pColor->GetThemeColor().getType() == 
model::ThemeColorType::Unknown)
+                        {
+                            eState = PropertyState_DEFAULT_VALUE;
+                        }
+                    }
+                    break;
                 }
             }
         }
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 7eaa1053f9e5..139e9d3ac48e 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -566,6 +566,7 @@ static o3tl::span<SfxItemPropertyMapEntry const> 
ImplGetSvxControlShapePropertyM
         { UNO_NAME_EDIT_CHAR_COLOR,           0,  
cppu::UnoType<sal_Int32>::get(),        0, MID_COLOR_RGB },
         { UNO_NAME_EDIT_CHAR_COLOR_THEME,     0,  
cppu::UnoType<sal_Int16>::get(),        0, MID_COLOR_THEME_INDEX },
         { UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, 0, 
cppu::UnoType<sal_Int16>::get(),     0, MID_COLOR_TINT_OR_SHADE },
+        { UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE, 0,  
cppu::UnoType<css::uno::XInterface>::get(), 0, MID_COLOR_THEME_REFERENCE },
         { u"CharBackColor",                    0,  
cppu::UnoType<sal_Int32>::get(),        0, 0 },
         { u"CharBackTransparent",              0,  cppu::UnoType<bool>::get(), 
            0, 0 },
         { u"CharRelief",                       0,  
cppu::UnoType<sal_Int16>::get(),        0, 0 },
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index e2b11927e59a..e4ff92bc3bed 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -608,6 +608,7 @@ const SvxShapeControlPropertyMapping[] =
     { "CharCaseMap", "CharCaseMap" },
     { "CharColorTheme", "CharColorTheme" },
     { "CharColorTintOrShade", "CharColorTintOrShade" },
+    { UNO_NAME_EDIT_CHAR_COLOR_THEME_REFERENCE, "CharColorThemeReference" },
 };
 
 namespace
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 9692df8c130d..794df51242f1 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1990,6 +1990,15 @@ beans::PropertyState SvxShape::_getPropertyState( const 
OUString& PropertyName )
                         eState = beans::PropertyState_DEFAULT_VALUE;
                     }
                 }
+                else if (pMap->nMemberId == MID_COLOR_THEME_REFERENCE)
+                {
+                    const XFillColorItem* pColor = 
rSet.GetItem<XFillColorItem>(pMap->nWID);
+                    if (pColor->GetThemeColor().getType() == 
model::ThemeColorType::Unknown)
+                    {
+                        eState = beans::PropertyState_DEFAULT_VALUE;
+                    }
+                }
+                break;
                 break;
             }
         }
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 38a9431a47a6..4f402d02c48a 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -36,6 +36,7 @@
 #include <o3tl/any.hxx>
 #include <svl/itempool.hxx>
 #include <editeng/memberids.h>
+#include <docmodel/uno/UnoThemeColor.hxx>
 #include <tools/mapunit.hxx>
 #include <tools/UnitConversion.hxx>
 #include <osl/diagnose.h>
@@ -1948,6 +1949,12 @@ bool XFillColorItem::QueryValue( css::uno::Any& rVal, 
sal_uInt8 nMemberId ) cons
             rVal <<= nValue;
             break;
         }
+        case MID_COLOR_THEME_REFERENCE:
+        {
+            auto xThemeColor = 
model::theme::createXThemeColor(GetThemeColor());
+            rVal <<= xThemeColor;
+            break;
+        }
         default:
         {
             rVal <<= GetColorValue().GetRGBColor();
@@ -1989,6 +1996,14 @@ bool XFillColorItem::PutValue( const css::uno::Any& 
rVal, sal_uInt8 nMemberId )
             
GetThemeColor().addTransformation({model::TransformationType::LumOff, nLumOff});
         }
         break;
+        case MID_COLOR_THEME_REFERENCE:
+        {
+            css::uno::Reference<css::util::XThemeColor> xThemeColor;
+            if (!(rVal >>= xThemeColor))
+                return false;
+            model::theme::setFromXThemeColor(GetThemeColor(), xThemeColor);
+        }
+        break;
         default:
         {
             Color nValue;
diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx
index a6591c6b77db..43cc2a669fe2 100644
--- a/sw/qa/core/theme/ThemeTest.cxx
+++ b/sw/qa/core/theme/ThemeTest.cxx
@@ -16,6 +16,9 @@
 #include <drawdoc.hxx>
 #include <IDocumentDrawModelAccess.hxx>
 #include <svx/svdpage.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
+
+using namespace css;
 
 class SwCoreThemeTest : public SwModelTestBase
 {
@@ -32,7 +35,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, 
testThemeColorInHeading)
     SwDoc* pDoc = getSwDoc();
     CPPUNIT_ASSERT(pDoc);
 
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(4), getProperty<sal_Int16>(getParagraph(1), 
"CharColorTheme"));
+    auto xThemeColor = 
getProperty<uno::Reference<util::XThemeColor>>(getParagraph(1),
+                                                                      
"CharColorThemeReference");
+    model::ThemeColor aThemeColor;
+    model::theme::setFromXThemeColor(aThemeColor, xThemeColor);
+    CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, 
aThemeColor.getType());
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExists)
diff --git a/sw/source/core/unocore/unomap.cxx 
b/sw/source/core/unocore/unomap.cxx
index ffff63747b61..0e036bff1884 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1440,6 +1440,7 @@ o3tl::span<const SfxItemPropertyMapEntry> 
SwUnoPropertyMapProvider::GetPropertyM
                     { 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_COLOR_THEME_REFERENCE,    
RES_CHRATR_COLOR, cppu::UnoType<css::uno::XInterface>::get(), PROPERTY_NONE, 
MID_COLOR_THEME_REFERENCE },
                     // 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 1ecf798715e6..efaa22dead5a 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -181,6 +181,7 @@ o3tl::span<const SfxItemPropertyMapEntry> 
SwUnoPropertyMapProvider::GetCharStyle
         { 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_COLOR_THEME_REFERENCE,    RES_CHRATR_COLOR, 
cppu::UnoType<css::uno::XInterface>::get(), PROPERTY_NONE, 
MID_COLOR_THEME_REFERENCE },
         { 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},
@@ -245,6 +246,7 @@ o3tl::span<const SfxItemPropertyMapEntry>  
SwUnoPropertyMapProvider::GetAutoChar
         { 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_COLOR_THEME_REFERENCE,    RES_CHRATR_COLOR, 
cppu::UnoType<css::uno::XInterface>::get(), PROPERTY_NONE, 
MID_COLOR_THEME_REFERENCE },
         { 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 de1a6aa1a2d6..583babbf2e3f 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -127,6 +127,7 @@
         { 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_COLOR_THEME_REFERENCE,          RES_CHRATR_COLOR,      
        cppu::UnoType<css::uno::XInterface>::get(),     
PropertyAttribute::MAYBEVOID, MID_COLOR_THEME_REFERENCE }, \
         { 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                        }, \
@@ -373,6 +374,7 @@
                     { 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_COLOR_THEME_REFERENCE, RES_CHRATR_COLOR, 
cppu::UnoType<css::uno::XInterface>::get(), PropertyAttribute::MAYBEVOID, 
MID_COLOR_THEME_REFERENCE }, \
                     { 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},\
@@ -485,6 +487,7 @@
                     { 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_COLOR_THEME_REFERENCE, RES_CHRATR_COLOR, 
cppu::UnoType<css::uno::XInterface>::get(), PropertyAttribute::MAYBEVOID, 
MID_COLOR_THEME_REFERENCE }, \
                     { 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/writerfilter/Library_writerfilter.mk 
b/writerfilter/Library_writerfilter.mk
index dafc17c959e1..3e0662b4fb35 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_libraries,writerfilter,\
     comphelper \
     cppu \
     cppuhelper \
+    docmodel \
     editeng \
     i18nlangtag \
     i18nutil \
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f6563b6d2413..7f6329f803e6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -69,6 +69,7 @@
 #include <com/sun/star/text/FontEmphasis.hpp>
 #include <com/sun/star/awt/CharSet.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XThemeColor.hpp>
 #include <comphelper/types.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/sequence.hxx>
@@ -79,6 +80,7 @@
 #include <unotools/mediadescriptor.hxx>
 
 #include "TextEffectsHandler.hxx"
+#include "ThemeColorHandler.hxx"
 #include "CellColorHandler.hxx"
 #include "SectionColumnHandler.hxx"
 #include "GraphicHelpers.hxx"
@@ -338,11 +340,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
             if (m_pImpl->GetTopContext())
                 handleUnderlineType(nIntValue, m_pImpl->GetTopContext());
             break;
-        case NS_ooxml::LN_CT_Color_val:
-            if (m_pImpl->GetTopContext())
-                m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::Any( 
nIntValue ) );
-            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", 
msfilter::util::ConvertColorOU(Color(ColorTransparency,nIntValue)));
-            break;
         case NS_ooxml::LN_CT_Underline_color:
             if (m_pImpl->GetTopContext())
             {
@@ -1030,31 +1027,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         case NS_ooxml::LN_CT_FtnEdnRef_id:
             // 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:
         {
             //see SwWW8ImplReader::SetDocumentGrid
@@ -2168,8 +2140,70 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
             }
         }
         break;
-    case NS_ooxml::LN_CT_PPr_sectPr:
     case NS_ooxml::LN_EG_RPrBase_color:
+    {
+        writerfilter::Reference<Properties>::Pointer_t pProperties = 
rSprm.getProps();
+        if (pProperties)
+        {
+            auto pThemeColorHandler = std::make_shared<ThemeColorHandler>();
+            pProperties->resolve(*pThemeColorHandler);
+
+            uno::Any 
aThemeColorName(TDefTableHandler::getThemeColorTypeString(pThemeColorHandler->mnIndex));
+            uno::Any 
aThemeColorTint(OUString::number(pThemeColorHandler->mnTint, 16));
+            uno::Any 
aThemeColorShade(OUString::number(pThemeColorHandler->mnShade, 16));
+
+            if (m_pImpl->GetTopContext())
+            {
+                m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, 
uno::Any(pThemeColorHandler->mnColor));
+
+                auto eType = 
TDefTableHandler::getThemeColorTypeIndex(pThemeColorHandler->mnIndex);
+                if (eType != model::ThemeColorType::Unknown)
+                {
+                    model::ThemeColor aThemeColor;
+                    aThemeColor.setType(eType);
+
+                    if (pThemeColorHandler->mnTint > 0 )
+                    {
+                        sal_Int16 nTint = sal_Int16((256 - 
pThemeColorHandler->mnTint) * 10000 / 256);
+                        
aThemeColor.addTransformation({model::TransformationType::Tint, nTint});
+                    }
+                    if (pThemeColorHandler->mnShade > 0)
+                    {
+                        sal_Int16 nShade = sal_Int16((256 - 
pThemeColorHandler->mnShade) * 10000 / 256);
+                        
aThemeColor.addTransformation({model::TransformationType::Shade, nShade});
+                    }
+
+                    auto xThemeColor = 
model::theme::createXThemeColor(aThemeColor);
+                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_THEME_REFERENCE, 
uno::Any(xThemeColor));
+                }
+
+                uno::Any 
aColorAny(msfilter::util::ConvertColorOU(Color(ColorTransparency, 
pThemeColorHandler->mnColor)));
+                
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_ORIGINAL_COLOR, aColorAny, 
true, CHAR_GRAB_BAG);
+
+                if (pThemeColorHandler->mnIndex >= 0)
+                    m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR, 
aThemeColorName, true, CHAR_GRAB_BAG);
+
+                if (pThemeColorHandler->mnTint > 0)
+                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_TINT, aThemeColorTint, 
true, CHAR_GRAB_BAG);
+
+                if (pThemeColorHandler->mnShade > 0)
+                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_SHADE, aThemeColorShade, 
true, CHAR_GRAB_BAG);
+            }
+            {
+                if (pThemeColorHandler->mnIndex >= 0)
+                {
+                    m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"themeColor", aThemeColorName.get<OUString>());
+                    if (pThemeColorHandler->mnTint > 0)
+                        m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"themeTint", aThemeColorTint.get<OUString>());
+                    if (pThemeColorHandler->mnShade > 0)
+                        m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"themeShade", aThemeColorShade.get<OUString>());
+                }
+                m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "color", 
m_pImpl->m_aSubInteropGrabBag);
+            }
+        }
+    }
+    break;
+    case NS_ooxml::LN_CT_PPr_sectPr:
     case NS_ooxml::LN_EG_RPrBase_rFonts:
     case NS_ooxml::LN_EG_RPrBase_eastAsianLayout:
     case NS_ooxml::LN_EG_RPrBase_u:
@@ -2183,12 +2217,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
     case NS_ooxml::LN_CT_PPr_rPr:
     case NS_ooxml::LN_CT_PPrBase_numPr:
     {
-        bool bTempGrabBag = !m_pImpl->isInteropGrabBagEnabled();
         if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
             m_pImpl->SetParaSectpr(true);
-        else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color && bTempGrabBag)
-            // if DomainMapper grab bag is not enabled, enable it temporarily
-            m_pImpl->enableInteropGrabBag("TempColorPropsGrabBag");
         resolveSprmProps(*this, rSprm);
         if (nSprmId == NS_ooxml::LN_CT_PPrBase_spacing)
             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "spacing", 
m_pImpl->m_aSubInteropGrabBag);
@@ -2196,25 +2226,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "rFonts", 
m_pImpl->m_aSubInteropGrabBag);
         else if (nSprmId == NS_ooxml::LN_EG_RPrBase_lang)
             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "lang", 
m_pImpl->m_aSubInteropGrabBag);
-        else if (nSprmId == NS_ooxml::LN_EG_RPrBase_color)
-        {
-            for (const auto& rItem : m_pImpl->m_aSubInteropGrabBag)
-            {
-                if (rItem.Name == "val")
-                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_ORIGINAL_COLOR, rItem.Value, 
true, CHAR_GRAB_BAG);
-                else if (rItem.Name == "themeColor")
-                    m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR, 
rItem.Value, true, CHAR_GRAB_BAG);
-                else if (rItem.Name == "themeShade")
-                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_SHADE, rItem.Value, 
true, CHAR_GRAB_BAG);
-                else if (rItem.Name == "themeTint")
-                    
m_pImpl->GetTopContext()->Insert(PROP_CHAR_THEME_COLOR_TINT, rItem.Value, true, 
CHAR_GRAB_BAG);
-            }
-            if (bTempGrabBag)
-                //disable and clear DomainMapper grab bag if it wasn't enabled 
before
-                m_pImpl->disableInteropGrabBag();
-
-            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "color", 
m_pImpl->m_aSubInteropGrabBag);
-        }
         else if (nSprmId == NS_ooxml::LN_CT_PPrBase_ind)
             m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ind", 
m_pImpl->m_aSubInteropGrabBag);
     }
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index 3f966d41f18e..98525149fcf9 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -32,8 +32,7 @@ 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_COLOR_THEME_REFERENCE: sName = 
"CharColorThemeReference"; 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 bddcbe56447a..52b989bf41c9 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -54,8 +54,7 @@ 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_COLOR_THEME_REFERENCE
         ,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 2dea73e65020..4d279ac4bc12 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -269,48 +269,48 @@ OUString 
TDefTableHandler::getThemeColorTypeString(sal_Int32 nType)
     return OUString();
 }
 
-sal_Int16 TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
+model::ThemeColorType TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
 {
     switch (nType)
     {
         case NS_ooxml::LN_Value_St_ThemeColor_dark1:
-                return 0;
+                return model::ThemeColorType::Dark1;
         case NS_ooxml::LN_Value_St_ThemeColor_light1:
-                return 1;
+                return model::ThemeColorType::Light1;
         case NS_ooxml::LN_Value_St_ThemeColor_dark2:
-                return 2;
+                return model::ThemeColorType::Dark2;
         case NS_ooxml::LN_Value_St_ThemeColor_light2:
-                return 3;
+                return model::ThemeColorType::Light2;
         case NS_ooxml::LN_Value_St_ThemeColor_accent1:
-                return 4;
+                return model::ThemeColorType::Accent1;
         case NS_ooxml::LN_Value_St_ThemeColor_accent2:
-                return 5;
+                return model::ThemeColorType::Accent2;
         case NS_ooxml::LN_Value_St_ThemeColor_accent3:
-                return 6;
+                return model::ThemeColorType::Accent3;
         case NS_ooxml::LN_Value_St_ThemeColor_accent4:
-                return 7;
+                return model::ThemeColorType::Accent4;
         case NS_ooxml::LN_Value_St_ThemeColor_accent5:
-                return 8;
+                return model::ThemeColorType::Accent5;
         case NS_ooxml::LN_Value_St_ThemeColor_accent6:
-                return 9;
+                return model::ThemeColorType::Accent6;
         case NS_ooxml::LN_Value_St_ThemeColor_hyperlink:
-                return 10;
+                return model::ThemeColorType::Hyperlink;
         case NS_ooxml::LN_Value_St_ThemeColor_followedHyperlink:
-                return 11;
+                return model::ThemeColorType::FollowedHyperlink;
         case NS_ooxml::LN_Value_St_ThemeColor_none:
-                return -1;
+                return model::ThemeColorType::Unknown;
         case NS_ooxml::LN_Value_St_ThemeColor_background1:
-                return 0;
+                return model::ThemeColorType::Dark1;
         case NS_ooxml::LN_Value_St_ThemeColor_text1:
-                return 1;
+                return model::ThemeColorType::Light1;
         case NS_ooxml::LN_Value_St_ThemeColor_background2:
-                return 2;
+                return model::ThemeColorType::Dark2;
         case NS_ooxml::LN_Value_St_ThemeColor_text2:
-                return 3;
+                return model::ThemeColorType::Light2;
         default:
                 break;
     }
-    return -1;
+    return model::ThemeColorType::Unknown;
 }
 
 void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
diff --git a/writerfilter/source/dmapper/TDefTableHandler.hxx 
b/writerfilter/source/dmapper/TDefTableHandler.hxx
index f9ae47eb5390..c997996a4f73 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.hxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.hxx
@@ -20,6 +20,8 @@
 
 #include "LoggedResources.hxx"
 #include <vector>
+#include <docmodel/theme/ThemeColorType.hxx>
+
 namespace com::sun::star{
     namespace table {
         struct BorderLine2;
@@ -66,7 +68,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);
+    static model::ThemeColorType getThemeColorTypeIndex(sal_Int32 nType);
 };
 }
 
diff --git a/writerfilter/source/dmapper/ThemeColorHandler.hxx 
b/writerfilter/source/dmapper/ThemeColorHandler.hxx
new file mode 100644
index 000000000000..88ae0cfaf418
--- /dev/null
+++ b/writerfilter/source/dmapper/ThemeColorHandler.hxx
@@ -0,0 +1,68 @@
+/* -*- 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 "LoggedResources.hxx"
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include "PropertyIds.hxx"
+
+#include <oox/helper/grabbagstack.hxx>
+#include <docmodel/uno/UnoThemeColor.hxx>
+
+#include <memory>
+#include <optional>
+
+namespace writerfilter::dmapper
+{
+/// Class to process all text effects like glow, textOutline, ...
+class ThemeColorHandler : public LoggedProperties
+{
+public:
+    sal_Int32 mnColor = 0;
+    sal_Int32 mnIndex = -1;
+    sal_Int32 mnTint = 0;
+    sal_Int32 mnShade = 0;
+
+    explicit ThemeColorHandler()
+        : LoggedProperties("ThemeColorHandler")
+    {
+    }
+
+    virtual void lcl_attribute(Id aName, Value& rValue) override
+    {
+        sal_Int32 nIntValue = rValue.getInt();
+
+        switch (aName)
+        {
+            case NS_ooxml::LN_CT_Color_val:
+                mnColor = nIntValue;
+                break;
+            case NS_ooxml::LN_CT_Color_themeColor:
+                mnIndex = nIntValue;
+                break;
+
+            case NS_ooxml::LN_CT_Color_themeTint:
+                mnTint = nIntValue;
+                break;
+
+            case NS_ooxml::LN_CT_Color_themeShade:
+                mnShade = nIntValue;
+                break;
+        }
+    }
+
+    virtual void lcl_sprm(Sprm& /*sprm*/) override {}
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8402470ae0eb3a2040dab4121b9b0032618b7010
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Dec 28 09:43:46 2022 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Jan 20 07:13:13 2023 +0000

    introduce docmodel comp., model::ThemeColor, use it in SvxColorItem
    
    Added a new component docmodel, that has the document model types,
    which only depend on other basic components. This is needed so the
    types can be used in every relevant component - xmloff, oox, svx,
    editeng,...
    
    Introduces model::ThemeColor, which is a class used to store the
    theme color data, including transformations (svx::Transformation).
    For UNO use XThemeColor is added, and the implementation UnoThemeColor
    which wraps svx::ThemeColor, so it can be tranported around.
    
    Reactor all the code and tests to accomodate for this change.
    
    Change-Id: I7ce6752cdfaf5e4d3b8e4d90314afa469dd65cfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144847
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit bd0f526f2d3e1ffe43a74672485815768eee6e9e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145844
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/Repository.mk b/Repository.mk
index 56d8b2d28b84..a5055347d73a 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -395,6 +395,7 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
        deploymentmisc \
        $(if $(filter-out MACOSX WNT,$(OS)),desktopbe1) \
        $(call gb_Helper_optional,SCRIPTING,dlgprov) \
+       docmodel \
        drawinglayercore \
        drawinglayer \
        editeng \
diff --git a/RepositoryModule_build.mk b/RepositoryModule_build.mk
index 2f3a06edd12a..2059c1f2a5a9 100644
--- a/RepositoryModule_build.mk
+++ b/RepositoryModule_build.mk
@@ -63,6 +63,7 @@ $(eval $(call gb_Module_add_moduledirs,cross_toolset,\
                configmgr \
                connectivity \
                cppcanvas \
+               docmodel \
                drawinglayer \
                editeng \
                emfio \
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index c0bd27b1c260..2fbee39dc610 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -74,6 +74,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
        cui \
        desktop \
        $(call gb_Helper_optional,DICTIONARIES,dictionaries) \
+       docmodel\
        drawinglayer \
        editeng \
        embeddedobj \
diff --git a/bin/update_pch b/bin/update_pch
index 1cb5cb9979a6..63a39ce51b0b 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -73,6 +73,7 @@ DEFAULTS = \
     'desktop.deploymentgui'             : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), #   
5.7
     'desktop.deploymentmisc'            : ( 3, EXCLUDE, EXCLUDE, EXCLUDE), #   
3.4
     'desktop.sofficeapp'                : ( 6, EXCLUDE, INCLUDE, INCLUDE), #   
6.5
+    'docmodel.docmodel'                 : ( 3, EXCLUDE, EXCLUDE, INCLUDE), #   
3.8
     'drawinglayer.drawinglayer'         : ( 4, EXCLUDE, EXCLUDE, EXCLUDE), #   
7.4
     'editeng.editeng'                   : ( 5, EXCLUDE, INCLUDE, EXCLUDE), #  
13.0
     'forms.frm'                         : ( 2, EXCLUDE, EXCLUDE, EXCLUDE), #  
14.2
@@ -1191,8 +1192,8 @@ class TestMakefileParser(unittest.TestCase):
 
     def test_parse_multiline_eval(self):
         source = """$(eval $(call gb_Library_set_include,sal,\\
-       $$(INCLUDE) \\
-       -I$(SRCDIR)/sal/inc \\
+    $$(INCLUDE) \\
+    -I$(SRCDIR)/sal/inc \\
 ))
 """
         lines = source.split('\n')
@@ -1203,9 +1204,9 @@ class TestMakefileParser(unittest.TestCase):
 
     def test_parse_multiline_eval_with_if(self):
         source = """$(eval $(call gb_Library_add_defs,sal,\\
-       $(if $(filter $(OS),iOS), \\
-               -DNO_CHILD_PROCESSES \\
-       ) \\
+    $(if $(filter $(OS),iOS), \\
+        -DNO_CHILD_PROCESSES \\
+    ) \\
 ))
 """
         lines = source.split('\n')
@@ -1216,7 +1217,7 @@ class TestMakefileParser(unittest.TestCase):
 
     def test_parse_multiline_add_with_if(self):
         source = """$(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/unx/time \\
+    sal/osl/unx/time \\
         $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \\
 ))
 """
@@ -1230,11 +1231,11 @@ class TestMakefileParser(unittest.TestCase):
     def test_parse_if_else(self):
         source = """ifeq ($(OS),MACOSX)
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/mac/mac \\
+    sal/osl/mac/mac \\
 ))
 else
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/unx/uunxapi \\
+    sal/osl/unx/uunxapi \\
 ))
 endif
 """
@@ -1251,16 +1252,16 @@ endif
     def test_parse_nested_if(self):
         source = """ifeq ($(OS),MACOSX)
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/mac/mac \\
+    sal/osl/mac/mac \\
 ))
 else
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/unx/uunxapi \\
+    sal/osl/unx/uunxapi \\
 ))
 
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/textenc/context \\
+    sal/textenc/context \\
 ))
 endif
 endif
@@ -1280,16 +1281,16 @@ endif
     def test_parse_exclude_system(self):
         source = """ifeq ($(OS),MACOSX)
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/mac/mac \\
+    sal/osl/mac/mac \\
 ))
 else
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/unx/uunxapi \\
+    sal/osl/unx/uunxapi \\
 ))
 
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/textenc/context \\
+    sal/textenc/context \\
 ))
 endif
 endif
@@ -1306,7 +1307,7 @@ endif
     def test_parse_filter(self):
         source = """ifneq ($(filter $(OS),MACOSX iOS),)
 $(eval $(call gb_Library_add_exception_objects,sal,\\
-       sal/osl/unx/osxlocale \\
+    sal/osl/unx/osxlocale \\
 ))
 endif
 """
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 85f779cc964d..03a1577ee66b 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_libraries,cui,\
     comphelper \
     cppu \
     cppuhelper \
+    docmodel \
     drawinglayer \
     editeng \
     i18nlangtag \
diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx
index 6553c5874b1a..7b7688c74ad9 100644
--- a/cui/inc/pch/precompiled_cui.hxx
+++ b/cui/inc/pch/precompiled_cui.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-08-13 18:00:55 using:
+ Generated on 2023-01-10 23:29:57 using:
  ./bin/update_pch cui cui --cutoff=8 --exclude:system --include:module 
--exclude:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -53,6 +53,7 @@
 #include <string>
 #include <string_view>
 #include <type_traits>
+#include <typeinfo>
 #include <unordered_map>
 #include <unordered_set>
 #include <utility>
@@ -114,7 +115,6 @@
 #include <vcl/customweld.hxx>
 #include <vcl/devicecoordinate.hxx>
 #include <vcl/dllapi.h>
-#include <comphelper/errcode.hxx>
 #include <vcl/event.hxx>
 #include <vcl/fntstyle.hxx>
 #include <vcl/font.hxx>
@@ -125,6 +125,7 @@
 #include <vcl/image.hxx>
 #include <vcl/imap.hxx>
 #include <vcl/imapobj.hxx>
+#include <vcl/kernarray.hxx>
 #include <vcl/keycod.hxx>
 #include <vcl/keycodes.hxx>
 #include <vcl/mapmod.hxx>
@@ -177,6 +178,7 @@
 #include <basegfx/range/b2drange.hxx>
 #include <basegfx/range/b2drectangle.hxx>
 #include <basegfx/range/basicrange.hxx>
+#include <basegfx/tuple/Size2D.hxx>
 #include <basegfx/tuple/Tuple2D.hxx>
 #include <basegfx/tuple/Tuple3D.hxx>
 #include <basegfx/tuple/b2dtuple.hxx>
@@ -186,6 +188,7 @@
 #include <basegfx/vector/b2dsize.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <basegfx/vector/b2enums.hxx>
+#include <basegfx/vector/b2isize.hxx>
 #include <basegfx/vector/b2ivector.hxx>
 #include <basic/basicdllapi.h>
 #include <basic/sbxdef.hxx>
@@ -261,6 +264,8 @@
 #include <com/sun/star/util/XAccounting.hpp>
 #include <comphelper/compbase.hxx>
 #include <comphelper/comphelperdllapi.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <comphelper/errcode.hxx>
 #include <comphelper/interfacecontainer4.hxx>
 #include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
@@ -276,6 +281,7 @@
 #include <cppuhelper/queryinterface.hxx>
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/weakref.hxx>
+#include <docmodel/theme/ThemeColorType.hxx>
 #include <drawinglayer/drawinglayerdllapi.h>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
 #include <drawinglayer/primitive2d/CommonTypes.hxx>
@@ -297,6 +303,7 @@
 #include <editeng/svxfont.hxx>
 #include <i18nlangtag/lang.h>
 #include <i18nlangtag/languagetag.hxx>
+#include <i18nutil/i18nutildllapi.h>
 #include <i18nutil/searchopt.hxx>
 #include <i18nutil/transliteration.hxx>
 #include <o3tl/cow_wrapper.hxx>
@@ -401,7 +408,6 @@
 #include <tools/datetime.hxx>
 #include <tools/debug.hxx>
 #include <tools/degree.hxx>
-#include <comphelper/diagnose_ex.hxx>
 #include <tools/fldunit.hxx>
 #include <tools/fontenum.hxx>
 #include <tools/fract.hxx>
@@ -420,7 +426,6 @@
 #include <tools/toolsdllapi.h>
 #include <tools/urlobj.hxx>
 #include <tools/weakbase.h>
-#include <tools/weakbase.hxx>
 #include <typelib/typeclass.h>
 #include <typelib/typedescription.h>
 #include <typelib/uik.h>
@@ -434,6 +439,7 @@
 #include <unotools/resmgr.hxx>
 #include <unotools/syslocale.hxx>
 #include <unotools/unotoolsdllapi.h>
+#include <unotools/weakref.hxx>
 #endif // PCH_LEVEL >= 3
 #if PCH_LEVEL >= 4
 #include <cfgutil.hxx>
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 3fff1a62352a..194dfd65f830 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1596,12 +1596,14 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( 
SfxItemSet& rSet )
     {
         SvxColorItem aItem( aSelectedColor.m_aColor, nWhich );
 
-        if (aSelectedColor.m_nThemeIndex != -1)
+        // The color was picked from the theme palette, remember its index.
+        model::ThemeColorType eType = 
model::convertToThemeColorType(aSelectedColor.m_nThemeIndex);
+        if (eType != model::ThemeColorType::Unknown)
         {
-            // The color was picked from the theme palette, remember its index.
-            aItem.GetThemeColor().SetThemeIndex(aSelectedColor.m_nThemeIndex);
-            aItem.GetThemeColor().SetLumMod(aSelectedColor.m_nLumMod);
-            aItem.GetThemeColor().SetLumOff(aSelectedColor.m_nLumOff);
+            aItem.GetThemeColor().setType(eType);
+            aItem.GetThemeColor().clearTransformations();
+            
aItem.GetThemeColor().addTransformation({model::TransformationType::LumMod, 
aSelectedColor.m_nLumMod});
+            
aItem.GetThemeColor().addTransformation({model::TransformationType::LumOff, 
aSelectedColor.m_nLumOff});
         }
 
         rSet.Put(aItem);
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 7790ff60a8c2..9c0b5b457525 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -245,17 +245,19 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet )
        sColorName = "#" + 
aCurrentColor.m_aColor.AsRGBHexString().toAsciiUpperCase();
     maPaletteManager.AddRecentColor( aCurrentColor.m_aColor, sColorName );
     XFillColorItem aColorItem( sColorName, aCurrentColor.m_aColor );
-    if (aCurrentColor.m_nThemeIndex != -1)
+    model::ThemeColorType eType = 
model::convertToThemeColorType(aCurrentColor.m_nThemeIndex);
+    if (eType != model::ThemeColorType::Unknown)
     {
-        aColorItem.GetThemeColor().SetThemeIndex(aCurrentColor.m_nThemeIndex);
+        aColorItem.GetThemeColor().setType(eType);
     }
+    aColorItem.GetThemeColor().clearTransformations();
     if (aCurrentColor.m_nLumMod != 10000)
     {
-        aColorItem.GetThemeColor().SetLumMod(aCurrentColor.m_nLumMod);
+        
aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumMod,
 aCurrentColor.m_nLumMod});
     }
     if (aCurrentColor.m_nLumOff != 0)
     {
-        aColorItem.GetThemeColor().SetLumOff(aCurrentColor.m_nLumOff);
+        
aColorItem.GetThemeColor().addTransformation({model::TransformationType::LumOff,
 aCurrentColor.m_nLumOff});
     }
     rSet->Put( aColorItem );
     rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
diff --git a/docmodel/Library_docmodel.mk b/docmodel/Library_docmodel.mk
new file mode 100644
index 000000000000..3e0d28dfda28
--- /dev/null
+++ b/docmodel/Library_docmodel.mk
@@ -0,0 +1,39 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 
100 -*-
+#
+# 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_Library_Library,docmodel))
+
+$(eval $(call gb_Library_add_exception_objects,docmodel,\
+    docmodel/source/uno/UnoThemeColor \
+))
+
+$(eval $(call gb_Library_set_include,docmodel,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/docmodel/inc \
+))
+
+$(eval $(call gb_Library_add_defs,docmodel,\
+    -DDOCMODEL_DLLIMPLEMENTATION \
+))
+
+$(eval $(call 
gb_Library_set_precompiled_header,docmodel,docmodel/inc/pch/precompiled_docmodel))
+
+$(eval $(call gb_Library_use_sdk_api,docmodel))
+
+$(eval $(call gb_Library_use_libraries,docmodel,\
+    basegfx \
+    comphelper \
+    cppuhelper \
+    cppu \
+    sal \
+    vcl \
+    tl \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/docmodel/Makefile b/docmodel/Makefile
new file mode 100644
index 000000000000..ccb1c85a04da
--- /dev/null
+++ b/docmodel/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/docmodel/Module_docmodel.mk b/docmodel/Module_docmodel.mk
new file mode 100644
index 000000000000..7e55ff74ad60
--- /dev/null
+++ b/docmodel/Module_docmodel.mk
@@ -0,0 +1,18 @@
+# -*- 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_Module_Module,docmodel))
+
+$(eval $(call gb_Module_add_targets,docmodel,\
+    Library_docmodel \
+))
+
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/docmodel/README.md b/docmodel/README.md
new file mode 100644
index 000000000000..c8d08b133b1e
--- /dev/null
+++ b/docmodel/README.md
@@ -0,0 +1,5 @@
+# Document Model Types and Objects
+
+Contains document model types, that don't require many depenencies except
+basic types found in basegfx and tools. The purpose of this types and
+objects is to be available in all common components.
diff --git a/docmodel/inc/pch/precompiled_docmodel.cxx 
b/docmodel/inc/pch/precompiled_docmodel.cxx
new file mode 100644
index 000000000000..f8a84e17d6c3
--- /dev/null
+++ b/docmodel/inc/pch/precompiled_docmodel.cxx
@@ -0,0 +1,12 @@
+/* -*- 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 "precompiled_docmodel.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/docmodel/inc/pch/precompiled_docmodel.hxx 
b/docmodel/inc/pch/precompiled_docmodel.hxx
new file mode 100644
index 000000000000..1942b8737a17
--- /dev/null
+++ b/docmodel/inc/pch/precompiled_docmodel.hxx
@@ -0,0 +1,34 @@
+/* -*- 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/.
+ */
+
+/*
+ This file has been autogenerated by update_pch.sh. It is possible to edit it
+ manually (such as when an include file has been moved/renamed/removed). All 
such
+ manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
+ also fixes all possible problems, so it's usually better to use it).
+
+ Generated on 2023-01-10 23:20:14 using:
+ bin/update_pch docmodel docmodel --cutoff=3 --exclude:system --exclude:module 
--include:local
+
+ If after updating build fails, use the following command to locate 
conflicting headers:
+ ./bin/update_pch_bisect ./docmodel/inc/pch/precompiled_docmodel.hxx "make 
docmodel.build" --find-conflicts
+*/
+
+#include <sal/config.h>
+#if PCH_LEVEL >= 1
+#endif // PCH_LEVEL >= 1
+#if PCH_LEVEL >= 2
+#include <sal/types.h>
+#endif // PCH_LEVEL >= 2
+#if PCH_LEVEL >= 3
+#endif // PCH_LEVEL >= 3
+#if PCH_LEVEL >= 4
+#endif // PCH_LEVEL >= 4
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/docmodel/source/uno/UnoThemeColor.cxx 
b/docmodel/source/uno/UnoThemeColor.cxx
new file mode 100644
index 000000000000..f6374b54933b
--- /dev/null
+++ b/docmodel/source/uno/UnoThemeColor.cxx
@@ -0,0 +1,40 @@
+/* -*- 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 <docmodel/uno/UnoThemeColor.hxx>
+#include <cppuhelper/queryinterface.hxx>
+
+using namespace css;
+
+// css::lang::XUnoTunnel
+UNO3_GETIMPLEMENTATION_IMPL(UnoThemeColor);
+
+sal_Int16 UnoThemeColor::getType() { return 
sal_uInt16(maThemeColor.getType()); }
+
+namespace model::theme
+{
+uno::Reference<util::XThemeColor> createXThemeColor(model::ThemeColor const& 
rThemeColor)
+{
+    return new UnoThemeColor(rThemeColor);
+}
+
+void setFromXThemeColor(model::ThemeColor& rThemeColor,
+                        uno::Reference<util::XThemeColor> const& rxColorTheme)
+{
+    UnoThemeColor* pUnoThemeColor = 
comphelper::getFromUnoTunnel<UnoThemeColor>(rxColorTheme);
+    if (pUnoThemeColor)
+    {
+        rThemeColor = pUnoThemeColor->getThemeColor();
+    }
+}
+
+} // end model::theme
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/CppunitTest_editeng_core.mk 
b/editeng/CppunitTest_editeng_core.mk
index 3b3a999e8fa0..9b79048b637a 100644
--- a/editeng/CppunitTest_editeng_core.mk
+++ b/editeng/CppunitTest_editeng_core.mk
@@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,editeng_core, \
     comphelper \
     cppu \
     cppuhelper \
+    docmodel \
     i18nlangtag \
     i18nutil \
     lng \
diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
index 6602793e3e02..7f7f3581b62f 100644
--- a/editeng/Library_editeng.mk
+++ b/editeng/Library_editeng.mk
@@ -138,6 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\
 $(eval $(call gb_Library_use_libraries,editeng,\
     xo \
     basegfx \
+    docmodel \
     lng \
     svt \
     tk \
diff --git a/editeng/inc/pch/precompiled_editeng.hxx 
b/editeng/inc/pch/precompiled_editeng.hxx
index 8472a893b5a1..3f5d71018ac5 100644
--- a/editeng/inc/pch/precompiled_editeng.hxx
+++ b/editeng/inc/pch/precompiled_editeng.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-09-03 23:10:43 using:
+ Generated on 2023-01-10 23:29:32 using:
  ./bin/update_pch editeng editeng --cutoff=5 --exclude:system --include:module 
--exclude:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -107,7 +107,6 @@
 #include <vcl/bitmapex.hxx>
 #include <vcl/checksum.hxx>
 #include <vcl/dllapi.h>
-#include <comphelper/errcode.hxx>
 #include <vcl/font.hxx>
 #include <vcl/gfxlink.hxx>
 #include <vcl/graph.hxx>
@@ -128,6 +127,7 @@
 #if PCH_LEVEL >= 3
 #include <basegfx/basegfxdllapi.h>
 #include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/numeric/ftools.hxx>
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/point/b2ipoint.hxx>
@@ -136,6 +136,7 @@
 #include <basegfx/range/Range2D.hxx>
 #include <basegfx/range/b2drange.hxx>
 #include <basegfx/range/basicrange.hxx>
+#include <basegfx/tuple/Size2D.hxx>
 #include <basegfx/tuple/Tuple2D.hxx>
 #include <basegfx/tuple/Tuple3D.hxx>
 #include <basegfx/tuple/b2dtuple.hxx>
@@ -145,6 +146,7 @@
 #include <basegfx/vector/b2dsize.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <basegfx/vector/b2enums.hxx>
+#include <basegfx/vector/b2isize.hxx>
 #include <basegfx/vector/b2ivector.hxx>
 #include <com/sun/star/awt/Key.hpp>
 #include <com/sun/star/awt/KeyGroup.hpp>
@@ -190,6 +192,7 @@
 #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
 #include <comphelper/comphelperdllapi.h>
 #include <comphelper/diagnose_ex.hxx>
+#include <comphelper/errcode.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 #include <cppu/cppudllapi.h>
diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 30b780f1b855..bf6017cdcf6d 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1353,38 +1353,6 @@ bool SvxContourItem::GetPresentation
     return true;
 }
 
-SvxThemeColor::SvxThemeColor()
-    : maThemeIndex(-1)
-    , mnLumMod(10000)
-    , mnLumOff(0)
-    , mnTintOrShade(0)
-{
-}
-
-bool SvxThemeColor::operator==(const SvxThemeColor& rThemeColor) const
-{
-    return maThemeIndex == rThemeColor.maThemeIndex &&
-        mnLumMod == rThemeColor.mnLumMod &&
-        mnLumOff == rThemeColor.mnLumOff &&
-        mnTintOrShade  == rThemeColor.mnTintOrShade;
-}
-
-void SvxThemeColor::dumpAsXml(xmlTextWriterPtr pWriter) const
-{
-    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxThemeColor"));
-
-    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("theme-index"),
-                                      
BAD_CAST(OString::number(maThemeIndex).getStr()));
-    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-mod"),
-                                      
BAD_CAST(OString::number(mnLumMod).getStr()));
-    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("lum-off"),
-                                      
BAD_CAST(OString::number(mnLumOff).getStr()));
-    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("tint-or-shade"),
-                                      
BAD_CAST(OString::number(mnTintOrShade).getStr()));
-
-    (void)xmlTextWriterEndElement(pWriter);
-}
-
 // class SvxColorItem ----------------------------------------------------
 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
     SfxPoolItem(nId),
@@ -1429,22 +1397,42 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, 
sal_uInt8 nMemberId ) const
         }
         case MID_COLOR_THEME_INDEX:
         {
-            rVal <<= maThemeColor.GetThemeIndex();
+            rVal <<= sal_Int16(maThemeColor.getType());
             break;
         }
         case MID_COLOR_TINT_OR_SHADE:
         {
-            rVal <<= maThemeColor.GetTintOrShade();
+            sal_Int16 nValue = 0;
+            for (auto const& rTransform : maThemeColor.getTransformations())
+            {
+                if (rTransform.meType == model::TransformationType::Tint)
+                    nValue = rTransform.mnValue;
+                else if (rTransform.meType == model::TransformationType::Shade)
+                    nValue = -rTransform.mnValue;
+            }
+            rVal <<= nValue;
             break;
         }
         case MID_COLOR_LUM_MOD:
         {
-            rVal <<= maThemeColor.GetLumMod();
+            sal_Int16 nValue = 10000;
+            for (auto const& rTransform : maThemeColor.getTransformations())
+            {
+                if (rTransform.meType == model::TransformationType::LumMod)
+                    nValue = rTransform.mnValue;
+            }
+            rVal <<= nValue;
             break;
         }
         case MID_COLOR_LUM_OFF:
         {
-            rVal <<= maThemeColor.GetLumOff();
+            sal_Int16 nValue = 0;
+            for (auto const& rTransform : maThemeColor.getTransformations())
+            {
+                if (rTransform.meType == model::TransformationType::LumOff)
+                    nValue = rTransform.mnValue;
+            }
+            rVal <<= nValue;
             break;
         }
         default:
@@ -1482,31 +1470,43 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, 
sal_uInt8 nMemberId )
             sal_Int16 nIndex = -1;
             if (!(rVal >>= nIndex))
                 return false;
-            maThemeColor.SetThemeIndex(nIndex);
+            maThemeColor.setType(model::convertToThemeColorType(nIndex));
         }
         break;
         case MID_COLOR_TINT_OR_SHADE:
         {
-            sal_Int16 nTintShade = -1;
+            sal_Int16 nTintShade = 0;
             if (!(rVal >>= nTintShade))
                 return false;
-            maThemeColor.SetTintOrShade(nTintShade);
+
+            
maThemeColor.removeTransformations(model::TransformationType::Tint);
+            
maThemeColor.removeTransformations(model::TransformationType::Shade);
+
+            if (nTintShade > 0)
+                
maThemeColor.addTransformation({model::TransformationType::Tint, nTintShade});
+            else if (nTintShade < 0)
+            {
+                sal_Int16 nShade = o3tl::narrowing<sal_Int16>(-nTintShade);
+                
maThemeColor.addTransformation({model::TransformationType::Shade, nShade});
+            }
         }
         break;
         case MID_COLOR_LUM_MOD:
         {
-            sal_Int16 nLumMod = -1;
+            sal_Int16 nLumMod = 10000;
             if (!(rVal >>= nLumMod))
                 return false;
-            maThemeColor.SetLumMod(nLumMod);
+            
maThemeColor.removeTransformations(model::TransformationType::LumMod);
+            maThemeColor.addTransformation({model::TransformationType::LumMod, 
nLumMod});
         }
         break;
         case MID_COLOR_LUM_OFF:
         {
-            sal_Int16 nLumOff = -1;
+            sal_Int16 nLumOff = 0;
             if (!(rVal >>= nLumOff))
                 return false;
-            maThemeColor.SetLumOff(nLumOff);
+            
maThemeColor.removeTransformations(model::TransformationType::LumOff);
+            maThemeColor.addTransformation({model::TransformationType::LumOff, 
nLumOff});
         }
         break;
         default:
@@ -1549,12 +1549,25 @@ void SvxColorItem::dumpAsXml(xmlTextWriterPtr pWriter) 
const

... etc. - the rest is truncated

Reply via email to