include/vcl/jsdialog/jsdialogbuilder.hxx | 23 ++++++++++++ include/vcl/salvtables.hxx | 2 - sc/source/core/data/validat.cxx | 4 +- vcl/jsdialog/jsdialogbuilder.cxx | 56 +++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-)
New commits: commit 65a310ead162a9d881ec95ee9802b8c223930fa0 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Mar 10 17:10:38 2020 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Tue Jun 23 06:13:12 2020 +0200 jsdialog: weld SpinButton and CheckButton Change-Id: I0dfa163b8a52594cde9e3529df8f433dc93bc459 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94432 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96845 Tested-by: Jenkins diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx index 543184eeb35a..ef3c6a6bcbaf 100644 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ b/include/vcl/jsdialog/jsdialogbuilder.hxx @@ -8,6 +8,7 @@ #include <vcl/builder.hxx> #include <vcl/salvtables.hxx> #include <vcl/button.hxx> +#include <vcl/fmtfield.hxx> class ComboBox; typedef std::map<OString, weld::Widget*> WidgetMap; @@ -51,6 +52,10 @@ public: bool bTakeOwnership = false) override; virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id, bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::SpinButton> + weld_spin_button(const OString& id, bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::CheckButton> + weld_check_button(const OString& id, bool bTakeOwnership = false) override; static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, @@ -150,6 +155,15 @@ public: virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; }; +class VCL_DLLPUBLIC JSSpinButton : public JSWidget<SalInstanceSpinButton, ::FormattedField> +{ +public: + JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_value(int value) override; +}; + class VCL_DLLPUBLIC JSMessageDialog : public SalInstanceMessageDialog, public JSDialogSender { public: @@ -160,4 +174,13 @@ public: virtual void set_secondary_text(const OUString& rText) override; }; +class VCL_DLLPUBLIC JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox> +{ +public: + JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_active(bool active) override; +}; + #endif diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index 1dc2d6a0cadd..7912520059e5 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -609,7 +609,7 @@ public: virtual ~SalInstanceEntry() override; }; -class SalInstanceSpinButton final : public SalInstanceEntry, public virtual weld::SpinButton +class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton { private: VclPtr<FormattedField> m_xButton; diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index e4a8f9548ad7..e121dbb6e489 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -407,8 +407,8 @@ bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput, break; } - bool bIsMobile = comphelper::LibreOfficeKit::isActive() - && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone(); + bool bIsMobile = comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() + && SfxViewShell::Current()->isLOKMobilePhone(); std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType, eStyle, aMessage, bIsMobile)); diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index c360eee7b9e6..0443170dee00 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -205,6 +205,36 @@ std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString& return pWeldWidget; } +std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OString& id, + bool bTakeOwnership) +{ + FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id); + auto pWeldWidget = pSpinButton ? std::make_unique<JSSpinButton>( + m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, + pSpinButton, this, bTakeOwnership) + : nullptr; + + if (pWeldWidget) + RememberWidget(id, pWeldWidget.get()); + + return pWeldWidget; +} + +std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OString& id, + bool bTakeOwnership) +{ + CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id); + auto pWeldWidget = pCheckButton ? std::make_unique<JSCheckButton>( + m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog, + pCheckButton, this, bTakeOwnership) + : nullptr; + + if (pWeldWidget) + RememberWidget(id, pWeldWidget.get()); + + return pWeldWidget; +} + weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, @@ -348,6 +378,19 @@ void JSNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int notifyDialogState(); } +JSSpinButton::JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin, + SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : JSWidget<SalInstanceSpinButton, ::FormattedField>(aOwnedToplevel, pSpin, pBuilder, + bTakeOwnership) +{ +} + +void JSSpinButton::set_value(int value) +{ + SalInstanceSpinButton::set_value(value); + notifyDialogState(); +} + JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : SalInstanceMessageDialog(pDialog, pBuilder, bTakeOwnership) @@ -366,3 +409,16 @@ void JSMessageDialog::set_secondary_text(const OUString& rText) SalInstanceMessageDialog::set_secondary_text(rText); notifyDialogState(); } + +JSCheckButton::JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox, + SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : JSWidget<SalInstanceCheckButton, ::CheckBox>(aOwnedToplevel, pCheckBox, pBuilder, + bTakeOwnership) +{ +} + +void JSCheckButton::set_active(bool active) +{ + SalInstanceCheckButton::set_active(active); + notifyDialogState(); +} _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits