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

weld SfxPrintOptionsDialog

and SwMMResultPrintDialog

Change-Id: Icded6a26a3a151293bea0c9173334cf634283e89
Reviewed-on: https://gerrit.libreoffice.org/53299Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 27e26fc4
......@@ -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();
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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 >
......
......@@ -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
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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>();
}
......
......@@ -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>();
}
......
......@@ -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: */
......@@ -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*/
)
{
......
<?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>
......@@ -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;
......
......@@ -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()
......
<?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>