jsdialog: formatted spin field
Change-Id: I5830dd523e0ccc736a686f38319a6c509e5650be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154193 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Pranam Lashkari <lpranam@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154363 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
@@ -95,6 +95,11 @@ public:
|
|||||||
rSpinButton.signal_value_changed();
|
rSpinButton.signal_value_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void trigger_value_changed(weld::FormattedSpinButton& rSpinButton)
|
||||||
|
{
|
||||||
|
rSpinButton.signal_value_changed();
|
||||||
|
}
|
||||||
|
|
||||||
static void trigger_closed(weld::Popover& rPopover) { rPopover.popdown(); }
|
static void trigger_closed(weld::Popover& rPopover) { rPopover.popdown(); }
|
||||||
|
|
||||||
static void trigger_key_press(weld::Widget& rWidget, const KeyEvent& rEvent)
|
static void trigger_key_press(weld::Widget& rWidget, const KeyEvent& rEvent)
|
||||||
|
@@ -1863,6 +1863,8 @@ class EntryFormatter;
|
|||||||
// are managed by a more complex Formatter which can support doubles.
|
// are managed by a more complex Formatter which can support doubles.
|
||||||
class VCL_DLLPUBLIC FormattedSpinButton : virtual public Entry
|
class VCL_DLLPUBLIC FormattedSpinButton : virtual public Entry
|
||||||
{
|
{
|
||||||
|
friend class ::LOKTrigger;
|
||||||
|
|
||||||
Link<FormattedSpinButton&, void> m_aValueChangedHdl;
|
Link<FormattedSpinButton&, void> m_aValueChangedHdl;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -295,6 +295,8 @@ public:
|
|||||||
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString& id) override;
|
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OUString& id) override;
|
||||||
virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString& id) override;
|
virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString& id) override;
|
||||||
virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& id) override;
|
virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& id) override;
|
||||||
|
virtual std::unique_ptr<weld::FormattedSpinButton>
|
||||||
|
weld_formatted_spin_button(const OUString& id) override;
|
||||||
virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OUString& id) override;
|
virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OUString& id) override;
|
||||||
virtual std::unique_ptr<weld::DrawingArea>
|
virtual std::unique_ptr<weld::DrawingArea>
|
||||||
weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
|
weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
|
||||||
@@ -643,6 +645,17 @@ public:
|
|||||||
virtual void set_value(sal_Int64 value) override;
|
virtual void set_value(sal_Int64 value) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class JSFormattedSpinButton final
|
||||||
|
: public JSWidget<SalInstanceFormattedSpinButton, ::FormattedField>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
|
||||||
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership);
|
||||||
|
|
||||||
|
virtual void set_text(const OUString& rText) override;
|
||||||
|
void set_text_without_notify(const OUString& rText);
|
||||||
|
};
|
||||||
|
|
||||||
class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, ::MessageDialog>
|
class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, ::MessageDialog>
|
||||||
{
|
{
|
||||||
std::unique_ptr<JSDialogSender> m_pOwnedSender;
|
std::unique_ptr<JSDialogSender> m_pOwnedSender;
|
||||||
|
@@ -333,6 +333,18 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto pFormattedField = dynamic_cast<weld::FormattedSpinButton*>(pWidget);
|
||||||
|
if (pFormattedField)
|
||||||
|
{
|
||||||
|
if (sAction == "change")
|
||||||
|
{
|
||||||
|
pFormattedField->set_text(rData["data"]);
|
||||||
|
LOKTrigger::trigger_changed(*pFormattedField);
|
||||||
|
LOKTrigger::trigger_value_changed(*pFormattedField);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (sControlType == "toolbox")
|
else if (sControlType == "toolbox")
|
||||||
{
|
{
|
||||||
|
@@ -1066,6 +1066,20 @@ std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OUSt
|
|||||||
return pWeldWidget;
|
return pWeldWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<weld::FormattedSpinButton>
|
||||||
|
JSInstanceBuilder::weld_formatted_spin_button(const OUString& id)
|
||||||
|
{
|
||||||
|
FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
|
||||||
|
auto pWeldWidget = pSpinButton
|
||||||
|
? std::make_unique<JSFormattedSpinButton>(this, pSpinButton, this, false)
|
||||||
|
: nullptr;
|
||||||
|
|
||||||
|
if (pWeldWidget)
|
||||||
|
RememberWidget(id, pWeldWidget.get());
|
||||||
|
|
||||||
|
return pWeldWidget;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OUString& id)
|
std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OUString& id)
|
||||||
{
|
{
|
||||||
CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
|
CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
|
||||||
@@ -1682,6 +1696,24 @@ void JSSpinButton::set_value(sal_Int64 value)
|
|||||||
sendAction(std::move(pMap));
|
sendAction(std::move(pMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin,
|
||||||
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||||
|
: JSWidget<SalInstanceFormattedSpinButton, ::FormattedField>(pSender, pSpin, pBuilder,
|
||||||
|
bTakeOwnership)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void JSFormattedSpinButton::set_text(const OUString& rText)
|
||||||
|
{
|
||||||
|
SalInstanceFormattedSpinButton::set_text(rText);
|
||||||
|
sendUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void JSFormattedSpinButton::set_text_without_notify(const OUString& rText)
|
||||||
|
{
|
||||||
|
SalInstanceFormattedSpinButton::set_text(rText);
|
||||||
|
}
|
||||||
|
|
||||||
JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog,
|
JSMessageDialog::JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog,
|
||||||
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||||
: JSWidget<SalInstanceMessageDialog, ::MessageDialog>(pSender, pDialog, pBuilder,
|
: JSWidget<SalInstanceMessageDialog, ::MessageDialog>(pSender, pDialog, pBuilder,
|
||||||
|
Reference in New Issue
Block a user