diff options
author | Henry Castro <hcastro@collabora.com> | 2020-12-17 11:02:40 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2020-12-22 13:04:47 +0100 |
commit | 07ba7227104f5c30a6dbaa88314cf62aac28b7c5 (patch) | |
tree | 62ba6bb8b58f8142791b92e4f2938e9d6e5b5e93 /vcl/jsdialog | |
parent | 71ec214d7583f637fefcb5eca13c637cc6b38029 (diff) |
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 <hcastro@collabora.com>
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r-- | vcl/jsdialog/executor.cxx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index b2103fbe865f..0ff259e7bfd4 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -179,7 +179,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") @@ -209,6 +209,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 @@ -216,17 +226,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; } } |