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 9310192a4a0af4e7e3e9ac6124cdd2a706dfedcb Author: Paris Oplopoios <paris.oplopo...@collabora.com> AuthorDate: Thu Mar 16 03:55:34 2023 +0200 Commit: Paris Oplopoios <parisop...@gmail.com> CommitDate: Thu Mar 16 23:45:34 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> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bdab0c035563..6753220051e0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3418,6 +3418,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 d63a5b2d3ae8..97b9c2c71e06 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 71b0557bb5d0..750cf6825d31 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5844,3 +5844,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 83bc6daa210e..5ccfd3c6a597 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> @@ -574,6 +575,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: {