LOK: Navigator: fix expand problems
Save/load content types' expanded status to view, and make sure it
is synchronized with client.
Treeviews now receive/send collapse event/status from/to client.
I've rewritten the way how headings are opened by default
(because synch of collapsed status broke that, as sub-headings
were not expanded at core side).
Change-Id: I80f5b4d99fe5224391a92c4609f94ddbcf37b8ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153771
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit b95750af71
)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158016
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
parent
94426f366b
commit
3649dc202b
6 changed files with 42 additions and 5 deletions
|
@ -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:
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue