diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-16 15:12:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-17 09:57:03 +0200 |
commit | 6b703887165a89b5a9003a3925985ec92292884e (patch) | |
tree | 9e38a060feb991aa114b41a129cd0b3186259b2a /cui/source | |
parent | c899ad348c375e6c59dbbc30e2458d9cbe226c12 (diff) |
weld AssignComponentDialog
Change-Id: I09fac24b81248bc27128d9142487301d4dc8ea6a
Reviewed-on: https://gerrit.libreoffice.org/54440
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/macropg.cxx | 34 | ||||
-rw-r--r-- | cui/source/customize/macropg_impl.hxx | 16 |
2 files changed, 20 insertions, 30 deletions
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index ac57cdd86611..345438a23cb3 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -622,13 +622,13 @@ long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* ) ) { - ScopedVclPtrInstance< AssignComponentDialog > pAssignDlg( pThis, sEventURL ); + AssignComponentDialog aAssignDlg(pThis->GetFrameWeld(), sEventURL); - short ret = pAssignDlg->Execute(); + short ret = aAssignDlg.run(); if( ret ) { sEventType = "UNO"; - sEventURL = pAssignDlg->getURL(); + sEventURL = aAssignDlg.getURL(); if(!pThis->bAppEvents) pThis->bDocModified = true; } @@ -821,45 +821,37 @@ SvxMacroAssignDlg::SvxMacroAssignDlg( vcl::Window* pParent, const Reference< fra SetTabPage(VclPtr<SvxMacroTabPage>::Create(get_content_area(), _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex)); } - -IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, Button*, void) +IMPL_LINK_NOARG(AssignComponentDialog, ButtonHandler, weld::Button&, void) { - OUString aMethodName = mpMethodEdit->GetText(); + OUString aMethodName = mxMethodEdit->get_text(); maURL.clear(); if( !aMethodName.isEmpty() ) { maURL = aVndSunStarUNO; maURL += aMethodName; } - EndDialog(1); + m_xDialog->response(RET_OK); } -AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUString& rURL ) - : ModalDialog( pParent, "AssignComponent", "cui/ui/assigncomponentdialog.ui" ) +AssignComponentDialog::AssignComponentDialog(weld::Window* pParent, const OUString& rURL) + : GenericDialogController(pParent, "cui/ui/assigncomponentdialog.ui", "AssignComponent") , maURL( rURL ) + , mxMethodEdit(m_xBuilder->weld_entry("methodEntry")) + , mxOKButton(m_xBuilder->weld_button("ok")) { - get(mpMethodEdit, "methodEntry"); - get(mpOKButton, "ok"); - mpOKButton->SetClickHdl(LINK(this, AssignComponentDialog, ButtonHandler)); + mxOKButton->connect_clicked(LINK(this, AssignComponentDialog, ButtonHandler)); OUString aMethodName; if( maURL.startsWith( aVndSunStarUNO ) ) { aMethodName = maURL.copy( strlen(aVndSunStarUNO) ); } - mpMethodEdit->SetText( aMethodName, Selection( 0, SELECTION_MAX ) ); + mxMethodEdit->set_text(aMethodName); + mxMethodEdit->select_region(0, -1); } AssignComponentDialog::~AssignComponentDialog() { - disposeOnce(); -} - -void AssignComponentDialog::dispose() -{ - mpMethodEdit.clear(); - mpOKButton.clear(); - ModalDialog::dispose(); } IMPL_LINK_NOARG( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, void ) diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx index b3d9d3842bf0..61f7fe3ac73c 100644 --- a/cui/source/customize/macropg_impl.hxx +++ b/cui/source/customize/macropg_impl.hxx @@ -37,23 +37,21 @@ public: bool bIDEDialogMode; }; -class AssignComponentDialog : public ModalDialog +class AssignComponentDialog : public weld::GenericDialogController { private: - VclPtr<Edit> mpMethodEdit; - VclPtr<OKButton> mpOKButton; - OUString maURL; - DECL_LINK(ButtonHandler, Button*, void); + std::unique_ptr<weld::Entry> mxMethodEdit; + std::unique_ptr<weld::Button> mxOKButton; + + DECL_LINK(ButtonHandler, weld::Button&, void); public: - AssignComponentDialog( vcl::Window * pParent, const OUString& rURL ); + AssignComponentDialog(weld::Window* pParent, const OUString& rURL); virtual ~AssignComponentDialog() override; - virtual void dispose() override; - const OUString& getURL() const - { return maURL; } + const OUString& getURL() const { return maURL; } }; #endif |