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
#define INCLUDED_SC_SOURCE_UI_INC_CRDLG_HXX
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/layout.hxx>
#include <vcl/weld.hxx>
#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<VclFrame> m_pFrame;
VclPtr<RadioButton> m_pBtnRows;
VclPtr<RadioButton> m_pBtnCols;
VclPtr<OKButton> m_pBtnOk;
std::unique_ptr<weld::Frame> m_xFrame;
std::unique_ptr<weld::RadioButton> m_xBtnRows;
std::unique_ptr<weld::RadioButton> m_xBtnCols;
std::unique_ptr<weld::Button> m_xBtnOk;
DECL_LINK(OkHdl, Button*, void);
DECL_LINK(OkHdl, weld::Button&, void);
};
#endif

View File

@@ -21,42 +21,25 @@
#include <crdlg.hxx>
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: */

View File

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

View File

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