diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-02-20 11:25:06 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2024-02-21 11:23:04 +0100 |
commit | e2ca1c82dbce30d625d33c0bd8c3c080294f93b8 (patch) | |
tree | 72382307c498cab15624de744b79e4e08d03b90e | |
parent | e28e048ac5fd4a9463326aeab4f4dd04ca55182a (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>
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 15 |
3 files changed, 47 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a6de0da0cc92..007e6735b96d 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -21,6 +21,8 @@ #include <scitems.hxx> +#include <comphelper/dispatchcommand.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <editeng/brushitem.hxx> @@ -1297,6 +1299,8 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans aAppOptions.SetAutoComplete(true); SC_MOD()->SetAppOptions(aAppOptions); + OUString sThemeName; + for (const beans::PropertyValue& rValue : rArguments) { if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>()) @@ -1305,6 +1309,8 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans options.SetAutoSpell(rValue.Value.get<bool>()); GetDocument()->SetDocOptions(options); } + else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>()) + sThemeName = rValue.Value.get<OUString>(); } // show us the text exactly @@ -1321,6 +1327,16 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans auto xChanges = comphelper::ConfigurationChanges::create(); officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges); xChanges->commit(); + + // 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); + } } uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 69bdf8f8cf67..7e10b3a2a361 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -33,8 +33,10 @@ #include <com/sun/star/embed/Aspects.hpp> #include <officecfg/Office/Common.hxx> +#include <comphelper/dispatchcommand.hxx> #include <comphelper/indexedpropertyvalues.hxx> #include <comphelper/lok.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> @@ -2575,6 +2577,8 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs { SolarMutexGuard aGuard; + OUString sThemeName; + if (DrawViewShell* pViewShell = GetViewShell()) { DrawView* pDrawView = pViewShell->GetDrawView(); @@ -2586,6 +2590,8 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs pDrawView->SetAuthor(rValue.Value.get<OUString>()); else if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>()) mpDoc->SetOnlineSpell(rValue.Value.get<bool>()); + else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>()) + sThemeName = rValue.Value.get<OUString>(); } // Disable comments if requested @@ -2627,6 +2633,16 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs if (!getenv("LO_TESTNAME")) SvtSlideSorterBarOptions().SetVisibleImpressView(true); + + // 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 SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 1b7c933ec974..32b34017b660 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> @@ -3639,6 +3641,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; @@ -3660,6 +3663,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) @@ -3708,6 +3713,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) |