sc/source/ui/app/scmod.cxx | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-)
New commits: commit 77ae7611fb2a670bb567718ce2cd3c4cc2fd9660 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Aug 26 12:18:06 2024 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Aug 27 10:42:48 2024 +0200 In desktop we want to update all the calc shells for dark/light mode while in kit mode we just want the current, before this in desktop mode none of the desktop shells for their dark/light mode updated move the kit code into the loop (which only runs once for kit) and move setting the DocColor code out of kit-only mode for all desktop Shells as well as the single current one for kit Change-Id: I319f067afefedddf3d92c5cff675dac35e046179 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172426 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index d595b5c22dd4..d2005b0cc187 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -208,41 +208,34 @@ void ScModule::ConfigurationChanged(utl::ConfigurationBroadcaster* p, Configurat } } - bool bSkipInvalidate = false; - const bool bKit = comphelper::LibreOfficeKit::isActive(); - if (bKit && p == m_pColorConfig.get()) - { - SfxViewShell* pSfxViewShell = SfxViewShell::Current(); - ScTabViewShell* pViewShell = dynamic_cast<ScTabViewShell*>(pSfxViewShell); - if (pViewShell) + //invalidate only the current view in tiled rendering mode, or all views otherwise + SfxViewShell* pViewShell = bKit ? SfxViewShell::Current() : SfxViewShell::GetFirst(); + while (pViewShell) + { + if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pViewShell)) { - ScViewRenderingOptions aViewRenderingOptions(pViewShell->GetViewRenderingData()); + ScViewRenderingOptions aViewRenderingOptions(pViewSh->GetViewRenderingData()); Color aFillColor(m_pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor); aViewRenderingOptions.SetDocColor(aFillColor); aViewRenderingOptions.SetColorSchemeName(svtools::ColorConfig::GetCurrentSchemeName()); - const bool bUnchanged(aViewRenderingOptions == pViewShell->GetViewRenderingData()); + const bool bUnchanged(aViewRenderingOptions == pViewSh->GetViewRenderingData()); if (!bUnchanged) - pViewShell->SetViewRenderingData(aViewRenderingOptions); - ScModelObj* pScModelObj = comphelper::getFromUnoTunnel<ScModelObj>(SfxObjectShell::Current()->GetModel()); - SfxLokHelper::notifyViewRenderState(SfxViewShell::Current(), pScModelObj); - // In Online, the document color is the one used for the background, contrary to - // Writer and Draw that use the application background color. - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, - aFillColor.AsRGBHexString().toUtf8()); + pViewSh->SetViewRenderingData(aViewRenderingOptions); - // if nothing changed, and the hint was OnlyCurrentDocumentColorScheme we can skip invalidate - bSkipInvalidate = bUnchanged && eHints == ConfigurationHints::OnlyCurrentDocumentColorScheme; - } - } + if (SfxObjectShell* pKitCurrentObjSh = bKit ? SfxObjectShell::Current() : nullptr) + { + ScModelObj* pScModelObj = comphelper::getFromUnoTunnel<ScModelObj>(pKitCurrentObjSh->GetModel()); + SfxLokHelper::notifyViewRenderState(pViewSh, pScModelObj); + // In Online, the document color is the one used for the background, contrary to + // Writer and Draw that use the application background color. + pViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, + aFillColor.AsRGBHexString().toUtf8()); + } - //invalidate only the current view in tiled rendering mode, or all views otherwise - SfxViewShell* pViewShell = bKit ? SfxViewShell::Current() : SfxViewShell::GetFirst(); - while (pViewShell) - { - if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pViewShell)) - { + // if nothing changed, and the hint was OnlyCurrentDocumentColorScheme we can skip invalidate + const bool bSkipInvalidate = bUnchanged && eHints == ConfigurationHints::OnlyCurrentDocumentColorScheme; if (!bSkipInvalidate) { pViewSh->PaintGrid();
