[Libreoffice-commits] core.git: sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Nov 1 19:36:13 UTC 2020


 sd/source/ui/view/drtxtob.cxx  |   14 ++++----------
 sd/source/ui/view/drtxtob1.cxx |    6 ++----
 2 files changed, 6 insertions(+), 14 deletions(-)

New commits:
commit c26ef8b1f06906fb1acd3999b36f546bf2722461
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Nov 1 15:40:50 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Nov 1 20:35:27 2020 +0100

    dynamic_cast followed by static_cast
    
    Change-Id: I29daabb250d72403ccf751aeeb5fd2fa755e895c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105145
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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) ) );
     }
 


More information about the Libreoffice-commits mailing list