sw/source/uibase/utlui/content.cxx | 43 ++++++++++++------------------------- 1 file changed, 15 insertions(+), 28 deletions(-)
New commits: commit 5728686b2f133e7a0e23544ecaebc34bfdde434b Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Sun Oct 8 23:13:51 2023 -0800 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Oct 18 10:57:35 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> (cherry picked from commit 79df80b642179fdd621538e8a7894a2f055ba16a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158031 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5114761fe939..cd6528752fef 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3932,36 +3932,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 &&