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 8ee605106974324b2bcf2a9323c6df4d572ac4a2
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Feb 9 10:23:38 2026 +0100
Commit:     Samuel Mehrbrodt <[email protected]>
CommitDate: Mon Feb 9 15:42:47 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]>

diff --git a/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx 
b/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx
index e2190170a081..4429764b1283 100644
--- a/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx
+++ b/sd/source/ui/controller/ThemeColorsToolBoxControl.cxx
@@ -32,8 +32,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>
@@ -105,6 +119,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 b65b18f172d0..6be0ef4cc34b 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 with 
auto-rename if needed
                     svx::ColorSets::get().insert(aColorSet, 
svx::ColorSets::IdenticalNameAction::AutoRename);
+                    // Invalidate to update the toolbar control
+                    GetViewFrame()->GetBindings().Invalidate(SID_ADD_THEME);
                 }
             });
 

Reply via email to