From 984e8adab12c3df34ee3ef22dc2a2ae60e1a9667 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Mon, 26 Jan 2026 10:08:20 +0100 Subject: [PATCH] Add UNO command for 'Add Theme' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0a2b5dcab5a889717082825e124e181527dadc19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198130 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice (cherry picked from commit 90910c7db4ba787595ae17f26710e1c6206f3ce4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198515 Reviewed-by: Samuel Mehrbrodt Tested-by: Jenkins --- include/sfx2/sfxsids.hrc | 1 + include/svx/dialog/ThemeColorEditDialog.hxx | 3 +-- .../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(-) diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 3da55d478324..ae3e328474d9 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -485,6 +485,7 @@ class SvxZoomItem; #define SID_ACCESSIBILITY_CHECK_ONLINE (SID_SFX_START + 814) #define SID_THEME_DIALOG (SID_SFX_START + 815) #define SID_REDACT_IMAGE (SID_SFX_START + 816) +#define SID_ADD_THEME (SID_SFX_START + 817) // default-ids for configuration #define SID_CONFIG TypedWhichId(SID_SFX_START + 904) diff --git a/include/svx/dialog/ThemeColorEditDialog.hxx b/include/svx/dialog/ThemeColorEditDialog.hxx index 182ff64d2da1..77b300211bee 100644 --- a/include/svx/dialog/ThemeColorEditDialog.hxx +++ b/include/svx/dialog/ThemeColorEditDialog.hxx @@ -21,8 +21,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 ae2ce5696ca3..dfd7dfcce3c0 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -8084,6 +8084,14 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 1 + + + Add Theme... + + + 1 + + Open the Properties Deck diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index 56f8c74e749d..3478d268a8b6 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -3043,6 +3043,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 fe4f0fb81500..11591d7b34bb 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -197,6 +197,8 @@ #include #include +#include +#include #include #include @@ -4279,6 +4281,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(OUString()); + + // Open ThemeColorEditDialog to create/edit the new color set + auto pSubDialog = std::make_shared(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 + svx::ColorSets::get().insert(aColorSet); + } + }); + + 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 3a0a67b95b11..95dff19d728e 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -13310,6 +13310,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) [