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

New commits:
commit 4a14359ec33274e46d2b6c8125cd28a82fb96be1
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Feb 9 21:06:58 2026 +0100
Commit:     Szymon Kłos <[email protected]>
CommitDate: Wed Feb 25 15:07:14 2026 +0100

    Enable 'Add Theme' for Writer
    
    Change-Id: I020cd75789fe13e7b2dee8eaf429f0bb9f168219
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199016
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>

diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index 40f5976efa66..bc7f98998baa 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -631,4 +631,11 @@ interface BaseTextSelection
         StateMethod = GetState;
         DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
     ]
+
+    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 94ea2d116356..cbed2bd5edd1 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -101,6 +101,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>
@@ -3048,6 +3049,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, 
svx::ColorSets::IdenticalNameAction::AutoRename);
+                    // 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