sw/source/uibase/utlui/content.cxx |   43 ++++++++++++-------------------------
 1 file changed, 15 insertions(+), 28 deletions(-)

New commits:
commit 79df80b642179fdd621538e8a7894a2f055ba16a
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sun Oct 8 23:13:51 2023 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Fri Oct 13 21:28:48 2023 +0200

    SwNavigator: Fix Indexes tracking
    
    Restores Indexes tracking when the document cursor is in TOX
    content which was lost in commit
    ca34204a39716ec9aa621e60ea50fb3c058c55f6.
    
    Change-Id: Ib0fed4b7a20b5d08b5c52eef28d13cf0044d87d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157693
    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 7456d2a28e12..9d96415c5c35 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3981,36 +3981,23 @@ void SwContentTree::UpdateTracking()
             return;
         }
         // hyperlinks
-        if (SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
-                
m_pActiveShell->GetContentAtPos(m_pActiveShell->GetCursorDocPos(), 
aContentAtPos) &&
-                !(m_bIsRoot && m_nRootType != ContentTypeId::URLFIELD))
+        // not in ToxContent tdf#148312
+        if (const SwSection* pSection = m_pActiveShell->GetCurrSection(); 
!pSection
+            || (pSection && pSection->GetType() != SectionType::ToxContent))
         {
-            // There is no need to search for hyperlinks in ToxContent 
tdf#148312
-            if (const SwTextINetFormat* pTextINetFormat =
-                    static_txtattr_cast<const 
SwTextINetFormat*>(aContentAtPos.pFndTextAttr))
-            {
-                if (const SwTextNode* pTextNode = 
pTextINetFormat->GetpTextNode())
-                {
-                    if (const SwSectionNode* pSectNd = 
pTextNode->FindSectionNode())
-                    {
-                        SectionType eType = pSectNd->GetSection().GetType();
-                        if (SectionType::ToxContent == eType)
-                        {
-                            m_xTreeView->set_cursor(-1);
-                            Select();
-                            return;
-                        }
-                    }
-                }
+            if (SwContentAtPos aContentAtPos(IsAttrAtPos::InetAttr);
+                
m_pActiveShell->GetContentAtPos(m_pActiveShell->GetCursorDocPos(), 
aContentAtPos)
+                && (!m_bIsRoot || m_nRootType == ContentTypeId::URLFIELD))
+            {
+                // Because hyperlink item names do not need to be unique, 
finding the corresponding
+                // item in the tree by name may result in incorrect selection. 
Find the item in the
+                // tree by comparing the SwTextINetFormat pointer at the 
document cursor position to
+                // that stored in the item SwURLFieldContent.
+                if (mTrackContentType[ContentTypeId::URLFIELD])
+                    lcl_SelectByContentTypeAndAddress(this, *m_xTreeView, 
ContentTypeId::URLFIELD,
+                                                      
aContentAtPos.pFndTextAttr);
+                return;
             }
-            // Because hyperlink item names do not need to be unique, finding 
the corresponding item
-            // in the tree by name may result in incorrect selection. Find the 
item in the tree by
-            // comparing the SwTextINetFormat pointer at the document cursor 
position to that stored
-            // in the item SwURLFieldContent.
-            if (mTrackContentType[ContentTypeId::URLFIELD])
-                lcl_SelectByContentTypeAndAddress(this, *m_xTreeView, 
ContentTypeId::URLFIELD,
-                                                  aContentAtPos.pFndTextAttr);
-            return;
         }
         // fields, comments
         if (SwField* pField = m_pActiveShell->GetCurField(); pField &&

Reply via email to