diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-07-01 22:07:36 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-07-01 22:07:36 +0000 |
commit | b6035a68916d94cc8123162741200639ed82d362 (patch) | |
tree | 29f577add3e9dbde4eb23b27417bc49e2b450ff2 /vcl/aqua | |
parent | 3eb8199d98f2e9c694021dcec09d321525445e2f (diff) |
INTEGRATION: CWS aquavcl08 (1.15.40); FILE MERGED
2008/05/15 17:30:39 pl 1.15.40.2: #i89520# do not dispatch additional cocoa events during printing
2008/05/15 13:26:30 pl 1.15.40.1: #i87249# support multiple page format print jobs on Mac/Aqua
Diffstat (limited to 'vcl/aqua')
-rw-r--r-- | vcl/aqua/source/gdi/salprn.cxx | 84 |
1 files changed, 55 insertions, 29 deletions
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index ba75ef2ceb0d..0bbc190de546 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salprn.cxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.16 $ * * This file is part of OpenOffice.org. * @@ -47,6 +47,7 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/beans/PropertyValue.hpp" + using namespace rtl; using namespace vcl; using namespace com::sun::star::uno; @@ -188,7 +189,7 @@ static struct PaperSizeEntry { 792, 1224, PAPER_TABLOID } }; -static bool getPaperSize( double o_fWidth, double o_fHeight, const Paper i_ePaper ) +static bool getPaperSize( double& o_fWidth, double& o_fHeight, const Paper i_ePaper ) { for(unsigned int i = 0; i < sizeof(aPaperSizes)/sizeof(aPaperSizes[0]); i++ ) { @@ -456,40 +457,65 @@ BOOL AquaSalInfoPrinter::StartJob( const String* pFileName, return FALSE; BOOL bSuccess = FALSE; - mnStartPageOffsetX = mnStartPageOffsetY = 0; - - // create view - NSView* pPrintView = [[AquaPrintView alloc] initWithQPrinter: pQPrinter withInfoPrinter: this]; + std::vector<ULONG> aPaperRanges; + if( ! pQPrinter->GetPaperRanges( aPaperRanges, true ) ) + return FALSE; - NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; + size_t nRanges = aPaperRanges.size(); + AquaSalInstance* pInst = GetSalData()->mpFirstInstance; - // set filename - if( pFileName ) + for( ULONG nCurRange = 0; nCurRange < nRanges-1; nCurRange++ ) { - [mpPrintInfo setJobDisposition: NSPrintSaveJob]; - NSString* pPath = CreateNSString( *pFileName ); - [pPrintDict setObject: pPath forKey: NSPrintSavePath]; - [pPath release]; - } + mnStartPageOffsetX = mnStartPageOffsetY = 0; - [pPrintDict setObject: [[NSNumber numberWithInt: (int)pQPrinter->GetCopyCount()] autorelease] forKey: NSPrintCopies]; - [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; - [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; - [pPrintDict setObject: [[NSNumber numberWithInt: (int)pQPrinter->GetPrintPageCount()] autorelease] forKey: NSPrintLastPage]; + // update job data + ImplJobSetup* pSetup = pQPrinter->GetPageSetup( aPaperRanges[ nCurRange ] ); + if( pSetup ) + SetData( ~0, pSetup ); + DBG_ASSERT( pSetup, "no job setup for range" ); + mnCurPageRangeStart = aPaperRanges[nCurRange]; + mnCurPageRangeCount = aPaperRanges[nCurRange+1] - aPaperRanges[nCurRange]; + // create view + NSView* pPrintView = [[AquaPrintView alloc] initWithQPrinter: pQPrinter withInfoPrinter: this]; - // create print operation - NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo]; + NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; - if( pPrintOperation ) - { - bool bShowPanel = (! bIsQuickJob && getUseNativeDialog()); - [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; - // [pPrintOperation setShowsProgressPanel: NO]; - bSuccess = TRUE; - mbJob = true; - [pPrintOperation runOperation]; - mbJob = false; + // set filename + if( pFileName ) + { + [mpPrintInfo setJobDisposition: NSPrintSaveJob]; + NSString* pPath = CreateNSString( *pFileName ); + [pPrintDict setObject: pPath forKey: NSPrintSavePath]; + [pPath release]; + + // in this case we can only deliver the print job in one file + mnCurPageRangeStart = 0; + mnCurPageRangeCount = aPaperRanges.back(); + nCurRange = nRanges; + } + + [pPrintDict setObject: [[NSNumber numberWithInt: (int)pQPrinter->GetCopyCount()] autorelease] forKey: NSPrintCopies]; + [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; + [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; + [pPrintDict setObject: [[NSNumber numberWithInt: (int)mnCurPageRangeCount] autorelease] forKey: NSPrintLastPage]; + + + // create print operation + NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo]; + + if( pPrintOperation ) + { + bool bShowPanel = (! bIsQuickJob && getUseNativeDialog() ); + [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; + // [pPrintOperation setShowsProgressPanel: NO]; + bSuccess = TRUE; + mbJob = true; + pInst->startedPrintJob(); + [pPrintOperation runOperation]; + pInst->endedPrintJob(); + mbJob = false; + } } return bSuccess; |