weld SfxPrintOptionsDialog
and SwMMResultPrintDialog
Change-Id: Icded6a26a3a151293bea0c9173334cf634283e89
Reviewed-on: https://gerrit.libreoffice.org/53299
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx
index 4f1bacd..66dec04 100644
--- a/include/sfx2/prnmon.hxx
+++ b/include/sfx2/prnmon.hxx
@@ -22,33 +22,32 @@
#include <memory>
#include <sal/config.h>
#include <sfx2/dllapi.h>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <sfx2/printer.hxx>
#include <vcl/weld.hxx>
class SfxViewShell;
struct SfxPrintOptDlg_Impl;
class SfxPrintOptionsDialog : public ModalDialog
class SfxPrintOptionsDialog : public weld::GenericDialogController
{
private:
std::unique_ptr<SfxPrintOptDlg_Impl> pDlgImpl;
SfxViewShell* pViewSh;
std::unique_ptr<SfxItemSet> pOptions;
VclPtr<SfxTabPage> pPage;
std::unique_ptr<weld::Widget> m_xHelpBtn;
std::unique_ptr<weld::Container> m_xContainer;
DECL_LINK(HelpRequestHdl, weld::Widget&, bool);
public:
SfxPrintOptionsDialog( vcl::Window *pParent,
SfxViewShell *pViewShell,
const SfxItemSet *rOptions );
SfxPrintOptionsDialog(weld::Window *pParent,
SfxViewShell *pViewShell,
const SfxItemSet *rOptions);
virtual ~SfxPrintOptionsDialog() override;
virtual void dispose() override;
virtual short Execute() override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
short execute();
const SfxItemSet& GetOptions() const { return *pOptions; }
void DisableHelp();
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 72ba237..f171de3 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -47,13 +47,13 @@ struct TabPageParent
, pPage(nullptr)
{
}
TabPageParent(weld::Window* _pPage)
TabPageParent(weld::Container* _pPage)
: pParent(nullptr)
, pPage(_pPage)
{
}
VclPtr<vcl::Window> pParent;
weld::Widget* pPage;
weld::Container* pPage;
};
typedef VclPtr<SfxTabPage> (*CreateTabPage)(TabPageParent pParent, const SfxItemSet *rAttrSet);
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index f29f94c..8f72837 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -244,7 +244,7 @@ public:
virtual SfxPrinter* GetPrinter( bool bCreate = false );
virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL );
virtual bool HasPrintOptionsPage() const;
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent, const SfxItemSet &rOptions );
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, const SfxItemSet &rOptions);
Printer* GetActivePrinter() const;
// Working set
diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx
index 64c2ed5..f1f5b6c 100644
--- a/include/svtools/prnsetup.hxx
+++ b/include/svtools/prnsetup.hxx
@@ -21,64 +21,58 @@
#define INCLUDED_SVTOOLS_PRNSETUP_HXX
#include <svtools/svtdllapi.h>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/group.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/weld.hxx>
#include <vcl/timer.hxx>
class Printer;
class QueueInfo;
class SVT_DLLPUBLIC PrinterSetupDialog : public ModalDialog
class SVT_DLLPUBLIC PrinterSetupDialog : public weld::GenericDialogController
{
private:
VclPtr<ListBox> m_pLbName;
VclPtr<PushButton> m_pBtnProperties;
VclPtr<PushButton> m_pBtnOptions;
VclPtr<FixedText> m_pFiStatus;
VclPtr<FixedText> m_pFiType;
VclPtr<FixedText> m_pFiLocation;
VclPtr<FixedText> m_pFiComment;
std::unique_ptr<weld::ComboBoxText> m_xLbName;
std::unique_ptr<weld::Button> m_xBtnProperties;
std::unique_ptr<weld::Button> m_xBtnOptions;
std::unique_ptr<weld::Label> m_xFiStatus;
std::unique_ptr<weld::Label> m_xFiType;
std::unique_ptr<weld::Label> m_xFiLocation;
std::unique_ptr<weld::Label> m_xFiComment;
AutoTimer maStatusTimer;
VclPtr<Printer> mpPrinter;
VclPtr<Printer> mpTempPrinter;
SVT_DLLPRIVATE void ImplSetInfo();
DECL_DLLPRIVATE_LINK( ImplPropertiesHdl, Button*, void );
DECL_DLLPRIVATE_LINK( ImplChangePrinterHdl, ListBox&, void );
DECL_DLLPRIVATE_LINK( ImplStatusHdl, Timer*, void );
DECL_DLLPRIVATE_LINK( ImplPropertiesHdl, weld::Button&, void );
DECL_DLLPRIVATE_LINK( ImplChangePrinterHdl, weld::ComboBoxText&, void );
DECL_DLLPRIVATE_LINK( ImplGetFocusHdl, weld::Widget&, void );
DECL_DLLPRIVATE_LINK( ImplStatusHdl, Timer*, void );
DECL_DLLPRIVATE_LINK( ImplDataChangedHdl, VclSimpleEvent&, void);
public:
PrinterSetupDialog( vcl::Window* pWindow );
PrinterSetupDialog(weld::Window* pWindow);
virtual ~PrinterSetupDialog() override;
virtual void dispose() override;
void SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; }
Printer* GetPrinter() const { return mpPrinter; }
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
short execute();
virtual short Execute() override;
weld::Window* GetFrameWeld() const { return m_xDialog.get(); }
void SetOptionsHdl( const Link<Button*,void>& rLink );
void SetOptionsHdl( const Link<weld::Button&,void>& rLink );
};
#define IMPL_PRINTDLG_STATUS_UPDATE 15000
void ImplFillPrnDlgListBox( const Printer* pPrinter,
ListBox* pBox, PushButton* pPropBtn );
void ImplFreePrnDlgListBox( ListBox* pBox, bool bClear = true );
Printer* ImplPrnDlgListBoxSelect( ListBox const * pBox, PushButton* pPropBtn,
weld::ComboBoxText* pBox, weld::Button* pPropBtn );
void ImplFreePrnDlgListBox( weld::ComboBoxText* pBox, bool bClear = true );
Printer* ImplPrnDlgListBoxSelect( weld::ComboBoxText const * pBox, weld::Button* pPropBtn,
Printer const * pPrinter, Printer* pTempPrinter );
Printer* ImplPrnDlgUpdatePrinter( Printer const * pPrinter, Printer* pTempPrinter );
void ImplPrnDlgUpdateQueueInfo( ListBox const * pBox, QueueInfo& rInfo );
void ImplPrnDlgUpdateQueueInfo( weld::ComboBoxText const * pBox, QueueInfo& rInfo );
OUString ImplPrnDlgGetStatusText( const QueueInfo& rInfo );
#endif // INCLUDED_SVTOOLS_PRNSETUP_HXX
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index ae40d76..0c14fb3 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -51,6 +51,7 @@ namespace vcl {
class PrintDialog;
}
namespace weld { class Window; }
enum class PrinterSupport
{
@@ -291,8 +292,8 @@ public:
bool SetJobSetup( const JobSetup& rSetup );
const JobSetup& GetJobSetup() const { return maJobSetup; }
bool Setup( vcl::Window* pWindow,
PrinterSetupMode eMode = PrinterSetupMode::DocumentGlobal );
bool Setup(weld::Window* pWindow,
PrinterSetupMode eMode = PrinterSetupMode::DocumentGlobal);
bool SetPrinterProps( const Printer* pPrinter );
/** SetPrinterOptions is used internally only now
@@ -559,7 +560,7 @@ public:
SAL_DLLPRIVATE void pushPropertiesToPrinter();
SAL_DLLPRIVATE void resetPaperToLastConfigured();
VCL_PLUGIN_PUBLIC void setJobState( css::view::PrintableState );
SAL_DLLPRIVATE void setupPrinter( vcl::Window* i_pDlgParent );
SAL_DLLPRIVATE void setupPrinter( weld::Window* i_pDlgParent );
SAL_DLLPRIVATE int getPageCountProtected() const;
SAL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue >
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ae9931e..93c5b55 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -37,7 +37,8 @@ public:
virtual void set_sensitive(bool sensitive) = 0;
virtual bool get_sensitive() const = 0;
virtual void set_visible(bool visible) = 0;
virtual bool get_visible() const = 0;
virtual bool get_visible() const = 0; //if this widget visibility is true
virtual bool is_visible() const = 0; //if this widget visibility and all parents is true
virtual void grab_focus() = 0;
virtual bool has_focus() const = 0;
virtual void show() = 0;
@@ -155,6 +156,8 @@ public:
void connect_help(const Link<Widget&, bool>& rLink) { m_aHelpRequestHdl = rLink; }
virtual SystemEnvData get_system_data() const = 0;
virtual void resize_to_request() = 0;
};
@@ -189,6 +192,7 @@ public:
= 0;
virtual void set_default_response(int response) = 0;
virtual Button* get_widget_for_response(int response) = 0;
virtual Container* weld_content_area() = 0;
};
class VCL_DLLPUBLIC MessageDialog : virtual public Dialog
diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx
index 179e6b1..bfeb685 100644
--- a/sc/source/ui/inc/prevwsh.hxx
+++ b/sc/source/ui/inc/prevwsh.hxx
@@ -105,7 +105,7 @@ public:
virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
virtual bool HasPrintOptionsPage() const override;
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent, const SfxItemSet &rOptions ) override;
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, const SfxItemSet &rOptions) override;
void AddAccessibilityObject( SfxListener& rObject );
void RemoveAccessibilityObject( SfxListener& rObject );
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 17bc4ec..1268111 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -318,7 +318,7 @@ public:
SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
virtual bool HasPrintOptionsPage() const override;
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent, const SfxItemSet &rOptions ) override;
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, const SfxItemSet &rOptions) override;
void ConnectObject( const SdrOle2Obj* pObj );
void ActivateObject( SdrOle2Obj* pObj, long nVerb );
diff --git a/sc/source/ui/inc/tpprint.hxx b/sc/source/ui/inc/tpprint.hxx
index fb201a5..9ddae6e 100644
--- a/sc/source/ui/inc/tpprint.hxx
+++ b/sc/source/ui/inc/tpprint.hxx
@@ -21,19 +21,17 @@
#define INCLUDED_SC_SOURCE_UI_INC_TPPRINT_HXX
#include <sfx2/tabdlg.hxx>
#include <vcl/fixed.hxx>
class ScTpPrintOptions : public SfxTabPage
{
friend class VclPtr<ScTpPrintOptions>;
VclPtr<CheckBox> m_pSkipEmptyPagesCB;
VclPtr<CheckBox> m_pSelectedSheetsCB;
VclPtr<CheckBox> m_pForceBreaksCB;
std::unique_ptr<weld::CheckButton> m_xSkipEmptyPagesCB;
std::unique_ptr<weld::CheckButton> m_xSelectedSheetsCB;
std::unique_ptr<weld::CheckButton> m_xForceBreaksCB;
ScTpPrintOptions( vcl::Window* pParent, const SfxItemSet& rCoreSet );
ScTpPrintOptions(TabPageParent pPage, const SfxItemSet& rCoreSet);
public:
virtual ~ScTpPrintOptions() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rCoreSet );
virtual bool FillItemSet( SfxItemSet* rCoreSet ) override;
virtual void Reset( const SfxItemSet* rCoreSet ) override;
diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx
index 9c8dcbc..f38a2f5 100644
--- a/sc/source/ui/optdlg/tpprint.cxx
+++ b/sc/source/ui/optdlg/tpprint.cxx
@@ -26,34 +26,22 @@
#include <scmod.hxx>
#include <sc.hrc>
ScTpPrintOptions::ScTpPrintOptions( vcl::Window* pParent,
ScTpPrintOptions::ScTpPrintOptions( TabPageParent pPage,
const SfxItemSet& rCoreAttrs )
: SfxTabPage ( pParent,
"optCalcPrintPage",
"modules/scalc/ui/optdlg.ui",
&rCoreAttrs )
: SfxTabPage(pPage, "modules/scalc/ui/optdlg.ui", "optCalcPrintPage", &rCoreAttrs )
, m_xSkipEmptyPagesCB(m_xBuilder->weld_check_button("suppressCB"))
, m_xSelectedSheetsCB(m_xBuilder->weld_check_button("printCB"))
, m_xForceBreaksCB(m_xBuilder->weld_check_button("forceBreaksCB"))
{
get( m_pSkipEmptyPagesCB , "suppressCB" );
get( m_pSelectedSheetsCB , "printCB" );
get( m_pForceBreaksCB, "forceBreaksCB" );
}
ScTpPrintOptions::~ScTpPrintOptions()
{
disposeOnce();
}
void ScTpPrintOptions::dispose()
VclPtr<SfxTabPage> ScTpPrintOptions::Create(TabPageParent pParent, const SfxItemSet* rAttrSet)
{
m_pSkipEmptyPagesCB.clear();
m_pSelectedSheetsCB.clear();
m_pForceBreaksCB.clear();
SfxTabPage::dispose();
}
VclPtr<SfxTabPage> ScTpPrintOptions::Create( TabPageParent pParent, const SfxItemSet* rAttrSet )
{
return VclPtr<ScTpPrintOptions>::Create( pParent.pParent, *rAttrSet );
return VclPtr<ScTpPrintOptions>::Create(pParent, *rAttrSet);
}
DeactivateRC ScTpPrintOptions::DeactivatePage( SfxItemSet* pSetP )
@@ -80,38 +68,38 @@ void ScTpPrintOptions::Reset( const SfxItemSet* rCoreSet )
if ( SfxItemState::SET == rCoreSet->GetItemState( SID_PRINT_SELECTEDSHEET, false , &pItem ) )
{
bool bChecked = static_cast<const SfxBoolItem*>(pItem)->GetValue();
m_pSelectedSheetsCB->Check( bChecked );
m_xSelectedSheetsCB->set_active( bChecked );
}
else
{
m_pSelectedSheetsCB->Check( !aOptions.GetAllSheets() );
m_xSelectedSheetsCB->set_active( !aOptions.GetAllSheets() );
}
m_pSkipEmptyPagesCB->Check( aOptions.GetSkipEmpty() );
m_pSkipEmptyPagesCB->SaveValue();
m_pSelectedSheetsCB->SaveValue();
m_pForceBreaksCB->Check( aOptions.GetForceBreaks() );
m_pForceBreaksCB->SaveValue();
m_xSkipEmptyPagesCB->set_active( aOptions.GetSkipEmpty() );
m_xSkipEmptyPagesCB->save_state();
m_xSelectedSheetsCB->save_state();
m_xForceBreaksCB->set_active( aOptions.GetForceBreaks() );
m_xForceBreaksCB->save_state();
}
bool ScTpPrintOptions::FillItemSet( SfxItemSet* rCoreAttrs )
{
rCoreAttrs->ClearItem( SID_PRINT_SELECTEDSHEET );
bool bSkipEmptyChanged = m_pSkipEmptyPagesCB->IsValueChangedFromSaved();
bool bSelectedSheetsChanged = m_pSelectedSheetsCB->IsValueChangedFromSaved();
bool bForceBreaksChanged = m_pForceBreaksCB->IsValueChangedFromSaved();
bool bSkipEmptyChanged = m_xSkipEmptyPagesCB->get_state_changed_from_saved();
bool bSelectedSheetsChanged = m_xSelectedSheetsCB->get_state_changed_from_saved();
bool bForceBreaksChanged = m_xForceBreaksCB->get_state_changed_from_saved();
if ( bSkipEmptyChanged || bSelectedSheetsChanged || bForceBreaksChanged )
{
ScPrintOptions aOpt;
aOpt.SetSkipEmpty( m_pSkipEmptyPagesCB->IsChecked() );
aOpt.SetAllSheets( !m_pSelectedSheetsCB->IsChecked() );
aOpt.SetForceBreaks( m_pForceBreaksCB->IsChecked() );
aOpt.SetSkipEmpty( m_xSkipEmptyPagesCB->get_active() );
aOpt.SetAllSheets( !m_xSelectedSheetsCB->get_active() );
aOpt.SetForceBreaks( m_xForceBreaksCB->get_active() );
rCoreAttrs->Put( ScTpPrintItem( aOpt ) );
if ( bSelectedSheetsChanged )
{
rCoreAttrs->Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, m_pSelectedSheetsCB->IsChecked() ) );
rCoreAttrs->Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, m_xSelectedSheetsCB->get_active() ) );
}
return true;
}
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index ac3f877..3d8360d 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -516,13 +516,13 @@ bool ScPreviewShell::HasPrintOptionsPage() const
return true;
}
VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage( TabPageParent pParent, const SfxItemSet &rOptions )
VclPtr<SfxTabPage> ScPreviewShell::CreatePrintOptionsPage(weld::Container* pPage, const SfxItemSet &rOptions)
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SC_TP_PRINT);
if ( ScTpPrintOptionsCreate )
return ScTpPrintOptionsCreate( pParent, &rOptions );
return ScTpPrintOptionsCreate(pPage, &rOptions);
return VclPtr<SfxTabPage>();
}
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index f5d0815..401cca9 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1049,13 +1049,13 @@ bool ScTabViewShell::HasPrintOptionsPage() const
return true;
}
VclPtr<SfxTabPage> ScTabViewShell::CreatePrintOptionsPage( TabPageParent pParent, const SfxItemSet &rOptions )
VclPtr<SfxTabPage> ScTabViewShell::CreatePrintOptionsPage(weld::Container* pPage, const SfxItemSet &rOptions )
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SC_TP_PRINT);
if ( ScTpPrintOptionsCreate )
return ScTpPrintOptionsCreate( pParent, &rOptions );
return ScTpPrintOptionsCreate(pPage, &rOptions);
return VclPtr<SfxTabPage>();
}
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index ee1b6e7..4b8ef5b 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -190,50 +190,38 @@ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions )
}
SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,
SfxViewShell *pViewShell,
const SfxItemSet *pSet)
: ModalDialog(pParent, "PrinterOptionsDialog",
"sfx/ui/printeroptionsdialog.ui")
SfxPrintOptionsDialog::SfxPrintOptionsDialog(weld::Window *pParent,
SfxViewShell *pViewShell,
const SfxItemSet *pSet)
: GenericDialogController(pParent, "sfx/ui/printeroptionsdialog.ui", "PrinterOptionsDialog")
, pDlgImpl(new SfxPrintOptDlg_Impl)
, pViewSh(pViewShell)
, pOptions(pSet->Clone())
, m_xHelpBtn(m_xBuilder->weld_widget("help"))
, m_xContainer(m_xDialog->weld_content_area())
{
VclContainer *pVBox = get_content_area();
// Insert TabPage
pPage.reset(pViewSh->CreatePrintOptionsPage(pVBox, *pOptions));
pPage.reset(pViewSh->CreatePrintOptionsPage(m_xContainer.get(), *pOptions));
DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" );
if( pPage )
{
pPage->Reset( pOptions.get() );
SetHelpId( pPage->GetHelpId() );
pPage->Show();
m_xDialog->set_help_id(pPage->GetHelpId());
}
}
SfxPrintOptionsDialog::~SfxPrintOptionsDialog()
{
disposeOnce();
}
void SfxPrintOptionsDialog::dispose()
{
pDlgImpl.reset();
pPage.disposeAndClear();
pOptions.reset();
ModalDialog::dispose();
}
short SfxPrintOptionsDialog::Execute()
short SfxPrintOptionsDialog::execute()
{
if( ! pPage )
return RET_CANCEL;
short nRet = ModalDialog::Execute();
short nRet = m_xDialog->run();
if ( nRet == RET_OK )
pPage->FillItemSet( pOptions.get() );
else
@@ -241,24 +229,15 @@ short SfxPrintOptionsDialog::Execute()
return nRet;
}
bool SfxPrintOptionsDialog::EventNotify( NotifyEvent& rNEvt )
IMPL_LINK_NOARG(SfxPrintOptionsDialog, HelpRequestHdl, weld::Widget&, bool)
{
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
if ( rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_F1 && pDlgImpl->mbHelpDisabled )
return true; // help disabled -> <F1> does nothing
}
return ModalDialog::EventNotify( rNEvt );
return !pDlgImpl->mbHelpDisabled;
}
void SfxPrintOptionsDialog::DisableHelp()
{
pDlgImpl->mbHelpDisabled = true;
get<HelpButton>("help")->Disable();
m_xHelpBtn->set_sensitive(false);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 44cc9d5..19534cb 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -407,38 +407,36 @@ class SfxDialogExecutor_Impl
{
private:
SfxViewShell* _pViewSh;
VclPtr<PrinterSetupDialog> _pSetupParent;
PrinterSetupDialog& _rSetupParent;
std::unique_ptr<SfxItemSet> _pOptions;
bool _bHelpDisabled;
DECL_LINK( Execute, Button*, void );
DECL_LINK( Execute, weld::Button&, void );
public:
SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent );
SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog& rParent );
Link<Button*, void> GetLink() const { return LINK(const_cast<SfxDialogExecutor_Impl*>(this), SfxDialogExecutor_Impl, Execute); }
Link<weld::Button&, void> GetLink() const { return LINK(const_cast<SfxDialogExecutor_Impl*>(this), SfxDialogExecutor_Impl, Execute); }
const SfxItemSet* GetOptions() const { return _pOptions.get(); }
void DisableHelp() { _bHelpDisabled = true; }
};
SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent ) :
SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog& rParent ) :
_pViewSh ( pViewSh ),
_pSetupParent ( pParent ),
_rSetupParent ( rParent ),
_pOptions ( nullptr ),
_bHelpDisabled ( false )
{
}
IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute, Button*, void)
IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute, weld::Button&, void)
{
// Options noted locally
if ( !_pOptions )
{
DBG_ASSERT( _pSetupParent, "no dialog parent" );
if( _pSetupParent )
_pOptions = static_cast<SfxPrinter*>( _pSetupParent->GetPrinter() )->GetOptions().Clone();
_pOptions = static_cast<SfxPrinter*>( _rSetupParent.GetPrinter() )->GetOptions().Clone();
}
assert(_pOptions);
@@ -446,13 +444,12 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute, Button*, void)
return;
// Create Dialog
VclPtrInstance<SfxPrintOptionsDialog> pDlg( static_cast<vcl::Window*>(_pSetupParent),
_pViewSh, _pOptions.get() );
if ( _bHelpDisabled )
pDlg->DisableHelp();
if ( pDlg->Execute() == RET_OK )
SfxPrintOptionsDialog aDlg(_rSetupParent.GetFrameWeld(), _pViewSh, _pOptions.get() );
if (_bHelpDisabled)
aDlg.DisableHelp();
if (aDlg.execute() == RET_OK)
{
_pOptions = pDlg->GetOptions().Clone();
_pOptions = aDlg.GetOptions().Clone();
}
}
@@ -824,20 +821,20 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
VclPtr<SfxPrinter> pDlgPrinter = pPrinter->Clone();
// execute PrinterSetupDialog
VclPtrInstance<PrinterSetupDialog> pPrintSetupDlg( GetWindow() );
PrinterSetupDialog aPrintSetupDlg(GetFrameWeld());
std::unique_ptr<SfxDialogExecutor_Impl> pExecutor;
if (pImpl->m_bHasPrintOptions && HasPrintOptionsPage())
{
// additional controls for dialog
pExecutor.reset( new SfxDialogExecutor_Impl( this, pPrintSetupDlg ) );
pExecutor.reset( new SfxDialogExecutor_Impl( this, aPrintSetupDlg ) );
if ( bPrintOnHelp )
pExecutor->DisableHelp();
pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() );
aPrintSetupDlg.SetOptionsHdl( pExecutor->GetLink() );
}
pPrintSetupDlg->SetPrinter( pDlgPrinter );
nDialogRet = pPrintSetupDlg->Execute();
aPrintSetupDlg.SetPrinter( pDlgPrinter );
nDialogRet = aPrintSetupDlg.execute();
if ( pExecutor && pExecutor->GetOptions() )
{
@@ -851,8 +848,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
}
}
pPrintSetupDlg.disposeAndClear();
// no recording of PrinterSetup except printer name (is printer dependent)
rReq.Ignore();
@@ -897,7 +892,7 @@ sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, SfxPrinterChan
VclPtr<SfxTabPage> SfxViewShell::CreatePrintOptionsPage
(
TabPageParent /*pParent*/,
weld::Container* /*pPage*/,
const SfxItemSet& /*rOptions*/
)
{
diff --git a/sfx2/uiconfig/ui/printeroptionsdialog.ui b/sfx2/uiconfig/ui/printeroptionsdialog.ui
index b041fff..f502002 100644
--- a/sfx2/uiconfig/ui/printeroptionsdialog.ui
+++ b/sfx2/uiconfig/ui/printeroptionsdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="sfx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="PrinterOptionsDialog">
@@ -7,6 +7,9 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="printeroptionsdialog|PrinterOptionsDialog">Printer Options</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 internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -22,6 +25,8 @@
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
@@ -36,6 +41,7 @@
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
@@ -78,5 +84,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 7b6e741..f0d8af2 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -251,7 +251,7 @@ protected:
void InsertFrom(SfxMedium &rMedium);
virtual bool HasPrintOptionsPage() const override;
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(TabPageParent pParent,
virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage,
const SfxItemSet &rOptions) override;
virtual void Deactivate(bool IsMDIActivate) override;
virtual void Activate(bool IsMDIActivate) override;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 819aaec2..5850194 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1260,10 +1260,10 @@ bool SmViewShell::HasPrintOptionsPage() const
return true;
}
VclPtr<SfxTabPage> SmViewShell::CreatePrintOptionsPage(TabPageParent pParent,
VclPtr<SfxTabPage> SmViewShell::CreatePrintOptionsPage(weld::Container* pPage,
const SfxItemSet &rOptions)
{
return SmPrintOptionsTabPage::Create(pParent, rOptions);
return SmPrintOptionsTabPage::Create(pPage, rOptions);
}
SmEditWindow *SmViewShell::GetEditWindow()
diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
index d7a8b06..3d97feb 100644
--- a/svtools/source/dialogs/prnsetup.cxx
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -20,11 +20,11 @@
#include <svtools/prnsetup.hxx>
#include <svtools/strings.hrc>
#include <svtools/svtresid.hxx>
#include <vcl/svapp.hxx>
#include <vcl/print.hxx>
void ImplFillPrnDlgListBox( const Printer* pPrinter,
ListBox* pBox, PushButton* pPropBtn )
weld::ComboBoxText* pBox, weld::Button* pPropBtn )
{
ImplFreePrnDlgListBox( pBox );
@@ -33,29 +33,29 @@ void ImplFillPrnDlgListBox( const Printer* pPrinter,
if ( nCount )
{
for( unsigned int i = 0; i < nCount; i++ )
pBox->InsertEntry( rPrinters[i] );
pBox->SelectEntry( pPrinter->GetName() );
pBox->append_text( rPrinters[i] );
pBox->set_active( pPrinter->GetName() );
}
pBox->Enable( nCount != 0 );
pPropBtn->Show( pPrinter->HasSupport( PrinterSupport::SetupDialog ) );
pBox->set_sensitive(nCount != 0);
pPropBtn->show( pPrinter->HasSupport( PrinterSupport::SetupDialog ) );
}
void ImplFreePrnDlgListBox( ListBox* pBox, bool bClear )
void ImplFreePrnDlgListBox( weld::ComboBoxText* pBox, bool bClear )
{
if ( bClear )
pBox->Clear();
pBox->clear();
}
Printer* ImplPrnDlgListBoxSelect( ListBox const * pBox, PushButton* pPropBtn,
Printer* ImplPrnDlgListBoxSelect( const weld::ComboBoxText* pBox, weld::Button* pPropBtn,
Printer const * pPrinter, Printer* pTempPrinterIn )
{
VclPtr<Printer> pTempPrinter( pTempPrinterIn );
if ( pBox->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND )
if ( pBox->get_active() != -1 )
{
const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectedEntry(), true );
const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->get_active_text(), true );
if( pInfo)
{
if ( !pTempPrinter )
@@ -76,13 +76,13 @@ Printer* ImplPrnDlgListBoxSelect( ListBox const * pBox, PushButton* pPropBtn,
}
}
pPropBtn->Enable( pTempPrinter->HasSupport( PrinterSupport::SetupDialog ) );
pPropBtn->set_sensitive(pTempPrinter->HasSupport(PrinterSupport::SetupDialog));
}
else
pPropBtn->Disable();
pPropBtn->set_sensitive(false);
}
else
pPropBtn->Disable();
pPropBtn->set_sensitive(false);
return pTempPrinter;
}
@@ -107,11 +107,11 @@ Printer* ImplPrnDlgUpdatePrinter( Printer const * pPrinter, Printer* pTempPrinte
}
void ImplPrnDlgUpdateQueueInfo( ListBox const * pBox, QueueInfo& rInfo )
void ImplPrnDlgUpdateQueueInfo( const weld::ComboBoxText* pBox, QueueInfo& rInfo )
{
if ( pBox->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND )
if ( pBox->get_active() != -1 )
{
const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectedEntry(), true );
const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->get_active_text(), true );
if( pInfo )
rInfo = *pInfo;
}
@@ -207,147 +207,128 @@ OUString ImplPrnDlgGetStatusText( const QueueInfo& rInfo )
return aStr;
}
PrinterSetupDialog::PrinterSetupDialog(vcl::Window* pParent)
: ModalDialog(pParent, "PrinterSetupDialog",
"svt/ui/printersetupdialog.ui")
PrinterSetupDialog::PrinterSetupDialog(weld::Window* pParent)
: GenericDialogController(pParent, "svt/ui/printersetupdialog.ui", "PrinterSetupDialog")
, m_xLbName(m_xBuilder->weld_combo_box_text("name"))
, m_xBtnProperties(m_xBuilder->weld_button("properties"))
, m_xBtnOptions(m_xBuilder->weld_button("options"))
, m_xFiStatus(m_xBuilder->weld_label("status"))
, m_xFiType(m_xBuilder->weld_label("type"))
, m_xFiLocation(m_xBuilder->weld_label("location"))
, m_xFiComment(m_xBuilder->weld_label("comment"))
{
get(m_pLbName, "name");
m_pLbName->SetStyle(m_pLbName->GetStyle() | WB_SORT);
get(m_pBtnProperties, "properties");
get(m_pBtnOptions, "options");
get(m_pFiStatus, "status");
get(m_pFiType, "type");
get(m_pFiLocation, "location");
get(m_pFiComment, "comment");
m_xLbName->make_sorted();
// show options button only if link is set
m_pBtnOptions->Hide();
m_xBtnOptions->hide();
mpPrinter = nullptr;
mpTempPrinter = nullptr;
maStatusTimer.SetTimeout( IMPL_PRINTDLG_STATUS_UPDATE );
maStatusTimer.SetInvokeHandler( LINK( this, PrinterSetupDialog, ImplStatusHdl ) );
m_pBtnProperties->SetClickHdl( LINK( this, PrinterSetupDialog, ImplPropertiesHdl ) );
m_pLbName->SetSelectHdl( LINK( this, PrinterSetupDialog, ImplChangePrinterHdl ) );
m_xBtnProperties->connect_clicked( LINK( this, PrinterSetupDialog, ImplPropertiesHdl ) );
m_xLbName->connect_changed( LINK( this, PrinterSetupDialog, ImplChangePrinterHdl ) );
m_xDialog->connect_focus_in( LINK( this, PrinterSetupDialog, ImplGetFocusHdl ) );
Application::AddEventListener(LINK( this, PrinterSetupDialog, ImplDataChangedHdl ) );
}
PrinterSetupDialog::~PrinterSetupDialog()
{
disposeOnce();
Application::RemoveEventListener(LINK( this, PrinterSetupDialog, ImplDataChangedHdl ) );
ImplFreePrnDlgListBox(m_xLbName.get(), false);
}
void PrinterSetupDialog::dispose()
void PrinterSetupDialog::SetOptionsHdl(const Link<weld::Button&, void>& rLink)
{
ImplFreePrnDlgListBox(m_pLbName, false);
m_pLbName.clear();
m_pBtnProperties.clear();
m_pBtnOptions.clear();
m_pFiStatus.clear();
m_pFiType.clear();
m_pFiLocation.clear();
m_pFiComment.clear();
mpTempPrinter.disposeAndClear();
mpPrinter.clear();
ModalDialog::dispose();
}
void PrinterSetupDialog::SetOptionsHdl( const Link<Button*,void>& rLink )
{
m_pBtnOptions->SetClickHdl( rLink );
m_pBtnOptions->Show( rLink.IsSet() );
m_xBtnOptions->connect_clicked(rLink);
m_xBtnOptions->show(rLink.IsSet());
}
void PrinterSetupDialog::ImplSetInfo()
{
const QueueInfo* pInfo = Printer::GetQueueInfo(m_pLbName->GetSelectedEntry(), true);
const QueueInfo* pInfo = Printer::GetQueueInfo(m_xLbName->get_active_text(), true);
if ( pInfo )
{
m_pFiType->SetText( pInfo->GetDriver() );
m_pFiLocation->SetText( pInfo->GetLocation() );
m_pFiComment->SetText( pInfo->GetComment() );
m_pFiStatus->SetText( ImplPrnDlgGetStatusText( *pInfo ) );
m_xFiType->set_label( pInfo->GetDriver() );
m_xFiLocation->set_label( pInfo->GetLocation() );
m_xFiComment->set_label( pInfo->GetComment() );
m_xFiStatus->set_label( ImplPrnDlgGetStatusText( *pInfo ) );
}
else
{
OUString aTempStr;
m_pFiType->SetText( aTempStr );
m_pFiLocation->SetText( aTempStr );
m_pFiComment->SetText( aTempStr );
m_pFiStatus->SetText( aTempStr );
m_xFiType->set_label( aTempStr );
m_xFiLocation->set_label( aTempStr );
m_xFiComment->set_label( aTempStr );
m_xFiStatus->set_label( aTempStr );
}
}
IMPL_LINK_NOARG(PrinterSetupDialog, ImplStatusHdl, Timer *, void)
{
QueueInfo aInfo;
ImplPrnDlgUpdateQueueInfo(m_pLbName, aInfo);
m_pFiStatus->SetText( ImplPrnDlgGetStatusText( aInfo ) );
ImplPrnDlgUpdateQueueInfo(m_xLbName.get(), aInfo);
m_xFiStatus->set_label( ImplPrnDlgGetStatusText( aInfo ) );
}
IMPL_LINK_NOARG(PrinterSetupDialog, ImplPropertiesHdl, Button*, void)
IMPL_LINK_NOARG(PrinterSetupDialog, ImplPropertiesHdl, weld::Button&, void)
{
if ( !mpTempPrinter )
mpTempPrinter = VclPtr<Printer>::Create( mpPrinter->GetJobSetup() );
mpTempPrinter->Setup( this );
mpTempPrinter->Setup(m_xDialog.get());
}
IMPL_LINK_NOARG(PrinterSetupDialog, ImplChangePrinterHdl, ListBox&, void)
IMPL_LINK_NOARG(PrinterSetupDialog, ImplChangePrinterHdl, weld::ComboBoxText&, void)
{
mpTempPrinter = ImplPrnDlgListBoxSelect(m_pLbName, m_pBtnProperties,
mpPrinter, mpTempPrinter );
mpTempPrinter = ImplPrnDlgListBoxSelect(m_xLbName.get(), m_xBtnProperties.get(),
mpPrinter, mpTempPrinter);
ImplSetInfo();
}
bool PrinterSetupDialog::EventNotify( NotifyEvent& rNEvt )
IMPL_LINK(PrinterSetupDialog, ImplGetFocusHdl, weld::Widget&, rWidget, void)
{
if ( (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS) && IsReallyVisible() )
ImplStatusHdl( &maStatusTimer );
return ModalDialog::EventNotify( rNEvt );
if (rWidget.is_visible())
ImplStatusHdl(&maStatusTimer);
}
void PrinterSetupDialog::DataChanged( const DataChangedEvent& rDCEvt )
IMPL_LINK(PrinterSetupDialog, ImplDataChangedHdl, VclSimpleEvent&, rEvt, void)
{
if ( rDCEvt.GetType() == DataChangedEventType::PRINTER )
{
mpTempPrinter = ImplPrnDlgUpdatePrinter( mpPrinter, mpTempPrinter );
Printer* pPrn;
if ( mpTempPrinter )
pPrn = mpTempPrinter;
else
pPrn = mpPrinter;
ImplFillPrnDlgListBox(pPrn, m_pLbName, m_pBtnProperties);
ImplSetInfo();
}
VclEventId nEvent = rEvt.GetId();
if (nEvent != VclEventId::ApplicationDataChanged)
return;
ModalDialog::DataChanged( rDCEvt );
DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvt).GetData());
if (!pData || pData->GetType() != DataChangedEventType::PRINTER)
return;
mpTempPrinter = ImplPrnDlgUpdatePrinter(mpPrinter, mpTempPrinter);
Printer* pPrn;
if (mpTempPrinter)
pPrn = mpTempPrinter;
else
pPrn = mpPrinter;
ImplFillPrnDlgListBox(pPrn, m_xLbName.get(), m_xBtnProperties.get());
ImplSetInfo();
}
short PrinterSetupDialog::Execute()
short PrinterSetupDialog::execute()
{
if ( !mpPrinter || mpPrinter->IsPrinting() || mpPrinter->IsJobActive() )
{
SAL_WARN( "svtools.dialogs", "PrinterSetupDialog::Execute() - No Printer or printer is printing" );
SAL_WARN( "svtools.dialogs", "PrinterSetupDialog::execute() - No Printer or printer is printing" );
return RET_CANCEL;
}
Printer::updatePrinters();
ImplFillPrnDlgListBox(mpPrinter, m_pLbName, m_pBtnProperties);
ImplFillPrnDlgListBox(mpPrinter, m_xLbName.get(), m_xBtnProperties.get());
ImplSetInfo();
maStatusTimer.Start();
// start dialog
short nRet = ModalDialog::Execute();
short nRet = m_xDialog->run();
// update data if the dialog was terminated with OK
if ( nRet == RET_OK )
diff --git a/svtools/uiconfig/ui/printersetupdialog.ui b/svtools/uiconfig/ui/printersetupdialog.ui
index 0ccfccd..354d7a7 100644
--- a/svtools/uiconfig/ui/printersetupdialog.ui
+++ b/svtools/uiconfig/ui/printersetupdialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="svt">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="PrinterSetupDialog">
@@ -7,6 +7,9 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="printersetupdialog|PrinterSetupDialog">Printer Setup</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 internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -43,7 +46,6 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
@@ -107,10 +109,10 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="printersetupdialog|label2">Name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -121,8 +123,8 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="printersetupdialog|label3">Status:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -133,8 +135,8 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="printersetupdialog|label4">Type:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -145,8 +147,8 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="printersetupdialog|label5">Location:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -157,8 +159,8 @@
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="printersetupdialog|label6">Comment:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -226,7 +228,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="name">
<object class="GtkComboBoxText" id="name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -261,9 +263,11 @@
</child>
<action-widgets>
<action-widget response="-11">help</action-widget>
<action-widget response="0">options</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 14d352f..63411ef 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -499,7 +499,7 @@ public:
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
virtual void ExecuteMMResultSaveDialog() = 0;
virtual void ExecuteMMResultPrintDialog() = 0;
virtual void ExecuteMMResultPrintDialog(weld::Window* pParent) = 0;
virtual void ExecuteMMResultEmailDialog() = 0;
protected:
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 73a9138..2dedb5f 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -618,7 +618,7 @@ public:
// methods for printing
SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override;
SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent,
SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pParent,
const SfxItemSet& rSet) override;
static SvxSearchItem* GetSearchItem() { return m_pSrchItem; }
/// See SfxViewShell::getPart().
@@ -646,7 +646,7 @@ inline const SwDocShell *SwView::GetDocShell() const
return const_cast<SwView*>(this)->GetDocShell();
}
VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent,
VclPtr<SfxTabPage> CreatePrintOptionsPage( weld::Container* pPage,
const SfxItemSet &rOptions,
bool bPreview);
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 03006da..133b423 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -451,7 +451,11 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet* )
m_xEndRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::EndDoc ) ;
m_xEndPageRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::EndPage ) ;
m_xInMarginsRB->set_active(pAddPrinterAttr->m_nPrintPostIts== SwPostItMode::InMargins ) ;
m_xFaxLB->set_active( pAddPrinterAttr->m_sFaxName );
auto nFound = m_xFaxLB->find_text(pAddPrinterAttr->m_sFaxName);
if (nFound != -1)
m_xFaxLB->set_active(nFound);
else
m_xFaxLB->set_active(0);
}
if (m_xProspectCB->get_active())
{
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index e19dee6..6fcd3740 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -254,54 +254,36 @@ void SwMMResultSaveDialog::dispose()
SfxModalDialog::dispose();
}
SwMMResultPrintDialog::SwMMResultPrintDialog()
: SfxModalDialog(nullptr, "MMResultPrintDialog", "modules/swriter/ui/mmresultprintdialog.ui")
, m_pTempPrinter(nullptr)
SwMMResultPrintDialog::SwMMResultPrintDialog(weld::Window* pParent)
: GenericDialogController(pParent, "modules/swriter/ui/mmresultprintdialog.ui", "MMResultPrintDialog")
, m_xPrinterFT(m_xBuilder->weld_label("printerft"))
, m_xPrinterLB(m_xBuilder->weld_combo_box_text("printers"))
, m_xPrinterSettingsPB(m_xBuilder->weld_button("printersettings"))
, m_xPrintAllRB(m_xBuilder->weld_radio_button("printallrb"))
, m_xFromRB(m_xBuilder->weld_radio_button("fromrb"))
, m_xFromNF(m_xBuilder->weld_spin_button("from"))
, m_xToFT(m_xBuilder->weld_label("toft"))
, m_xToNF(m_xBuilder->weld_spin_button("to"))
, m_xOKButton(m_xBuilder->weld_button("ok"))
{
get(m_pPrinterFT, "printerft");
get(m_pPrinterLB, "printers");
m_pPrinterLB->SetStyle(m_pPrinterLB->GetStyle() | WB_SORT);
get(m_pPrinterSettingsPB, "printersettings");
get(m_pPrintAllRB, "printallrb");
get(m_pFromRB, "fromrb");
get(m_pFromNF, "from-nospin");
get(m_pToFT, "toft");
get(m_pToNF, "to-nospin");
get(m_pOKButton, "ok");
m_xPrinterLB->make_sorted();
m_pPrinterLB->SetSelectHdl(LINK(this, SwMMResultPrintDialog, PrinterChangeHdl_Impl));
m_pPrinterSettingsPB->SetClickHdl(LINK(this, SwMMResultPrintDialog, PrinterSetupHdl_Impl));
m_xPrinterLB->connect_changed(LINK(this, SwMMResultPrintDialog, PrinterChangeHdl_Impl));
m_xPrinterSettingsPB->connect_clicked(LINK(this, SwMMResultPrintDialog, PrinterSetupHdl_Impl));
Link<Button*,void> aLink = LINK(this, SwMMResultPrintDialog, DocumentSelectionHdl_Impl);
m_pPrintAllRB->SetClickHdl(aLink);
m_pFromRB->SetClickHdl(aLink);
Link<weld::ToggleButton&,void> aLink = LINK(this, SwMMResultPrintDialog, DocumentSelectionHdl_Impl);
m_xPrintAllRB->connect_toggled(aLink);
m_xFromRB->connect_toggled(aLink);
// m_pPrintAllRB is the default, so disable m_pFromNF and m_pToNF initially.
aLink.Call(m_pPrintAllRB);
aLink.Call(*m_xPrintAllRB);
m_pOKButton->SetClickHdl(LINK(this, SwMMResultPrintDialog, PrintHdl_Impl));
m_xOKButton->connect_clicked(LINK(this, SwMMResultPrintDialog, PrintHdl_Impl));
FillInPrinterSettings();
}
SwMMResultPrintDialog::~SwMMResultPrintDialog()
{
disposeOnce();
}
void SwMMResultPrintDialog::dispose()
{
m_pPrinterFT.clear();
m_pPrinterLB.clear();
m_pPrinterSettingsPB.clear();
m_pPrintAllRB.clear();
m_pFromRB.clear();
m_pFromNF.clear();
m_pToFT.clear();
m_pToNF.clear();
m_pOKButton.clear();
m_pTempPrinter.clear();
SfxModalDialog::dispose();
}
SwMMResultEmailDialog::SwMMResultEmailDialog()
@@ -375,33 +357,30 @@ void SwMMResultPrintDialog::FillInPrinterSettings()
const std::vector<OUString>& rPrinters = Printer::GetPrinterQueues();
unsigned int nCount = rPrinters.size();
bool bMergePrinterExists = false;
if ( nCount )
{
for( unsigned int i = 0; i < nCount; i++ )
{
m_pPrinterLB->InsertEntry( rPrinters[i] );
if( !bMergePrinterExists && rPrinters[i] == xConfigItem->GetSelectedPrinter() )
bMergePrinterExists = true;
}
for (unsigned int i = 0; i < nCount; ++i)
{
m_xPrinterLB->append_text( rPrinters[i] );
if( !bMergePrinterExists && rPrinters[i] == xConfigItem->GetSelectedPrinter() )
bMergePrinterExists = true;
}
assert(xConfigItem);
if(!bMergePrinterExists)
{
SfxPrinter* pPrinter = pView->GetWrtShell().getIDocumentDeviceAccess().getPrinter( true );
m_pPrinterLB->SelectEntry(pPrinter->GetName());
m_xPrinterLB->set_active(pPrinter->GetName());
}
else
{
m_pPrinterLB->SelectEntry(xConfigItem->GetSelectedPrinter());
m_xPrinterLB->set_active(xConfigItem->GetSelectedPrinter());
}
sal_Int32 count = xConfigItem->GetMergedDocumentCount();
m_pToNF->SetValue(count);
m_pToNF->SetMax(count);
m_xToNF->set_value(count);
m_xToNF->set_max(count);
m_pPrinterLB->SelectEntry(xConfigItem->GetSelectedPrinter());
m_xPrinterLB->set_active(xConfigItem->GetSelectedPrinter());
}
void SwMMResultEmailDialog::FillInEmailSettings()
@@ -469,12 +448,12 @@ IMPL_LINK(SwMMResultSaveDialog, DocumentSelectionHdl_Impl, Button*, pButton, voi
m_pToNF->Enable(bEnableFromTo);
}
IMPL_LINK(SwMMResultPrintDialog, DocumentSelectionHdl_Impl, Button*, pButton, void)
IMPL_LINK(SwMMResultPrintDialog, DocumentSelectionHdl_Impl, weld::ToggleButton&, rButton, void)
{
bool bEnableFromTo = pButton == m_pFromRB;
m_pFromNF->Enable(bEnableFromTo);
m_pToFT->Enable(bEnableFromTo);
m_pToNF->Enable(bEnableFromTo);
bool bEnableFromTo = &rButton == m_xFromRB.get();
m_xFromNF->set_sensitive(bEnableFromTo);
m_xToFT->set_sensitive(bEnableFromTo);
m_xToNF->set_sensitive(bEnableFromTo);
}
IMPL_LINK(SwMMResultEmailDialog, DocumentSelectionHdl_Impl, Button*, pButton, void)
@@ -748,14 +727,14 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void)
endDialog(pButton);
}
IMPL_LINK(SwMMResultPrintDialog, PrinterChangeHdl_Impl, ListBox&, rBox, void)
IMPL_LINK(SwMMResultPrintDialog, PrinterChangeHdl_Impl, weld::ComboBoxText&, rBox, void)
{
SwView* pView = ::GetActiveView();
std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
assert(xConfigItem);
if (rBox.GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND)
if (rBox.get_active() != -1)
{
const QueueInfo* pInfo = Printer::GetQueueInfo( rBox.GetSelectedEntry(), false );
const QueueInfo* pInfo = Printer::GetQueueInfo( rBox.get_active_text(), false );
if( pInfo )
{
@@ -776,15 +755,15 @@ IMPL_LINK(SwMMResultPrintDialog, PrinterChangeHdl_Impl, ListBox&, rBox, void)
else if( ! m_pTempPrinter )
m_pTempPrinter = VclPtr<Printer>::Create();
m_pPrinterSettingsPB->Enable( m_pTempPrinter->HasSupport( PrinterSupport::SetupDialog ) );
m_xPrinterSettingsPB->set_sensitive(m_pTempPrinter->HasSupport(PrinterSupport::SetupDialog));
}
else
m_pPrinterSettingsPB->Disable();
m_xPrinterSettingsPB->set_sensitive(false);
xConfigItem->SetSelectedPrinter(rBox.GetSelectedEntry());
xConfigItem->SetSelectedPrinter(rBox.get_active_text());
}
IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void)
IMPL_LINK_NOARG(SwMMResultPrintDialog, PrintHdl_Impl, weld::Button&, void)
{
SwView* pView = ::GetActiveView();
std::shared_ptr<SwMailMergeConfigItem> xConfigItem = pView->GetMailMergeConfigItem();
@@ -799,15 +778,15 @@ IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void)
sal_uInt32 nEnd = 0;
sal_uInt32 documentCount = xConfigItem->GetMergedDocumentCount();
if(m_pPrintAllRB->IsChecked())
if (m_xPrintAllRB->get_active())
{
nBegin = 0;
nEnd = documentCount;
}
else
{
nBegin = static_cast< sal_Int32 >(m_pFromNF->GetValue() - 1);
nEnd = static_cast< sal_Int32 >(m_pToNF->GetValue());
nBegin = m_xFromNF->get_value() - 1;
nEnd = m_xToNF->get_value();
if(nEnd > documentCount)
nEnd = documentCount;
}
@@ -838,15 +817,15 @@ IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void)
pTargetView->ExecPrint( aProps, false, true );
SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh));
endDialog(pButton);
m_xDialog->response(RET_OK);
}
IMPL_LINK(SwMMResultPrintDialog, PrinterSetupHdl_Impl, Button*, pButton, void)
IMPL_LINK_NOARG(SwMMResultPrintDialog, PrinterSetupHdl_Impl, weld::Button&, void)
{
if( !m_pTempPrinter )
PrinterChangeHdl_Impl(*m_pPrinterLB);
if(m_pTempPrinter)
m_pTempPrinter->Setup(pButton);
if (!m_pTempPrinter)
PrinterChangeHdl_Impl(*m_xPrinterLB);
if (m_pTempPrinter)
m_pTempPrinter->Setup(m_xDialog.get());
}
IMPL_LINK(SwMMResultEmailDialog, SendTypeHdl_Impl, ListBox&, rBox, void)
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index fd0e200..a5a6ca3 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -1139,10 +1139,10 @@ void SwAbstractDialogFactory_Impl::ExecuteMMResultSaveDialog()
pDialog->Execute();
}
void SwAbstractDialogFactory_Impl::ExecuteMMResultPrintDialog()
void SwAbstractDialogFactory_Impl::ExecuteMMResultPrintDialog(weld::Window* pParent)
{
ScopedVclPtrInstance<SwMMResultPrintDialog> pDialog;
pDialog->Execute();
SwMMResultPrintDialog aDialog(pParent);
aDialog.run();
}
void SwAbstractDialogFactory_Impl::ExecuteMMResultEmailDialog()
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 48fd7f9..fd13c1d 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -649,7 +649,7 @@ public:
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) override;
virtual void ExecuteMMResultSaveDialog() override;
virtual void ExecuteMMResultPrintDialog() override;
virtual void ExecuteMMResultPrintDialog(weld::Window* pParent) override;
virtual void ExecuteMMResultEmailDialog() override;
};
diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx
index 0e52ab4..7605bd4 100644
--- a/sw/source/ui/envelp/envprt.cxx
+++ b/sw/source/ui/envelp/envprt.cxx
@@ -115,10 +115,9 @@ IMPL_LINK( SwEnvPrtPage, ButtonHdl, Button *, pBtn, void )
// Call printer setup
if (pPrt)
{
VclPtrInstance< PrinterSetupDialog > pDlg(this);
pDlg->SetPrinter(pPrt);
pDlg->Execute();
pDlg.reset();
PrinterSetupDialog aDlg(GetFrameWeld());
aDlg.SetPrinter(pPrt);
aDlg.execute();
GrabFocus();
m_pPrinterInfo->SetText(pPrt->GetName());
}
diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx
index c876f2e..faecd0e 100644
--- a/sw/source/ui/envelp/labprt.cxx
+++ b/sw/source/ui/envelp/labprt.cxx
@@ -87,10 +87,9 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton, void )
if (!pPrinter)
pPrinter = VclPtr<Printer>::Create();
VclPtrInstance< PrinterSetupDialog > pDlg(this);
pDlg->SetPrinter(pPrinter);
pDlg->Execute();
pDlg.disposeAndClear();
PrinterSetupDialog aDlg(GetFrameWeld());
aDlg.SetPrinter(pPrinter);
aDlg.execute();
GrabFocus();
m_pPrinterInfo->SetText(pPrinter->GetName());
return;
diff --git a/sw/source/ui/inc/mmresultdialogs.hxx b/sw/source/ui/inc/mmresultdialogs.hxx
index 01e8982..a63a665 100644
--- a/sw/source/ui/inc/mmresultdialogs.hxx
+++ b/sw/source/ui/inc/mmresultdialogs.hxx
@@ -25,6 +25,7 @@
#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/prgsbar.hxx>
#include <vcl/weld.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/basedlgs.hxx>
#include <svtools/simptabl.hxx>
@@ -68,35 +69,30 @@ public:
};
/// Dialog implementing the printing of the result document.
class SwMMResultPrintDialog : public SfxModalDialog
class SwMMResultPrintDialog : public weld::GenericDialogController
{
VclPtr<FixedText> m_pPrinterFT;
VclPtr<ListBox> m_pPrinterLB;
VclPtr<PushButton> m_pPrinterSettingsPB;
VclPtr<RadioButton> m_pPrintAllRB;
VclPtr<RadioButton> m_pFromRB;
VclPtr<NumericField> m_pFromNF;
VclPtr<FixedText> m_pToFT;
VclPtr<NumericField> m_pToNF;
VclPtr<Button> m_pOKButton;
VclPtr<Printer> m_pTempPrinter;
DECL_LINK(PrinterChangeHdl_Impl, ListBox&,void );
DECL_LINK(PrintHdl_Impl, Button*, void);
DECL_LINK(PrinterSetupHdl_Impl, Button*, void );
DECL_LINK(DocumentSelectionHdl_Impl, Button*, void);
std::unique_ptr<weld::Label> m_xPrinterFT;
std::unique_ptr<weld::ComboBoxText> m_xPrinterLB;
std::unique_ptr<weld::Button> m_xPrinterSettingsPB;
std::unique_ptr<weld::RadioButton> m_xPrintAllRB;
std::unique_ptr<weld::RadioButton> m_xFromRB;
std::unique_ptr<weld::SpinButton> m_xFromNF;
std::unique_ptr<weld::Label> m_xToFT;
std::unique_ptr<weld::SpinButton> m_xToNF;
std::unique_ptr<weld::Button> m_xOKButton;
DECL_LINK(PrinterChangeHdl_Impl, weld::ComboBoxText&, void );
DECL_LINK(PrintHdl_Impl, weld::Button&, void);
DECL_LINK(PrinterSetupHdl_Impl, weld::Button&, void );
DECL_LINK(DocumentSelectionHdl_Impl, weld::ToggleButton&, void);
void FillInPrinterSettings();
public:
SwMMResultPrintDialog();
SwMMResultPrintDialog(weld::Window* pParent);
virtual ~SwMMResultPrintDialog() override;
virtual void dispose() override;
};
/// Dialog implementing the sending as email of the result document.
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 1a74f3f..6be3003 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -816,7 +816,7 @@ void SwModule::ExecOther(SfxRequest& rReq)
switch (nWhich)
{
case FN_MAILMERGE_SAVE_DOCUMENTS: pFact->ExecuteMMResultSaveDialog(); break;
case FN_MAILMERGE_PRINT_DOCUMENTS: pFact->ExecuteMMResultPrintDialog(); break;
case FN_MAILMERGE_PRINT_DOCUMENTS: pFact->ExecuteMMResultPrintDialog(rReq.GetFrameWeld()); break;
case FN_MAILMERGE_EMAIL_DOCUMENTS: pFact->ExecuteMMResultEmailDialog(); break;
}
}
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index 5d046f6..059aecd 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -201,7 +201,7 @@ class SW_DLLPUBLIC SwPagePreview: public SfxViewShell
SAL_DLLPRIVATE virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
SAL_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
SAL_DLLPRIVATE virtual bool HasPrintOptionsPage() const override;
SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(TabPageParent pParent, const SfxItemSet &rOptions) override;
SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pParent, const SfxItemSet &rOptions) override;
SAL_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill );
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index cd22486..76f46c2 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1706,10 +1706,10 @@ bool SwPagePreview::HasPrintOptionsPage() const
return true;
}
VclPtr<SfxTabPage> SwPagePreview::CreatePrintOptionsPage( TabPageParent pParent,
VclPtr<SfxTabPage> SwPagePreview::CreatePrintOptionsPage( weld::Container* pPage,
const SfxItemSet &rOptions )
{
return ::CreatePrintOptionsPage( TabPageParent(pParent.pParent), rOptions, !m_bNormalPrint );
return ::CreatePrintOptionsPage(pPage, rOptions, !m_bNormalPrint);
}
void SwPagePreviewWin::SetViewShell( SwViewShell* pShell )
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index f840dc3..d7ac187 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -170,10 +170,10 @@ namespace
// TabPage for application-specific print options
VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(TabPageParent pParent,
VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(weld::Container* pPage,
const SfxItemSet& rSet)
{
return ::CreatePrintOptionsPage( pParent, rSet, false );
return ::CreatePrintOptionsPage(pPage, rSet, false);
}
// Print dispatcher
@@ -303,7 +303,7 @@ void SwView::NotifyCursor(SfxViewShell* pViewShell) const
// Create page printer/additions for SwView and SwPagePreview
VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent,
VclPtr<SfxTabPage> CreatePrintOptionsPage( weld::Container* pPage,
const SfxItemSet &rOptions,
bool bPreview )
{
@@ -317,16 +317,16 @@ VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent,
if (!fnCreatePage)
return nullptr;
VclPtr<SfxTabPage> pPage = fnCreatePage(pParent, &rOptions);
OSL_ENSURE(pPage, "No page");
if (!pPage)
VclPtr<SfxTabPage> pSfxPage = fnCreatePage(pPage, &rOptions);
OSL_ENSURE(pSfxPage, "No page");
if (!pSfxPage)
return nullptr;
SfxAllItemSet aSet(*(rOptions.GetPool()));
aSet.Put(SfxBoolItem(SID_PREVIEWFLAG_TYPE, bPreview));
aSet.Put(SfxBoolItem(SID_FAX_LIST, true));
pPage->PageCreated(aSet);
return pPage;
pSfxPage->PageCreated(aSet);
return pSfxPage;
}
void SetAppPrintOptions( SwViewShell* pSh, bool bWeb )
diff --git a/sw/uiconfig/swriter/ui/mmresultprintdialog.ui b/sw/uiconfig/swriter/ui/mmresultprintdialog.ui
index e1ef3d8..64096ab 100644
--- a/sw/uiconfig/swriter/ui/mmresultprintdialog.ui
+++ b/sw/uiconfig/swriter/ui/mmresultprintdialog.ui
@@ -1,11 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.4 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="lower">1</property>
<property name="upper">100000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkDialog" id="MMResultPrintDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="mmresultprintdialog|MMResultPrintDialog">Print merged document</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 internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -57,6 +72,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
@@ -93,10 +109,10 @@
<object class="GtkLabel" id="printerft">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="mmresultprintdialog|printerft">_Printer</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">printers</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -205,7 +221,7 @@
<property name="draw_indicator">True</property>
<property name="group">printallrb</property>
<accessibility>
<relation type="label-for" target="from-nospin"/>
<relation type="label-for" target="from"/>
</accessibility>
</object>
<packing>
@@ -219,7 +235,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="mmresultprintdialog|toft">_To</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">to-nospin</property>
<property name="mnemonic_widget">to</property>
</object>
<packing>
<property name="left_attach">2</property>
@@ -227,10 +243,11 @@
</packing>
</child>
<child>
<object class="GtkSpinButton" id="from-nospin">
<object class="GtkSpinButton" id="from">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="no">1</property>
<property name="text">1</property>
<property name="adjustment">adjustment1</property>
<property name="value">1</property>
<accessibility>
<relation type="labelled-by" target="fromrb"/>
@@ -242,10 +259,11 @@
</packing>
</child>
<child>
<object class="GtkSpinButton" id="to-nospin">
<object class="GtkSpinButton" id="to">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text">1</property>
<property name="adjustment">adjustment2</property>
<property name="value">1</property>
</object>
<packing>
@@ -288,5 +306,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index a0ec782..e54c01a 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -267,7 +267,7 @@ GenPspGraphics *SvpSalInstance::CreatePrintGraphics()
return new GenPspGraphics();
}
bool SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
bool SvpSalInfoPrinter::Setup( weld::Window*, ImplJobSetup* )
{
return false;
}
diff --git a/vcl/inc/headless/svpprn.hxx b/vcl/inc/headless/svpprn.hxx
index d38d36d..a7572af 100644
--- a/vcl/inc/headless/svpprn.hxx
+++ b/vcl/inc/headless/svpprn.hxx
@@ -30,7 +30,7 @@
class SvpSalInfoPrinter : public PspSalInfoPrinter
{
public:
virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override;
virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override;
};
class SvpSalPrinter : public PspSalPrinter
diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h
index 8f9c040..717c8e1 100644
--- a/vcl/inc/osx/salprn.h
+++ b/vcl/inc/osx/salprn.h
@@ -68,7 +68,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* i_pGraphics ) override;
virtual bool Setup( SalFrame* i_pFrame, ImplJobSetup* i_pSetupData ) override;
virtual bool Setup( weld::Window* i_pFrame, ImplJobSetup* i_pSetupData ) override;
virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override;
virtual bool SetData( JobSetFlags i_nFlags, ImplJobSetup* i_pSetupData ) override;
virtual void GetPageInfo( const ImplJobSetup* i_pSetupData,
diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx
index d9da1a6..d2af082 100644
--- a/vcl/inc/salprn.hxx
+++ b/vcl/inc/salprn.hxx
@@ -60,7 +60,7 @@ public:
virtual SalGraphics* AcquireGraphics() = 0;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0;
virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) = 0;
virtual bool Setup(weld::Window* pFrame, ImplJobSetup* pSetupData) = 0;
// This function set the driver data and
// set the new indepen data in pSetupData
virtual bool SetPrinterData( ImplJobSetup* pSetupData ) = 0;
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
index 9d80de3..a8ad4fb 100644
--- a/vcl/inc/unx/genprn.h
+++ b/vcl/inc/unx/genprn.h
@@ -40,7 +40,7 @@ public:
// override all pure virtual methods
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override;
virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override;
virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override;
virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override;
virtual void GetPageInfo( const ImplJobSetup* pSetupData,
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index f9be475..c0c6e7f 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -55,7 +55,7 @@ public:
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override;
virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override;
virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override;
virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override;
virtual void GetPageInfo( const ImplJobSetup* pSetupData,
diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx
index b87585d..baeb6c6 100644
--- a/vcl/osx/salprn.cxx
+++ b/vcl/osx/salprn.cxx
@@ -148,7 +148,7 @@ void AquaSalInfoPrinter::ReleaseGraphics( SalGraphics* )
mbGraphics = false;
}
bool AquaSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
bool AquaSalInfoPrinter::Setup( weld::Window*, ImplJobSetup* )
{
return false;
}
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index ab1d797..a22721c 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -37,6 +37,7 @@
#include <vcl/layout.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/slider.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/unowrap.hxx>
@@ -215,6 +216,11 @@ public:
return m_xWidget->IsVisible();
}
virtual bool is_visible() const override
{
return m_xWidget->IsReallyVisible();
}
virtual void grab_focus() override
{
m_xWidget->GrabFocus();
@@ -562,6 +568,11 @@ public:
return true;
}
virtual SystemEnvData get_system_data() const override
{
return *m_xWindow->GetSystemData();
}
virtual ~SalInstanceWindow() override
{
clear_child_help(m_xWindow);
@@ -622,6 +633,11 @@ public:
{
m_xDialog->set_default_response(nResponse);
}
virtual Container* weld_content_area() override
{
return new SalInstanceContainer(m_xDialog->get_content_area(), false);
}
};
class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 8e068cb..b697e9e 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1043,7 +1043,7 @@ bool Printer::SetJobSetup( const JobSetup& rSetup )
return false;
}
bool Printer::Setup( vcl::Window* pWindow, PrinterSetupMode eMode )
bool Printer::Setup(weld::Window* pWindow, PrinterSetupMode eMode)
{
if ( IsDisplayPrinter() )
return false;
@@ -1056,18 +1056,19 @@ bool Printer::Setup( vcl::Window* pWindow, PrinterSetupMode eMode )
rData.SetPrinterSetupMode( eMode );
// TODO: orig page size
SalFrame* pFrame;
if ( !pWindow )
pWindow = ImplGetDefaultWindow();
if (!pWindow)
{
vcl::Window* pDefWin = ImplGetDefaultWindow();
pWindow = pDefWin ? pDefWin->GetFrameWeld() : nullptr;
}
if( !pWindow )
return false;
pFrame = pWindow->ImplGetFrame();
ReleaseGraphics();
ImplSVData* pSVData = ImplGetSVData();
pSVData->maAppData.mnModalMode++;
nImplSysDialog++;
bool bSetup = mpInfoPrinter->Setup( pFrame, &rData );
bool bSetup = mpInfoPrinter->Setup(pWindow, &rData);
pSVData->maAppData.mnModalMode--;
nImplSysDialog--;
if ( bSetup )
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 48647b8d..544e07c 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -796,7 +796,7 @@ void PrinterController::resetPrinterOptions( bool i_bFileOutput )
mpImplData->mxPrinter->SetPrinterOptions( aOpt );
}
void PrinterController::setupPrinter( vcl::Window* i_pParent )
void PrinterController::setupPrinter( weld::Window* i_pParent )
{
bool bRet = false;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 6ca8876..a7ef48c 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1720,7 +1720,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton, void )
{
if( pButton == maJobPage.mpSetupButton )
{
maPController->setupPrinter( this );
maPController->setupPrinter(GetFrameWeld());
// tdf#63905 don't use cache: page size may change
preparePreview();
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index b2d46d9..dc1d4eb 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -524,7 +524,7 @@ void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics )
}
}
bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup )
bool PspSalInfoPrinter::Setup( weld::Window* pFrame, ImplJobSetup* pJobSetup )
{
if( ! pFrame || ! pJobSetup )
return false;
@@ -540,7 +540,7 @@ bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup )
aInfo.m_bPapersizeFromSetup = pJobSetup->GetPapersizeFromSetup();
aInfo.meSetupMode = pJobSetup->GetPrinterSetupMode();
if (SetupPrinterDriver(pFrame->GetFrameWeld(), aInfo))
if (SetupPrinterDriver(pFrame, aInfo))
{
aInfo.resolveDefaultBackend();
rtl_freeMemory( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) );
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 20f9415..74a4c34 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1226,6 +1226,11 @@ public:
return gtk_widget_get_visible(m_pWidget);
}
virtual bool is_visible() const override
{
return gtk_widget_is_visible(m_pWidget);
}
virtual void grab_focus() override
{
gtk_widget_grab_focus(m_pWidget);
@@ -1805,6 +1810,12 @@ public:
return ret;
}
virtual SystemEnvData get_system_data() const override
{
assert(false && "nothing should call this impl, yet anyway, if ever");
return SystemEnvData();
}
virtual ~GtkInstanceWindow() override
{
if (m_xWindow.is())
@@ -2025,6 +2036,11 @@ public:
virtual weld::Button* get_widget_for_response(int nResponse) override;
virtual Container* weld_content_area() override
{
return new GtkInstanceContainer(GTK_CONTAINER(gtk_dialog_get_content_area(m_pDialog)), false);
}
virtual ~GtkInstanceDialog() override
{
g_signal_handler_disconnect(m_pDialog, m_nCloseSignalId);
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 37b72eb..a682f9d 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -348,7 +348,7 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter const * pPrinter,
}
static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSetup* pSetupData,
bool bIn, WinSalFrame* pVisibleDlgParent )
bool bIn, weld::Window* pVisibleDlgParent )
{
HANDLE hPrn;
LPWSTR pPrinterNameW = const_cast<LPWSTR>(o3tl::toW(pPrinter->maDeviceName.getStr()));
@@ -392,7 +392,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe
// check if the dialog should be shown
if ( pVisibleDlgParent )
{
hWnd = pVisibleDlgParent->mhWnd;
hWnd = pVisibleDlgParent->get_system_data().hWnd;
nMode |= DM_IN_PROMPT;
}
@@ -1164,9 +1164,9 @@ void WinSalInfoPrinter::ReleaseGraphics( SalGraphics* )
mbGraphics = FALSE;
}
bool WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
bool WinSalInfoPrinter::Setup(weld::Window* pFrame, ImplJobSetup* pSetupData)
{
if ( ImplUpdateSalJobSetup( this, pSetupData, true, static_cast<WinSalFrame*>(pFrame) ) )
if ( ImplUpdateSalJobSetup(this, pSetupData, true, pFrame))
{
ImplDevModeToJobSetup( this, pSetupData, JobSetFlags::ALL );
return ImplUpdateSalPrnIC( this, pSetupData );