Resolves: tdf#137274 comment node not expandable when there are comments
if it was opened and closed before deleting (or undoing thereof) comments
If the node is currently not expanded, but it was previously expanded, then it
is not filled-on-demand because it is already filled.
If the content it tracks has changed, remove its current children and set it to
filled-on-demand if there would be a non-zero set of new children
Change-Id: Ic8eafea7f298d285d1e6c4a60cb21b57a971bd86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103980
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 44ce6c1..4729818 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2377,8 +2377,9 @@ bool SwContentTree::HasContentChanged()
// i.e. in header/footer
pArrType->FillMemberList(&bLevelOrVisibilityChanged);
bool bRemoveChildren = false;
const size_t nChildCount = GetChildCount(*xEntry);
if (nChildCount != pArrType->GetMemberCount())
const size_t nOldChildCount = GetChildCount(*xEntry);
const size_t nNewChildCount = pArrType->GetMemberCount();
if (nOldChildCount != nNewChildCount)
{
bRemoveChildren = true;
}
@@ -2386,7 +2387,7 @@ bool SwContentTree::HasContentChanged()
{
std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(xEntry.get()));
(void)m_xTreeView->iter_children(*xChild);
for (size_t j = 0; j < nChildCount; ++j)
for (size_t j = 0; j < nOldChildCount; ++j)
{
const SwContent* pCnt = pArrType->GetMember(j);
OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
@@ -2406,8 +2407,8 @@ bool SwContentTree::HasContentChanged()
remove(*xRemove);
m_xTreeView->copy_iterator(*xEntry, *xRemove);
}
m_xTreeView->set_children_on_demand(*xEntry, nNewChildCount != 0);
}
m_xTreeView->set_children_on_demand(*xEntry, !nChildCount);
}
else if((nCntCount != 0)
!= (pArrType->GetMemberCount()!=0))