diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:56:43 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-05 15:56:43 +0000 |
commit | 046bc84c6c9cbe36f807d6dac1811b701e5bd44a (patch) | |
tree | df95709d29d48062f61cf7e3fc75a3c120c5ce95 /sfx2/source | |
parent | 89d9f339af92001550ed9ea3f76a383d15df7a22 (diff) |
INTEGRATION: CWS nativeprintdlg01_DEV300 (1.30.68); FILE MERGED
2008/02/22 13:00:38 pl 1.30.68.5: #i86352# add options button in PrinterSetupDialog
2008/01/13 21:28:14 ericb 1.30.68.4: RESYNC: (1.32-1.33); FILE MERGED
2007/12/12 21:07:41 ericb 1.30.68.3: RESYNC: (1.30-1.31); FILE MERGED
2007/12/12 20:29:50 ericb 1.30.68.2: solve conflict with kprinter
2007/11/23 21:47:56 ericb 1.30.68.1: #i77579# add kprinter changes
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 56f63e1a4e84..d6cfdac2ed3e 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -4,9 +4,9 @@ * * $RCSfile: viewprn.cxx,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: obo $ $Date: 2008-02-26 15:12:49 $ + * last change: $Author: kz $ $Date: 2008-03-05 16:56:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -130,7 +130,8 @@ class SfxDialogExecutor_Impl { private: SfxViewShell* _pViewSh; - PrintDialog* _pParent; + PrintDialog* _pPrintParent; + PrinterSetupDialog* _pSetupParent; SfxItemSet* _pOptions; sal_Bool _bModified; sal_Bool _bHelpDisabled; @@ -139,6 +140,7 @@ private: public: SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrintDialog* pParent ); + SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent ); ~SfxDialogExecutor_Impl() { delete _pOptions; } Link GetLink() const { return LINK( this, SfxDialogExecutor_Impl, Execute); } @@ -151,7 +153,20 @@ public: SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrintDialog* pParent ) : _pViewSh ( pViewSh ), - _pParent ( pParent ), + _pPrintParent ( pParent ), + _pSetupParent ( NULL ), + _pOptions ( NULL ), + _bModified ( sal_False ), + _bHelpDisabled ( sal_False ) + +{ +} + +SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent ) : + + _pViewSh ( pViewSh ), + _pPrintParent ( NULL ), + _pSetupParent ( pParent ), _pOptions ( NULL ), _bModified ( sal_False ), _bHelpDisabled ( sal_False ) @@ -165,21 +180,29 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG ) { // Options lokal merken if ( !_pOptions ) - _pOptions = ( (SfxPrinter*)_pParent->GetPrinter() )->GetOptions().Clone(); + { + DBG_ASSERT( _pPrintParent || _pSetupParent, "no dialog parent" ); + if( _pPrintParent ) + _pOptions = ( (SfxPrinter*)_pPrintParent->GetPrinter() )->GetOptions().Clone(); + else if( _pSetupParent ) + _pOptions = ( (SfxPrinter*)_pSetupParent->GetPrinter() )->GetOptions().Clone(); + } - if ( _pOptions && _pParent && _pParent->IsSheetRangeAvailable() ) + if ( _pOptions && _pPrintParent && _pPrintParent->IsSheetRangeAvailable() ) { SfxItemState eState = _pOptions->GetItemState( SID_PRINT_SELECTEDSHEET ); if ( eState != SFX_ITEM_UNKNOWN ) { - PrintSheetRange eRange = _pParent->GetCheckedSheetRange(); + PrintSheetRange eRange = _pPrintParent->GetCheckedSheetRange(); BOOL bValue = ( PRINTSHEETS_ALL != eRange ); _pOptions->Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, bValue ) ); } } // Dialog ausf"uhren - SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( _pParent, _pViewSh, _pOptions ); + SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( _pPrintParent ? static_cast<Window*>(_pPrintParent) + : static_cast<Window*>(_pSetupParent), + _pViewSh, _pOptions ); if ( _bHelpDisabled ) pDlg->DisableHelp(); if ( pDlg->Execute() == RET_OK ) @@ -187,12 +210,12 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG ) delete _pOptions; _pOptions = pDlg->GetOptions().Clone(); - if ( _pOptions && _pParent && _pParent->IsSheetRangeAvailable() ) + if ( _pOptions && _pPrintParent && _pPrintParent->IsSheetRangeAvailable() ) { const SfxPoolItem* pItem; if ( SFX_ITEM_SET == _pOptions->GetItemState( SID_PRINT_SELECTEDSHEET, FALSE , &pItem ) ) { - _pParent->CheckSheetRange( ( (const SfxBoolItem*)pItem )->GetValue() + _pPrintParent->CheckSheetRange( ( (const SfxBoolItem*)pItem )->GetValue() ? PRINTSHEETS_SELECTED_SHEETS : PRINTSHEETS_ALL ); } } @@ -527,8 +550,31 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // execute PrinterSetupDialog PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() ); + + if ( pImp->bHasPrintOptions ) + { + // additional controls for dialog + pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg ); + if ( bPrintOnHelp ) + pExecutor->DisableHelp(); + pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() ); + } + pPrintSetupDlg->SetPrinter( pDlgPrinter ); nDialogRet = pPrintSetupDlg->Execute(); + + if ( pExecutor && pExecutor->GetOptions() ) + { + if ( nDialogRet == RET_OK ) + // remark: have to be recorded if possible! + pDlgPrinter->SetOptions( *pExecutor->GetOptions() ); + else + { + pPrinter->SetOptions( *pExecutor->GetOptions() ); + SetPrinter( pPrinter, SFX_PRINTER_OPTIONS ); + } + } + DELETEZ( pPrintSetupDlg ); // no recording of PrinterSetup except printer name (is printer dependent) |