include/vcl/salvtables.hxx | 2 ++ vcl/jsdialog/executor.cxx | 20 +++++++++++++------- vcl/source/app/salvtables.cxx | 7 +++++++ 3 files changed, 22 insertions(+), 7 deletions(-)
New commits: commit 9d5201aefffb4636c5e3612013424da4ca701612 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Dec 17 11:02:40 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Tue Jan 19 02:47:26 2021 +0100 jsdialog: add the "expand" action to the tree list view control Change-Id: I69f1b06748053fdfe9164c52e889629e51f91409 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107914 Tested-by: Jenkins Reviewed-by: Henry Castro <hcas...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109204 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index d63d8b00dd36..c46f1a0668f1 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -1339,6 +1339,8 @@ public: virtual bool get_iter_first(weld::TreeIter& rIter) const override; + virtual bool get_iter_abs_pos(weld::TreeIter& rIter, int nPos) const; + virtual bool iter_next_sibling(weld::TreeIter& rIter) const override; virtual bool iter_next(weld::TreeIter& rIter) const override; diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 1a66fe36520a..f4bcc817a461 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -206,7 +206,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat } else if (sControlType == "treeview") { - auto pTreeView = dynamic_cast<weld::TreeView*>(pWidget); + auto pTreeView = dynamic_cast<JSTreeView*>(pWidget); if (pTreeView) { if (sAction == "change") @@ -238,6 +238,16 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat LOKTrigger::trigger_row_activated(*pTreeView); return true; } + else if (sAction == "expand") + { + OString nRowString + = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US); + int nAbsPos = std::atoi(nRowString.getStr()); + std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); + pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); + pTreeView->expand_row(*itEntry); + return true; + } else if (sAction == "dragstart") { OString nRowString @@ -245,17 +255,13 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat int nRow = std::atoi(nRowString.getStr()); pTreeView->select(nRow); + pTreeView->drag_start(); - JSTreeView* pJSTreeView = dynamic_cast<JSTreeView*>(pTreeView); - if (pJSTreeView) - pJSTreeView->drag_start(); return true; } else if (sAction == "dragend") { - JSTreeView* pJSTreeView = dynamic_cast<JSTreeView*>(pTreeView); - if (pJSTreeView) - pJSTreeView->drag_end(); + pTreeView->drag_end(); return true; } } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c4275fefb8be..844e36775ea8 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -4158,6 +4158,13 @@ bool SalInstanceTreeView::get_iter_first(weld::TreeIter& rIter) const return rVclIter.iter != nullptr; } +bool SalInstanceTreeView::get_iter_abs_pos(weld::TreeIter& rIter, int nAbsPos) const +{ + SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter); + rVclIter.iter = m_xTreeView->GetEntryAtAbsPos(nAbsPos); + return rVclIter.iter != nullptr; +} + bool SalInstanceTreeView::iter_next_sibling(weld::TreeIter& rIter) const { SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits