summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-23 09:10:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-25 21:25:39 +0200
commitc31668c50fff0c7050cc176a7a5a83a08c670c12 (patch)
tree3dedbc98fefdaf0953861b56e403c35a60a85671 /sw/source
parentfb55ab7c8ed49bdf5d9d0d57ca0741c20cb16451 (diff)
weld SwLabPrtPage
Change-Id: I64ae3826298ad210ec095256e4364b607684abca Reviewed-on: https://gerrit.libreoffice.org/53327 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/envelp/labprt.cxx100
-rw-r--r--sw/source/ui/envelp/labprt.hxx23
2 files changed, 53 insertions, 70 deletions
diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx
index faecd0ee8018..872f31d7f070 100644
--- a/sw/source/ui/envelp/labprt.cxx
+++ b/sw/source/ui/envelp/labprt.cxx
@@ -27,35 +27,31 @@
#include <cmdid.h>
-SwLabPrtPage::SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet)
- : SfxTabPage(pParent, "LabelOptionsPage",
- "modules/swriter/ui/labeloptionspage.ui", &rSet)
+SwLabPrtPage::SwLabPrtPage(TabPageParent pParent, const SfxItemSet& rSet)
+ : SfxTabPage(pParent, "modules/swriter/ui/labeloptionspage.ui", "LabelOptionsPage", &rSet)
, pPrinter(nullptr)
+ , m_xPageButton(m_xBuilder->weld_radio_button("entirepage"))
+ , m_xSingleButton(m_xBuilder->weld_radio_button("singlelabel"))
+ , m_xSingleGrid(m_xBuilder->weld_widget("singlegrid"))
+ , m_xPrinterFrame(m_xBuilder->weld_widget("printerframe"))
+ , m_xColField(m_xBuilder->weld_spin_button("cols"))
+ , m_xRowField(m_xBuilder->weld_spin_button("rows"))
+ , m_xSynchronCB(m_xBuilder->weld_check_button("synchronize"))
+ , m_xPrinterInfo(m_xBuilder->weld_label("printername"))
+ , m_xPrtSetup(m_xBuilder->weld_button("setup"))
{
- get(m_pPageButton, "entirepage");
- get(m_pSingleButton, "singlelabel");
- get(m_pSingleGrid, "singlegrid");
- get(m_pColField, "cols");
- get(m_pRowField, "rows");
- get(m_pSynchronCB, "synchronize");
- get(m_pPrinterFrame, "printerframe");
- get(m_pPrinterInfo, "printername");
- get(m_pPrtSetup, "setup");
SetExchangeSupport();
// Install handlers
- Link<Button*,void> aLk = LINK(this, SwLabPrtPage, CountHdl);
- m_pPageButton->SetClickHdl( aLk );
- m_pSingleButton->SetClickHdl( aLk );
-
- m_pPrtSetup->SetClickHdl( aLk );
+ Link<weld::Button&,void> aLk = LINK(this, SwLabPrtPage, CountHdl);
+ m_xPageButton->connect_clicked( aLk );
+ m_xSingleButton->connect_clicked( aLk );
+ m_xPrtSetup->connect_clicked( aLk );
SvtCommandOptions aCmdOpts;
- if ( aCmdOpts.Lookup(
- SvtCommandOptions::CMDOPTION_DISABLED,
- "Print" ) )
+ if (aCmdOpts.Lookup(SvtCommandOptions::CMDOPTION_DISABLED, "Print"))
{
- m_pPrinterFrame->Hide();
+ m_xPrinterFrame->hide();
}
}
@@ -67,21 +63,12 @@ SwLabPrtPage::~SwLabPrtPage()
void SwLabPrtPage::dispose()
{
pPrinter.disposeAndClear();
- m_pPageButton.clear();
- m_pSingleButton.clear();
- m_pSingleGrid.clear();
- m_pPrinterFrame.clear();
- m_pColField.clear();
- m_pRowField.clear();
- m_pSynchronCB.clear();
- m_pPrinterInfo.clear();
- m_pPrtSetup.clear();
SfxTabPage::dispose();
}
-IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton, void )
+IMPL_LINK( SwLabPrtPage, CountHdl, weld::Button&, rButton, void )
{
- if (pButton == m_pPrtSetup)
+ if (&rButton == m_xPrtSetup.get())
{
// Call printer setup
if (!pPrinter)
@@ -90,24 +77,24 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton, void )
PrinterSetupDialog aDlg(GetFrameWeld());
aDlg.SetPrinter(pPrinter);
aDlg.execute();
- GrabFocus();
- m_pPrinterInfo->SetText(pPrinter->GetName());
+ rButton.grab_focus();
+ m_xPrinterInfo->set_label(pPrinter->GetName());
return;
}
- const bool bEnable = pButton == m_pSingleButton;
- m_pSingleGrid->Enable(bEnable);
- m_pSynchronCB->Enable(!bEnable);
+ const bool bEnable = &rButton == m_xSingleButton.get();
+ m_xSingleGrid->set_sensitive(bEnable);
+ m_xSynchronCB->set_sensitive(!bEnable);
- OSL_ENSURE(!bEnable || pButton == m_pPageButton, "NewButton?" );
+ OSL_ENSURE(!bEnable || &rButton == m_xPageButton.get(), "NewButton?" );
if ( bEnable )
{
- m_pColField->GrabFocus();
+ m_xColField->grab_focus();
}
}
VclPtr<SfxTabPage> SwLabPrtPage::Create(TabPageParent pParent, const SfxItemSet* rSet)
{
- return VclPtr<SwLabPrtPage>::Create( pParent.pParent, *rSet );
+ return VclPtr<SwLabPrtPage>::Create(pParent, *rSet );
}
void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet )
@@ -125,10 +112,10 @@ DeactivateRC SwLabPrtPage::DeactivatePage(SfxItemSet* _pSet)
void SwLabPrtPage::FillItem(SwLabItem& rItem)
{
- rItem.m_bPage = m_pPageButton->IsChecked();
- rItem.m_nCol = static_cast<sal_Int32>(m_pColField->GetValue());
- rItem.m_nRow = static_cast<sal_Int32>(m_pRowField->GetValue());
- rItem.m_bSynchron = m_pSynchronCB->IsChecked() && m_pSynchronCB->IsEnabled();
+ rItem.m_bPage = m_xPageButton->get_active();
+ rItem.m_nCol = m_xColField->get_value();
+ rItem.m_nRow = m_xRowField->get_value();
+ rItem.m_bSynchron = m_xSynchronCB->get_active() && m_xSynchronCB->get_sensitive();
}
bool SwLabPrtPage::FillItemSet(SfxItemSet* rSet)
@@ -146,35 +133,32 @@ void SwLabPrtPage::Reset(const SfxItemSet* )
SwLabItem aItem;
GetParentSwLabDlg()->GetLabItem(aItem);
- m_pColField->SetValue (aItem.m_nCol);
- m_pRowField->SetValue (aItem.m_nRow);
+ m_xColField->set_value(aItem.m_nCol);
+ m_xRowField->set_value(aItem.m_nRow);
if (aItem.m_bPage)
{
- m_pPageButton->Check();
- m_pPageButton->GetClickHdl().Call(m_pPageButton);
+ m_xPageButton->set_active(true);
+ CountHdl(*m_xPageButton);
}
else
{
- m_pSingleButton->GetClickHdl().Call(m_pSingleButton);
- m_pSingleButton->Check();
+ CountHdl(*m_xSingleButton);
+ m_xSingleButton->set_active(true);
}
if (pPrinter)
{
// show printer
- m_pPrinterInfo->SetText(pPrinter->GetName());
+ m_xPrinterInfo->set_label(pPrinter->GetName());
}
else
- m_pPrinterInfo->SetText(Printer::GetDefaultPrinterName());
-
- m_pColField->SetMax(aItem.m_nCols);
- m_pRowField->SetMax(aItem.m_nRows);
+ m_xPrinterInfo->set_label(Printer::GetDefaultPrinterName());
- m_pColField->SetLast(m_pColField->GetMax());
- m_pRowField->SetLast(m_pRowField->GetMax());
+ m_xColField->set_max(aItem.m_nCols);
+ m_xRowField->set_max(aItem.m_nRows);
- m_pSynchronCB->Check(aItem.m_bSynchron);
+ m_xSynchronCB->set_active(aItem.m_bSynchron);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx
index 500f2c40332c..d4dc36d0dfab 100644
--- a/sw/source/ui/envelp/labprt.hxx
+++ b/sw/source/ui/envelp/labprt.hxx
@@ -32,18 +32,17 @@ class SwLabPrtPage : public SfxTabPage
{
VclPtr<Printer> pPrinter; // for the shaft setting - unfortunately
- VclPtr<RadioButton> m_pPageButton;
- VclPtr<RadioButton> m_pSingleButton;
- VclPtr<VclContainer> m_pSingleGrid;
- VclPtr<VclContainer> m_pPrinterFrame;
- VclPtr<NumericField> m_pColField;
- VclPtr<NumericField> m_pRowField;
- VclPtr<CheckBox> m_pSynchronCB;
+ std::unique_ptr<weld::RadioButton> m_xPageButton;
+ std::unique_ptr<weld::RadioButton> m_xSingleButton;
+ std::unique_ptr<weld::Widget> m_xSingleGrid;
+ std::unique_ptr<weld::Widget> m_xPrinterFrame;
+ std::unique_ptr<weld::SpinButton> m_xColField;
+ std::unique_ptr<weld::SpinButton> m_xRowField;
+ std::unique_ptr<weld::CheckButton> m_xSynchronCB;
+ std::unique_ptr<weld::Label> m_xPrinterInfo;
+ std::unique_ptr<weld::Button> m_xPrtSetup;
- VclPtr<FixedText> m_pPrinterInfo;
- VclPtr<PushButton> m_pPrtSetup;
-
- DECL_LINK( CountHdl, Button *, void );
+ DECL_LINK( CountHdl, weld::Button&, void );
SwLabDlg* GetParentSwLabDlg() {return static_cast<SwLabDlg*>(GetTabDialog());}
@@ -51,7 +50,7 @@ class SwLabPrtPage : public SfxTabPage
using TabPage::DeactivatePage;
public:
- SwLabPrtPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ SwLabPrtPage(TabPageParent pParent, const SfxItemSet& rSet);
virtual ~SwLabPrtPage() override;
virtual void dispose() override;