diff options
Diffstat (limited to 'sfx2/source/view/viewprn.cxx')
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 61 |
1 files changed, 45 insertions, 16 deletions
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index f62ae4c1ddc7..d1cfd8c2d181 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -143,18 +143,26 @@ SfxPrinterController::SfxPrinterController( const Any& i_rComplete, aRenderOptions[1].Value = i_rViewProp; aRenderOptions[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ); aRenderOptions[2].Value <<= sal_True; - Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); - int nProps = aRenderParms.getLength(); - for( int i = 0; i < nProps; i++ ) + try { - if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); + int nProps = aRenderParms.getLength(); + for( int i = 0; i < nProps; i++ ) { - Sequence< beans::PropertyValue > aUIProps; - aRenderParms[i].Value >>= aUIProps; - setUIOptions( aUIProps ); - break; + if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + { + Sequence< beans::PropertyValue > aUIProps; + aRenderParms[i].Value >>= aUIProps; + setUIOptions( aUIProps ); + break; + } } } + catch( lang::IllegalArgumentException& ) + { + // the first renderer should always be available for the UI options, + // but catch the exception to be safe + } } // set some job parameters @@ -234,7 +242,13 @@ Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_ if( mxRenderable.is() && pPrinter ) { Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); - aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + try + { + aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + } + catch( lang::IllegalArgumentException& ) + { + } } return aResult; } @@ -332,7 +346,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt mpObjectShell->EnableSetModified( m_bOrigStatus ); if ( mpViewShell ) - mpViewShell->pImp->pPrinterController = 0; + { + mpViewShell->pImp->m_pPrinterController.reset(); + } } } @@ -643,7 +659,7 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro this, rProps ) ); - pImp->pPrinterController = pController.get(); + pImp->m_pPrinterController = pController; SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), @@ -661,7 +677,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro Printer* SfxViewShell::GetActivePrinter() const { - return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0; + return (pImp->m_pPrinterController) + ? pImp->m_pPrinterController->getPrinter().get() : 0; } void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) @@ -697,6 +714,14 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) case SID_PRINTDOCDIRECT: { SfxObjectShell* pDoc = GetObjectShell(); + + // derived class may decide to abort this + if( !pDoc->QuerySlotExecutable( nId ) ) + { + rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) ); + return; + } + bool bDetectHidden = ( !bSilent && pDoc ); if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES ) break; @@ -825,7 +850,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) // execute PrinterSetupDialog PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() ); - if ( pImp->bHasPrintOptions ) + if (pImp->m_bHasPrintOptions) { // additional controls for dialog pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg ); @@ -974,7 +999,7 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/, BOOL SfxViewShell::IsPrinterLocked() const { - return pImp->nPrinterLocks > 0; + return pImp->m_nPrinterLocks > 0; } //-------------------------------------------------------------------- @@ -983,9 +1008,13 @@ void SfxViewShell::LockPrinter( BOOL bLock) { BOOL bChanged = FALSE; if ( bLock ) - bChanged = 1 == ++pImp->nPrinterLocks; + { + bChanged = 1 == ++pImp->m_nPrinterLocks; + } else - bChanged = 0 == --pImp->nPrinterLocks; + { + bChanged = 0 == --pImp->m_nPrinterLocks; + } if ( bChanged ) { |