sd/source/ui/dlg/navigatr.cxx |   51 +++++++++++++++++++++++++++++-------------
 1 file changed, 36 insertions(+), 15 deletions(-)

New commits:
commit 878ab17b0fad66fb7accd9573ef7f66403d593b9
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sun Mar 31 13:56:36 2024 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Apr 2 22:43:45 2024 +0200

    tdf#139944 SdNavigator: disable in master mode
    
    Improve where the disable is done and in addition to making disabled
    also clear the objects tree.
    
    Also fixes a drag and drop ordering scrolling bug introduced by commit
    60e32969a98cad348cf8e55e8f93abc3d6e9c70c
    
    Change-Id: I702c85bc1ba16837fb7f8c2246bdb29d96e6cc6f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165606
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index dbea0b6b4818..a329601a2a35 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -157,6 +157,24 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc 
)
 {
     SdDrawDocument* pNonConstDoc = const_cast<SdDrawDocument*>(pDoc); // const 
as const can...
     sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
+    ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+
+    // tdf#139944 disable navigator in master mode
+    if (pViewShell)
+    {
+        if (const sd::DrawViewShell* pDrawViewShell = 
static_cast<::sd::DrawViewShell*>(pViewShell))
+        {
+            if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
+            {
+                m_xContainer->set_sensitive(false);
+                mxTlbObjects->clear();
+                return;
+            }
+            else
+                m_xContainer->set_sensitive(true);
+        }
+    }
+
     const OUString& aDocShName( pDocShell->GetName() );
     OUString aDocName = pDocShell->GetMedium()->GetName();
     if (!mxTlbObjects->IsEqualToDoc(pDoc))
@@ -165,7 +183,8 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc )
         RefreshDocumentLB();
         mxLbDocs->set_active_text(aDocShName);
     }
-    if (const sd::ViewShell* pViewShell = pDocShell->GetViewShell())
+
+    if (pViewShell)
         lcl_select_marked_object(pViewShell, mxTlbObjects.get());
 }
 
@@ -176,6 +195,22 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* 
pDoc )
     OUString aDocShName( pDocShell->GetName() );
     ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
 
+    // tdf#139944 disable navigator in master mode
+    if (pViewShell)
+    {
+        if (const sd::DrawViewShell* pDrawViewShell = 
static_cast<::sd::DrawViewShell*>(pViewShell))
+        {
+            if (pDrawViewShell->GetEditMode() == EditMode::MasterPage)
+            {
+                m_xContainer->set_sensitive(false);
+                mxTlbObjects->clear();
+                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)
@@ -783,20 +818,6 @@ void 
SdNavigatorControllerItem::StateChangedAtToolBoxControl( sal_uInt16 nSId,
     if( !(pInfo && pInfo->IsActive()) )
         return;
 
-    if (::sd::DrawDocShell* pDrawDocShell = pInfo->GetDrawDocShell())
-    {
-        const auto pDrawViewShell =
-                static_cast<::sd::DrawViewShell 
*>(pDrawDocShell->GetViewShell());
-        if (pDrawViewShell)
-        {
-            pNavigatorWin->FreshTree(pDrawDocShell->GetDoc());
-            bool bEditModePage(pDrawViewShell->GetEditMode() == 
EditMode::Page);
-            pNavigatorWin->mxToolbox->set_sensitive(bEditModePage);
-            pNavigatorWin->mxLbDocs->set_sensitive(bEditModePage);
-            pNavigatorWin->mxTlbObjects->set_sensitive(bEditModePage);
-        }
-    }
-
     const SfxUInt32Item& rStateItem = dynamic_cast<const 
SfxUInt32Item&>(*pItem);
     NavState nState = static_cast<NavState>(rStateItem.GetValue());
 

Reply via email to