sw/source/uibase/inc/conttree.hxx | 2 +- sw/source/uibase/utlui/content.cxx | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-)
New commits: commit b96aedb6f4a830c9b61f103dbbe71f491dca1d70 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Apr 30 13:52:09 2025 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed May 21 12:12:28 2025 +0200 Navigator: freeze/thaw collapse Do single set of freeze / thaw. Previously we did once for cleanup, then another one for fill. That is worse for JSDialog where thaw emits update of the widget. expand_row has assertion protecting from doing it in the frozen state. Change-Id: I1b962560b5f864cca42c475789917a2ce5e61bb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184835 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185590 Tested-by: Jenkins diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 7512c574d178..b2981e9b50d5 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -239,7 +239,7 @@ public: /** Show the file */ void Display( bool bActiveView ); /** In the clear the content types have to be deleted, also. */ - void clear(); + void clear(bool bLeaveFrozen = false); /** After a file is dropped on the Navigator, the new shell will be set */ void SetHiddenShell(SwWrtShell* pSh); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 4afcecf265b4..bc322460de81 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3218,7 +3218,10 @@ void SwContentTree::Display( bool bActive ) nEntryRelPos = GetAbsPos(*xOldSelEntry) - GetAbsPos(*xParentEntry); } - clear(); + SwWrtShell* pShell = GetWrtShell(); + // thaw updates widget, in case we still do modification - leave it frozen + bool bLeaveFrozen = !!pShell; + clear(bLeaveFrozen); if (!bActive) { @@ -3233,7 +3236,6 @@ void SwContentTree::Display( bool bActive ) else if (State::HIDDEN == m_eState) m_eState = State::ACTIVE; - SwWrtShell* pShell = GetWrtShell(); if (pShell) { std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator(); @@ -3242,8 +3244,6 @@ void SwContentTree::Display( bool bActive ) // all content navigation view if(m_nRootType == ContentTypeId::UNKNOWN) { - m_xTreeView->freeze(); - for( ContentTypeId nCntType : o3tl::enumrange<ContentTypeId>() ) { std::unique_ptr<SwContentType>& rpContentT = bActive ? @@ -3281,6 +3281,7 @@ void SwContentTree::Display( bool bActive ) } } + bLeaveFrozen = false; // do not thaw on the end m_xTreeView->thaw(); // restore visual expanded tree state @@ -3290,8 +3291,6 @@ void SwContentTree::Display( bool bActive ) // root content navigation view else { - m_xTreeView->freeze(); - std::unique_ptr<SwContentType>& rpRootContentT = bActive ? m_aActiveContentArr[m_nRootType] : m_aHiddenContentArr[m_nRootType]; @@ -3318,6 +3317,7 @@ void SwContentTree::Display( bool bActive ) m_xTreeView->set_sensitive(*xEntry, m_xTreeView->iter_has_child(*xEntry)); + bLeaveFrozen = false; // do not thaw on the end m_xTreeView->thaw(); if (bChOnDemand) @@ -3362,18 +3362,22 @@ void SwContentTree::Display( bool bActive ) UpdateContentFunctionsToolbar(); } + if (bLeaveFrozen) + m_xTreeView->thaw(); + if (!m_bIgnoreDocChange && GetEntryCount() == nOldEntryCount) { m_xTreeView->vadjustment_set_value(nOldScrollPos); } } -void SwContentTree::clear() +void SwContentTree::clear(bool bLeaveFrozen) { m_xTreeView->freeze(); m_xTreeView->clear(); m_nEntryCount = 0; - m_xTreeView->thaw(); + if (!bLeaveFrozen) + m_xTreeView->thaw(); } bool SwContentTree::FillTransferData(TransferDataContainer& rTransfer)