sd/source/ui/dlg/navigatr.cxx |   61 +++++++++++++++++++-----------------------
 1 file changed, 29 insertions(+), 32 deletions(-)

New commits:
commit 64f1fbc4a66715aa616ffeff1eb612393fa9fba3
Author:     Jim Raykowski <[email protected]>
AuthorDate: Wed Mar 13 16:26:44 2024 -0800
Commit:     Jim Raykowski <[email protected]>
CommitDate: Wed Apr 10 18:48:39 2024 +0200

    tdf#160190 Fix selection stops working in sidebar SdNavigator
    
    after formula or OLE insert
    
    Change-Id: I945a07fef137aa30afff91ac7c50f180e5f4c3d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164797
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <[email protected]>

diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 538f1c68b113..5c01c44b618d 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -164,20 +164,21 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* 
pDoc )
     sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
     ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
 
+    // tdf#160190
+    if (!pViewShell)
+        return;
+
     // tdf#139944 disable navigator in master mode
-    if (pViewShell)
+    if (const sd::DrawViewShell* pDrawViewShell = 
static_cast<::sd::DrawViewShell*>(pViewShell))
     {
-        if (const sd::DrawViewShell* pDrawViewShell = 
static_cast<::sd::DrawViewShell*>(pViewShell))
+        if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
         {
-            if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
-            {
-                m_xContainer->set_sensitive(false);
-                mxTlbObjects->clear();
-                return;
-            }
-            else
-                m_xContainer->set_sensitive(true);
+            m_xContainer->set_sensitive(false);
+            mxTlbObjects->clear();
+            return;
         }
+        else
+            m_xContainer->set_sensitive(true);
     }
 
     const OUString& aDocShName( pDocShell->GetName() );
@@ -189,8 +190,7 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc )
         mxLbDocs->set_active_text(aDocShName);
     }
 
-    if (pViewShell)
-        lcl_select_marked_objects(pViewShell, mxTlbObjects.get());
+    lcl_select_marked_objects(pViewShell, mxTlbObjects.get());
 }
 
 void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
@@ -200,35 +200,33 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* 
pDoc )
     OUString aDocShName( pDocShell->GetName() );
     ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
 
+    // tdf#160190
+    if (!pViewShell)
+        return;
+
     // tdf#139944 disable navigator in master mode
-    if (pViewShell)
+    if (const sd::DrawViewShell* pDrawViewShell = 
static_cast<::sd::DrawViewShell*>(pViewShell))
     {
-        if (const sd::DrawViewShell* pDrawViewShell = 
static_cast<::sd::DrawViewShell*>(pViewShell))
+        if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
         {
-            if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
-            {
-                m_xContainer->set_sensitive(false);
-                mxTlbObjects->clear();
-                RefreshDocumentLB();
-                return;
-            }
-            else
-                m_xContainer->set_sensitive(true);
+            m_xContainer->set_sensitive(false);
+            mxTlbObjects->clear();
+            RefreshDocumentLB();
+            return;
         }
+        else
+            m_xContainer->set_sensitive(true);
     }
 
     // Restore the 'ShowAllShapes' flag from the last time (in this session)
     // that the navigator was shown.
-    if (pViewShell != nullptr)
-    {
-        ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
-        if (pFrameView != nullptr)
-            
mxTlbObjects->SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), 
false);
-    }
+    ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
+    if (pFrameView != nullptr)
+        
mxTlbObjects->SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), 
false);
 
     // Disable the shape filter drop down menu when there is a running slide
     // show.
-    if (pViewShell!=nullptr && sd::SlideShow::IsRunning( 
pViewShell->GetViewShellBase() )
+    if (sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() )
         && !sd::SlideShow::IsInteractiveSlideshow( 
&pViewShell->GetViewShellBase() ) ) // IASS
         mxToolbox->set_item_sensitive("shapes", false);
     else
@@ -256,8 +254,7 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc 
)
         }
     }
 
-    if (pViewShell)
-        lcl_select_marked_objects(pViewShell, mxTlbObjects.get());
+    lcl_select_marked_objects(pViewShell, mxTlbObjects.get());
 }
 
 /**

Reply via email to