From b97aa4eada3164b20f663a9817e92af78495109f Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Sun, 8 Oct 2023 22:42:09 -0800 Subject: tdf#144349 related: Make master document navigator track TOX content Done, with a related patch to make the master document navigator track 'Text' content, to make the Navigator less likely not to have an item selected, which may be enough to resolve tdf#155741 - Allow insertion of items into master without a selected item Change-Id: I6df1b668c502cadbe057229e031ede9aa4f4089a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157695 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- sw/source/uibase/utlui/glbltree.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sw') diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 26dd58f5b7ea..fe18195e7c22 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -801,7 +801,20 @@ void SwGlobalTree::UpdateTracking() const SwSection* pSection = pActiveShellCurrSection; while (SwSection* pParent = pSection->GetParent()) pSection = pParent; - m_xTreeView->select_text(pSection->GetSectionName()); + for (const std::unique_ptr& rGlblDocContent : *m_pSwGlblDocContents) + { + if (rGlblDocContent->GetType() == GlobalDocContentType::GLBLDOC_UNKNOWN) + continue; + if ((pSection->GetType() == SectionType::ToxContent + && rGlblDocContent->GetTOX() == pSection->GetTOXBase()) + || (pSection->GetType() != SectionType::ToxContent + && rGlblDocContent->GetSection() == pSection)) + { + const OUString& rId(weld::toId(rGlblDocContent.get())); + m_xTreeView->select(m_xTreeView->find_id(rId)); + break; + } + } } Select(); -- cgit