Kaydet (Commit) 08d4100a authored tarafından Caolán McNamara's avatar Caolán McNamara

weld OPageNumberDialog

Change-Id: I074dade23767e48bc1e0e311629ed4c0b55c1a00
Reviewed-on: https://gerrit.libreoffice.org/61480
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 4b713fb4
......@@ -36,46 +36,30 @@ using namespace ::comphelper;
// class OPageNumberDialog
OPageNumberDialog::OPageNumberDialog( vcl::Window* _pParent
,const uno::Reference< report::XReportDefinition >& _xHoldAlive
,OReportController* _pController)
: ModalDialog( _pParent, "PageNumberDialog" , "modules/dbreport/ui/pagenumberdialog.ui" )
,m_pController(_pController)
,m_xHoldAlive(_xHoldAlive)
OPageNumberDialog::OPageNumberDialog(weld::Window* pParent,
const uno::Reference< report::XReportDefinition >& _xHoldAlive,
OReportController* _pController)
: GenericDialogController(pParent, "modules/dbreport/ui/pagenumberdialog.ui", "PageNumberDialog")
, m_pController(_pController)
, m_xHoldAlive(_xHoldAlive)
, m_xPageN(m_xBuilder->weld_radio_button("pagen"))
, m_xPageNofM(m_xBuilder->weld_radio_button("pagenofm"))
, m_xTopPage(m_xBuilder->weld_radio_button("toppage"))
, m_xBottomPage(m_xBuilder->weld_radio_button("bottompage"))
, m_xAlignmentLst(m_xBuilder->weld_combo_box("alignment"))
, m_xShowNumberOnFirstPage(m_xBuilder->weld_check_button("shownumberonfirstpage"))
{
get(m_pPageN,"pagen");
get(m_pPageNofM,"pagenofm");
get(m_pTopPage,"toppage");
get(m_pBottomPage,"bottompage");
get(m_pAlignmentLst,"alignment");
get(m_pShowNumberOnFirstPage,"shownumberonfirstpage");
m_pShowNumberOnFirstPage->Hide();
m_xShowNumberOnFirstPage->hide();
}
OPageNumberDialog::~OPageNumberDialog()
{
disposeOnce();
}
void OPageNumberDialog::dispose()
{
m_pPageN.clear();
m_pPageNofM.clear();
m_pTopPage.clear();
m_pBottomPage.clear();
m_pAlignmentLst.clear();
m_pShowNumberOnFirstPage.clear();
ModalDialog::dispose();
}
short OPageNumberDialog::Execute()
void OPageNumberDialog::execute()
{
short nRet = ModalDialog::Execute();
if ( nRet == RET_OK )
short nRet = m_xDialog->run();
if (nRet == RET_OK)
{
try
{
......@@ -83,7 +67,7 @@ short OPageNumberDialog::Execute()
sal_Int32 nPosX = 0;
sal_Int32 nPos2X = 0;
awt::Size aRptSize = getStyleProperty<awt::Size>(m_xHoldAlive,PROPERTY_PAPERSIZE);
switch ( m_pAlignmentLst->GetSelectedEntryPos() )
switch (m_xAlignmentLst->get_active())
{
case 0: // left
nPosX = getStyleProperty<sal_Int32>(m_xHoldAlive,PROPERTY_LEFTMARGIN);
......@@ -102,23 +86,21 @@ short OPageNumberDialog::Execute()
default:
break;
}
if ( m_pAlignmentLst->GetSelectedEntryPos() > 2 )
if (m_xAlignmentLst->get_active() > 2)
nPosX = nPos2X;
uno::Sequence<beans::PropertyValue> aValues( comphelper::InitPropertySequence({
{ PROPERTY_POSITION, uno::Any(awt::Point(nPosX,0)) },
{ PROPERTY_PAGEHEADERON, uno::Any(m_pTopPage->IsChecked()) },
{ PROPERTY_STATE, uno::Any(m_pPageNofM->IsChecked()) }
{ PROPERTY_PAGEHEADERON, uno::Any(m_xTopPage->get_active()) },
{ PROPERTY_STATE, uno::Any(m_xPageNofM->get_active()) }
}));
m_pController->executeChecked(SID_INSERT_FLD_PGNUMBER,aValues);
}
catch(uno::Exception&)
{
nRet = RET_NO;
}
}
return nRet;
}
} // rptui
......
......@@ -19,14 +19,9 @@
#ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_PAGENUMBER_HXX
#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_PAGENUMBER_HXX
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
#include <vcl/button.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/report/XReportDefinition.hpp>
namespace rptui
{
class OReportController;
......@@ -35,30 +30,26 @@ class OReportController;
|* Groups and Sorting dialog
|*
\************************************************************************/
class OPageNumberDialog : public ModalDialog
class OPageNumberDialog : public weld::GenericDialogController
{
VclPtr<RadioButton> m_pPageN;
VclPtr<RadioButton> m_pPageNofM;
VclPtr<RadioButton> m_pTopPage;
VclPtr<RadioButton> m_pBottomPage;
VclPtr<ListBox> m_pAlignmentLst;
VclPtr<CheckBox> m_pShowNumberOnFirstPage;
::rptui::OReportController* m_pController;
css::uno::Reference< css::report::XReportDefinition>
m_xHoldAlive;
std::unique_ptr<weld::RadioButton> m_xPageN;
std::unique_ptr<weld::RadioButton> m_xPageNofM;
std::unique_ptr<weld::RadioButton> m_xTopPage;
std::unique_ptr<weld::RadioButton> m_xBottomPage;
std::unique_ptr<weld::ComboBox> m_xAlignmentLst;
std::unique_ptr<weld::CheckButton> m_xShowNumberOnFirstPage;
OPageNumberDialog(const OPageNumberDialog&) = delete;
void operator =(const OPageNumberDialog&) = delete;
public:
OPageNumberDialog( vcl::Window* pParent
,const css::uno::Reference< css::report::XReportDefinition>& _xHoldAlive
,::rptui::OReportController* _pController);
OPageNumberDialog(weld::Window* pParent,
const css::uno::Reference< css::report::XReportDefinition>& _xHoldAlive,
::rptui::OReportController* _pController);
virtual ~OPageNumberDialog() override;
virtual void dispose() override;
virtual short Execute() override;
void execute();
};
} // namespace rptui
......
......@@ -1565,8 +1565,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
{
if ( !aArgs.getLength() )
{
ScopedVclPtrInstance< OPageNumberDialog > aDlg(getView(),m_xReportDefinition,this);
aDlg->Execute();
OPageNumberDialog aDlg(getFrameWeld(), m_xReportDefinition, this);
aDlg.execute();
}
else
createPageNumber(aArgs);
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="rpt">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="PageNumberDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="pagenumberdialog|PageNumberDialog">Page Numbers</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>
......@@ -104,7 +110,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">pagenofm</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -120,7 +125,6 @@
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">pagen</property>
</object>
......@@ -183,7 +187,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">bottompage</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -273,10 +276,10 @@
<object class="GtkLabel" id="alignment_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="pagenumberdialog|alignment_label">_Alignment:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">alignment</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment