docmodel/Library_docmodel.mk            |    1 
 docmodel/source/color/ComplexColor.cxx  |  176 ++++++++++++++++++++++++++++++++
 include/docmodel/color/ComplexColor.hxx |  141 +++----------------------
 include/svx/xcolit.hxx                  |   25 ++--
 include/svx/xflclit.hxx                 |   31 +----
 include/svx/xit.hxx                     |   52 +++++----
 svx/source/xoutdev/xattr.cxx            |   59 ++++++----
 7 files changed, 282 insertions(+), 203 deletions(-)

New commits:
commit 8f7d808ddf83b2c7744da0684970fece58bd7001
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sat Dec 6 23:00:57 2025 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat Feb 21 11:50:36 2026 +0100

    svx: clean-up NameOrIndex and XColorItem and XFillColorItem
    
    Change-Id: I40ef3e6826857f465a7e0c1643536b99cc32e778
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195168
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199914
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx
index 7336d0bc62a2..5cd3c6cbd993 100644
--- a/include/svx/xcolit.hxx
+++ b/include/svx/xcolit.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVX_XCOLIT_HXX
-#define INCLUDED_SVX_XCOLIT_HXX
+#pragma once
 
 #include <tools/color.hxx>
 #include <docmodel/color/ComplexColor.hxx>
@@ -32,21 +31,21 @@ class SVXCORE_DLLPUBLIC XColorItem : public NameOrIndex
     model::ComplexColor maComplexColor;
 
 public:
-            static SfxPoolItem* CreateDefault();
-            DECLARE_ITEM_TYPE_FUNCTION(XColorItem)
-            XColorItem() : NameOrIndex() {}
-            XColorItem(TypedWhichId<XColorItem> nWhich, sal_Int32 nIndex, 
const Color& rTheColor);
-            XColorItem(TypedWhichId<XColorItem> nWhich, const Color& 
rTheColor);
-            XColorItem(TypedWhichId<XColorItem> nWhich, const OUString& rName, 
const Color& rTheColor);
-            XColorItem(const XColorItem& rItem);
+    static SfxPoolItem* CreateDefault();
+    DECLARE_ITEM_TYPE_FUNCTION(XColorItem)
+    XColorItem();
+    XColorItem(TypedWhichId<XColorItem> nWhich, sal_Int32 nIndex, const Color& 
rTheColor);
+    XColorItem(TypedWhichId<XColorItem> nWhich, const Color& rTheColor);
+    XColorItem(TypedWhichId<XColorItem> nWhich, const OUString& rName, const 
Color& rTheColor);
+    XColorItem(const XColorItem& rItem);
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) 
const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) 
override;
-    virtual bool            operator==(const SfxPoolItem& rItem) const 
override;
+    virtual bool operator==(const SfxPoolItem& rItem) const override;
     virtual XColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
 
-    const Color&    GetColorValue() const;
-    void            SetColorValue(const Color& rNew) { m_aColor = rNew; 
Detach(); }
+    Color const& GetColorValue() const;
+    void SetColorValue(const Color& rNew);
 
     void setComplexColor(model::ComplexColor const& rComplexColor) { 
maComplexColor = rComplexColor; }
     const model::ComplexColor& getComplexColor() const { return 
maComplexColor; }
@@ -55,6 +54,4 @@ public:
     virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xflclit.hxx b/include/svx/xflclit.hxx
index ea2908e6ee71..706a73b5ae46 100644
--- a/include/svx/xflclit.hxx
+++ b/include/svx/xflclit.hxx
@@ -17,41 +17,30 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVX_XFLCLIT_HXX
-#define INCLUDED_SVX_XFLCLIT_HXX
+#pragma once
 
 #include <svx/xcolit.hxx>
 #include <svx/svxdllapi.h>
 
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-//                           Fuellattribute
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
-
 class SVXCORE_DLLPUBLIC XFillColorItem final : public XColorItem
 {
 public:
-            static SfxPoolItem* CreateDefault();
-            DECLARE_ITEM_TYPE_FUNCTION(XFillColorItem)
-            XFillColorItem() : XColorItem() {}
-            XFillColorItem(sal_Int32 nIndex, const Color& rTheColor);
-            XFillColorItem(const OUString& rName, const Color& rTheColor);
+    static SfxPoolItem* CreateDefault();
+    DECLARE_ITEM_TYPE_FUNCTION(XFillColorItem)
+    XFillColorItem();
+    XFillColorItem(sal_Int32 nIndex, const Color& rTheColor);
+    XFillColorItem(const OUString& rName, const Color& rTheColor);
 
     virtual XFillColorItem* Clone(SfxItemPool* pPool = nullptr) const override;
 
-    virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 
nMemberId = 0 ) const override;
-    virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 
nMemberId ) override;
+    virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) 
const override;
+    virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) 
override;
 
-    virtual bool GetPresentation( SfxItemPresentation ePres,
-                                  MapUnit eCoreMetric,
-                                  MapUnit ePresMetric,
-                                  OUString &rText, const IntlWrapper& ) const 
override;
+    virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit 
eCoreMetric, MapUnit ePresMetric,
+                                 OUString &rText, const IntlWrapper& rWrapper) 
const override;
 
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
     virtual boost::property_tree::ptree dumpAsJSON() const override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/xit.hxx b/include/svx/xit.hxx
index db639a9284d1..1188db6206cd 100644
--- a/include/svx/xit.hxx
+++ b/include/svx/xit.hxx
@@ -17,47 +17,55 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVX_XIT_HXX
-#define INCLUDED_SVX_XIT_HXX
+#pragma once
 
 #include <svl/stritem.hxx>
 #include <svx/xtable.hxx>
 #include <svx/svxdllapi.h>
 #include <unotools/resmgr.hxx>
 
-/************************************************************************/
-
 class SfxItemPool;
 class NameOrIndex;
 
-typedef bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* 
p2 );
-
-
+typedef std::function<bool(const NameOrIndex*, const NameOrIndex*)> 
SvxCompareValueFunc;
 
 class SVXCORE_DLLPUBLIC NameOrIndex : public SfxStringItem
 {
-    sal_Int32    m_nPalIndex;
+    sal_Int32 m_nPalIndex;
 
 protected:
-    void    Detach()    { m_nPalIndex = -1; }
+    void Detach()
+    {
+        m_nPalIndex = -1;
+    }
 
 public:
-            DECLARE_ITEM_TYPE_FUNCTION(NameOrIndex)
-            NameOrIndex() : SfxStringItem(0) { m_nPalIndex = -1; }
-            NameOrIndex(TypedWhichId<NameOrIndex> nWhich, sal_Int32 nIndex);
-            NameOrIndex(TypedWhichId<NameOrIndex> nWhich, const OUString& 
rName);
-            NameOrIndex(const NameOrIndex& rNameOrIndex);
+    DECLARE_ITEM_TYPE_FUNCTION(NameOrIndex)
+    NameOrIndex();
+    NameOrIndex(TypedWhichId<NameOrIndex> nWhich, sal_Int32 nIndex);
+    NameOrIndex(TypedWhichId<NameOrIndex> nWhich, const OUString& rName);
+    NameOrIndex(const NameOrIndex& rNameOrIndex);
 
-    virtual bool         operator==(const SfxPoolItem& rItem) const override;
+    virtual bool operator==(const SfxPoolItem& rItem) const override;
     virtual NameOrIndex* Clone(SfxItemPool* pPool = nullptr) const override;
+
     // Marked as false since the SfxStringItem superclass supports hashing, but
     // this class has not been checked for safety under hashing yet.
-    virtual bool         supportsHashCode() const override { return false; }
-
-            OUString const & GetName() const              { return GetValue(); 
  }
-            void         SetName(const OUString& rName) { SetValue(rName);     
}
-            bool         IsIndex() const          { return (m_nPalIndex >= 0); 
}
-            sal_Int32    GetPalIndex() const { return m_nPalIndex; }
+    virtual bool supportsHashCode() const override { return false; }
+
+    OUString const & GetName() const
+    {
+        return GetValue();
+    }
+    void SetName(const OUString& rName)
+    {
+        SetValue(rName);
+    }
+    bool IsIndex() const
+    {
+        return (m_nPalIndex >= 0);
+    }
+    sal_Int32 GetPalIndex() const { return m_nPalIndex; }
 
     /** this checks if the given NameOrIndex item has a unique name for its 
value.
         The returned String is a unique name for an item with this value in 
both given pools.
@@ -68,6 +76,4 @@ public:
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 9abb2ad79755..f5fa68bc3e88 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -98,6 +98,12 @@ using namespace ::com::sun::star;
 
 typedef std::map<OUString, OUString> StringMap;
 
+NameOrIndex::NameOrIndex()
+    : SfxStringItem(0)
+{
+    m_nPalIndex = -1;
+}
+
 NameOrIndex::NameOrIndex(TypedWhichId<NameOrIndex> _nWhich, sal_Int32 nIndex) :
     SfxStringItem(_nWhich, OUString()),
     m_nPalIndex(nIndex)
@@ -272,15 +278,19 @@ void NameOrIndex::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 
 SfxPoolItem* XColorItem::CreateDefault() { return new XColorItem(); }
 
-XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, sal_Int32 nIndex, 
const Color& rTheColor) :
-    NameOrIndex(_nWhich, nIndex),
-    m_aColor(rTheColor)
+XColorItem::XColorItem()
+    : NameOrIndex()
+{}
+
+XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, sal_Int32 nIndex, 
const Color& rTheColor)
+    : NameOrIndex(_nWhich, nIndex)
+    , m_aColor(rTheColor)
 {
 }
 
-XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, const OUString& 
rName, const Color& rTheColor) :
-    NameOrIndex(_nWhich, rName),
-    m_aColor(rTheColor)
+XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, const OUString& 
rName, const Color& rTheColor)
+    : NameOrIndex(_nWhich, rName)
+    , m_aColor(rTheColor)
 {
 }
 
@@ -290,10 +300,10 @@ XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, 
const Color& rTheColor)
 {
 }
 
-XColorItem::XColorItem(const XColorItem& rItem) :
-    NameOrIndex(rItem),
-    m_aColor(rItem.m_aColor),
-    maComplexColor(rItem.maComplexColor)
+XColorItem::XColorItem(const XColorItem& rItem)
+    : NameOrIndex(rItem)
+    , m_aColor(rItem.m_aColor)
+    , maComplexColor(rItem.maComplexColor)
 {
 }
 
@@ -309,13 +319,19 @@ bool XColorItem::operator==(const SfxPoolItem& rItem) 
const
             static_cast<const XColorItem&>(rItem).maComplexColor == 
maComplexColor;
 }
 
-const Color& XColorItem::GetColorValue() const
+Color const& XColorItem::GetColorValue() const
 {
     assert(!IsIndex());
     return m_aColor;
 
 }
 
+void XColorItem::SetColorValue(const Color& rNew)
+{
+    m_aColor = rNew;
+    Detach();
+}
+
 bool XColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId) const
 {
     nMemberId &= ~CONVERT_TWIPS;
@@ -1811,13 +1827,17 @@ boost::property_tree::ptree 
XFillStyleItem::dumpAsJSON() const
 
 SfxPoolItem* XFillColorItem::CreateDefault() { return new XFillColorItem; }
 
-XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
-    XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
+XFillColorItem::XFillColorItem()
+    : XColorItem()
+{}
+
+XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor)
+    : XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
 {
 }
 
-XFillColorItem::XFillColorItem(const OUString& rName, const Color& rTheColor) :
-    XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
+XFillColorItem::XFillColorItem(const OUString& rName, const Color& rTheColor)
+    : XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
 {
 }
 
@@ -1826,13 +1846,8 @@ XFillColorItem* XFillColorItem::Clone(SfxItemPool* 
/*pPool*/) const
     return new XFillColorItem(*this);
 }
 
-bool XFillColorItem::GetPresentation
-(
-    SfxItemPresentation /*ePres*/,
-    MapUnit             /*eCoreUnit*/,
-    MapUnit             /*ePresUnit*/,
-    OUString&           rText, const IntlWrapper&
-)   const
+bool XFillColorItem::GetPresentation(SfxItemPresentation /*ePres*/, MapUnit 
/*eCoreUnit*/, MapUnit /*ePresUnit*/,
+                                     OUString& rText, const IntlWrapper& 
/*rWrapper*/) const
 {
     rText = GetName();
     return true;
commit 33def3b38a48b976640dc56ca954b58678cc8ca2
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Sat Dec 6 22:00:05 2025 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sat Feb 21 11:50:27 2026 +0100

    docmodel: add ComplexColor.cxx and move function definitions there
    
    No need to be a template only class.
    
    Change-Id: I3d73fe18443662205967ce5904233a93d7785164
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195166
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199913
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/docmodel/Library_docmodel.mk b/docmodel/Library_docmodel.mk
index 1de5c254a110..01e63c4b7e48 100644
--- a/docmodel/Library_docmodel.mk
+++ b/docmodel/Library_docmodel.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_Library_add_exception_objects,docmodel,\
     docmodel/source/theme/ColorSet \
     docmodel/source/theme/Theme \
     docmodel/source/color/ComplexColorJSON \
+    docmodel/source/color/ComplexColor \
     docmodel/source/styles/ChartStyle \
     docmodel/source/styles/ChartColorStyle \
 ))
diff --git a/docmodel/source/color/ComplexColor.cxx 
b/docmodel/source/color/ComplexColor.cxx
new file mode 100644
index 000000000000..4b957abad991
--- /dev/null
+++ b/docmodel/source/color/ComplexColor.cxx
@@ -0,0 +1,176 @@
+/* -*- 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/color/ComplexColor.hxx>
+#include <sal/log.hxx>
+#include <tools/color.hxx>
+#include <docmodel/theme/ThemeColorType.hxx>
+#include <docmodel/color/Transformation.hxx>
+#include <o3tl/hash_combine.hxx>
+
+namespace model
+{
+void ComplexColor::addTransformation(Transformation const& rTransform)
+{
+    maTransformations.push_back(rTransform);
+}
+
+void ComplexColor::removeTransformations(TransformationType eType)
+{
+    std::erase_if(maTransformations,
+                  [eType](Transformation const& rTransform) { return 
rTransform.meType == eType; });
+}
+
+void ComplexColor::setCRGB(sal_Int32 nR, sal_Int32 nG, sal_Int32 nB)
+{
+    mnComponent1 = nR;
+    mnComponent2 = nG;
+    mnComponent3 = nB;
+    meType = ColorType::CRGB;
+}
+
+void ComplexColor::setRGB(double r, double g, double b)
+{
+    mnComponent1 = r;
+    mnComponent2 = g;
+    mnComponent3 = b;
+    maFinalColor = ::Color(sal_Int8(r), sal_Int8(g), sal_Int8(b));
+    meType = ColorType::RGB;
+}
+
+void ComplexColor::getRGB(double& r, double& g, double& b)
+{
+    if (meType != ColorType::RGB)
+        return;
+    r = mnComponent1;
+    g = mnComponent2;
+    b = mnComponent3;
+}
+
+Color ComplexColor::getRGB() const { return Color(mnComponent1, mnComponent2, 
mnComponent3); }
+
+void ComplexColor::setColor(Color const& rColor)
+{
+    mnComponent1 = rColor.GetRed();
+    mnComponent2 = rColor.GetGreen();
+    mnComponent3 = rColor.GetBlue();
+    maFinalColor = rColor;
+    meType = ColorType::RGB;
+}
+
+void ComplexColor::setRGB(sal_Int32 nRGB)
+{
+    ::Color aColor(ColorTransparency, nRGB);
+    setColor(aColor);
+}
+
+void ComplexColor::setHSL(sal_Int32 nH, sal_Int32 nS, sal_Int32 nL)
+{
+    mnComponent1 = nH;
+    mnComponent2 = nS;
+    mnComponent3 = nL;
+    meType = ColorType::HSL;
+}
+
+void ComplexColor::setSystemColor(SystemColorType eSystemColorType, sal_Int32 
nRGB)
+{
+    maLastColor = ::Color(ColorTransparency, nRGB);
+    meSystemColorType = eSystemColorType;
+    meType = ColorType::System;
+}
+
+bool ComplexColor::isOpaque() const
+{
+    for (const Transformation& t : maTransformations)
+    {
+        if (t.meType == model::TransformationType::Alpha && t.mnValue != 10000)
+        {
+            return false;
+        }
+    }
+    return true;
+}
+
+bool ComplexColor::isTransparent() const
+{
+    for (const Transformation& t : maTransformations)
+    {
+        if (t.meType == model::TransformationType::Alpha && t.mnValue == 0)
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+void ComplexColor::setThemeColor(ThemeColorType eType)
+{
+    meThemeColorType = eType;
+    meType = ColorType::Theme;
+}
+
+bool ComplexColor::operator==(const ComplexColor& rComplexColor) const
+{
+    return meType == rComplexColor.meType && mnComponent1 == 
rComplexColor.mnComponent1
+           && mnComponent2 == rComplexColor.mnComponent2
+           && mnComponent3 == rComplexColor.mnComponent3
+           && meSystemColorType == rComplexColor.meSystemColorType
+           && maLastColor == rComplexColor.maLastColor
+           && meThemeColorType == rComplexColor.meThemeColorType
+           && maTransformations.size() == 
rComplexColor.maTransformations.size()
+           && std::equal(maTransformations.begin(), maTransformations.end(),
+                         rComplexColor.maTransformations.begin());
+}
+
+Color ComplexColor::applyTransformations(Color const& rColor) const
+{
+    Color aColor(rColor);
+
+    for (auto const& rTransform : maTransformations)
+    {
+        switch (rTransform.meType)
+        {
+            case TransformationType::Tint:
+                aColor.ApplyTintOrShade(rTransform.mnValue);
+                break;
+            case TransformationType::Shade:
+                aColor.ApplyTintOrShade(-rTransform.mnValue);
+                break;
+            case TransformationType::LumMod:
+                aColor.ApplyLumModOff(rTransform.mnValue, 0);
+                break;
+            case TransformationType::LumOff:
+                aColor.ApplyLumModOff(10000, rTransform.mnValue);
+                break;
+            default:
+                break;
+        }
+    }
+    return aColor;
+}
+
+std::size_t ComplexColor::getHash() const
+{
+    std::size_t seed = 0;
+    o3tl::hash_combine(seed, meType);
+    o3tl::hash_combine(seed, mnComponent1);
+    o3tl::hash_combine(seed, mnComponent2);
+    o3tl::hash_combine(seed, mnComponent3);
+    o3tl::hash_combine(seed, meSystemColorType);
+    o3tl::hash_combine(seed, sal_uInt32(maLastColor));
+    for (auto const& rTransform : maTransformations)
+        o3tl::hash_combine(seed, rTransform);
+    o3tl::hash_combine(seed, sal_uInt32(maFinalColor));
+    return seed;
+}
+
+} // end of namespace model
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/docmodel/color/ComplexColor.hxx 
b/include/docmodel/color/ComplexColor.hxx
index e57530936bda..0333b128fadf 100644
--- a/include/docmodel/color/ComplexColor.hxx
+++ b/include/docmodel/color/ComplexColor.hxx
@@ -142,17 +142,9 @@ public:
         maTransformations = rTransformations;
     }
 
-    void addTransformation(Transformation const& rTransform)
-    {
-        maTransformations.push_back(rTransform);
-    }
+    void addTransformation(Transformation const& rTransform);
 
-    void removeTransformations(TransformationType eType)
-    {
-        std::erase_if(maTransformations, [eType](Transformation const& 
rTransform) {
-            return rTransform.meType == eType;
-        });
-    }
+    void removeTransformations(TransformationType eType);
 
     void clearTransformations() { maTransformations.clear(); }
 
@@ -160,137 +152,40 @@ public:
     double getGreen() const { return mnComponent2; }
     double getBlue() const { return mnComponent3; }
 
-    void setCRGB(sal_Int32 nR, sal_Int32 nG, sal_Int32 nB)
-    {
-        mnComponent1 = nR;
-        mnComponent2 = nG;
-        mnComponent3 = nB;
-        meType = ColorType::CRGB;
-    }
+    void setCRGB(sal_Int32 nR, sal_Int32 nG, sal_Int32 nB);
 
-    Color getRGB() const { return Color(mnComponent1, mnComponent2, 
mnComponent3); }
+    void setRGB(double r, double g, double b);
 
-    void setColor(Color const& rColor)
-    {
-        mnComponent1 = rColor.GetRed();
-        mnComponent2 = rColor.GetGreen();
-        mnComponent3 = rColor.GetBlue();
-        maFinalColor = rColor;
-        meType = ColorType::RGB;
-    }
+    void getRGB(double& r, double& g, double& b);
 
-    void setRGB(sal_Int32 nRGB)
-    {
-        ::Color aColor(ColorTransparency, nRGB);
-        setColor(aColor);
-    }
+    Color getRGB() const;
 
-    void setHSL(sal_Int32 nH, sal_Int32 nS, sal_Int32 nL)
-    {
-        mnComponent1 = nH;
-        mnComponent2 = nS;
-        mnComponent3 = nL;
-        meType = ColorType::HSL;
-    }
+    void setColor(Color const& rColor);
 
-    void setSystemColor(SystemColorType eSystemColorType, sal_Int32 nRGB)
-    {
-        maLastColor = ::Color(ColorTransparency, nRGB);
-        meSystemColorType = eSystemColorType;
-        meType = ColorType::System;
-    }
+    void setRGB(sal_Int32 nRGB);
 
-    bool isOpaque() const
-    {
-        for (const Transformation& t : maTransformations)
-        {
-            if (t.meType == model::TransformationType::Alpha && t.mnValue != 
10000)
-            {
-                return false;
-            }
-        }
-        return true;
-    }
+    void setHSL(sal_Int32 nH, sal_Int32 nS, sal_Int32 nL);
 
-    bool isTransparent() const
-    {
-        for (const Transformation& t : maTransformations)
-        {
-            if (t.meType == model::TransformationType::Alpha && t.mnValue == 0)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
+    void setSystemColor(SystemColorType eSystemColorType, sal_Int32 nRGB);
+
+    bool isOpaque() const;
+
+    bool isTransparent() const;
 
     void setThemePlaceholder() { meType = ColorType::Placeholder; }
 
-    void setThemeColor(ThemeColorType eType)
-    {
-        meThemeColorType = eType;
-        meType = ColorType::Theme;
-    }
+    void setThemeColor(ThemeColorType eType);
 
-    bool operator==(const ComplexColor& rComplexColor) const
-    {
-        return meType == rComplexColor.meType && mnComponent1 == 
rComplexColor.mnComponent1
-               && mnComponent2 == rComplexColor.mnComponent2
-               && mnComponent3 == rComplexColor.mnComponent3
-               && meSystemColorType == rComplexColor.meSystemColorType
-               && maLastColor == rComplexColor.maLastColor
-               && meThemeColorType == rComplexColor.meThemeColorType
-               && maTransformations.size() == 
rComplexColor.maTransformations.size()
-               && std::equal(maTransformations.begin(), 
maTransformations.end(),
-                             rComplexColor.maTransformations.begin());
-    }
+    bool operator==(const ComplexColor& rComplexColor) const;
 
     /** Applies the defined transformations to the input color */
-    Color applyTransformations(Color const& rColor) const
-    {
-        Color aColor(rColor);
-
-        for (auto const& rTransform : maTransformations)
-        {
-            switch (rTransform.meType)
-            {
-                case TransformationType::Tint:
-                    aColor.ApplyTintOrShade(rTransform.mnValue);
-                    break;
-                case TransformationType::Shade:
-                    aColor.ApplyTintOrShade(-rTransform.mnValue);
-                    break;
-                case TransformationType::LumMod:
-                    aColor.ApplyLumModOff(rTransform.mnValue, 0);
-                    break;
-                case TransformationType::LumOff:
-                    aColor.ApplyLumModOff(10000, rTransform.mnValue);
-                    break;
-                default:
-                    break;
-            }
-        }
-        return aColor;
-    }
+    Color applyTransformations(Color const& rColor) const;
 
     void setFinalColor(Color const& rColor) { maFinalColor = rColor; }
 
     Color const& getFinalColor() const { return maFinalColor; }
 
-    std::size_t getHash() const
-    {
-        std::size_t seed = 0;
-        o3tl::hash_combine(seed, meType);
-        o3tl::hash_combine(seed, mnComponent1);
-        o3tl::hash_combine(seed, mnComponent2);
-        o3tl::hash_combine(seed, mnComponent3);
-        o3tl::hash_combine(seed, meSystemColorType);
-        o3tl::hash_combine(seed, sal_uInt32(maLastColor));
-        for (auto const& rTransform : maTransformations)
-            o3tl::hash_combine(seed, rTransform);
-        o3tl::hash_combine(seed, sal_uInt32(maFinalColor));
-        return seed;
-    }
+    std::size_t getHash() const;
 
     static model::ComplexColor createRGB(Color const& rColor)
     {

Reply via email to