summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkyler Grey <skyler.grey@collabora.com>2024-07-29 09:52:18 +0000
committerSkyler Grey <skyler.grey@collabora.com>2024-08-01 09:21:27 +0200
commit5cc22e205287d76cae6cc24453cd1b5e7ac39344 (patch)
tree51e8fd828702c41350f78da4c6cbbef1a119d39b
parentee467e85efbdd7b18ccecc76894b9a7613bb44e9 (diff)
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 Refs: https://github.com/CollaboraOnline/online/pull/9652 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171208 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sc/source/ui/unoobj/docuno.cxx11
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx11
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx11
3 files changed, 33 insertions, 0 deletions
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::Sequence<css::beans
SC_MOD()->SetAppOptions(aAppOptions);
OUString sThemeName;
+ OUString sBackgroundThemeName;
for (const beans::PropertyValue& rValue : rArguments)
{
@@ -1327,6 +1328,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
@@ -1353,6 +1356,14 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans
}));
comphelper::dispatchCommand(".uno:ChangeTheme", 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 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::Sequence<cs
SolarMutexGuard aGuard;
OUString sThemeName;
+ OUString sBackgroundThemeName;
if (DrawViewShell* pViewShell = GetViewShell())
{
@@ -3474,6 +3475,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
@@ -3525,6 +3528,14 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
}));
comphelper::dispatchCommand(".uno:ChangeTheme", 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 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::Sequence<css::
aViewOption.SetUseHeaderFooterMenu(false);
OUString sThemeName;
+ OUString sBackgroundThemeName;
OUString sOrigAuthor = SW_MOD()->GetRedlineAuthor(SW_MOD()->GetRedlineAuthor());
OUString sAuthor;
@@ -3674,6 +3675,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)
@@ -3732,6 +3735,14 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
}));
comphelper::dispatchCommand(".uno:ChangeTheme", 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)