sw/source/uibase/utlui/content.cxx |   33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

New commits:
commit 857fe51bc8f2d3f3535807a69399c7e2fee971ae
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Apr 11 17:50:16 2024 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sun Apr 14 05:08:07 2024 +0200

    SwContentTree: remove repeated pointer assignment
    
    The selected entry does not change within the CommandHdl function
    therefore assignment of the pointer to the selected entry SwContentType
    does not need to be repeated elsewhere in the function.
    
    Change-Id: I025ecb9259e2ee46a64d55c75d0c3f3c8cc625ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166018
    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 8e301753b236..9e80e06c3292 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1941,31 +1941,22 @@ IMPL_LINK(SwContentTree, CommandHdl, const 
CommandEvent&, rCEvt, bool)
         }
         else
         {
-            if (lcl_IsContentType(*xEntry, *m_xTreeView))
-                pType = 
weld::fromId<SwContentType*>(m_xTreeView->get_id(*xEntry));
-            else
-                pType = weld::fromId<SwContent*>(
-                            m_xTreeView->get_id(*xEntry))->GetParent();
-            if (pType)
+            if (ContentTypeId::OUTLINE == nContentType)
             {
-                if (ContentTypeId::OUTLINE == nContentType)
+                bOutline = true;
+                if (State::HIDDEN != m_eState)
                 {
-                    bOutline = true;
-                    if (State::HIDDEN != m_eState)
-                    {
-                        lcl_SetOutlineContentEntriesSensitivities(this, 
*m_xTreeView, *xEntry,
-                                                                  
*xSubPopOutlineContent);
-                        bRemoveSendOutlineEntry = false;
-                    }
-                    bRemoveToggleExpandEntry = 
lcl_InsertExpandCollapseAllItem(*m_xTreeView, *xEntry,
-                                                                               
*xPop);
+                    lcl_SetOutlineContentEntriesSensitivities(this, 
*m_xTreeView, *xEntry,
+                                                              
*xSubPopOutlineContent);
+                    bRemoveSendOutlineEntry = false;
                 }
-                else if (State::HIDDEN != m_eState &&
-                         nContentType == ContentTypeId::POSTIT &&
-                         
!m_pActiveShell->GetView().GetDocShell()->IsReadOnly() &&
-                         pType->GetMemberCount() > 0)
-                    bRemovePostItEntries = false;
+                bRemoveToggleExpandEntry
+                    = lcl_InsertExpandCollapseAllItem(*m_xTreeView, *xEntry, 
*xPop);
             }
+            else if (State::HIDDEN != m_eState && nContentType == 
ContentTypeId::POSTIT
+                     && !m_pActiveShell->GetView().GetDocShell()->IsReadOnly()
+                     && pType->GetMemberCount() > 0)
+                bRemovePostItEntries = false;
         }
     }
 

Reply via email to