From 5cc22e205287d76cae6cc24453cd1b5e7ac39344 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Mon, 29 Jul 2024 09:52:18 +0000 Subject: feat(invert): Allow inverted background on init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Refs: https://github.com/CollaboraOnline/online/pull/9652 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171208 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara --- 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(+) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 1cc6dc3182d1..2efedd61b856 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1316,6 +1316,7 @@ void ScModelObj::initializeForTiledRendering(const css::uno::SequenceSetAppOptions(aAppOptions); OUString sThemeName; + OUString sBackgroundThemeName; for (const beans::PropertyValue& rValue : rArguments) { @@ -1327,6 +1328,8 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence()) sThemeName = rValue.Value.get(); + else if (rValue.Name == ".uno:InvertBackground" && rValue.Value.has()) + sBackgroundThemeName = rValue.Value.get(); } // show us the text exactly @@ -1353,6 +1356,14 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence 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 1e3600fb53f9..991cf2a037bf 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -3460,6 +3460,7 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::SequenceSetOnlineSpell(rValue.Value.get()); else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has()) sThemeName = rValue.Value.get(); + else if (rValue.Name == ".uno:InvertBackground" && rValue.Value.has()) + sBackgroundThemeName = rValue.Value.get(); } // Disable comments if requested @@ -3525,6 +3528,14 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence 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 070e40c8d8b0..2cffa5af217f 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3651,6 +3651,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::SequenceGetRedlineAuthor(SW_MOD()->GetRedlineAuthor()); OUString sAuthor; @@ -3674,6 +3675,8 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence()); else if (rValue.Name == ".uno:ChangeTheme" && rValue.Value.has()) sThemeName = rValue.Value.get(); + else if (rValue.Name == ".uno:InvertBackground" && rValue.Value.has()) + sBackgroundThemeName = rValue.Value.get(); } if (!sAuthor.isEmpty() && sAuthor != sOrigAuthor) @@ -3732,6 +3735,14 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence aPropertyValues(comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(sBackgroundThemeName) } + })); + comphelper::dispatchCommand(".uno:InvertBackground", aPropertyValues); + } } void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) -- cgit