diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2023-06-09 05:56:31 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-16 11:39:31 +0200 |
commit | 94426f366beff15784bcd2cd852c980e8d5a4467 (patch) | |
tree | b1d28d8b4e5cfd99646d12411013df62d0e3d7f2 | |
parent | 7215ac4ded82da0c0efc6a5d9465f632e8e8a4b6 (diff) |
LOK: fix for navigator: hide empty contentTypes
fixed that opening heading by default, first check if headings
are not hidden, because it blindly opened the 1. type, but
from now, that can be an other type, or nothing
Change-Id: I86cac472d8cba9a46befc5a84ef073c01fa7243d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152779
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 61e2022110d3088bc1653713dc270beaacae4c74)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157966
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | sw/source/uibase/inc/conttree.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 11 |
3 files changed, 16 insertions, 4 deletions
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 3f3483351daf..495cdfa91353 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -244,6 +244,7 @@ public: { return State::HIDDEN == m_eState ? m_pHiddenShell : m_pActiveShell; } bool IsInDrag() const; + bool HasHeadings() const; sal_uInt8 GetOutlineLevel()const {return m_nOutlineLevel;} void SetOutlineLevel(sal_uInt8 nSet); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index a5079e411331..d047251ea958 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1267,6 +1267,14 @@ bool SwContentTree::IsInDrag() const return m_xTreeView->get_drag_source() == m_xTreeView.get(); } +bool SwContentTree::HasHeadings() const +{ + const std::unique_ptr<SwContentType>& rpContentT = m_aActiveContentArr[ContentTypeId::OUTLINE]; + if (rpContentT && rpContentT->GetMemberCount() > 0) + return true; + return false; +} + // QueryDrop will be executed in the navigator sal_Int8 SwContentTree::AcceptDrop(const AcceptDropEvent& rEvt) { diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 67807c69f8bc..c868592e904d 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -736,10 +736,13 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent, m_xGlobalTree->HideTree(); //Open Headings by default - auto& pTreeView = m_xContentTree->get_widget(); - std::unique_ptr<weld::TreeIter> itEntry(pTreeView.make_iterator()); - pTreeView.get_iter_first(*itEntry); - pTreeView.expand_row(*itEntry); + if (m_xContentTree->HasHeadings()) + { + auto& pTreeView = m_xContentTree->get_widget(); + std::unique_ptr<weld::TreeIter> itEntry(pTreeView.make_iterator()); + pTreeView.get_iter_first(*itEntry); + pTreeView.expand_row(*itEntry); + } } } |