diff options
Diffstat (limited to 'sw/source/ui/envelp/labprt.cxx')
-rw-r--r-- | sw/source/ui/envelp/labprt.cxx | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index edede9718984..6b1c78f160ae 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <osl/diagnose.h> #include <svtools/prnsetup.hxx> #include <unotools/cmdoptions.hxx> #include <vcl/print.hxx> @@ -27,7 +26,7 @@ SwLabPrtPage::SwLabPrtPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, "modules/swriter/ui/labeloptionspage.ui", "LabelOptionsPage", &rSet) - , pPrinter(nullptr) + , m_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")) @@ -41,13 +40,13 @@ SwLabPrtPage::SwLabPrtPage(weld::Container* pPage, weld::DialogController* pCont SetExchangeSupport(); // Install handlers - Link<weld::Button&,void> aLk = LINK(this, SwLabPrtPage, CountHdl); - m_xPageButton->connect_clicked( aLk ); - m_xSingleButton->connect_clicked( aLk ); - m_xPrtSetup->connect_clicked( aLk ); + Link<weld::Toggleable&,void> aLk = LINK(this, SwLabPrtPage, CountHdl); + m_xPageButton->connect_toggled(aLk); + m_xSingleButton->connect_toggled(aLk); + m_xPrtSetup->connect_clicked(LINK(this, SwLabPrtPage, PrtSetupHdl)); SvtCommandOptions aCmdOpts; - if (aCmdOpts.Lookup(SvtCommandOptions::CMDOPTION_DISABLED, "Print")) + if (aCmdOpts.LookupDisabled("Print")) { m_xPrinterFrame->hide(); } @@ -55,33 +54,33 @@ SwLabPrtPage::SwLabPrtPage(weld::Container* pPage, weld::DialogController* pCont SwLabPrtPage::~SwLabPrtPage() { - pPrinter.disposeAndClear(); + m_pPrinter.disposeAndClear(); } -IMPL_LINK( SwLabPrtPage, CountHdl, weld::Button&, rButton, void ) +IMPL_LINK( SwLabPrtPage, PrtSetupHdl, weld::Button&, rButton, void ) { - if (&rButton == m_xPrtSetup.get()) - { - // Call printer setup - if (!pPrinter) - pPrinter = VclPtr<Printer>::Create(); - - PrinterSetupDialog aDlg(GetFrameWeld()); - aDlg.SetPrinter(pPrinter); - aDlg.run(); - rButton.grab_focus(); - m_xPrinterInfo->set_label(pPrinter->GetName()); + // Call printer setup + if (!m_pPrinter) + m_pPrinter = VclPtr<Printer>::Create(); + + PrinterSetupDialog aDlg(GetFrameWeld()); + aDlg.SetPrinter(m_pPrinter); + aDlg.run(); + rButton.grab_focus(); + m_xPrinterInfo->set_label(m_pPrinter->GetName()); +} + +IMPL_LINK(SwLabPrtPage, CountHdl, weld::Toggleable&, rButton, void) +{ + if (!rButton.get_active()) return; - } - const bool bEnable = &rButton == m_xSingleButton.get(); + + const bool bEnable = m_xSingleButton->get_active(); m_xSingleGrid->set_sensitive(bEnable); m_xSynchronCB->set_sensitive(!bEnable); - OSL_ENSURE(!bEnable || &rButton == m_xPageButton.get(), "NewButton?" ); - if ( bEnable ) - { + if (bEnable) m_xColField->grab_focus(); - } } std::unique_ptr<SfxTabPage> SwLabPrtPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet) @@ -139,10 +138,10 @@ void SwLabPrtPage::Reset(const SfxItemSet* ) m_xSingleButton->set_active(true); } - if (pPrinter) + if (m_pPrinter) { // show printer - m_xPrinterInfo->set_label(pPrinter->GetName()); + m_xPrinterInfo->set_label(m_pPrinter->GetName()); } else m_xPrinterInfo->set_label(Printer::GetDefaultPrinterName()); |