include/sfx2/sfxsids.hrc                                             |    1 
 include/svx/dialog/ThemeColorEditDialog.hxx                          |    3 -
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |    8 ++
 sd/sdi/_drvwsh.sdi                                                   |    5 +
 sd/source/ui/view/drviews2.cxx                                       |   27 
++++++++++
 svx/sdi/svx.sdi                                                      |   17 
++++++
 6 files changed, 59 insertions(+), 2 deletions(-)

New commits:
commit 90910c7db4ba787595ae17f26710e1c6206f3ce4
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Jan 26 10:08:20 2026 +0100
Commit:     Szymon Kłos <[email protected]>
CommitDate: Tue Jan 27 12:15:50 2026 +0100

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

diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 003b4f0d0fa8..06784d09e4f3 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -481,6 +481,7 @@ class SvxZoomItem;
 #define SID_ASYNCHRON                       (SID_SFX_START + 813)
 #define SID_ACCESSIBILITY_CHECK_ONLINE      (SID_SFX_START + 814)
 #define SID_THEME_DIALOG                    (SID_SFX_START + 815)
+#define SID_ADD_THEME                       (SID_SFX_START + 816)
 
 // default-ids for configuration
 #define SID_CONFIG                          
TypedWhichId<SfxStringItem>(SID_SFX_START + 904)
diff --git a/include/svx/dialog/ThemeColorEditDialog.hxx 
b/include/svx/dialog/ThemeColorEditDialog.hxx
index 067d89d606fa..3f004b0f4b2c 100644
--- a/include/svx/dialog/ThemeColorEditDialog.hxx
+++ b/include/svx/dialog/ThemeColorEditDialog.hxx
@@ -19,8 +19,7 @@ class ColorListBox;
 
 namespace svx
 {
-class UNLESS_MERGELIBS(SVX_DLLPUBLIC) ThemeColorEditDialog final
-    : public weld::GenericDialogController
+class SVX_DLLPUBLIC ThemeColorEditDialog final : public 
weld::GenericDialogController
 {
 private:
     model::ColorSet maColorSet;
diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 0b3cc508a2a8..48f6619deddf 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -7620,6 +7620,14 @@ bit 3 (0x8): #define 
UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:AddTheme" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Add Theme...</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:SidebarDeck.PropertyDeck" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Open the Properties Deck</value>
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index d5e9fb31cfd9..d5719a018564 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -3003,6 +3003,11 @@ interface DrawView
         ExecMethod = FuTemporary;
         StateMethod = GetAttrState;
     ]
+    SID_ADD_THEME
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
     SID_ALIGN_PAGE
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b42191d522e6..5822d23e18c6 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -197,6 +197,8 @@
 
 #include <theme/ThemeColorChanger.hxx>
 #include <svx/dialog/ThemeDialog.hxx>
+#include <svx/dialog/ThemeColorEditDialog.hxx>
+#include <svx/ColorSets.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <ViewShellBase.hxx>
@@ -4281,6 +4283,31 @@ void DrawViewShell::FuTemporary(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>(GetFrameWeld(), *pCurrentColorSet);
+
+            weld::DialogController::runAsync(pSubDialog, 
[pSubDialog](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);
+                }
+            });
+
+            Cancel();
+            rReq.Ignore();
+        }
+        break;
+
         case SID_ATTR_GLOW_COLOR:
         case SID_ATTR_GLOW_RADIUS:
         case SID_ATTR_GLOW_TRANSPARENCY:
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index aa9d5fd0873c..233b9b891423 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12680,6 +12680,23 @@ SfxVoidItem ThemeDialog SID_THEME_DIALOG
     GroupId = SfxGroupId::Format;
 ]
 
+SfxVoidItem AddTheme SID_ADD_THEME
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Format;
+]
+
 SfxBoolItem AccessibilityCheckOnline SID_ACCESSIBILITY_CHECK_ONLINE
 (SfxBoolItem Enable FN_PARAM_1)
 [

Reply via email to