move ColorSet class to own file inside docmodel

Also move ColorSet from svx to model namespace so it is consistent
with other classes in docmodel.

Change-Id: Iacbdbdf5ece4015c628a0e45adf6a732b2d27777
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146220
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
diff --git a/docmodel/Library_docmodel.mk b/docmodel/Library_docmodel.mk
index 3e0d28d..22ecdfa 100644
--- a/docmodel/Library_docmodel.mk
+++ b/docmodel/Library_docmodel.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_Library_Library,docmodel))

$(eval $(call gb_Library_add_exception_objects,docmodel,\
    docmodel/source/uno/UnoThemeColor \
    docmodel/source/theme/ColorSet \
))

$(eval $(call gb_Library_set_include,docmodel,\
@@ -18,6 +19,10 @@ $(eval $(call gb_Library_set_include,docmodel,\
    -I$(SRCDIR)/docmodel/inc \
))

$(eval $(call gb_Library_use_externals,docmodel,\
	libxml2 \
))

$(eval $(call gb_Library_add_defs,docmodel,\
    -DDOCMODEL_DLLIMPLEMENTATION \
))
diff --git a/docmodel/source/theme/ColorSet.cxx b/docmodel/source/theme/ColorSet.cxx
new file mode 100644
index 0000000..55c03da
--- /dev/null
+++ b/docmodel/source/theme/ColorSet.cxx
@@ -0,0 +1,74 @@
/* -*- 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/theme/ColorSet.hxx>
#include <sstream>
#include <utility>
#include <libxml/xmlwriter.h>
#include <sal/log.hxx>

namespace model
{
ColorSet::ColorSet(OUString const& rName)
    : maName(rName)
{
}

void ColorSet::add(model::ThemeColorType eType, Color aColorData)
{
    if (eType == model::ThemeColorType::Unknown)
        return;
    maColors[sal_Int16(eType)] = aColorData;
}

Color ColorSet::getColor(model::ThemeColorType eType) const
{
    if (eType == model::ThemeColorType::Unknown)
    {
        SAL_WARN("svx", "ColorSet::getColor with ThemeColorType::Unknown");
        return COL_AUTO;
    }
    return maColors[size_t(eType)];
}

Color ColorSet::resolveColor(model::ThemeColor const& rThemeColor) const
{
    auto eType = rThemeColor.getType();
    if (eType == model::ThemeColorType::Unknown)
    {
        SAL_WARN("svx", "ColorSet::resolveColor with ThemeColorType::Unknown");
        return COL_AUTO;
    }
    Color aColor = getColor(eType);
    return rThemeColor.applyTransformations(aColor);
}

void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const
{
    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ColorSet"));
    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maName"),
                                      BAD_CAST(maName.toUtf8().getStr()));

    for (const auto& rColor : maColors)
    {
        (void)xmlTextWriterStartElement(pWriter, BAD_CAST("Color"));
        std::stringstream ss;
        ss << rColor;
        (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(ss.str().c_str()));
        (void)xmlTextWriterEndElement(pWriter);
    }

    (void)xmlTextWriterEndElement(pWriter);
}

} // end of namespace svx

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/docmodel/theme/ColorSet.hxx b/include/docmodel/theme/ColorSet.hxx
new file mode 100644
index 0000000..6e7fa94
--- /dev/null
+++ b/include/docmodel/theme/ColorSet.hxx
@@ -0,0 +1,45 @@
/* -*- 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 <array>
#include <docmodel/dllapi.h>
#include <rtl/ustring.hxx>
#include <docmodel/theme/ThemeColorType.hxx>
#include <docmodel/theme/ThemeColor.hxx>
#include <tools/color.hxx>

typedef struct _xmlTextWriter* xmlTextWriterPtr;

namespace model
{
class DOCMODEL_DLLPUBLIC ColorSet
{
    OUString maName;
    std::array<Color, 12> maColors;

public:
    ColorSet(OUString const& rName);

    void add(model::ThemeColorType Type, Color aColorData);

    const OUString& getName() const { return maName; }

    Color resolveColor(model::ThemeColor const& rThemeColor) const;

    Color getColor(model::ThemeColorType eType) const;

    void dumpAsXml(xmlTextWriterPtr pWriter) const;
};

} // end of namespace model

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx
index fd76625..33ff971 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -30,7 +30,7 @@
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
#include <svx/ColorSets.hxx>
#include <docmodel/theme/ColorSet.hxx>

namespace oox::drawingml {

@@ -95,7 +95,7 @@ public:
    const OUString& GetName() const { return maName; }

    void ToAny(css::uno::Any& rVal) const;
    void fill(svx::ColorSet& rColorSet) const;
    void fill(model::ColorSet& rColorSet) const;

};

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 68da921..b06dbea 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -19,6 +19,7 @@
#include <sal/types.h>
#include <svx/svxdllapi.h>
#include <docmodel/theme/ThemeColor.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <tools/color.hxx>

typedef struct _xmlTextWriter* xmlTextWriterPtr;
@@ -27,49 +28,27 @@ class SdrPage;
namespace svx
{


class SVXCORE_DLLPUBLIC ColorSet
{
    OUString maName;
    std::array<Color, 12> maColors;

public:
    ColorSet(OUString const& rName);

    void add(model::ThemeColorType Type, Color aColorData);

    const OUString& getName() const
    {
        return maName;
    }

    Color resolveColor(model::ThemeColor const& rThemeColor) const;
    Color getColor(model::ThemeColorType eType) const;

    void dumpAsXml(xmlTextWriterPtr pWriter) const;
};

class SVXCORE_DLLPUBLIC ColorSets
{
    std::vector<ColorSet> maColorSets;
    std::vector<model::ColorSet> maColorSets;
public:
    ColorSets();
    ~ColorSets();

    void init();
    const std::vector<ColorSet>& getColorSets() const
    const std::vector<model::ColorSet>& getColorSets() const
    {
        return maColorSets;
    }

    const ColorSet& getColorSet(sal_uInt32 nIndex) const
    const model::ColorSet& getColorSet(sal_uInt32 nIndex) const
    {
        return maColorSets[nIndex];
    }

    const ColorSet& getColorSet(std::u16string_view rName);
    const model::ColorSet& getColorSet(std::u16string_view rName);

    void insert(ColorSet const& rColorSet);
    void insert(model::ColorSet const& rColorSet);
};

struct SVXCORE_DLLPUBLIC ThemeSupplementalFont
@@ -217,7 +196,7 @@ class SVXCORE_DLLPUBLIC Theme
{
private:
    OUString maName;
    std::unique_ptr<ColorSet> mpColorSet;
    std::unique_ptr<model::ColorSet> mpColorSet;

    FontScheme maFontScheme;

@@ -231,9 +210,9 @@ public:

    FontScheme const& getFontScheme() const { return maFontScheme; }

    void SetColorSet(std::unique_ptr<ColorSet> pColorSet);
    const ColorSet* GetColorSet() const;
    ColorSet* GetColorSet();
    void SetColorSet(std::unique_ptr<model::ColorSet> pColorSet);
    const model::ColorSet* GetColorSet() const;
    model::ColorSet* GetColorSet();

    void SetName(const OUString& rName);
    const OUString& GetName() const;
diff --git a/include/svx/dialog/ThemeColorValueSet.hxx b/include/svx/dialog/ThemeColorValueSet.hxx
index 4b70ed0..ee73275 100644
--- a/include/svx/dialog/ThemeColorValueSet.hxx
+++ b/include/svx/dialog/ThemeColorValueSet.hxx
@@ -12,13 +12,13 @@
#include <svx/svxdllapi.h>
#include <sal/config.h>
#include <svtools/valueset.hxx>
#include <svx/ColorSets.hxx>
#include <docmodel/theme/ColorSet.hxx>

namespace svx
{
class SVX_DLLPUBLIC ThemeColorValueSet final : public ValueSet
{
    std::vector<std::reference_wrapper<const svx::ColorSet>> maColorSets;
    std::vector<std::reference_wrapper<const model::ColorSet>> maColorSets;

public:
    ThemeColorValueSet()
@@ -30,7 +30,7 @@ public:
    void UserDraw(const UserDrawEvent& rUserDrawEvent) override;
    void StyleUpdated() override;

    void insert(svx::ColorSet const& rColorSet);
    void insert(model::ColorSet const& rColorSet);
};

} // end svx namespace
diff --git a/include/svx/theme/IThemeColorChanger.hxx b/include/svx/theme/IThemeColorChanger.hxx
index 93cba58..4f10ad1 100644
--- a/include/svx/theme/IThemeColorChanger.hxx
+++ b/include/svx/theme/IThemeColorChanger.hxx
@@ -10,7 +10,7 @@
#pragma once

#include <svx/svxdllapi.h>
#include <svx/ColorSets.hxx>
#include <docmodel/theme/ColorSet.hxx>

namespace svx
{
@@ -18,7 +18,7 @@ class SVXCORE_DLLPUBLIC IThemeColorChanger
{
public:
    virtual ~IThemeColorChanger() = default;
    virtual void apply(svx::ColorSet const& rColorSet) = 0;
    virtual void apply(model::ColorSet const& rColorSet) = 0;
};

} // end svx namespace
diff --git a/include/svx/theme/ThemeColorChanger.hxx b/include/svx/theme/ThemeColorChanger.hxx
index cf40718..708344f 100644
--- a/include/svx/theme/ThemeColorChanger.hxx
+++ b/include/svx/theme/ThemeColorChanger.hxx
@@ -11,7 +11,7 @@

#include <svx/svxdllapi.h>
#include <svx/theme/IThemeColorChanger.hxx>
#include <svx/ColorSets.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdobj.hxx>

@@ -19,7 +19,7 @@ namespace svx
{
namespace theme
{
SVXCORE_DLLPUBLIC void updateSdrObject(svx::ColorSet const& rColorSet, SdrObject* pObject);
SVXCORE_DLLPUBLIC void updateSdrObject(model::ColorSet const& rColorSet, SdrObject* pObject);
}

class SVXCORE_DLLPUBLIC ThemeColorChanger : public IThemeColorChanger
@@ -31,7 +31,7 @@ public:
    ThemeColorChanger(SdrPage* pPage);
    virtual ~ThemeColorChanger() override;

    void apply(svx::ColorSet const& rColorSet) override;
    void apply(model::ColorSet const& rColorSet) override;
};

} // end svx namespace
diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx
index f4f14d0..105ba4c 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -130,7 +130,7 @@ void ClrScheme::ToAny(css::uno::Any& rVal) const
    rVal <<= comphelper::containerToSequence(aRet);
}

void ClrScheme::fill(svx::ColorSet& rColorSet) const
void ClrScheme::fill(model::ColorSet& rColorSet) const
{
    for (const auto& [nToken, rColor] : maClrScheme)
    {
diff --git a/oox/source/drawingml/theme.cxx b/oox/source/drawingml/theme.cxx
index dfa81fe..7847149 100644
--- a/oox/source/drawingml/theme.cxx
+++ b/oox/source/drawingml/theme.cxx
@@ -28,6 +28,7 @@
#include <svx/unopage.hxx>
#include <svx/svdpage.hxx>
#include <svx/ColorSets.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <svx/unoapi.hxx>

using namespace com::sun::star;
@@ -111,7 +112,7 @@ const TextFont* Theme::resolveFont( std::u16string_view rName ) const
std::unique_ptr<svx::Theme> Theme::createSvxTheme() const
{
    auto pTheme = std::make_unique<svx::Theme>(maThemeName);
    auto pColorSet = std::make_unique<svx::ColorSet>(maClrScheme.GetName());
    auto pColorSet = std::make_unique<model::ColorSet>(maClrScheme.GetName());
    maClrScheme.fill(*pColorSet);
    pTheme->SetColorSet(std::move(pColorSet));

diff --git a/oox/source/export/ThemeExport.cxx b/oox/source/export/ThemeExport.cxx
index b168498..0f1b8eb 100644
--- a/oox/source/export/ThemeExport.cxx
+++ b/oox/source/export/ThemeExport.cxx
@@ -37,7 +37,7 @@ void ThemeExport::write(OUString const& rPath, svx::Theme const& rTheme)

    pFS->startElementNS(XML_a, XML_themeElements);

    const svx::ColorSet* pColorSet = rTheme.GetColorSet();
    const model::ColorSet* pColorSet = rTheme.GetColorSet();

    pFS->startElementNS(XML_a, XML_clrScheme, XML_name, pColorSet->getName());
    writeColorSet(pFS, rTheme);
@@ -242,7 +242,7 @@ bool ThemeExport::writeColorSet(sax_fastparser::FSHelperPtr pFS, svx::Theme cons
        = { XML_dk1,     XML_lt1,     XML_dk2,     XML_lt2,     XML_accent1, XML_accent2,
            XML_accent3, XML_accent4, XML_accent5, XML_accent6, XML_hlink,   XML_folHlink };

    const svx::ColorSet* pColorSet = rTheme.GetColorSet();
    const model::ColorSet* pColorSet = rTheme.GetColorSet();
    if (!pColorSet)
        return false;

diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c053586..23eaeba 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2176,7 +2176,7 @@ bool PowerPointExport::WriteColorSets(const FSHelperPtr& pFS, svx::Theme* pTheme
        return false;
    }

    svx::ColorSet* pColorSet = pTheme->GetColorSet();
    model::ColorSet* pColorSet = pTheme->GetColorSet();
    if (!pColorSet)
    {
        return false;
@@ -2271,7 +2271,7 @@ void PowerPointExport::WriteTheme(sal_Int32 nThemeNum, svx::Theme* pTheme)
    OUString aColorSchemeName("Office");
    if (pTheme)
    {
        svx::ColorSet* pColorSet = pTheme->GetColorSet();
        model::ColorSet* pColorSet = pTheme->GetColorSet();
        if (pColorSet)
        {
            aColorSchemeName = pColorSet->getName();
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index f4b2bef..074a18d 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_use_libraries,svx,\
		crashreport) \
    $(call gb_Helper_optional,DBCONNECTIVITY, \
        dbtools) \
    docmodel \
    drawinglayercore \
    drawinglayer \
    editeng \
diff --git a/svx/source/dialog/ThemeColorValueSet.cxx b/svx/source/dialog/ThemeColorValueSet.cxx
index 204a37b..bc0356b 100644
--- a/svx/source/dialog/ThemeColorValueSet.cxx
+++ b/svx/source/dialog/ThemeColorValueSet.cxx
@@ -19,7 +19,7 @@ constexpr tools::Long LABEL_HEIGHT = 16;
constexpr tools::Long LABEL_TEXT_HEIGHT = 14;
constexpr tools::Long constElementNumber = 8;

void ThemeColorValueSet::insert(svx::ColorSet const& rColorSet)
void ThemeColorValueSet::insert(model::ColorSet const& rColorSet)
{
    maColorSets.push_back(std::cref(rColorSet));
    InsertItem(maColorSets.size());
@@ -40,7 +40,7 @@ void ThemeColorValueSet::UserDraw(const UserDrawEvent& rUserDrawEvent)
    tools::Rectangle aRect = rUserDrawEvent.GetRect();
    const Point aPosition = aRect.GetPos();
    const sal_uInt16 nItemId = rUserDrawEvent.GetItemId();
    svx::ColorSet const& rColorSet = maColorSets[nItemId - 1];
    model::ColorSet const& rColorSet = maColorSets[nItemId - 1];

    Size aSize = aRect.GetSize();
    Size aMin(BORDER * 7 + SIZE * constElementNumber / 2 + BORDER * 2,
diff --git a/svx/source/dialog/ThemeDialog.cxx b/svx/source/dialog/ThemeDialog.cxx
index 449a466..ff07865 100644
--- a/svx/source/dialog/ThemeDialog.cxx
+++ b/svx/source/dialog/ThemeDialog.cxx
@@ -9,6 +9,7 @@

#include <svx/dialog/ThemeDialog.hxx>
#include <docmodel/theme/ThemeColor.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <vcl/svapp.hxx>

namespace svx
@@ -53,7 +54,7 @@ void ThemeDialog::DoubleClickHdl()

    sal_uInt32 nIndex = nItemId - 1;

    svx::ColorSet const& rColorSet = maColorSets.getColorSet(nIndex);
    model::ColorSet const& rColorSet = maColorSets.getColorSet(nIndex);

    mpChanger->apply(rColorSet);
}
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index eada260..23adaf3 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -10,7 +10,6 @@

#include <svx/ColorSets.hxx>

#include <sstream>
#include <utility>

#include <libxml/xmlwriter.h>
@@ -21,6 +20,7 @@
#include <svx/svditer.hxx>
#include <editeng/unoprnms.hxx>
#include <docmodel/uno/UnoThemeColor.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <o3tl/enumrange.hxx>
#include <com/sun/star/util/Color.hpp>

@@ -29,58 +29,6 @@ using namespace com::sun::star;
namespace svx
{

ColorSet::ColorSet(OUString const& rName)
    : maName(rName)
{}

void ColorSet::add(model::ThemeColorType eType, Color aColorData)
{
    if (eType == model::ThemeColorType::Unknown)
        return;
    maColors[sal_Int16(eType)] = aColorData;
}

Color ColorSet::getColor(model::ThemeColorType eType) const
{
    if (eType == model::ThemeColorType::Unknown)
    {
        SAL_WARN("svx", "ColorSet::getColor with ThemeColorType::Unknown");
        return COL_AUTO;
    }
    return maColors[size_t(eType)];
}

Color ColorSet::resolveColor(model::ThemeColor const& rThemeColor) const
{
    auto eType = rThemeColor.getType();
    if (eType == model::ThemeColorType::Unknown)
    {
        SAL_WARN("svx", "ColorSet::resolveColor with ThemeColorType::Unknown");
        return COL_AUTO;
    }
    Color aColor = getColor(eType);
    return rThemeColor.applyTransformations(aColor);
}

void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const
{
    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ColorSet"));
    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maName"),
                                      BAD_CAST(maName.toUtf8().getStr()));

    for (const auto& rColor : maColors)
    {
        (void)xmlTextWriterStartElement(pWriter, BAD_CAST("Color"));
        std::stringstream ss;
        ss << rColor;
        (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(ss.str().c_str()));
        (void)xmlTextWriterEndElement(pWriter);
    }

    (void)xmlTextWriterEndElement(pWriter);
}

ColorSets::ColorSets()
{}

@@ -90,7 +38,7 @@ ColorSets::~ColorSets()
void ColorSets::init()
{
    {
        ColorSet aColorSet("LibreOffice");
        model::ColorSet aColorSet("LibreOffice");
        aColorSet.add(model::ThemeColorType::Dark1, 0x000000);
        aColorSet.add(model::ThemeColorType::Light1, 0xFFFFFF);
        aColorSet.add(model::ThemeColorType::Dark2, 0x000000);
@@ -106,7 +54,7 @@ void ColorSets::init()
        maColorSets.push_back(aColorSet);
    }
    {
        ColorSet aColorSet("Rainbow");
        model::ColorSet aColorSet("Rainbow");
        aColorSet.add(model::ThemeColorType::Dark1, 0x000000);
        aColorSet.add(model::ThemeColorType::Light1, 0xFFFFFF);
        aColorSet.add(model::ThemeColorType::Dark2, 0x1C1C1C);
@@ -122,7 +70,7 @@ void ColorSets::init()
        maColorSets.push_back(aColorSet);
    }
    {
        ColorSet aColorSet("Beach");
        model::ColorSet aColorSet("Beach");
        aColorSet.add(model::ThemeColorType::Dark1, 0x000000);
        aColorSet.add(model::ThemeColorType::Light1, 0xFFFFFF);
        aColorSet.add(model::ThemeColorType::Dark2, 0xFFBF00);
@@ -138,7 +86,7 @@ void ColorSets::init()
        maColorSets.push_back(aColorSet);
    }
    {
        ColorSet aColorSet("Sunset");
        model::ColorSet aColorSet("Sunset");
        aColorSet.add(model::ThemeColorType::Dark1, 0x000000);
        aColorSet.add(model::ThemeColorType::Light1, 0xFFFFFF);
        aColorSet.add(model::ThemeColorType::Dark2, 0x492300);
@@ -154,7 +102,7 @@ void ColorSets::init()
        maColorSets.push_back(aColorSet);
    }
    {
        ColorSet aColorSet("Ocean");
        model::ColorSet aColorSet("Ocean");
        aColorSet.add(model::ThemeColorType::Dark1, 0x000000);
        aColorSet.add(model::ThemeColorType::Light1, 0xFFFFFF);
        aColorSet.add(model::ThemeColorType::Dark2, 0x2A6099);
@@ -170,7 +118,7 @@ void ColorSets::init()
        maColorSets.push_back(aColorSet);
    }
    {
        ColorSet aColorSet("Forest");
        model::ColorSet aColorSet("Forest");
        aColorSet.add(model::ThemeColorType::Dark1, 0x000000);
        aColorSet.add(model::ThemeColorType::Light1, 0xFFFFFF);
        aColorSet.add(model::ThemeColorType::Dark2, 0x000000);
@@ -186,7 +134,7 @@ void ColorSets::init()
        maColorSets.push_back(aColorSet);
    }
    {
        ColorSet aColorSet("Breeze");
        model::ColorSet aColorSet("Breeze");
        aColorSet.add(model::ThemeColorType::Dark1, 0x232629);
        aColorSet.add(model::ThemeColorType::Light1, 0xFCFCFC);
        aColorSet.add(model::ThemeColorType::Dark2, 0x31363B);
@@ -203,9 +151,9 @@ void ColorSets::init()
    }
}

const ColorSet& ColorSets::getColorSet(std::u16string_view rName)
const model::ColorSet& ColorSets::getColorSet(std::u16string_view rName)
{
    for (const ColorSet & rColorSet : maColorSets)
    for (const model::ColorSet & rColorSet : maColorSets)
    {
        if (rColorSet.getName() == rName)
            return rColorSet;
@@ -213,7 +161,7 @@ const ColorSet& ColorSets::getColorSet(std::u16string_view rName)
    return maColorSets[0];
}

void ColorSets::insert(ColorSet const& rColorSet)
void ColorSets::insert(model::ColorSet const& rColorSet)
{
    maColorSets.push_back(rColorSet);
}
@@ -223,11 +171,11 @@ Theme::Theme(OUString const& rName)
{
}

void Theme::SetColorSet(std::unique_ptr<ColorSet> pColorSet) { mpColorSet = std::move(pColorSet); }
void Theme::SetColorSet(std::unique_ptr<model::ColorSet> pColorSet) { mpColorSet = std::move(pColorSet); }

const ColorSet* Theme::GetColorSet() const { return mpColorSet.get(); }
const model::ColorSet* Theme::GetColorSet() const { return mpColorSet.get(); }

ColorSet* Theme::GetColorSet() { return mpColorSet.get(); }
model::ColorSet* Theme::GetColorSet() { return mpColorSet.get(); }

void Theme::SetName(const OUString& rName) { maName = rName; }

@@ -276,7 +224,7 @@ std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& rVal)
{
    comphelper::SequenceAsHashMap aMap(rVal);
    std::unique_ptr<Theme> pTheme;
    ColorSet* pColorSet = nullptr;
    model::ColorSet* pColorSet = nullptr;

    auto it = aMap.find("Name");
    if (it != aMap.end())
@@ -291,7 +239,7 @@ std::unique_ptr<Theme> Theme::FromAny(const css::uno::Any& rVal)
    {
        OUString aName;
        it->second >>= aName;
        auto pSet = std::make_unique<ColorSet>(aName);
        auto pSet = std::make_unique<model::ColorSet>(aName);
        pTheme->SetColorSet(std::move(pSet));
        pColorSet = pTheme->GetColorSet();
    }
diff --git a/svx/source/theme/ThemeColorChanger.cxx b/svx/source/theme/ThemeColorChanger.cxx
index 677a044..792f85d3 100644
--- a/svx/source/theme/ThemeColorChanger.cxx
+++ b/svx/source/theme/ThemeColorChanger.cxx
@@ -14,6 +14,7 @@
#include <svx/svditer.hxx>
#include <editeng/unoprnms.hxx>
#include <docmodel/uno/UnoThemeColor.hxx>
#include <docmodel/theme/ColorSet.hxx>

#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -30,7 +31,7 @@ namespace theme
namespace
{
/// Updates text portion property colors
void updateTextPortionColorSet(svx::ColorSet const& rColorSet,
void updateTextPortionColorSet(model::ColorSet const& rColorSet,
                               const uno::Reference<beans::XPropertySet>& xPortion)
{
    if (!xPortion->getPropertySetInfo()->hasPropertyByName(
@@ -53,7 +54,7 @@ void updateTextPortionColorSet(svx::ColorSet const& rColorSet,
}

/// Updates the fill property colors
void updateFillColorSet(svx::ColorSet const& rColorSet,
void updateFillColorSet(model::ColorSet const& rColorSet,
                        const uno::Reference<beans::XPropertySet>& xShape)
{
    if (!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_FILLCOLOR_THEME_REFERENCE))
@@ -75,7 +76,7 @@ void updateFillColorSet(svx::ColorSet const& rColorSet,
}

/// Updates the line property colors
void updateLineColorSet(svx::ColorSet const& rColorSet,
void updateLineColorSet(model::ColorSet const& rColorSet,
                        const uno::Reference<beans::XPropertySet>& xShape)
{
    if (!xShape->getPropertySetInfo()->hasPropertyByName(UNO_NAME_LINECOLOR_THEME_REFERENCE))
@@ -99,7 +100,7 @@ void updateLineColorSet(svx::ColorSet const& rColorSet,
} // end anonymous namespace

/// Updates properties of the SdrObject
void updateSdrObject(svx::ColorSet const& rColorSet, SdrObject* pObject)
void updateSdrObject(model::ColorSet const& rColorSet, SdrObject* pObject)
{
    uno::Reference<drawing::XShape> xShape = pObject->getUnoShape();
    uno::Reference<text::XTextRange> xShapeText(xShape, uno::UNO_QUERY);
@@ -136,7 +137,7 @@ ThemeColorChanger::ThemeColorChanger(SdrPage* pPage)

ThemeColorChanger::~ThemeColorChanger() = default;

void ThemeColorChanger::apply(svx::ColorSet const& rColorSet)
void ThemeColorChanger::apply(model::ColorSet const& rColorSet)
{
    for (size_t nObject = 0; nObject < mpPage->GetObjCount(); ++nObject)
    {
diff --git a/sw/qa/core/theme/ThemeTest.cxx b/sw/qa/core/theme/ThemeTest.cxx
index 43cc2a6..412482e 100644
--- a/sw/qa/core/theme/ThemeTest.cxx
+++ b/sw/qa/core/theme/ThemeTest.cxx
@@ -53,7 +53,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreThemeTest, testDrawPageThemeExists)
    CPPUNIT_ASSERT(pTheme);
    CPPUNIT_ASSERT_EQUAL(OUString(u"Office Theme"), pTheme->GetName());

    svx::ColorSet* pColorSet = pTheme->GetColorSet();
    model::ColorSet* pColorSet = pTheme->GetColorSet();
    CPPUNIT_ASSERT(pColorSet);
    CPPUNIT_ASSERT_EQUAL(OUString(u"Orange"), pColorSet->getName());

diff --git a/sw/source/core/inc/ThemeColorChanger.hxx b/sw/source/core/inc/ThemeColorChanger.hxx
index a246f17..71526f7 100644
--- a/sw/source/core/inc/ThemeColorChanger.hxx
+++ b/sw/source/core/inc/ThemeColorChanger.hxx
@@ -10,7 +10,7 @@
#pragma once

#include <docsh.hxx>
#include <svx/ColorSets.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <svx/theme/ThemeColorChanger.hxx>

namespace sw
@@ -24,7 +24,7 @@ public:
    ThemeColorChanger(SwDocShell* pDocSh);
    virtual ~ThemeColorChanger() override;

    void apply(svx::ColorSet const& rColorSet) override;
    void apply(model::ColorSet const& rColorSet) override;
};

} // end sw namespace
diff --git a/sw/source/core/model/ThemeColorChanger.cxx b/sw/source/core/model/ThemeColorChanger.cxx
index dc9a7fe..715c02e 100644
--- a/sw/source/core/model/ThemeColorChanger.cxx
+++ b/sw/source/core/model/ThemeColorChanger.cxx
@@ -46,10 +46,10 @@ namespace
class ThemeColorHandler : public sw::ModelTraverseHandler
{
    SwDoc& mrDocument;
    svx::ColorSet const& mrColorSet;
    model::ColorSet const& mrColorSet;

public:
    ThemeColorHandler(SwDoc& rDocument, svx::ColorSet const& rColorSet)
    ThemeColorHandler(SwDoc& rDocument, model::ColorSet const& rColorSet)
        : mrDocument(rDocument)
        , mrColorSet(rColorSet)
    {
@@ -115,7 +115,7 @@ public:
    }
};

void changeColor(SwFormat* pFormat, svx::ColorSet const& rColorSet, SwDoc* pDocument)
void changeColor(SwFormat* pFormat, model::ColorSet const& rColorSet, SwDoc* pDocument)
{
    const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
    std::unique_ptr<SfxItemSet> pNewSet = rAttrSet.Clone();
@@ -142,7 +142,7 @@ ThemeColorChanger::ThemeColorChanger(SwDocShell* pDocSh)

ThemeColorChanger::~ThemeColorChanger() = default;

void ThemeColorChanger::apply(svx::ColorSet const& rColorSet)
void ThemeColorChanger::apply(model::ColorSet const& rColorSet)
{
    SwDoc* pDocument = mpDocSh->GetDoc();
    if (!pDocument)
@@ -154,13 +154,13 @@ void ThemeColorChanger::apply(svx::ColorSet const& rColorSet)
    svx::Theme* pTheme = pPage->getSdrPageProperties().GetTheme();
    if (pTheme)
    {
        pTheme->SetColorSet(std::make_unique<svx::ColorSet>(rColorSet));
        pTheme->SetColorSet(std::make_unique<model::ColorSet>(rColorSet));
    }
    else
    {
        pPage->getSdrPageProperties().SetTheme(std::make_unique<svx::Theme>("Office"));
        pTheme = pPage->getSdrPageProperties().GetTheme();
        pTheme->SetColorSet(std::make_unique<svx::ColorSet>(rColorSet));
        pTheme->SetColorSet(std::make_unique<model::ColorSet>(rColorSet));
    }

    SfxStyleSheetBasePool* pPool = mpDocSh->GetStyleSheetPool();
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index 76fd5e5..d2c225c 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -59,10 +59,10 @@ ThemePanel::ThemePanel(weld::Widget* pParent)
            maColorSets.insert(*pTheme->GetColorSet());
    }

    const std::vector<svx::ColorSet>& aColorSets = maColorSets.getColorSets();
    const std::vector<model::ColorSet>& aColorSets = maColorSets.getColorSets();
    for (size_t i = 0; i < aColorSets.size(); ++i)
    {
        const svx::ColorSet& rColorSet = aColorSets[i];
        const model::ColorSet& rColorSet = aColorSets[i];
        mxValueSetColors->insert(rColorSet);
    }

@@ -106,7 +106,7 @@ void ThemePanel::DoubleClickHdl()
        return;
    sal_uInt32 nIndex = nItemId - 1;

    svx::ColorSet const& rColorSet = maColorSets.getColorSet(nIndex);
    model::ColorSet const& rColorSet = maColorSets.getColorSet(nIndex);

    ThemeColorChanger aChanger(pDocSh);
    aChanger.apply(rColorSet);
diff --git a/writerfilter/source/dmapper/ThemeHandler.cxx b/writerfilter/source/dmapper/ThemeHandler.cxx
index 555a2b4..3a7260d 100644
--- a/writerfilter/source/dmapper/ThemeHandler.cxx
+++ b/writerfilter/source/dmapper/ThemeHandler.cxx
@@ -10,6 +10,7 @@
#include "ThemeHandler.hxx"
#include <i18nlangtag/languagetag.hxx>
#include <ooxml/resourceids.hxx>
#include <svx/ColorSets.hxx>

using namespace com::sun::star;