sd/source/ui/controller/ThemeColorsToolBoxControl.cxx |   18 +++++++++++++++++-
 sd/source/ui/controller/ThemeColorsToolBoxControl.hxx |    2 ++
 sd/source/ui/view/drviews2.cxx                        |    4 +++-
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit f96cf5d2d3ccc25b6e47e75338af6bb3a8b19bf1
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Feb 9 10:23:38 2026 +0100
Commit:     Samuel Mehrbrodt <[email protected]>
CommitDate: Mon Feb 16 07:19:04 2026 +0100

    Update theme color toolbox control after adding a new theme
    
    Change-Id: I3fd8f7d9accdaf1e21f992b782a7718ab7379c52
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198962
    Reviewed-by: Szymon Kłos <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Samuel Mehrbrodt <[email protected]>
    (cherry picked from commit 944567a9c1bfb311f2cd33a556029751a960663c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199014
    Tested-by: Jenkins

diff --git a/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx 
b/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx
index 3ada0c5a7f75..4386ae8cf9a3 100644
--- a/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx
+++ b/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx
@@ -33,8 +33,22 @@ void SAL_CALL ThemeColorsToolBoxControl::dispose()
 }
 
 void SAL_CALL
-ThemeColorsToolBoxControl::statusChanged(const css::frame::FeatureStateEvent& 
/*rEvent*/)
+ThemeColorsToolBoxControl::initialize(const css::uno::Sequence<css::uno::Any>& 
rArguments)
 {
+    svt::ToolboxController::initialize(rArguments);
+
+    // Register to listen for AddTheme command changes
+    addStatusListener(".uno:AddTheme");
+}
+
+void SAL_CALL ThemeColorsToolBoxControl::statusChanged(const 
css::frame::FeatureStateEvent& rEvent)
+{
+    SolarMutexGuard aSolarMutexGuard;
+
+    if (m_xVclBox && rEvent.FeatureURL.Complete == ".uno:AddTheme")
+        m_xVclBox->refreshThemeColors();
+
+    svt::ToolboxController::statusChanged(rEvent);
 }
 
 css::uno::Reference<css::awt::XWindow>
@@ -106,6 +120,8 @@ ThemeColorsPaneWrapper::~ThemeColorsPaneWrapper() { 
disposeOnce(); }
 
 void ThemeColorsPaneWrapper::SetOptimalSize() { 
SetSizePixel(GetOptimalSize()); }
 
+void ThemeColorsPaneWrapper::refreshThemeColors() { initColorSets(); }
+
 void ThemeColorsPaneWrapper::dispose()
 {
     mxIconViewThemeColors.reset();
diff --git a/sd/source/ui/controller/ThemeColorsToolBoxControl.hxx 
b/sd/source/ui/controller/ThemeColorsToolBoxControl.hxx
index 9e9b876da7d8..57465b894ef5 100644
--- a/sd/source/ui/controller/ThemeColorsToolBoxControl.hxx
+++ b/sd/source/ui/controller/ThemeColorsToolBoxControl.hxx
@@ -30,6 +30,7 @@ public:
     virtual ~ThemeColorsPaneWrapper() override;
     virtual void dispose() override;
     void SetOptimalSize();
+    void refreshThemeColors();
 
     DECL_LINK(SelectionChangedHdl, weld::IconView&, void);
 
@@ -50,6 +51,7 @@ public:
     virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& 
rEvent) override;
 
     // XToolbarController
+    virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& 
rArguments) override;
     virtual css::uno::Reference<css::awt::XWindow>
         SAL_CALL createItemWindow(const 
css::uno::Reference<css::awt::XWindow>& rParent) override;
 
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b9fbc62e1c2f..e8b1b7f64edc 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -4290,7 +4290,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             // Open ThemeColorEditDialog to create/edit the new color set
             auto pSubDialog = 
std::make_shared<svx::ThemeColorEditDialog>(GetFrameWeld(), *pCurrentColorSet);
 
-            weld::DialogController::runAsync(pSubDialog, 
[pSubDialog](sal_uInt32 nResult) {
+            weld::DialogController::runAsync(pSubDialog, [pSubDialog, 
this](sal_uInt32 nResult) {
                 if (nResult != RET_OK)
                     return;
 
@@ -4299,6 +4299,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                 {
                     // Add the new color set to the global collection
                     svx::ColorSets::get().insert(aColorSet);
+                    // Invalidate to update the toolbar control
+                    GetViewFrame()->GetBindings().Invalidate(SID_ADD_THEME);
                 }
             });
 

Reply via email to