sw/source/uibase/inc/conttree.hxx | 2 +- sw/source/uibase/utlui/content.cxx | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-)
New commits: commit a01e6603d5b0356757fd647f90c69a395f376ba5 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue May 6 11:16:13 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue May 6 15:18:01 2025 +0200 clear while frozen if we will need to freeze anyway so we have a single thaw event Change-Id: If82c40480b418e845932854c6b20b09af208967e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184984 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 362a334dffe1..4a732f4e56ca 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -236,7 +236,7 @@ public: /** Show the file */ void Display( bool bActiveView ); /** In the clear the content types have to be deleted, also. */ - void clear(bool bLeaveFrozen = false); + void clear(); /** 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 2eee844b520f..8d90e3e0e79e 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3044,11 +3044,6 @@ void SwContentTree::Display( bool bActive ) nEntryRelPos = GetAbsPos(*xOldSelEntry) - GetAbsPos(*xParentEntry); } - SwWrtShell* pShell = GetWrtShell(); - // thaw updates widget, in case we still do modification - leave it frozen - bool bLeaveFrozen = !!pShell; - clear(bLeaveFrozen); - if (!bActive) { m_aOverlayObjectDelayTimer.Stop(); @@ -3062,7 +3057,10 @@ void SwContentTree::Display( bool bActive ) else if (State::HIDDEN == m_eState) m_eState = State::ACTIVE; - if (pShell) + SwWrtShell* pShell = GetWrtShell(); + if (!pShell) + clear(); + else { std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator(); std::unique_ptr<weld::TreeIter> xCntTypeEntry; @@ -3070,6 +3068,9 @@ void SwContentTree::Display( bool bActive ) // all content navigation view if(m_nRootType == ContentTypeId::UNKNOWN) { + m_xTreeView->freeze(); + clear(); + for( ContentTypeId nCntType : o3tl::enumrange<ContentTypeId>() ) { std::unique_ptr<SwContentType>& rpContentT = bActive ? @@ -3107,7 +3108,6 @@ void SwContentTree::Display( bool bActive ) } } - bLeaveFrozen = false; // do not thaw on the end m_xTreeView->thaw(); // restore visual expanded tree state @@ -3117,6 +3117,9 @@ void SwContentTree::Display( bool bActive ) // root content navigation view else { + m_xTreeView->freeze(); + clear(); + std::unique_ptr<SwContentType>& rpRootContentT = bActive ? m_aActiveContentArr[m_nRootType] : m_aHiddenContentArr[m_nRootType]; @@ -3143,7 +3146,6 @@ 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) @@ -3188,22 +3190,18 @@ 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(bool bLeaveFrozen) +void SwContentTree::clear() { m_xTreeView->freeze(); m_xTreeView->clear(); m_nEntryCount = 0; - if (!bLeaveFrozen) - m_xTreeView->thaw(); + m_xTreeView->thaw(); } bool SwContentTree::FillTransferData(TransferDataContainer& rTransfer)