summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-20 11:25:06 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-02-21 14:33:11 +0100
commitf64d8d879e78fd3fdf593d3f29c16e5bf270a8cd (patch)
tree6508e0784d7bd1bd846022b95f9a60ae52a34717 /sc/source
parent833abb4a197561c34ec59cceb9d7d8a46f6b17ce (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 'sc/source')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index abb046ba1dd2..b59167efef3c 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>
@@ -1310,6 +1312,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>())
@@ -1318,6 +1322,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
@@ -1334,6 +1340,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 )