[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 7 16:33:30 UTC 2020


 sw/source/uibase/utlui/content.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 242e90f16bc23eb85941b0bf13c5350375ce3837
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 7 15:21:52 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 7 18:32:52 2020 +0200

    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/+/104061
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 56c39fa7b25b..626e5354f01d 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2556,8 +2556,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;
                     }
@@ -2565,7 +2566,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)));
@@ -2585,8 +2586,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))


More information about the Libreoffice-commits mailing list