[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 8 19:28:03 UTC 2020
sw/source/uibase/utlui/content.cxx | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
New commits:
commit 95438b18160a8b6e51c30c6566e40f5aeaf94f1f
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Mon Sep 21 23:50:26 2020 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Oct 8 21:27:25 2020 +0200
tdf#136964 Writer Navigator: Use same Headings expanded states
for Headings content navigation view and All content navigation view.
Change-Id: I21fae6f0b6c0c67dd89a58fb6a5694475238e66c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103742
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 626e5354f01d..bc801c5af2d0 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2039,13 +2039,12 @@ void SwContentTree::Display( bool bActive )
{
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
std::unique_ptr<weld::TreeIter> xSelEntry;
+ std::vector<std::unique_ptr<weld::TreeIter>> aNodesToExpand;
// all content navigation view
if(m_nRootType == ContentTypeId::UNKNOWN)
{
m_xTreeView->freeze();
- std::vector<std::unique_ptr<weld::TreeIter>> aNodesToExpand;
-
for( ContentTypeId nCntType : o3tl::enumrange<ContentTypeId>() )
{
std::unique_ptr<SwContentType>& rpContentT = bActive ?
@@ -2054,11 +2053,10 @@ void SwContentTree::Display( bool bActive )
if(!rpContentT)
rpContentT.reset(new SwContentType(pShell, nCntType, m_nOutlineLevel ));
- OUString sEntry = rpContentT->GetName();
OUString aImage(GetImageIdForContentTypeId(nCntType));
bool bChOnDemand = 0 != rpContentT->GetMemberCount();
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rpContentT.get())));
- insert(nullptr, sEntry, sId, bChOnDemand, xEntry.get());
+ insert(nullptr, rpContentT->GetName(), sId, bChOnDemand, xEntry.get());
m_xTreeView->set_image(*xEntry, aImage);
m_xTreeView->set_sensitive(*xEntry, bChOnDemand);
@@ -2169,7 +2167,8 @@ void SwContentTree::Display( bool bActive )
}
else
{
- RequestingChildren(*xEntry);
+ // fill contents of to-be expanded entries while frozen
+ Expand(*xEntry, &aNodesToExpand);
m_xTreeView->set_children_on_demand(*xEntry, false);
}
@@ -2177,7 +2176,14 @@ void SwContentTree::Display( bool bActive )
m_xTreeView->thaw();
- m_xTreeView->expand_row(*xEntry);
+ if (bChOnDemand)
+ {
+ // restore visual expanded tree state
+ for (const auto& rNode : aNodesToExpand)
+ m_xTreeView->expand_row(*rNode);
+ }
+ else
+ m_xTreeView->expand_row(*xEntry);
// reselect the entry
if (nEntryRelPos)
More information about the Libreoffice-commits
mailing list