summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/view.hxx1
-rw-r--r--sw/source/uibase/inc/conttree.hxx2
-rw-r--r--sw/source/uibase/utlui/content.cxx21
-rw-r--r--sw/source/uibase/utlui/navipi.cxx9
-rw-r--r--vcl/jsdialog/executor.cxx10
-rw-r--r--vcl/source/treelist/svtabbx.cxx4
6 files changed, 42 insertions, 5 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index c5967bb4e213..523f86cc8468 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -355,6 +355,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
public: // #i123922# Needs to be called from a 2nd place now as a helper method
SAL_DLLPRIVATE bool InsertGraphicDlg( SfxRequest& );
+ sal_Int32 m_nNaviExpandedStatus = -1;
protected:
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index 495cdfa91353..9c6db5b5a5eb 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -274,6 +274,8 @@ public:
// return true if it has any children
bool RequestingChildren(const weld::TreeIter& rParent);
+ void ExpandAllHeadings();
+
virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) override;
sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index d047251ea958..02d3a661e4d1 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1135,6 +1135,12 @@ SwContentTree::SwContentTree(std::unique_ptr<weld::TreeView> xTreeView, SwNaviga
OUString sDocTitle = pView->GetDocShell()->GetTitle();
if (lcl_DocOutLineExpandStateMap.find(sDocTitle) != lcl_DocOutLineExpandStateMap.end())
mOutLineNodeMap = lcl_DocOutLineExpandStateMap[sDocTitle];
+ if (comphelper::LibreOfficeKit::isActive()) {
+ if (pView->m_nNaviExpandedStatus < 0)
+ m_nActiveBlock = 1;
+ else
+ m_nActiveBlock = pView->m_nNaviExpandedStatus;
+ }
}
m_aUpdTimer.SetInvokeHandler(LINK(this, SwContentTree, TimerUpdate));
@@ -1149,6 +1155,8 @@ SwContentTree::~SwContentTree()
{
OUString sDocTitle = pView->GetDocShell()->GetTitle();
lcl_DocOutLineExpandStateMap[sDocTitle] = mOutLineNodeMap;
+ if (comphelper::LibreOfficeKit::isActive())
+ pView->m_nNaviExpandedStatus = m_nActiveBlock;
}
clear(); // If applicable erase content types previously.
m_aUpdTimer.Stop();
@@ -2225,6 +2233,19 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent)
return false;
}
+void SwContentTree::ExpandAllHeadings()
+{
+ if (HasHeadings())
+ {
+ std::unique_ptr<weld::TreeIter> xEntry = GetEntryAtAbsPos(0);
+ if (xEntry)
+ {
+ if (!IsAllExpanded(*m_xTreeView, *xEntry))
+ ExpandOrCollapseAll(*m_xTreeView, *xEntry);
+ }
+ }
+}
+
SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
{
SdrObject *pRetObj = nullptr;
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index c868592e904d..3fd5b7f9b682 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -736,12 +736,11 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent,
m_xGlobalTree->HideTree();
//Open Headings by default
- if (m_xContentTree->HasHeadings())
+ SwView *pView = GetCreateView();
+ if (pView->m_nNaviExpandedStatus < 0)
{
- auto& pTreeView = m_xContentTree->get_widget();
- std::unique_ptr<weld::TreeIter> itEntry(pTreeView.make_iterator());
- pTreeView.get_iter_first(*itEntry);
- pTreeView.expand_row(*itEntry);
+ pView->m_nNaviExpandedStatus = 1;
+ m_xContentTree->ExpandAllHeadings();
}
}
}
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 17c56d78e61e..46d5fb675366 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -498,6 +498,16 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap
pTreeView->expand_row(*itEntry);
return true;
}
+ else if (sAction == "collapse")
+ {
+ sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]);
+ std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator());
+ pTreeView->get_iter_abs_pos(*itEntry, nAbsPos);
+ pTreeView->set_cursor_without_notify(*itEntry);
+ pTreeView->grab_focus();
+ pTreeView->collapse_row(*itEntry);
+ return true;
+ }
else if (sAction == "dragstart")
{
sal_Int32 nRow = o3tl::toInt32(rData["data"]);
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 0c3a179f0adf..81f0f4e8b078 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -104,6 +104,10 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter,
rJsonWriter.put("ondemand", true);
}
}
+ if (rChildren.size() > 0 && !pTabListBox->IsExpanded(pEntry))
+ {
+ rJsonWriter.put("collapsed", true);
+ }
if (bCheckButtons)
{