diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-09 06:28:34 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-28 14:32:13 +0100 |
commit | d7f3e68f849d11f6e02019b4a788982cae71d37b (patch) | |
tree | aba0ad754bdf73a495e84a2530959cd7f87f77ef | |
parent | 1a7ca9b41362068e5c19317b8e63ad0343960974 (diff) |
jsdialog: handle value change for spinfields
Change-Id: Ie9ef1017b959f5ef42abe6de4ac18e077d1ceb1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107446
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108397
Tested-by: Jenkins
-rw-r--r-- | include/vcl/jsdialog/executor.hxx | 5 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 2 | ||||
-rw-r--r-- | vcl/jsdialog/executor.cxx | 10 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx index 038b86b30f64..1e2a0806e3e9 100644 --- a/include/vcl/jsdialog/executor.hxx +++ b/include/vcl/jsdialog/executor.hxx @@ -40,6 +40,11 @@ public: { rDrawingArea.click(rPos); } + + static void trigger_value_changed(weld::SpinButton& rSpinButton) + { + rSpinButton.signal_value_changed(); + } }; namespace jsdialog diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index fd9fb9260587..648c1746b15e 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1589,6 +1589,8 @@ public: class VCL_DLLPUBLIC SpinButton : virtual public Entry { + friend class ::LOKTrigger; + protected: Link<SpinButton&, void> m_aValueChangedHdl; Link<SpinButton&, void> m_aOutputHdl; diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 933149efde05..cfb36dd858be 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -128,14 +128,24 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat auto pSpinField = dynamic_cast<weld::SpinButton*>(pWidget); if (pSpinField) { + if (sAction == "change") + { + OString sValue = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US); + int nValue = std::atoi(sValue.getStr()); + pSpinField->set_value(nValue); + LOKTrigger::trigger_value_changed(*pSpinField); + return true; + } if (sAction == "plus") { pSpinField->set_value(pSpinField->get_value() + 1); + LOKTrigger::trigger_value_changed(*pSpinField); return true; } else if (sAction == "minus") { pSpinField->set_value(pSpinField->get_value() - 1); + LOKTrigger::trigger_value_changed(*pSpinField); return true; } } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 160ef1b512bc..aa1febfe5d2a 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -860,7 +860,7 @@ JSSpinButton::JSSpinButton(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Wind void JSSpinButton::set_value(int value) { SalInstanceSpinButton::set_value(value); - notifyDialogState(); + notifyDialogState(true); // if input is limited we can receive the same JSON } JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, VclPtr<vcl::Window> aContentWindow, |