diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-01 15:40:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-01 20:35:27 +0100 |
commit | c26ef8b1f06906fb1acd3999b36f546bf2722461 (patch) | |
tree | 06bce3e3953d494198789289e101c79993de56d2 /sd | |
parent | 0b8526460dc6196408a97a0f081f1146abe89799 (diff) |
dynamic_cast followed by static_cast
Change-Id: I29daabb250d72403ccf751aeeb5fd2fa755e895c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105145
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 6 |
2 files changed, 6 insertions, 14 deletions
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<OutlineView*>(mpView)->GetViewByWindow( - mpViewShell->GetActiveWindow()); - } + if (OutlineView* pOView = dynamic_cast<OutlineView*>(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<OutlineView*>(mpView)->GetViewByWindow( - mpViewShell->GetActiveWindow()); - } + if (OutlineView* pOView = dynamic_cast<OutlineView*>(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<OutlineView*>(mpView)) { - pOLV = static_cast<OutlineView*>(mpView) - ->GetViewByWindow(mpViewShell->GetActiveWindow()); - + pOLV = pOView->GetViewByWindow(mpViewShell->GetActiveWindow()); aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) ); } |