sw/source/uibase/utlui/content.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
New commits: commit 52500239e8a5a8c897a1af25b40e6b4d004eb21b Author: Attila Szűcs <attila.sz...@collabora.com> AuthorDate: Thu Jun 8 11:21:16 2023 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Oct 15 11:25:51 2023 +0200 LOK: navigator: hide empty contentTypes In case of LOK, do not insert empty contenttype to tree, and implement new way to find changes in contents, in hidden contentTypes, because the original checked only on the tree. Change-Id: Ib1e4da5e05b2ad4161c6a66a9c54111d558f66f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152735 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit ed3bb61461e4e394bd476b4ec57ff3025eca153f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157983 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 64e2c4aad25b..ca4e431f8038 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <comphelper/lok.hxx> #include <comphelper/string.hxx> #include <editeng/frmdiritem.hxx> #include <svl/urlbmk.hxx> @@ -2616,6 +2617,13 @@ void SwContentTree::Display( bool bActive ) OUString aImage(GetImageIdForContentTypeId(nCntType)); bool bChOnDemand = 0 != rpContentT->GetMemberCount(); + + // In case of LOK, empty content types must be hidden in the contenttree + if (comphelper::LibreOfficeKit::isActive() && !bChOnDemand) + { + continue; + } + OUString sId(weld::toId(rpContentT.get())); insert(nullptr, rpContentT->GetName(), sId, bChOnDemand, xEntry.get()); m_xTreeView->set_image(*xEntry, aImage); @@ -3010,6 +3018,27 @@ bool SwContentTree::HasContentChanged() // is detected only fill member lists for remaining content types. The Display function // will clear and recreate the treeview from the content type member arrays if content has // changed. + + if (comphelper::LibreOfficeKit::isActive()) + { + // In case of LOK, empty contentTypes are hidden, even in all content view + // so it is not enough to check only the m_xTreeView. + bool bCountChanged = false; + for (ContentTypeId i : o3tl::enumrange<ContentTypeId>()) + { + if (m_aActiveContentArr[i]) + { + auto nLastTMCount = m_aActiveContentArr[i]->GetMemberCount(); + m_aActiveContentArr[i]->FillMemberList(); + // If the member count of a type is changed, then the content is surely changed + if (m_aActiveContentArr[i]->GetMemberCount() != nLastTMCount) + bCountChanged = true; + } + } + if (bCountChanged) + return true; + } + std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator()); // lambda function to find the next content type entry