From 07ba7227104f5c30a6dbaa88314cf62aac28b7c5 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Thu, 17 Dec 2020 11:02:40 -0400 Subject: 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 --- vcl/jsdialog/executor.cxx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'vcl/jsdialog') 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(pWidget); + auto pTreeView = dynamic_cast(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 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(pTreeView); - if (pJSTreeView) - pJSTreeView->drag_start(); return true; } else if (sAction == "dragend") { - JSTreeView* pJSTreeView = dynamic_cast(pTreeView); - if (pJSTreeView) - pJSTreeView->drag_end(); + pTreeView->drag_end(); return true; } } -- cgit