sw/source/uibase/utlui/content.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
New commits: commit 07982093f9751e333526252982292bf56d0990d3 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Wed Jan 26 21:12:45 2022 -0900 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Sat Jan 29 23:04:24 2022 +0100 SwNavigator: fix HasContentChanged always returns true when there are outline nodes in the frames, headers, footer section of the document model When outline nodes are in the frames, headers, footers section of the document model the outline content array, used to fill Writer Navigator content tree outline content type members and determine outline content change, will likely differ in order to that of the document model outline nodes array. Outline nodes in frames, headers, and footers section of the document model are placed at the beginning of the document model outline nodes array. Writer outline content array members are placed in document appearance order. This patch is done to correct comparison of old outline content array members to current outline content array members to determine outline level change. Change-Id: I5047aa0491a9d0f170fe61f381bf0982f97ff906 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129063 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 0079e5b33e2b..181217ac68f3 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -456,7 +456,6 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) const size_t nOutlineCount = m_nMemberCount = m_pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount(); - size_t nPos = 0; for (size_t i = 0; i < nOutlineCount; ++i) { const sal_uInt8 nLevel = m_pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(i); @@ -478,15 +477,28 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) auto pCnt(make_unique<SwOutlineContent>(this, aEntry, i, nLevel, m_pWrtShell->IsOutlineMovable( i ), nYPos)); m_pMember->insert(std::move(pCnt)); - // with the same number and existing "pOldMember" the - // old one is compared with the new OutlinePos. - if (nOldMemberCount > nPos && static_cast<SwOutlineContent*>((*pOldMember)[nPos].get())->GetOutlineLevel() != nLevel) - *pbLevelOrVisibilityChanged = true; - - nPos++; } } + // need to check level (and equal entry number) after + // creation due to a sorted list being used here + if (pOldMember && nullptr != pbLevelOrVisibilityChanged) + { + if (pOldMember->size() != m_pMember->size()) + { + *pbLevelOrVisibilityChanged = true; + break; + } + for (size_t i = 0; i < pOldMember->size(); i++) + { + if (static_cast<SwOutlineContent*>((*pOldMember)[i].get())->GetOutlineLevel() != + static_cast<SwOutlineContent*>((*m_pMember)[i].get())->GetOutlineLevel()) + { + *pbLevelOrVisibilityChanged = true; + break; + } + } + } } break; case ContentTypeId::TABLE :