desktop/source/lib/init.cxx | 1 + include/sfx2/sfxsids.hrc | 2 ++ sfx2/sdi/appslots.sdi | 4 ++++ sfx2/sdi/sfx.sdi | 14 ++++++++++++++ sfx2/source/appl/appserv.cxx | 14 ++++++++++++++ 5 files changed, 35 insertions(+)
New commits: commit bcc9698ad4f8d49dfdd981e4f4c289cb9a6db87b Author: Paris Oplopoios <paris.oplopo...@collabora.com> AuthorDate: Thu Mar 16 03:55:34 2023 +0200 Commit: Paris Oplopoios <parisop...@gmail.com> CommitDate: Fri Mar 17 01:58:10 2023 +0000 Add uno command that changes the theme Add an uno command that changes the theme to the one specified in the first parameter Change-Id: Ia0fef2ca698415e07f1943cf80ab667fb5c37238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148942 Tested-by: Jenkins Reviewed-by: Paris Oplopoios <parisop...@gmail.com> (cherry picked from commit fc8681b0a783cb82167c42dc0fb730cf2b619eb9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149023 Tested-by: Paris Oplopoios <parisop...@gmail.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 480fc9952e6a..4caa1b034d86 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3424,6 +3424,7 @@ static void doc_iniUnoCommands () OUString(".uno:InsertSlide"), OUString(".uno:DeleteSlide"), OUString(".uno:DuplicateSlide"), + OUString(".uno:ChangeTheme"), OUString(".uno:Cut"), OUString(".uno:Copy"), OUString(".uno:Paste"), diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index d029b314d4d9..d7f602bf5c5a 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -295,6 +295,8 @@ class SvxZoomItem; #define SID_TOOLBAR_MODE_UI (SID_SFX_START + 1742) #define SID_TOOLBAR_LOCK (SID_SFX_START + 1743) #define SID_WIDGET_TEST_DIALOG (SID_SFX_START + 1744) +#define FN_CHANGE_THEME (SID_SFX_START + 1745) +#define FN_PARAM_NEW_THEME TypedWhichId<SfxStringItem>(SID_SFX_START + 1746) // SID_SFX_free_END (SID_SFX_START + 3999) diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index daa0a86265e0..429c48332f7f 100644 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -64,6 +64,10 @@ interface Application [ ExecMethod = MiscExec_Impl ; ] + FN_CHANGE_THEME // ole(no) api(final/play/rec) + [ + ExecMethod = MiscExec_Impl ; + ] SID_CONFIG // ole(no) api(final/play/rec) [ ExecMethod = MiscExec_Impl ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index ca9e68894e1f..ea3340c426a3 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5807,3 +5807,17 @@ SfxVoidItem WidgetTestDialog SID_WIDGET_TEST_DIALOG ToolBoxConfig = TRUE, GroupId = SfxGroupId::Application; ] + +SfxVoidItem ChangeTheme FN_CHANGE_THEME +(SfxStringItem NewTheme FN_PARAM_NEW_THEME) +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + GroupId = SfxGroupId::Application; +] diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index ace3a1434a63..f2dfca480c5d 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -50,6 +50,7 @@ #include <svtools/addresstemplate.hxx> #include <svtools/restartdialog.hxx> +#include <svtools/colorcfg.hxx> #include <svl/visitem.hxx> #include <unotools/configmgr.hxx> @@ -593,6 +594,19 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) break; } + case FN_CHANGE_THEME: + { + const SfxStringItem* pNewThemeArg = rReq.GetArg<SfxStringItem>(FN_PARAM_NEW_THEME); + if (!pNewThemeArg) + { + SAL_WARN("sfx.appl", "FN_CHANGE_THEME: no theme name"); + break; + } + svtools::EditableColorConfig aEditableConfig; + aEditableConfig.LoadScheme(pNewThemeArg->GetValue()); + break; + } + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_HELPINDEX: {