sw/source/uibase/utlui/content.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
New commits: commit 5e9c8d21874eea8cb5adf2ecab1905295af2308f Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Sun Sep 24 12:58:04 2023 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Tue Sep 26 02:47:10 2023 +0200 tdf#152029 Fix sections not brought to attention in master document SwSectionFormats::FindFormatByName doesn't seem to find section formats by name for sections of a document contained in a master document. This causes the document sections to not be brought to attention by hovering the mouse over the section entry in the Navigator. This patch makes the document sections be brought to attention by using an approach similiar to what is done to fill the sections entries in the Navigator content tree. Change-Id: I10e265d23a311440ac91d44b3185f807b205edb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157231 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 d8a6e71daa04..77fd3a6f5eb8 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -5719,12 +5719,23 @@ void SwContentTree::BringEntryToAttention(const weld::TreeIter& rEntry) { BringBookmarksToAttention(std::vector<OUString> {pCnt->GetName()}); } - else if (nType == ContentTypeId::REGION|| nType == ContentTypeId::INDEX) + else if (nType == ContentTypeId::REGION || nType == ContentTypeId::INDEX) { - const SwSectionFormats& rFormats = m_pActiveShell->GetDoc()->GetSections(); - const SwSectionFormat* pFormat = rFormats.FindFormatByName(pCnt->GetName()); - if (pFormat) - BringTypesWithFlowFramesToAttention({pFormat->GetSectionNode()}); + size_t nSectionFormatCount = m_pActiveShell->GetSectionFormatCount(); + for (size_t i = 0; i < nSectionFormatCount; ++i) + { + const SwSectionFormat& rSectionFormat = m_pActiveShell->GetSectionFormat(i); + if (!rSectionFormat.IsInNodesArr()) + continue; + const SwSection* pSection = rSectionFormat.GetSection(); + if (!pSection) + continue; + if (pCnt->GetName() == pSection->GetSectionName()) + { + BringTypesWithFlowFramesToAttention({rSectionFormat.GetSectionNode()}); + break; + } + } } else if (nType == ContentTypeId::URLFIELD) {