From f7048e9b792c0123318f1133bafa030d688e10d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 15 May 2018 09:28:26 +0100 Subject: [PATCH] weld ScColOrRowDlg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I475974fc54910da88064779ceae6586bd71a3865 Reviewed-on: https://gerrit.libreoffice.org/54356 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/ui/inc/crdlg.hxx | 20 ++++++------- sc/source/ui/miscdlgs/crdlg.cxx | 39 ++++++++------------------ sc/source/ui/optdlg/tpusrlst.cxx | 3 +- sc/uiconfig/scalc/ui/colorrowdialog.ui | 9 ++++-- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/sc/source/ui/inc/crdlg.hxx b/sc/source/ui/inc/crdlg.hxx index faf4e4b11037..daea06afd699 100644 --- a/sc/source/ui/inc/crdlg.hxx +++ b/sc/source/ui/inc/crdlg.hxx @@ -20,25 +20,21 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX #define INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX -#include -#include -#include +#include #include "scui_def.hxx" -class ScColOrRowDlg : public ModalDialog +class ScColOrRowDlg : public weld::GenericDialogController { public: - ScColOrRowDlg(vcl::Window* pParent, const OUString& rStrTitle, - const OUString& rStrLabel); + ScColOrRowDlg(weld::Window* pParent, const OUString& rStrTitle, const OUString& rStrLabel); virtual ~ScColOrRowDlg() override; - virtual void dispose() override; private: - VclPtr m_pFrame; - VclPtr m_pBtnRows; - VclPtr m_pBtnCols; - VclPtr m_pBtnOk; + std::unique_ptr m_xFrame; + std::unique_ptr m_xBtnRows; + std::unique_ptr m_xBtnCols; + std::unique_ptr m_xBtnOk; - DECL_LINK(OkHdl, Button*, void); + DECL_LINK(OkHdl, weld::Button&, void); }; #endif diff --git a/sc/source/ui/miscdlgs/crdlg.cxx b/sc/source/ui/miscdlgs/crdlg.cxx index 3ca8726c2895..4764075697a4 100644 --- a/sc/source/ui/miscdlgs/crdlg.cxx +++ b/sc/source/ui/miscdlgs/crdlg.cxx @@ -21,42 +21,25 @@ #include -ScColOrRowDlg::ScColOrRowDlg(vcl::Window* pParent, const OUString& rStrTitle, - const OUString& rStrLabel) - : ModalDialog(pParent, "ColOrRowDialog", - "modules/scalc/ui/colorrowdialog.ui") +ScColOrRowDlg::ScColOrRowDlg(weld::Window* pParent, const OUString& rStrTitle, const OUString& rStrLabel) + : GenericDialogController(pParent, "modules/scalc/ui/colorrowdialog.ui", "ColOrRowDialog") + , m_xFrame(m_xBuilder->weld_frame("frame")) + , m_xBtnRows(m_xBuilder->weld_radio_button("rows")) + , m_xBtnCols(m_xBuilder->weld_radio_button("columns")) + , m_xBtnOk(m_xBuilder->weld_button("ok")) { - get(m_pBtnOk, "ok"); - get(m_pBtnCols, "columns"); - get(m_pBtnRows, "rows"); - get(m_pFrame, "frame"); - - SetText(rStrTitle); - m_pFrame->set_label(rStrLabel); - - m_pBtnCols->Check(); - - m_pBtnOk->SetClickHdl( LINK( this, ScColOrRowDlg, OkHdl ) ); + m_xDialog->set_title(rStrTitle); + m_xFrame->set_label(rStrLabel); + m_xBtnOk->connect_clicked(LINK(this, ScColOrRowDlg, OkHdl)); } ScColOrRowDlg::~ScColOrRowDlg() { - disposeOnce(); } -void ScColOrRowDlg::dispose() +IMPL_LINK_NOARG(ScColOrRowDlg, OkHdl, weld::Button&, void) { - m_pFrame.clear(); - m_pBtnRows.clear(); - m_pBtnCols.clear(); - m_pBtnOk.clear(); - ModalDialog::dispose(); -} - - -IMPL_LINK_NOARG(ScColOrRowDlg, OkHdl, Button*, void) -{ - EndDialog( m_pBtnCols->IsChecked() ? SCRET_COLS : SCRET_ROWS ); + m_xDialog->response(m_xBtnCols->get_active() ? SCRET_COLS : SCRET_ROWS); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 3bd623bc7d43..5f7734c483f6 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -357,7 +357,8 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) ) { - nCellDir = ScopedVclPtrInstance(this, aStrCopyList, aStrCopyFrom)->Execute(); + ScColOrRowDlg aDialog(GetFrameWeld(), aStrCopyList, aStrCopyFrom); + nCellDir = aDialog.run(); } else if ( nStartCol != nEndCol ) nCellDir = SCRET_ROWS; diff --git a/sc/uiconfig/scalc/ui/colorrowdialog.ui b/sc/uiconfig/scalc/ui/colorrowdialog.ui index ad1e0ceb9c64..bfe948ff3304 100644 --- a/sc/uiconfig/scalc/ui/colorrowdialog.ui +++ b/sc/uiconfig/scalc/ui/colorrowdialog.ui @@ -1,5 +1,5 @@ - + @@ -7,7 +7,13 @@ 6 Copy List False + True + 0 + 0 dialog + + + False @@ -98,7 +104,6 @@ 0 True True - rows False