sd/source/ui/view/drviewsk.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
New commits: commit 3875619ecce202bc9c6b504d6ce46a8aac770d53 Author: Caolán McNamara <[email protected]> AuthorDate: Fri May 12 21:17:57 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Jun 13 11:08:59 2023 +0200 cid#1530046 Unchecked dynamic_cast Change-Id: Iaeec0f90e6faae8f7c5ab8e1745c8bdb62925ca5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151714 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 439a78496a9a45c6e412fa93edb537727ab7862a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152871 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx index 3a20691afa54..6e73a87d0ee4 100644 --- a/sd/source/ui/view/drviewsk.cxx +++ b/sd/source/ui/view/drviewsk.cxx @@ -23,19 +23,21 @@ void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, Co { svtools::ColorConfig *pColorConfig = dynamic_cast<svtools::ColorConfig*>(pCb); ConfigureAppBackgroundColor(pColorConfig); - SfxViewShell* pCurrentShell = SfxViewShell::Current(); - if (comphelper::LibreOfficeKit::isActive() && pCurrentShell) + if (comphelper::LibreOfficeKit::isActive()) { - DrawViewShell* pCurrentDrawShell = nullptr; + SfxViewShell* pCurrentShell = SfxViewShell::Current(); ViewShellBase* pShellBase = dynamic_cast<ViewShellBase*>(pCurrentShell); - if(pShellBase) - pCurrentDrawShell = dynamic_cast<DrawViewShell*>(pShellBase->GetMainViewShell().get()); - pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; - pCurrentDrawShell->maViewOptions.msColorSchemeName = pColorConfig->GetCurrentSchemeName(); + if (!pShellBase) + return; + if (DrawViewShell* pCurrentDrawShell = dynamic_cast<DrawViewShell*>(pShellBase->GetMainViewShell().get())) + { + pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; + pCurrentDrawShell->maViewOptions.msColorSchemeName = pColorConfig->GetCurrentSchemeName(); + } SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel<SdXImpressDocument>(pCurrentShell->GetCurrentDocument()); SfxLokHelper::notifyViewRenderState(pCurrentShell, pDoc); Color aFillColor(pColorConfig->GetColorValue(svtools::APPBACKGROUND).nColor); - SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, + pCurrentShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, aFillColor.AsRGBHexString().toUtf8().getStr()); } }
