summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2023-07-02 17:31:38 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2023-07-04 20:26:42 +0200
commit8ffb8e164d9d350a1b9887d0a75e0a82892008ee (patch)
tree1c96a2bc6d226d4a0b48db1f66da24ca1adaf278 /include/svx
parent203476b6676505acafd1c41561800afd9316a0f6 (diff)
tdf#154270 Sync toolbar button recent colors
As the last used color is stored per button instance, these will go out of sync with several buttons being visible (e.g. a toolbar and a sidebar, or a toolbar overflow popup), and will reset whenever the toolbar resets (e.g. change in selection, switch from print preview, or customization). Fix that by storing the last colors per-document, and notifying other buttons on changes. Keep the last color also stored per-button for now, as a fallback for reportdesign (which isn't sfx2 based). Change-Id: I866f1de5c8ff6f56c47dc4b6b5acf52957d4e6c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153943 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/Palette.hxx46
-rw-r--r--include/svx/PaletteManager.hxx1
-rw-r--r--include/svx/colorwindow.hxx3
-rw-r--r--include/svx/tbcontrl.hxx1
4 files changed, 2 insertions, 49 deletions
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index 4858b47140c4..5bf63762b75c 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -20,56 +20,12 @@
#pragma once
#include <sal/config.h>
+#include <sfx2/namedcolor.hxx>
#include <functional>
-#include <rtl/ustring.hxx>
-#include <tools/color.hxx>
-#include <svx/svxdllapi.h>
-
-#include <docmodel/color/ComplexColor.hxx>
-#include <docmodel/theme/ThemeColorType.hxx>
-
class SvxColorValueSet;
-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;
-
- NamedColor(Color const& rColor, OUString const& rName)
- : m_aColor(rColor)
- , m_aName(rName)
- {}
-
- model::ComplexColor getComplexColor()
- {
- model::ComplexColor aComplexColor;
-
- auto eThemeColorType = model::convertToThemeColorType(m_nThemeIndex);
-
- if (eThemeColorType != model::ThemeColorType::Unknown)
- {
- aComplexColor.setSchemeColor(eThemeColorType);
-
- if (m_nLumMod != 10000)
- aComplexColor.addTransformation({model::TransformationType::LumMod, m_nLumMod});
-
- if (m_nLumMod != 0)
- aComplexColor.addTransformation({model::TransformationType::LumOff, m_nLumOff});
- }
-
- aComplexColor.setFinalColor(m_aColor);
-
- return aComplexColor;
- }
-};
-
typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction;
class Palette
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 5a5000bc0076..f2711b2e022a 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -71,6 +71,7 @@ public:
tools::Long GetColorCount() const;
tools::Long GetRecentColorCount() const;
void AddRecentColor(const Color& rRecentColor, const OUString& rColorName, bool bFront = true);
+ void SetSplitButtonColor(const NamedColor& rColor);
void SetBtnUpdater(svx::ToolboxButtonColorUpdaterBase* pBtnUpdater);
void PopupColorPicker(weld::Window* pParent, const OUString& aCommand, const Color& rInitialColor);
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 0a2e0a5ffeb8..c0feb10f1f61 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -99,7 +99,6 @@ private:
std::unique_ptr<weld::CustomWeld> mxRecentColorSetWin;
weld::Button* mpDefaultButton;
- Link<const NamedColor&, void> maSelectedLink;
DECL_DLLPRIVATE_LINK(SelectHdl, ValueSet*, void);
DECL_DLLPRIVATE_LINK(SelectPaletteHdl, weld::ComboBox&, void);
DECL_DLLPRIVATE_LINK(AutoColorClickHdl, weld::Button&, void);
@@ -128,8 +127,6 @@ public:
virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
- void SetSelectedHdl( const Link<const NamedColor&, void>& rLink ) { maSelectedLink = rLink; }
-
virtual void GrabFocus() override;
};
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 6eafd38d87b9..11d41ee4ddde 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -210,7 +210,6 @@ class SVXCORE_DLLPUBLIC SvxColorToolBoxControl final : public cppu::ImplInherita
bool m_bSplitButton;
sal_uInt16 m_nSlotId;
ColorSelectFunction m_aColorSelectFunction;
- DECL_DLLPRIVATE_LINK(SelectedHdl, const NamedColor&, void);
weld::Window* GetParentFrame() const;