weld ScColOrRowDlg

Change-Id: I475974fc54910da88064779ceae6586bd71a3865
Reviewed-on: https://gerrit.libreoffice.org/54356
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-05-15 09:28:26 +01:00
parent d735ffde2d
commit f7048e9b79
4 changed files with 28 additions and 43 deletions

View File

@@ -20,25 +20,21 @@
#ifndef INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX #ifndef INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX
#define INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX #define INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX
#include <vcl/dialog.hxx> #include <vcl/weld.hxx>
#include <vcl/button.hxx>
#include <vcl/layout.hxx>
#include "scui_def.hxx" #include "scui_def.hxx"
class ScColOrRowDlg : public ModalDialog class ScColOrRowDlg : public weld::GenericDialogController
{ {
public: public:
ScColOrRowDlg(vcl::Window* pParent, const OUString& rStrTitle, ScColOrRowDlg(weld::Window* pParent, const OUString& rStrTitle, const OUString& rStrLabel);
const OUString& rStrLabel);
virtual ~ScColOrRowDlg() override; virtual ~ScColOrRowDlg() override;
virtual void dispose() override;
private: private:
VclPtr<VclFrame> m_pFrame; std::unique_ptr<weld::Frame> m_xFrame;
VclPtr<RadioButton> m_pBtnRows; std::unique_ptr<weld::RadioButton> m_xBtnRows;
VclPtr<RadioButton> m_pBtnCols; std::unique_ptr<weld::RadioButton> m_xBtnCols;
VclPtr<OKButton> m_pBtnOk; std::unique_ptr<weld::Button> m_xBtnOk;
DECL_LINK(OkHdl, Button*, void); DECL_LINK(OkHdl, weld::Button&, void);
}; };
#endif #endif

View File

@@ -21,42 +21,25 @@
#include <crdlg.hxx> #include <crdlg.hxx>
ScColOrRowDlg::ScColOrRowDlg(vcl::Window* pParent, const OUString& rStrTitle, ScColOrRowDlg::ScColOrRowDlg(weld::Window* pParent, const OUString& rStrTitle, const OUString& rStrLabel)
const OUString& rStrLabel) : GenericDialogController(pParent, "modules/scalc/ui/colorrowdialog.ui", "ColOrRowDialog")
: ModalDialog(pParent, "ColOrRowDialog", , m_xFrame(m_xBuilder->weld_frame("frame"))
"modules/scalc/ui/colorrowdialog.ui") , 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"); m_xDialog->set_title(rStrTitle);
get(m_pBtnCols, "columns"); m_xFrame->set_label(rStrLabel);
get(m_pBtnRows, "rows"); m_xBtnOk->connect_clicked(LINK(this, ScColOrRowDlg, OkHdl));
get(m_pFrame, "frame");
SetText(rStrTitle);
m_pFrame->set_label(rStrLabel);
m_pBtnCols->Check();
m_pBtnOk->SetClickHdl( LINK( this, ScColOrRowDlg, OkHdl ) );
} }
ScColOrRowDlg::~ScColOrRowDlg() ScColOrRowDlg::~ScColOrRowDlg()
{ {
disposeOnce();
} }
void ScColOrRowDlg::dispose() IMPL_LINK_NOARG(ScColOrRowDlg, OkHdl, weld::Button&, void)
{ {
m_pFrame.clear(); m_xDialog->response(m_xBtnCols->get_active() ? SCRET_COLS : SCRET_ROWS);
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 );
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -357,7 +357,8 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) ) if ( (nStartCol != nEndCol) && (nStartRow != nEndRow) )
{ {
nCellDir = ScopedVclPtrInstance<ScColOrRowDlg>(this, aStrCopyList, aStrCopyFrom)->Execute(); ScColOrRowDlg aDialog(GetFrameWeld(), aStrCopyList, aStrCopyFrom);
nCellDir = aDialog.run();
} }
else if ( nStartCol != nEndCol ) else if ( nStartCol != nEndCol )
nCellDir = SCRET_ROWS; nCellDir = SCRET_ROWS;

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="sc"> <interface domain="sc">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="ColOrRowDialog"> <object class="GtkDialog" id="ColOrRowDialog">
@@ -7,7 +7,13 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="colorrowdialog|ColOrRowDialog">Copy List</property> <property name="title" translatable="yes" context="colorrowdialog|ColOrRowDialog">Copy List</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
@@ -98,7 +104,6 @@
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">rows</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>