jsdialog: execute IconView actions

Change-Id: If94df547096a5adb15ace432695f91ee7e879bb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109078
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109257
Tested-by: Jenkins
This commit is contained in:
Szymon Kłos
2021-01-11 09:47:33 +01:00
parent 26f246c020
commit e87119a3a9
3 changed files with 40 additions and 1 deletions

View File

@@ -22,6 +22,10 @@ public:
static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
static void trigger_changed(weld::IconView& rIconView) { rIconView.signal_selection_changed(); }
static void trigger_toggled(weld::ToggleButton& rButton) { rButton.signal_toggled(); }
static void trigger_row_activated(weld::TreeView& rTreeView)
@@ -29,7 +33,10 @@ public:
rTreeView.signal_row_activated();
}
static void trigger_changed(weld::TreeView& rTreeView) { rTreeView.signal_changed(); }
static void trigger_item_activated(weld::IconView& rIconView)
{
rIconView.signal_item_activated();
}
static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent)
{

View File

@@ -1238,6 +1238,8 @@ public:
class VCL_DLLPUBLIC IconView : virtual public Container
{
friend class ::LOKTrigger;
private:
OUString m_sSavedValue;

View File

@@ -250,6 +250,36 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
}
}
}
else if (sControlType == "iconview")
{
auto pIconView = dynamic_cast<weld::IconView*>(pWidget);
if (pIconView)
{
if (sAction == "select")
{
OString nPosString
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
int nPos = std::atoi(nPosString.getStr());
pIconView->select(nPos);
LOKTrigger::trigger_changed(*pIconView);
return true;
}
else if (sAction == "activate")
{
OString nPosString
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
int nPos = std::atoi(nPosString.getStr());
pIconView->select(nPos);
LOKTrigger::trigger_changed(*pIconView);
LOKTrigger::trigger_item_activated(*pIconView);
return true;
}
}
}
else if (sControlType == "expander")
{
auto pExpander = dynamic_cast<weld::Expander*>(pWidget);