From c26ef8b1f06906fb1acd3999b36f546bf2722461 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 1 Nov 2020 15:40:50 +0000 Subject: dynamic_cast followed by static_cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I29daabb250d72403ccf751aeeb5fd2fa755e895c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105145 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sd/source/ui/view/drtxtob.cxx | 14 ++++---------- sd/source/ui/view/drtxtob1.cxx | 6 ++---- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 02344e1c4564..1464a5d06c30 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -180,11 +180,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) assert(mpViewShell); - if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) - { - pOLV = static_cast(mpView)->GetViewByWindow( - mpViewShell->GetActiveWindow()); - } + if (OutlineView* pOView = dynamic_cast(mpView)) + pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow()); sal_uInt16 stretchY = 100; if( pOutliner ) @@ -254,11 +251,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); - if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) - { - pOLV = static_cast(mpView)->GetViewByWindow( - mpViewShell->GetActiveWindow()); - } + if (OutlineView* pOView = dynamic_cast(mpView)) + pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow()); bool bOutlineViewSh = dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr; diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 996265c3c9ea..69e83e18f2db 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -121,11 +121,9 @@ void TextObjectBar::Execute( SfxRequest &rReq ) assert(mpViewShell); - if( dynamic_cast< const OutlineView *>( mpView ) != nullptr) + if (OutlineView* pOView = dynamic_cast(mpView)) { - pOLV = static_cast(mpView) - ->GetViewByWindow(mpViewShell->GetActiveWindow()); - + pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow()); aGuard.reset( new OutlineViewModelChangeGuard( static_cast(*mpView) ) ); } -- cgit