chart2/source/controller/sidebar/ChartColorWrapper.cxx |    2 
 chart2/source/controller/sidebar/ChartColorWrapper.hxx |    2 
 cui/source/inc/cuitabarea.hxx                          |    4 -
 cui/source/tabpages/chardlg.cxx                        |    2 
 cui/source/tabpages/tpcolor.cxx                        |   22 +++++-----
 include/svx/Palette.hxx                                |   23 +----------
 include/svx/PaletteManager.hxx                         |    2 
 include/svx/colorbox.hxx                               |   10 ++--
 include/svx/tbcontrl.hxx                               |    2 
 reportdesign/source/ui/dlg/Condition.cxx               |    4 -
 reportdesign/source/ui/dlg/Condition.hxx               |    2 
 svx/source/tbxctrls/Palette.cxx                        |   13 ------
 svx/source/tbxctrls/PaletteManager.cxx                 |    4 -
 svx/source/tbxctrls/tbcontrl.cxx                       |   35 ++++++++---------
 14 files changed, 49 insertions(+), 78 deletions(-)

New commits:
commit e538b0b10dea838ca7cf6329e67dc715bc6cf5ba
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon May 22 14:35:19 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Thu Jun 1 17:58:34 2023 +0200

    svx: combine svx::NamedThemedColor into NamedColor
    
    Change-Id: I9a9656ddce9c12564411cfcb3e8e8714ae74a418
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152236
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit 9a4b768b0a22bd3ae627c7355bbd223b9cf65015)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152265
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx 
b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
index fc2f8b79839b..bbaf95c56e7d 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
@@ -87,7 +87,7 @@ ChartColorWrapper::ChartColorWrapper(
 {
 }
 
-void ChartColorWrapper::operator()([[maybe_unused]] const OUString& , const 
svx::NamedThemedColor& rColor)
+void ChartColorWrapper::operator()([[maybe_unused]] const OUString& , const 
NamedColor& rColor)
 {
     css::uno::Reference<css::beans::XPropertySet> xPropSet = 
getPropSet(mxModel);
 
diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.hxx 
b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
index c4d30a8a314c..6894726768d0 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.hxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.hxx
@@ -28,7 +28,7 @@ public:
             SvxColorToolBoxControl* pControl,
             OUString  rPropertyName);
 
-    void operator()(const OUString& rCommand, const svx::NamedThemedColor& 
rColor);
+    void operator()(const OUString& rCommand, const NamedColor& rColor);
         // ColorSelectFunction signature
 
     void updateModel(const rtl::Reference<::chart::ChartModel>& xModel);
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index b05ce7af425f..bc2d968f2443 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -658,7 +658,7 @@ private:
     ColorModel          eCM;
 
     Color               aPreviousColor;
-    svx::NamedThemedColor aCurrentColor;
+    NamedColor aCurrentColor;
 
     PaletteManager maPaletteManager;
     SvxXRectPreview m_aCtlPreviewOld;
@@ -714,7 +714,7 @@ private:
     DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
     DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
     DECL_LINK( SelectColorModeHdl_Impl, weld::Toggleable&, void );
-    void ChangeColor(const svx::NamedThemedColor &rNewColor, bool 
bUpdatePreset = true);
+    void ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset = true);
     void SetColorModel(ColorModel eModel);
     void ChangeColorModel();
     void UpdateColorValues( bool bUpdatePreset = true );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 438a9ac37cbf..46dd3ded5e6f 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1572,7 +1572,7 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( 
SfxItemSet& rSet )
     sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
     const SfxItemSet& rOldSet = GetItemSet();
 
-    svx::NamedThemedColor aSelectedColor;
+    NamedColor aSelectedColor;
     bool bChanged = m_bNewFontColor;
 
     if (bChanged)
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 50019764830f..fd458ee9b08f 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -210,9 +210,9 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& )
         ChangeColorModel();
 
         const Color aColor = pFillColorItem->GetColorValue();
-        svx::NamedThemedColor aThemedColor;
-        aThemedColor.m_aColor = aColor;
-        ChangeColor( aThemedColor );
+        NamedColor aNamedColor;
+        aNamedColor.m_aColor = aColor;
+        ChangeColor(aNamedColor);
         sal_Int32 nPos = FindInPalette( aColor );
 
         if ( nPos != -1 )
@@ -289,9 +289,9 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet )
     SetColorModel( eCM );
     ChangeColorModel();
 
-    svx::NamedThemedColor aThemedColor;
-    aThemedColor.m_aColor = aNewColor;
-    ChangeColor(aThemedColor);
+    NamedColor aColor;
+    aColor.m_aColor = aNewColor;
+    ChangeColor(aColor);
 
     UpdateModified();
 }
@@ -519,14 +519,14 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, 
ValueSet*, pValSet, void)
     {
         bThemePaletteSelected = maPaletteManager.IsThemePaletteSelected();
     }
-    svx::NamedThemedColor aThemedColor;
-    aThemedColor.m_aColor = aColor;
+    NamedColor aNamedColor;
+    aNamedColor.m_aColor = aColor;
     if (bThemePaletteSelected)
     {
-        PaletteManager::GetThemeIndexLumModOff(nPos, 
aThemedColor.m_nThemeIndex, aThemedColor.m_nLumMod, aThemedColor.m_nLumOff);
+        PaletteManager::GetThemeIndexLumModOff(nPos, 
aNamedColor.m_nThemeIndex, aNamedColor.m_nLumMod, aNamedColor.m_nLumOff);
     }
 
-    ChangeColor(aThemedColor, false);
+    ChangeColor(aNamedColor, false);
 
     if (pValSet == m_xValSetColorList.get())
     {
@@ -589,7 +589,7 @@ IMPL_STATIC_LINK_NOARG(SvxColorTabPage, OnMoreColorsClick, 
weld::Button&, void)
     comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs);
 }
 
-void SvxColorTabPage::ChangeColor(const svx::NamedThemedColor &rNewColor, bool 
bUpdatePreset )
+void SvxColorTabPage::ChangeColor(const NamedColor &rNewColor, bool 
bUpdatePreset )
 {
     aPreviousColor = rNewColor.m_aColor;
     aCurrentColor = rNewColor;
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index 8965138c7831..ebdcb63a1377 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -33,6 +33,9 @@ struct SVXCORE_DLLPUBLIC NamedColor
 {
     Color m_aColor;
     OUString m_aName;
+    sal_Int16 m_nThemeIndex = -1;
+    sal_Int16 m_nLumMod = 10000;
+    sal_Int16 m_nLumOff = 0;
 
     NamedColor() = default;
 
@@ -42,25 +45,7 @@ struct SVXCORE_DLLPUBLIC NamedColor
     {}
 };
 
-namespace svx
-{
-
-/// A color with an optional name and other theming-related properties.
-struct SVXCORE_DLLPUBLIC NamedThemedColor
-{
-    Color m_aColor;
-    OUString m_aName;
-    sal_Int16 m_nThemeIndex = -1;
-    sal_Int16 m_nLumMod = 10000;
-    sal_Int16 m_nLumOff = 0;
-
-    static NamedThemedColor FromNamedColor(const NamedColor& rNamedColor);
-
-    NamedColor ToNamedColor() const;
-};
-}
-
-typedef std::function<void(const OUString&, const svx::NamedThemedColor&)> 
ColorSelectFunction;
+typedef std::function<void(const OUString&, const NamedColor&)> 
ColorSelectFunction;
 
 class Palette
 {
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index a21961ecd0ec..c6d1712a12f4 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -82,7 +82,7 @@ public:
     static void GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& 
rThemeIndex,
                                        sal_Int16& rLumMod, sal_Int16& rLumOff);
 
-    static void DispatchColorCommand(const OUString& aCommand, const 
svx::NamedThemedColor& rColor);
+    static void DispatchColorCommand(const OUString& aCommand, const 
NamedColor& rColor);
 };
 
 #endif // INCLUDED_SVX_PALETTEMANAGER_HXX
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
index 2705833ee37d..319f3314c12f 100644
--- a/include/svx/colorbox.hxx
+++ b/include/svx/colorbox.hxx
@@ -21,7 +21,7 @@ class ListBoxColorWrapper
 public:
     ListBoxColorWrapper(ColorListBox* pControl);
     void operator()(const OUString& rCommand,
-                    const svx::NamedThemedColor& rColor); // 
ColorSelectFunction signature
+                    const NamedColor& rColor); // ColorSelectFunction signature
 private:
     ColorListBox* mpControl;
 };
@@ -36,14 +36,14 @@ private:
     ListBoxColorWrapper m_aColorWrapper;
     Color m_aAutoDisplayColor;
     Color m_aSaveColor;
-    svx::NamedThemedColor m_aSelectedColor;
+    NamedColor m_aSelectedColor;
     sal_uInt16 m_nSlotId;
     bool m_bShowNoneButton;
     std::shared_ptr<PaletteManager> m_xPaletteManager;
     TopLevelParentFunction m_aTopLevelParentFunction;
     ColorStatus m_aColorStatus;
 
-    void Selected(const svx::NamedThemedColor& rNamedColor);
+    void Selected(const NamedColor& rNamedColor);
     void createColorWindow();
     void LockWidthRequest(int nWidthRequest);
     int CalcBestWidthRequest();
@@ -63,8 +63,8 @@ public:
     void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false);
 
     Color const& GetSelectEntryColor() const { return 
m_aSelectedColor.m_aColor; }
-    NamedColor GetSelectedEntry() const { return 
m_aSelectedColor.ToNamedColor(); }
-    const svx::NamedThemedColor& GetSelectedEntryThemedColor() const { return 
m_aSelectedColor; }
+    NamedColor GetSelectedEntry() const { return m_aSelectedColor; }
+    const NamedColor& GetSelectedEntryThemedColor() const { return 
m_aSelectedColor; }
 
     void SelectEntry(const NamedColor& rColor);
     void SelectEntry(const Color& rColor);
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 194db28a51f0..8347e3b9df1e 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -200,7 +200,7 @@ friend class SfxStyleControllerItem_Impl;
     SfxStyleFamily GetActFamily() const;
 };
 
-typedef std::function<void(const OUString&, const svx::NamedThemedColor&)> 
ColorSelectFunction;
+typedef std::function<void(const OUString&, const NamedColor&)> 
ColorSelectFunction;
 
 class SVXCORE_DLLPUBLIC SvxColorToolBoxControl final : public 
cppu::ImplInheritanceHelper< svt::PopupWindowController,
                                                                                
  css::frame::XSubToolbarController >
diff --git a/reportdesign/source/ui/dlg/Condition.cxx 
b/reportdesign/source/ui/dlg/Condition.cxx
index e3a48258637f..2a4d5ff2ed89 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -74,9 +74,9 @@ ConditionColorWrapper::ConditionColorWrapper(Condition* 
pControl, sal_uInt16 nSl
 }
 
 void ConditionColorWrapper::operator()(
-    [[maybe_unused]] const OUString& /*rCommand*/, const 
svx::NamedThemedColor& rNamedColor)
+    [[maybe_unused]] const OUString& /*rCommand*/, const NamedColor& 
rNamedColor)
 {
-    mpControl->ApplyCommand(mnSlotId, rNamedColor.ToNamedColor());
+    mpControl->ApplyCommand(mnSlotId, rNamedColor);
 }
 
 // = Condition
diff --git a/reportdesign/source/ui/dlg/Condition.hxx 
b/reportdesign/source/ui/dlg/Condition.hxx
index 2e25d343d1b9..02d26921bc62 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -58,7 +58,7 @@ namespace rptui
     {
     public:
         ConditionColorWrapper(Condition* pControl, sal_uInt16 nSlotId);
-        void operator()(const OUString& rCommand, const svx::NamedThemedColor& 
rColor);
+        void operator()(const OUString& rCommand, const NamedColor& rColor);
             // ColorSelectFunction signature
     private:
         Condition* mpControl;
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index 5c21062f7a6a..8c81eb53167e 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -377,17 +377,4 @@ Palette* PaletteSOC::Clone() const
     return new PaletteSOC(*this);
 }
 
-namespace svx
-{
-NamedColor NamedThemedColor::ToNamedColor() const { return { m_aColor, m_aName 
}; }
-
-NamedThemedColor NamedThemedColor::FromNamedColor(const NamedColor& 
rNamedColor)
-{
-    NamedThemedColor aColor;
-    aColor.m_aColor = rNamedColor.m_aColor;
-    aColor.m_aName = rNamedColor.m_aName;
-    return aColor;
-}
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index be5c65461910..5f0c83fb6bf3 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -418,12 +418,12 @@ void PaletteManager::PopupColorPicker(weld::Window* 
pParent, const OUString& aCo
             if (mpBtnUpdater)
                 mpBtnUpdater->Update(aNamedColor);
             AddRecentColor(aLastColor, sColorName);
-            maColorSelectFunction(aCommandCopy, 
svx::NamedThemedColor::FromNamedColor(aNamedColor));
+            maColorSelectFunction(aCommandCopy, aNamedColor);
         }
     });
 }
 
-void PaletteManager::DispatchColorCommand(const OUString& aCommand, const 
svx::NamedThemedColor& rColor)
+void PaletteManager::DispatchColorCommand(const OUString& aCommand, const 
NamedColor& rColor)
 {
     using namespace css;
     using namespace css::uno;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index cbf02496b701..871fddcc8748 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2233,14 +2233,13 @@ IMPL_LINK(ColorWindow, SelectHdl, ValueSet*, pColorSet, 
void)
 
     maMenuButton.set_inactive();
 
-    auto aNamedThemedColor = 
svx::NamedThemedColor::FromNamedColor(aNamedColor);
     if (bThemePaletteSelected)
     {
-        PaletteManager::GetThemeIndexLumModOff(nSelectedItemId, 
aNamedThemedColor.m_nThemeIndex,
-                                               aNamedThemedColor.m_nLumMod,
-                                               aNamedThemedColor.m_nLumOff);
+        PaletteManager::GetThemeIndexLumModOff(nSelectedItemId, 
aNamedColor.m_nThemeIndex,
+                                               aNamedColor.m_nLumMod,
+                                               aNamedColor.m_nLumOff);
     }
-    aColorSelectFunction(sCommand, aNamedThemedColor);
+    aColorSelectFunction(sCommand, aNamedColor);
 }
 
 IMPL_LINK_NOARG(ColorWindow, SelectPaletteHdl, weld::ComboBox&, void)
@@ -2273,7 +2272,7 @@ IMPL_LINK(ColorWindow, AutoColorClickHdl, weld::Button&, 
rButton, void)
 
     maMenuButton.set_inactive();
 
-    aColorSelectFunction(sCommand, 
svx::NamedThemedColor::FromNamedColor(aNamedColor));
+    aColorSelectFunction(sCommand, aNamedColor);
 }
 
 IMPL_LINK_NOARG(ColorWindow, OpenPickerClickHdl, weld::Button&, void)
@@ -4205,7 +4204,7 @@ ListBoxColorWrapper::ListBoxColorWrapper(ColorListBox* 
pControl)
 }
 
 void ListBoxColorWrapper::operator()(
-    [[maybe_unused]] const OUString& /*rCommand*/, const 
svx::NamedThemedColor& rColor)
+    [[maybe_unused]] const OUString& /*rCommand*/, const NamedColor& rColor)
 {
     mpControl->Selected(rColor);
 }
@@ -4225,8 +4224,8 @@ void ColorListBox::SetSlotId(sal_uInt16 nSlotId, bool 
bShowNoneButton)
     m_bShowNoneButton = bShowNoneButton;
     m_xButton->set_popover(nullptr);
     m_xColorWindow.reset();
-    m_aSelectedColor = svx::NamedThemedColor::FromNamedColor(bShowNoneButton ? 
GetNoneColor() : GetAutoColor(m_nSlotId));
-    ShowPreview(m_aSelectedColor.ToNamedColor());
+    m_aSelectedColor = bShowNoneButton ? GetNoneColor() : 
GetAutoColor(m_nSlotId);
+    ShowPreview(m_aSelectedColor);
     createColorWindow();
 }
 
@@ -4241,7 +4240,7 @@ 
ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl,
     , m_aTopLevelParentFunction(std::move(aTopLevelParentFunction))
 {
     m_xButton->connect_toggled(LINK(this, ColorListBox, ToggleHdl));
-    m_aSelectedColor = 
svx::NamedThemedColor::FromNamedColor(GetAutoColor(m_nSlotId));
+    m_aSelectedColor = GetAutoColor(m_nSlotId);
     if (!pCache)
         LockWidthRequest(CalcBestWidthRequest());
     else
@@ -4250,7 +4249,7 @@ 
ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl,
         m_xPaletteManager.reset(pCache->m_xPaletteManager->Clone());
         m_xPaletteManager->SetColorSelectFunction(std::ref(m_aColorWrapper));
     }
-    ShowPreview(m_aSelectedColor.ToNamedColor());
+    ShowPreview(m_aSelectedColor);
 }
 
 IMPL_LINK(ColorListBox, ToggleHdl, weld::Toggleable&, rButton, void)
@@ -4296,7 +4295,7 @@ void ColorListBox::createColorWindow()
     m_xButton->set_popover(m_xColorWindow->getTopLevel());
     if (m_bShowNoneButton)
         m_xColorWindow->ShowNoneButton();
-    m_xColorWindow->SelectEntry(m_aSelectedColor.ToNamedColor());
+    m_xColorWindow->SelectEntry(m_aSelectedColor);
 }
 
 void ColorListBox::SelectEntry(const NamedColor& rColor)
@@ -4308,21 +4307,21 @@ void ColorListBox::SelectEntry(const NamedColor& rColor)
     }
     ColorWindow* pColorWindow = getColorWindow();
     pColorWindow->SelectEntry(rColor);
-    m_aSelectedColor = 
svx::NamedThemedColor::FromNamedColor(pColorWindow->GetSelectEntryColor());
-    ShowPreview(m_aSelectedColor.ToNamedColor());
+    m_aSelectedColor = pColorWindow->GetSelectEntryColor();
+    ShowPreview(m_aSelectedColor);
 }
 
 void ColorListBox::SelectEntry(const Color& rColor)
 {
     ColorWindow* pColorWindow = getColorWindow();
     pColorWindow->SelectEntry(rColor);
-    m_aSelectedColor = 
svx::NamedThemedColor::FromNamedColor(pColorWindow->GetSelectEntryColor());
-    ShowPreview(m_aSelectedColor.ToNamedColor());
+    m_aSelectedColor = pColorWindow->GetSelectEntryColor();
+    ShowPreview(m_aSelectedColor);
 }
 
-void ColorListBox::Selected(const svx::NamedThemedColor& rColor)
+void ColorListBox::Selected(const NamedColor& rColor)
 {
-    ShowPreview(rColor.ToNamedColor());
+    ShowPreview(rColor);
     m_aSelectedColor = rColor;
     if (m_aSelectedLink.IsSet())
         m_aSelectedLink.Call(*this);

Reply via email to