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

Caolán McNamara caolanm at redhat.com
Mon May 16 11:27:25 UTC 2016


 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx |   26 ++++++----------
 1 file changed, 10 insertions(+), 16 deletions(-)

New commits:
commit 689e53de62e83c17df592b3d020599acd2b41a4e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 16 12:26:55 2016 +0100

    no need to double dynamic_cast
    
    Change-Id: I183d03c4c28f87790665ac971abc9544e86797f1

diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 3393c5a..73cd3a8 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -720,15 +720,12 @@ void SlideSorterViewShell::GetStateMovePageFirst (SfxItemSet& rSet)
     if ( ! IsMainViewShell())
     {
         std::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
-        if (pMainViewShell.get() != nullptr && nullptr != dynamic_cast< const DrawViewShell *>( pMainViewShell.get() ))
+        DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
+        if (pDrawViewShell != nullptr && pDrawViewShell->GetPageKind() == PK_HANDOUT)
         {
-            DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
-            if (pDrawViewShell != nullptr && pDrawViewShell->GetPageKind() == PK_HANDOUT)
-            {
-                rSet.DisableItem( SID_MOVE_PAGE_FIRST );
-                rSet.DisableItem( SID_MOVE_PAGE_UP );
-                return;
-            }
+            rSet.DisableItem( SID_MOVE_PAGE_FIRST );
+            rSet.DisableItem( SID_MOVE_PAGE_UP );
+            return;
         }
     }
 
@@ -837,15 +834,12 @@ void SlideSorterViewShell::ExecMovePageLast (SfxRequest& /*rReq*/)
 void SlideSorterViewShell::GetStateMovePageLast (SfxItemSet& rSet)
 {
     std::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
-    if (pMainViewShell.get() != nullptr && nullptr != dynamic_cast< const DrawViewShell *>( pMainViewShell.get() ))
+    DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
+    if (pDrawViewShell != nullptr && pDrawViewShell->GetPageKind() == PK_HANDOUT)
     {
-       DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
-        if (pDrawViewShell != nullptr && pDrawViewShell->GetPageKind() == PK_HANDOUT)
-        {
-            rSet.DisableItem( SID_MOVE_PAGE_LAST );
-            rSet.DisableItem( SID_MOVE_PAGE_DOWN );
-            return;
-        }
+        rSet.DisableItem( SID_MOVE_PAGE_LAST );
+        rSet.DisableItem( SID_MOVE_PAGE_DOWN );
+        return;
     }
 
     sal_uInt16 lastSelectedPageNo = 0;


More information about the Libreoffice-commits mailing list