sw/source/uibase/utlui/content.cxx |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 7c4f9a1280e5524eee81fe65bf5d76e83e68275e
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Sep 23 23:51:59 2021 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Sep 25 23:10:39 2021 +0200

    SwNavigator: Set in content type init if delete and edit are allowed
    
    Fixes crash that occurs for REFERENCE content type 'Delete' and
    'Edit...' menu items. These are not allowed for REFERENCE content type.
    
    Change-Id: I893acd57f80c9a96637e4070f3e1ca7c29b1d7ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122559
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 2acbcc679ef8..583ccd958ce7 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -493,8 +493,8 @@ void SwContentType::Init(bool* pbInvalidateWindow)
         case ContentTypeId::REFERENCE:
         {
             m_nMemberCount = m_pWrtShell->GetRefMarks();
-            m_bEdit = true;
-            m_bDelete = true;
+            m_bEdit = false;
+            m_bDelete = false;
         }
         break;
         case ContentTypeId::URLFIELD:
@@ -1587,12 +1587,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
                 ContentTypeId::INDEX == nContentType ||
                 ContentTypeId::DRAWOBJECT == nContentType);
 
-        if (ContentTypeId::TEXTFIELD == nContentType || 
ContentTypeId::REFERENCE == nContentType)
-        {
-            bRemoveEditEntry = false;
-            bRemoveDeleteEntry = false;
-        }
-        else if(ContentTypeId::OUTLINE == nContentType)
+        if(ContentTypeId::OUTLINE == nContentType)
         {
             bOutline = true;
             lcl_SetOutlineContentEntriesSensitivities(this, *m_xTreeView, 
*xEntry, *xSubPopOutlineContent);
@@ -4523,8 +4518,9 @@ void SwContentTree::EditEntry(const weld::TreeIter& 
rEntry, EditEntryMode nMode)
             else
                 nSlot = SID_EDIT_HYPERLINK;
         break;
-        case ContentTypeId::TEXTFIELD:
         case ContentTypeId::REFERENCE:
+        break;
+        case ContentTypeId::TEXTFIELD:
         {
             const SwTextFieldContent* pTextFieldCnt = static_cast<const 
SwTextFieldContent*>(pCnt);
             if (nMode == EditEntryMode::DELETE)

Reply via email to