diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-05-12 21:17:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-13 11:08:59 +0200 |
commit | 3875619ecce202bc9c6b504d6ce46a8aac770d53 (patch) | |
tree | 36a4e06a7f61b47059dea881a68a2e1d999725fe /sd | |
parent | 366a9cdd1a0b03c1abe7ffc7515a34a8abd27754 (diff) |
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 <caolanm@redhat.com>
(cherry picked from commit 439a78496a9a45c6e412fa93edb537727ab7862a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152871
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drviewsk.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
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()); } } |