diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2023-06-08 11:21:16 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-15 11:25:51 +0200 |
commit | 52500239e8a5a8c897a1af25b40e6b4d004eb21b (patch) | |
tree | a03db05fb6cbd2ed3e74ec69733f7ec028eec8c6 /sw/source/uibase/utlui | |
parent | 148394645cf753e8548b7cff6effe4ae69ca0fbd (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@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.mcnamara@collabora.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
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 |