sw/sdi/_basesh.sdi                 |    7 +++++++
 sw/source/uibase/shells/basesh.cxx |   27 +++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

New commits:
commit cd06e9a20d83b2ed3a6249496cfdd8ab97c38d6e
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Feb 9 21:06:58 2026 +0100
Commit:     Samuel Mehrbrodt <[email protected]>
CommitDate: Mon Feb 16 16:10:56 2026 +0100

    Enable 'Add Theme' for Writer
    
    Change-Id: I020cd75789fe13e7b2dee8eaf429f0bb9f168219
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199442
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <[email protected]>

diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index 93ffc70378be..cdca55870f8c 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -636,4 +636,11 @@ interface BaseTextSelection
         ExecMethod = Execute ;
         StateMethod = GetState ;
     ]
+
+    SID_ADD_THEME
+    [
+        ExecMethod = ExecDlg;
+        StateMethod = GetState;
+        DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+    ]
 }
diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 7f50de6a74d0..4af93e87f983 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -103,6 +103,7 @@
 
 #include <svx/unobrushitemhelper.hxx>
 #include <svx/dialog/ThemeDialog.hxx>
+#include <svx/dialog/ThemeColorEditDialog.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <comphelper/lok.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
@@ -3057,6 +3058,32 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
         }
         break;
 
+        case SID_ADD_THEME:
+        {
+            // Create empty color set as starting point for new theme
+            auto pCurrentColorSet = 
std::make_shared<model::ColorSet>(OUString());
+
+            // Open ThemeColorEditDialog to create/edit the new color set
+            auto pSubDialog = 
std::make_shared<svx::ThemeColorEditDialog>(GetView().GetFrameWeld(), 
*pCurrentColorSet);
+
+            weld::DialogController::runAsync(pSubDialog, [pSubDialog, 
this](sal_uInt32 nResult) {
+                if (nResult != RET_OK)
+                    return;
+
+                auto aColorSet = pSubDialog->getColorSet();
+                if (!aColorSet.getName().isEmpty())
+                {
+                    // Add the new color set to the global collection with 
auto-rename if needed
+                    svx::ColorSets::get().insert(aColorSet);
+                    // Invalidate to update the toolbar control
+                    
GetView().GetViewFrame().GetBindings().Invalidate(SID_ADD_THEME);
+                }
+            });
+
+            rReq.Done();
+        }
+        break;
+
         case SID_APPLY_THEME:
         {
             if (pArgs)

Reply via email to