summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2023-10-08 23:13:51 -0800
committerJim Raykowski <raykowj@gmail.com>2023-10-13 21:28:48 +0200
commit79df80b642179fdd621538e8a7894a2f055ba16a (patch)
treef76450398a8e93c092268150a55b1f990e66a713 /sw/source/uibase/utlui
parentc0a284541fad2c4609d418a5002550f6f9581d51 (diff)
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 <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/content.cxx43
1 files changed, 15 insertions, 28 deletions
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 &&