sc/source/ui/unoobj/docuno.cxx | 11 +++++++++++ sd/source/ui/unoidl/unomodel.cxx | 11 +++++++++++ sw/source/uibase/uno/unotxdoc.cxx | 11 +++++++++++ 3 files changed, 33 insertions(+)
New commits: commit 8d9a96fca21118da6676f56b4abd48594fc1956e Author: Skyler Grey <skyler.g...@collabora.com> AuthorDate: Mon Jul 29 09:52:18 2024 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Aug 16 21:56:41 2024 +0200 feat(invert): Allow inverted background on init Previously for Online there was no way to save the background invert state and reload it. Worse, when someone changed the state it would become the default for new document loads. This patch allows Online to specify whether it wants the background to be inverted, which should allow smooth tab refreshes while also avoiding mingling state from different people. There is a change to online to support this here: https://github.com/CollaboraOnline/online/pull/9652 Change-Id: I8c22c03d3b4589736d48509004f7789dd5166389 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171955 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 8fdbec2ba040..dce8f566f733 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1317,6 +1317,7 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans SC_MOD()->SetAppOptions(aAppOptions); OUString sThemeName; + OUString sBackgroundThemeName; for (const beans::PropertyValue& rValue : rArguments) { @@ -1328,6 +1329,8 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans } else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>()) sThemeName = rValue.Value.get<OUString>(); + else if (rValue.Name == ".uno:InvertBackground" && rValue.Value.has<OUString>()) + sBackgroundThemeName = rValue.Value.get<OUString>(); } // show us the text exactly @@ -1354,6 +1357,14 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans })); comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, aPropertyValues); } + if (!sBackgroundThemeName.isEmpty()) + { + css::uno::Sequence<css::beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(sBackgroundThemeName) } + })); + comphelper::dispatchCommand(".uno:InvertBackground", 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 f8f9359d7988..247c4810b9e8 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2730,6 +2730,7 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs SolarMutexGuard aGuard; OUString sThemeName; + OUString sBackgroundThemeName; if (DrawViewShell* pViewShell = GetViewShell()) { @@ -2744,6 +2745,8 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs mpDoc->SetOnlineSpell(rValue.Value.get<bool>()); else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>()) sThemeName = rValue.Value.get<OUString>(); + else if (rValue.Name == ".uno:InvertBackground" && rValue.Value.has<OUString>()) + sBackgroundThemeName = rValue.Value.get<OUString>(); } // Disable comments if requested @@ -2795,6 +2798,14 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs })); comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, aPropertyValues); } + if (!sBackgroundThemeName.isEmpty()) + { + css::uno::Sequence<css::beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(sBackgroundThemeName) } + })); + comphelper::dispatchCommand(".uno:InvertBackground", 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 e963b890bbfd..6262416a480f 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3763,6 +3763,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: aViewOption.SetUseHeaderFooterMenu(false); OUString sThemeName; + OUString sBackgroundThemeName; OUString sOrigAuthor = SW_MOD()->GetRedlineAuthor(SW_MOD()->GetRedlineAuthor()); OUString sAuthor; @@ -3786,6 +3787,8 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: aViewOption.SetOnlineSpell(rValue.Value.get<bool>()); else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has<OUString>()) sThemeName = rValue.Value.get<OUString>(); + else if (rValue.Name == ".uno:InvertBackground" && rValue.Value.has<OUString>()) + sBackgroundThemeName = rValue.Value.get<OUString>(); } if (!sAuthor.isEmpty() && sAuthor != sOrigAuthor) @@ -3844,6 +3847,14 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: })); comphelper::dispatchCommand(u".uno:ChangeTheme"_ustr, aPropertyValues); } + if (!sBackgroundThemeName.isEmpty()) + { + css::uno::Sequence<css::beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(sBackgroundThemeName) } + })); + comphelper::dispatchCommand(".uno:InvertBackground", aPropertyValues); + } } void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)