diff options
author | Philipp Lohmann <pl@openoffice.org> | 2009-06-26 13:31:24 +0000 |
---|---|---|
committer | Philipp Lohmann <pl@openoffice.org> | 2009-06-26 13:31:24 +0000 |
commit | 61e5696463d074e6bba86a12300f9623a32f71e7 (patch) | |
tree | 0a30c483f60ae7b41aa768306af3f2cb0661cf0d /vcl/source/gdi/print3.cxx | |
parent | 497f21a8d0142c70d1c188a77055c509fd7cb690 (diff) |
#i92516# add: Pages, Wait
Diffstat (limited to 'vcl/source/gdi/print3.cxx')
-rw-r--r-- | vcl/source/gdi/print3.cxx | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 7e5c68c700bb..1d6a614f847d 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -264,8 +264,18 @@ void Printer::PrintJob( const boost::shared_ptr<PrinterListener>& i_pListener, const JobSetup& i_rInitSetup ) { - PrintJobAsync* pAsync = new PrintJobAsync( i_pListener, i_rInitSetup ); - Application::PostUserEvent( LINK( pAsync, PrintJobAsync, ExecJob ) ); + sal_Bool bSynchronous = sal_False; + beans::PropertyValue* pVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); + if( pVal ) + pVal->Value >>= bSynchronous; + + if( bSynchronous ) + ImplPrintJob( i_pListener, i_rInitSetup ); + else + { + PrintJobAsync* pAsync = new PrintJobAsync( i_pListener, i_rInitSetup ); + Application::PostUserEvent( LINK( pAsync, PrintJobAsync, ExecJob ) ); + } } void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListener, @@ -284,6 +294,27 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListene // reset last page property i_pListener->setLastPage( sal_False ); + beans::PropertyValue* pPagesVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ); + if( pPagesVal ) + { + rtl::OUString aPagesVal; + pPagesVal->Value >>= aPagesVal; + if( aPagesVal.getLength() ) + { + // "Pages" attribute from API is now equivalent to "PageRange" + // AND "PrintContent" = 1 except calc where it is "PrintRange" = 1 + // Argh ! That sure needs cleaning up + beans::PropertyValue* pVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); + if( ! pVal ) + pVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); + if( pVal ) + { + pVal->Value = makeAny( sal_Int32( 1 ) ); + i_pListener->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), pPagesVal->Value ); + } + } + } + // check if the printer brings up its own dialog // in that case leave the work to that dialog const String& rQuick( i_rInitSetup.GetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) ) ); |