diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-02-20 11:25:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-02-21 14:33:11 +0100 |
commit | f64d8d879e78fd3fdf593d3f29c16e5bf270a8cd (patch) | |
tree | 6508e0784d7bd1bd846022b95f9a60ae52a34717 /sw | |
parent | 833abb4a197561c34ec59cceb9d7d8a46f6b17ce (diff) |
support possibility to set Theme early during initializeForTiledRendering
so we are already in the desired theme from the start
Change-Id: Ibaaf647612a0a61ce74fa4e4272d7084868a6ea3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163650
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163686
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 358cdbba532a..1b36c4f249e7 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -19,6 +19,8 @@ #include <sal/config.h> #include <officecfg/Office/Common.hxx> +#include <comphelper/dispatchcommand.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/string.hxx> #include <AnnotationWin.hxx> #include <o3tl/any.hxx> @@ -3574,6 +3576,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: // the case of clicking in the header area of a document with no headers aViewOption.SetUseHeaderFooterMenu(false); + OUString sThemeName; OUString sOrigAuthor = SW_MOD()->GetRedlineAuthor(SW_MOD()->GetRedlineAuthor()); OUString sAuthor; @@ -3595,6 +3598,8 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: } else if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>()) aViewOption.SetOnlineSpell(rValue.Value.get<bool>()); + else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>()) + sThemeName = rValue.Value.get<OUString>(); } if (!sAuthor.isEmpty() && sAuthor != sOrigAuthor) @@ -3643,6 +3648,16 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: // don't change the whitespace at the beginning of paragraphs, this is // annoying when taking minutes without further formatting SwEditShell::GetAutoFormatFlags()->bAFormatByInpDelSpacesAtSttEnd = false; + + // if we know what theme the user wants, then we can dispatch that now early + if (!sThemeName.isEmpty()) + { + css::uno::Sequence<css::beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(sThemeName) } + })); + comphelper::dispatchCommand(".uno:ChangeTheme", aPropertyValues); + } } void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) |