| print.cxx (86e1cf34) | print.cxx (d9b868a3) |
|---|---|
| 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 81 unchanged lines hidden (view full) --- 90{ 91 const ImplJobSetup* pConstData = rJobSetup.ImplGetConstData(); 92 93 if ( !pConstData->mnPaperWidth || !pConstData->mnPaperHeight ) 94 { 95 if ( pConstData->mePaperFormat != PAPER_USER ) 96 { 97 ImplJobSetup* pData = rJobSetup.ImplGetData(); | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 81 unchanged lines hidden (view full) --- 90{ 91 const ImplJobSetup* pConstData = rJobSetup.ImplGetConstData(); 92 93 if ( !pConstData->mnPaperWidth || !pConstData->mnPaperHeight ) 94 { 95 if ( pConstData->mePaperFormat != PAPER_USER ) 96 { 97 ImplJobSetup* pData = rJobSetup.ImplGetData(); |
| 98 PaperInfo aInfo(pConstData->mePaperFormat); | 98 PaperInfo aInfo(pConstData->mePaperFormat); |
| 99 pData->mnPaperWidth = aInfo.getWidth(); 100 pData->mnPaperHeight = aInfo.getHeight(); 101 } 102 } 103 else if ( pConstData->mePaperFormat == PAPER_USER ) 104 { 105 Paper ePaper = ImplGetPaperFormat( pConstData->mnPaperWidth, pConstData->mnPaperHeight ); 106 if ( ePaper != PAPER_USER ) --- 20 unchanged lines hidden (view full) --- 127} 128 129// ----------------------------------------------------------------------- 130 131PrinterOptions::~PrinterOptions() 132{ 133} 134 | 99 pData->mnPaperWidth = aInfo.getWidth(); 100 pData->mnPaperHeight = aInfo.getHeight(); 101 } 102 } 103 else if ( pConstData->mePaperFormat == PAPER_USER ) 104 { 105 Paper ePaper = ImplGetPaperFormat( pConstData->mnPaperWidth, pConstData->mnPaperHeight ); 106 if ( ePaper != PAPER_USER ) --- 20 unchanged lines hidden (view full) --- 127} 128 129// ----------------------------------------------------------------------- 130 131PrinterOptions::~PrinterOptions() 132{ 133} 134 |
| 135#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceTransparency")) 136#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedTransparencyMode")) 137#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceGradients")) 138#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientMode")) 139#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientStepCount")) 140#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceBitmaps")) 141#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapMode")) 142#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapResolution")) 143#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency")) 144#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales")) | 135#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceTransparency")) 136#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedTransparencyMode")) 137#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceGradients")) 138#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientMode")) 139#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientStepCount")) 140#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceBitmaps")) 141#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapMode")) 142#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapResolution")) 143#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency")) 144#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales")) |
| 145 146bool PrinterOptions::ReadFromConfig( bool i_bFile ) 147{ 148 bool bSuccess = false; 149 // save old state in case something goes wrong 150 PrinterOptions aOldValues( *this ); | 145 146bool PrinterOptions::ReadFromConfig( bool i_bFile ) 147{ 148 bool bSuccess = false; 149 // save old state in case something goes wrong 150 PrinterOptions aOldValues( *this ); |
| 151 | 151 |
| 152 // get the configuration service 153 Reference< XMultiServiceFactory > xConfigProvider; 154 Reference< XNameAccess > xConfigAccess; 155 try 156 { 157 // get service provider 158 Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); 159 // create configuration hierarchical access name --- 41 unchanged lines hidden (view full) --- 201 if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nValue ) 202 SetReducedBitmapMode( (PrinterBitmapMode)nValue ); 203 if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nValue ) 204 SetReducedBitmapResolution( (sal_uInt16)nValue ); 205 if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bValue ) 206 SetReducedBitmapIncludesTransparency( bValue ); 207 if( xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bValue ) 208 SetConvertToGreyscales( bValue ); | 152 // get the configuration service 153 Reference< XMultiServiceFactory > xConfigProvider; 154 Reference< XNameAccess > xConfigAccess; 155 try 156 { 157 // get service provider 158 Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); 159 // create configuration hierarchical access name --- 41 unchanged lines hidden (view full) --- 201 if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nValue ) 202 SetReducedBitmapMode( (PrinterBitmapMode)nValue ); 203 if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nValue ) 204 SetReducedBitmapResolution( (sal_uInt16)nValue ); 205 if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bValue ) 206 SetReducedBitmapIncludesTransparency( bValue ); 207 if( xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bValue ) 208 SetConvertToGreyscales( bValue ); |
| 209 | 209 |
| 210 bSuccess = true; 211 } 212 } 213 } 214 } 215 catch( Exception& ) 216 { 217 } 218 } 219 } 220 catch( WrappedTargetException& ) 221 { 222 } | 210 bSuccess = true; 211 } 212 } 213 } 214 } 215 catch( Exception& ) 216 { 217 } 218 } 219 } 220 catch( WrappedTargetException& ) 221 { 222 } |
| 223 | 223 |
| 224 if( ! bSuccess ) 225 *this = aOldValues; 226 return bSuccess; 227} 228 229void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions ) 230{ 231 *mpPrinterOptions = i_rOptions; --- 27 unchanged lines hidden (view full) --- 259{ 260} 261 262// ----------------------------------------------------------------------- 263 264bool QueueInfo::operator==( const QueueInfo& rInfo ) const 265{ 266 return | 224 if( ! bSuccess ) 225 *this = aOldValues; 226 return bSuccess; 227} 228 229void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions ) 230{ 231 *mpPrinterOptions = i_rOptions; --- 27 unchanged lines hidden (view full) --- 259{ 260} 261 262// ----------------------------------------------------------------------- 263 264bool QueueInfo::operator==( const QueueInfo& rInfo ) const 265{ 266 return |
| 267 maPrinterName == rInfo.maPrinterName && | 267 maPrinterName == rInfo.maPrinterName && |
| 268 maDriver == rInfo.maDriver && 269 maLocation == rInfo.maLocation && 270 maComment == rInfo.maComment && 271 mnStatus == rInfo.mnStatus && 272 mnJobs == rInfo.mnJobs; 273} 274 275// ----------------------------------------------------------------------- --- 119 unchanged lines hidden (view full) --- 395} 396 397// ----------------------------------------------------------------------- 398 399const std::vector<rtl::OUString>& Printer::GetPrinterQueues() 400{ 401 ImplSVData* pSVData = ImplGetSVData(); 402 if ( !pSVData->maGDIData.mpPrinterQueueList ) | 268 maDriver == rInfo.maDriver && 269 maLocation == rInfo.maLocation && 270 maComment == rInfo.maComment && 271 mnStatus == rInfo.mnStatus && 272 mnJobs == rInfo.mnJobs; 273} 274 275// ----------------------------------------------------------------------- --- 119 unchanged lines hidden (view full) --- 395} 396 397// ----------------------------------------------------------------------- 398 399const std::vector<rtl::OUString>& Printer::GetPrinterQueues() 400{ 401 ImplSVData* pSVData = ImplGetSVData(); 402 if ( !pSVData->maGDIData.mpPrinterQueueList ) |
| 403 ImplInitPrnQueueList(); 404 return pSVData->maGDIData.mpPrinterQueueList->m_aPrinterList; | 403 ImplInitPrnQueueList(); 404 return pSVData->maGDIData.mpPrinterQueueList->m_aPrinterList; |
| 405} 406 407// ----------------------------------------------------------------------- 408const QueueInfo* Printer::GetQueueInfo( const String& rPrinterName, bool bStatusUpdate ) 409{ 410 ImplSVData* pSVData = ImplGetSVData(); 411 412 if ( !pSVData->maGDIData.mpPrinterQueueList ) 413 ImplInitPrnQueueList(); 414 415 ImplPrnQueueData* pInfo = pSVData->maGDIData.mpPrinterQueueList->Get( rPrinterName ); 416 if( pInfo ) 417 { 418 if( !pInfo->mpQueueInfo || bStatusUpdate ) 419 pSVData->mpDefInst->GetPrinterQueueState( pInfo->mpSalQueueInfo ); | 405} 406 407// ----------------------------------------------------------------------- 408const QueueInfo* Printer::GetQueueInfo( const String& rPrinterName, bool bStatusUpdate ) 409{ 410 ImplSVData* pSVData = ImplGetSVData(); 411 412 if ( !pSVData->maGDIData.mpPrinterQueueList ) 413 ImplInitPrnQueueList(); 414 415 ImplPrnQueueData* pInfo = pSVData->maGDIData.mpPrinterQueueList->Get( rPrinterName ); 416 if( pInfo ) 417 { 418 if( !pInfo->mpQueueInfo || bStatusUpdate ) 419 pSVData->mpDefInst->GetPrinterQueueState( pInfo->mpSalQueueInfo ); |
| 420 | 420 |
| 421 if ( !pInfo->mpQueueInfo ) 422 pInfo->mpQueueInfo = new QueueInfo; | 421 if ( !pInfo->mpQueueInfo ) 422 pInfo->mpQueueInfo = new QueueInfo; |
| 423 | 423 |
| 424 pInfo->mpQueueInfo->maPrinterName = pInfo->mpSalQueueInfo->maPrinterName; 425 pInfo->mpQueueInfo->maDriver = pInfo->mpSalQueueInfo->maDriver; 426 pInfo->mpQueueInfo->maLocation = pInfo->mpSalQueueInfo->maLocation; 427 pInfo->mpQueueInfo->maComment = pInfo->mpSalQueueInfo->maComment; 428 pInfo->mpQueueInfo->mnStatus = pInfo->mpSalQueueInfo->mnStatus; | 424 pInfo->mpQueueInfo->maPrinterName = pInfo->mpSalQueueInfo->maPrinterName; 425 pInfo->mpQueueInfo->maDriver = pInfo->mpSalQueueInfo->maDriver; 426 pInfo->mpQueueInfo->maLocation = pInfo->mpSalQueueInfo->maLocation; 427 pInfo->mpQueueInfo->maComment = pInfo->mpSalQueueInfo->maComment; 428 pInfo->mpQueueInfo->mnStatus = pInfo->mpSalQueueInfo->mnStatus; |
| 429 pInfo->mpQueueInfo->mnJobs = pInfo->mpSalQueueInfo->mnJobs; | 429 pInfo->mpQueueInfo->mnJobs = pInfo->mpSalQueueInfo->mnJobs; |
| 430 return pInfo->mpQueueInfo; 431 } 432 return NULL; 433} 434 435// ----------------------------------------------------------------------- 436 437XubString Printer::GetDefaultPrinterName() 438{ 439 static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" ); 440 if( !pEnv || !*pEnv ) 441 { 442 ImplSVData* pSVData = ImplGetSVData(); | 430 return pInfo->mpQueueInfo; 431 } 432 return NULL; 433} 434 435// ----------------------------------------------------------------------- 436 437XubString Printer::GetDefaultPrinterName() 438{ 439 static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" ); 440 if( !pEnv || !*pEnv ) 441 { 442 ImplSVData* pSVData = ImplGetSVData(); |
| 443 | 443 |
| 444 return pSVData->mpDefInst->GetDefaultPrinter(); 445 } | 444 return pSVData->mpDefInst->GetDefaultPrinter(); 445 } |
| 446 return XubString(); | 446 return XubString(); |
| 447} 448 449// ======================================================================= 450 451void Printer::ImplInitData() 452{ | 447} 448 449// ======================================================================= 450 451void Printer::ImplInitData() 452{ |
| 453 mbDevOutput = sal_False; | 453 mbDevOutput = sal_False; |
| 454 meOutDevType = OUTDEV_PRINTER; 455 mbDefPrinter = sal_False; | 454 meOutDevType = OUTDEV_PRINTER; 455 mbDefPrinter = sal_False; |
| 456 mnError = 0; 457 mnCurPage = 0; | 456 mnError = 0; 457 mnCurPage = 0; |
| 458 mnCurPrintPage = 0; | 458 mnCurPrintPage = 0; |
| 459 mnPageQueueSize = 0; 460 mnCopyCount = 1; | 459 mnPageQueueSize = 0; 460 mnCopyCount = 1; |
| 461 mbCollateCopy = sal_False; | 461 mbCollateCopy = sal_False; |
| 462 mbPrinting = sal_False; 463 mbJobActive = sal_False; 464 mbPrintFile = sal_False; | 462 mbPrinting = sal_False; 463 mbJobActive = sal_False; 464 mbPrintFile = sal_False; |
| 465 mbInPrintPage = sal_False; 466 mbNewJobSetup = sal_False; 467 mpInfoPrinter = NULL; | 465 mbInPrintPage = sal_False; 466 mbNewJobSetup = sal_False; 467 mpInfoPrinter = NULL; |
| 468 mpPrinter = NULL; | 468 mpPrinter = NULL; |
| 469 mpDisplayDev = NULL; 470 mbIsQueuePrinter = sal_False; | 469 mpDisplayDev = NULL; 470 mbIsQueuePrinter = sal_False; |
| 471 mpPrinterOptions = new PrinterOptions; | 471 mpPrinterOptions = new PrinterOptions; |
| 472 473 // Printer in die Liste eintragen 474 ImplSVData* pSVData = ImplGetSVData(); 475 mpNext = pSVData->maGDIData.mpFirstPrinter; 476 mpPrev = NULL; 477 if ( mpNext ) 478 mpNext->mpPrev = this; 479 else 480 pSVData->maGDIData.mpLastPrinter = this; 481 pSVData->maGDIData.mpFirstPrinter = this; 482} 483 484// ----------------------------------------------------------------------- 485 486void Printer::ImplInit( SalPrinterQueueInfo* pInfo ) 487{ 488 ImplSVData* pSVData = ImplGetSVData(); | 472 473 // Printer in die Liste eintragen 474 ImplSVData* pSVData = ImplGetSVData(); 475 mpNext = pSVData->maGDIData.mpFirstPrinter; 476 mpPrev = NULL; 477 if ( mpNext ) 478 mpNext->mpPrev = this; 479 else 480 pSVData->maGDIData.mpLastPrinter = this; 481 pSVData->maGDIData.mpFirstPrinter = this; 482} 483 484// ----------------------------------------------------------------------- 485 486void Printer::ImplInit( SalPrinterQueueInfo* pInfo ) 487{ 488 ImplSVData* pSVData = ImplGetSVData(); |
| 489 // #i74084# update info for this specific SalPrinterQueueInfo 490 pSVData->mpDefInst->GetPrinterQueueState( pInfo ); | 489 // #i74084# update info for this specific SalPrinterQueueInfo 490 pSVData->mpDefInst->GetPrinterQueueState( pInfo ); |
| 491 | 491 |
| 492 // Testen, ob Treiber ueberhaupt mit dem JobSetup uebereinstimmt | 492 // Testen, ob Treiber überhaupt mit dem JobSetup übereinstimmt |
| 493 ImplJobSetup* pJobSetup = maJobSetup.ImplGetData(); 494 495 if ( pJobSetup->mpDriverData ) 496 { 497 if ( (pJobSetup->maPrinterName != pInfo->maPrinterName) || 498 (pJobSetup->maDriver != pInfo->maDriver) ) 499 { 500 rtl_freeMemory( pJobSetup->mpDriverData ); --- 6 unchanged lines hidden (view full) --- 507 maPrinterName = pInfo->maPrinterName; 508 maDriver = pInfo->maDriver; 509 510 // In JobSetup den Printernamen eintragen 511 pJobSetup->maPrinterName = maPrinterName; 512 pJobSetup->maDriver = maDriver; 513 514 mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, pJobSetup ); | 493 ImplJobSetup* pJobSetup = maJobSetup.ImplGetData(); 494 495 if ( pJobSetup->mpDriverData ) 496 { 497 if ( (pJobSetup->maPrinterName != pInfo->maPrinterName) || 498 (pJobSetup->maDriver != pInfo->maDriver) ) 499 { 500 rtl_freeMemory( pJobSetup->mpDriverData ); --- 6 unchanged lines hidden (view full) --- 507 maPrinterName = pInfo->maPrinterName; 508 maDriver = pInfo->maDriver; 509 510 // In JobSetup den Printernamen eintragen 511 pJobSetup->maPrinterName = maPrinterName; 512 pJobSetup->maDriver = maDriver; 513 514 mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, pJobSetup ); |
| 515 mpPrinter = NULL; | 515 mpPrinter = NULL; |
| 516 mpJobGraphics = NULL; 517 ImplUpdateJobSetupPaper( maJobSetup ); 518 519 if ( !mpInfoPrinter ) 520 { 521 ImplInitDisplay( NULL ); 522 return; 523 } 524 | 516 mpJobGraphics = NULL; 517 ImplUpdateJobSetupPaper( maJobSetup ); 518 519 if ( !mpInfoPrinter ) 520 { 521 ImplInitDisplay( NULL ); 522 return; 523 } 524 |
| 525 // we need a graphics | 525 // we need a graphic |
| 526 if ( !ImplGetGraphics() ) 527 { 528 ImplInitDisplay( NULL ); 529 return; 530 } 531 | 526 if ( !ImplGetGraphics() ) 527 { 528 ImplInitDisplay( NULL ); 529 return; 530 } 531 |
| 532 // Daten initialisieren | 532 // initialize data |
| 533 ImplUpdatePageData(); 534 mpFontList = new ImplDevFontList(); 535 mpFontCache = new ImplFontCache( sal_True ); 536 mpGraphics->GetDevFontList( mpFontList ); 537} 538 539// ----------------------------------------------------------------------- 540 --- 351 unchanged lines hidden (view full) --- 892 mbPrintFile = pPrinter->mbPrintFile; 893 mnCopyCount = pPrinter->mnCopyCount; 894 mbCollateCopy = pPrinter->mbCollateCopy; 895 mnPageQueueSize = pPrinter->mnPageQueueSize; 896 *mpPrinterOptions = *pPrinter->mpPrinterOptions; 897 898 if ( pPrinter->IsDisplayPrinter() ) 899 { | 533 ImplUpdatePageData(); 534 mpFontList = new ImplDevFontList(); 535 mpFontCache = new ImplFontCache( sal_True ); 536 mpGraphics->GetDevFontList( mpFontList ); 537} 538 539// ----------------------------------------------------------------------- 540 --- 351 unchanged lines hidden (view full) --- 892 mbPrintFile = pPrinter->mbPrintFile; 893 mnCopyCount = pPrinter->mnCopyCount; 894 mbCollateCopy = pPrinter->mbCollateCopy; 895 mnPageQueueSize = pPrinter->mnPageQueueSize; 896 *mpPrinterOptions = *pPrinter->mpPrinterOptions; 897 898 if ( pPrinter->IsDisplayPrinter() ) 899 { |
| 900 // Alten Printer zerstoeren | 900 // Alten Printer zerstören |
| 901 if ( !IsDisplayPrinter() ) 902 { 903 ImplReleaseGraphics(); 904 pSVData->mpDefInst->DestroyInfoPrinter( mpInfoPrinter ); 905 if ( mpFontEntry ) 906 { 907 mpFontCache->Release( mpFontEntry ); 908 mpFontEntry = NULL; --- 19 unchanged lines hidden (view full) --- 928 mpInfoPrinter = NULL; 929 } 930 931 // Neuen Printer bauen 932 ImplInitDisplay( NULL ); 933 return sal_True; 934 } 935 | 901 if ( !IsDisplayPrinter() ) 902 { 903 ImplReleaseGraphics(); 904 pSVData->mpDefInst->DestroyInfoPrinter( mpInfoPrinter ); 905 if ( mpFontEntry ) 906 { 907 mpFontCache->Release( mpFontEntry ); 908 mpFontEntry = NULL; --- 19 unchanged lines hidden (view full) --- 928 mpInfoPrinter = NULL; 929 } 930 931 // Neuen Printer bauen 932 ImplInitDisplay( NULL ); 933 return sal_True; 934 } 935 |
| 936 // Alten Printer zerstoeren? | 936 // Alten Printer zerstören? |
| 937 if ( GetName() != pPrinter->GetName() ) 938 { 939 ImplReleaseGraphics(); 940 if ( mpDisplayDev ) 941 { 942 delete mpDisplayDev; 943 mpDisplayDev = NULL; 944 } --- 156 unchanged lines hidden (view full) --- 1101 pSetupData->meOrientation = ORIENTATION_PORTRAIT; 1102 bFound = true; 1103 break; 1104 } 1105 } 1106 1107 // If the printer supports landscape orientation, check paper sizes again 1108 // with landscape orientation. This is necessary as a printer driver provides | 937 if ( GetName() != pPrinter->GetName() ) 938 { 939 ImplReleaseGraphics(); 940 if ( mpDisplayDev ) 941 { 942 delete mpDisplayDev; 943 mpDisplayDev = NULL; 944 } --- 156 unchanged lines hidden (view full) --- 1101 pSetupData->meOrientation = ORIENTATION_PORTRAIT; 1102 bFound = true; 1103 break; 1104 } 1105 } 1106 1107 // If the printer supports landscape orientation, check paper sizes again 1108 // with landscape orientation. This is necessary as a printer driver provides |
| 1109 // all paper sizes with portrait orientation only!! | 1109 // all paper sizes with portrait orientation only! |
| 1110 if ( pSetupData->mePaperFormat == PAPER_USER && 1111 nLandscapeAngle != 0 && 1112 HasSupport( SUPPORT_SET_ORIENTATION )) 1113 { 1114 1115 PaperInfo aRotatedInfo(pSetupData->mnPaperHeight, pSetupData->mnPaperWidth); 1116 1117 for ( int i = 0; i < nPaperCount; i++ ) --- 5 unchanged lines hidden (view full) --- 1123 pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(), 1124 rPaperInfo.getHeight() ); 1125 pSetupData->meOrientation = ORIENTATION_LANDSCAPE; 1126 bFound = true; 1127 break; 1128 } 1129 } 1130 } | 1110 if ( pSetupData->mePaperFormat == PAPER_USER && 1111 nLandscapeAngle != 0 && 1112 HasSupport( SUPPORT_SET_ORIENTATION )) 1113 { 1114 1115 PaperInfo aRotatedInfo(pSetupData->mnPaperHeight, pSetupData->mnPaperWidth); 1116 1117 for ( int i = 0; i < nPaperCount; i++ ) --- 5 unchanged lines hidden (view full) --- 1123 pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(), 1124 rPaperInfo.getHeight() ); 1125 pSetupData->meOrientation = ORIENTATION_LANDSCAPE; 1126 bFound = true; 1127 break; 1128 } 1129 } 1130 } |
| 1131 | 1131 |
| 1132 if( ! bFound && bMatchNearest ) 1133 { 1134 sal_Int64 nBestMatch = SAL_MAX_INT64; 1135 int nBestIndex = 0; 1136 Orientation eBestOrientation = ORIENTATION_PORTRAIT; 1137 for( int i = 0; i < nPaperCount; i++ ) 1138 { 1139 const PaperInfo& rPaperInfo = GetPaperInfo( i ); | 1132 if( ! bFound && bMatchNearest ) 1133 { 1134 sal_Int64 nBestMatch = SAL_MAX_INT64; 1135 int nBestIndex = 0; 1136 Orientation eBestOrientation = ORIENTATION_PORTRAIT; 1137 for( int i = 0; i < nPaperCount; i++ ) 1138 { 1139 const PaperInfo& rPaperInfo = GetPaperInfo( i ); |
| 1140 1141 // check protrait match | 1140 1141 // check portrait match |
| 1142 sal_Int64 nDX = pSetupData->mnPaperWidth - rPaperInfo.getWidth(); 1143 sal_Int64 nDY = pSetupData->mnPaperHeight - rPaperInfo.getHeight(); | 1142 sal_Int64 nDX = pSetupData->mnPaperWidth - rPaperInfo.getWidth(); 1143 sal_Int64 nDY = pSetupData->mnPaperHeight - rPaperInfo.getHeight(); |
| 1144 sal_Int64 nMatch = nDX*nDX + nDY*nDY; | 1144 sal_Int64 nMatch = nDX*nDX + nDY*nDY; |
| 1145 if( nMatch < nBestMatch ) 1146 { 1147 nBestMatch = nMatch; 1148 nBestIndex = i; 1149 eBestOrientation = ORIENTATION_PORTRAIT; 1150 } 1151 1152 // check landscape match --- 156 unchanged lines hidden (view full) --- 1309 PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_KAI16, 1310 PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, PAPER_B6_JIS 1311 }; 1312 OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) == aPaperStrings.Count(), "localized paper name count wrong" ); 1313 for( int i = 0; i < int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); i++ ) 1314 (*pSVData->mpPaperNames)[PaperIndex[i]] = aPaperStrings.GetString(i); 1315 } 1316 } | 1145 if( nMatch < nBestMatch ) 1146 { 1147 nBestMatch = nMatch; 1148 nBestIndex = i; 1149 eBestOrientation = ORIENTATION_PORTRAIT; 1150 } 1151 1152 // check landscape match --- 156 unchanged lines hidden (view full) --- 1309 PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_KAI16, 1310 PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, PAPER_B6_JIS 1311 }; 1312 OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) == aPaperStrings.Count(), "localized paper name count wrong" ); 1313 for( int i = 0; i < int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); i++ ) 1314 (*pSVData->mpPaperNames)[PaperIndex[i]] = aPaperStrings.GetString(i); 1315 } 1316 } |
| 1317 | 1317 |
| 1318 std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); 1319 return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); 1320} 1321 1322// ----------------------------------------------------------------------- 1323 1324rtl::OUString Printer::GetPaperName( bool i_bPaperUser ) const 1325{ 1326 Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM ); 1327 Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() ); 1328 if( ePaper == PAPER_USER ) 1329 ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() ); 1330 return (ePaper != PAPER_USER || i_bPaperUser ) ? GetPaperName( ePaper ) : rtl::OUString(); 1331} 1332 1333// ----------------------------------------------------------------------- 1334 1335const PaperInfo& Printer::GetPaperInfo( int nPaper ) const 1336{ | 1318 std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper ); 1319 return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString(); 1320} 1321 1322// ----------------------------------------------------------------------- 1323 1324rtl::OUString Printer::GetPaperName( bool i_bPaperUser ) const 1325{ 1326 Size aPageSize = PixelToLogic( GetPaperSizePixel(), MAP_100TH_MM ); 1327 Paper ePaper = ImplGetPaperFormat( aPageSize.Width(), aPageSize.Height() ); 1328 if( ePaper == PAPER_USER ) 1329 ePaper = ImplGetPaperFormat( aPageSize.Height(), aPageSize.Width() ); 1330 return (ePaper != PAPER_USER || i_bPaperUser ) ? GetPaperName( ePaper ) : rtl::OUString(); 1331} 1332 1333// ----------------------------------------------------------------------- 1334 1335const PaperInfo& Printer::GetPaperInfo( int nPaper ) const 1336{ |
| 1337 if( ! mpInfoPrinter ) 1338 return ImplGetEmptyPaper(); 1339 if( ! mpInfoPrinter->m_bPapersInit ) 1340 mpInfoPrinter->InitPaperFormats( maJobSetup.ImplGetConstData() ); 1341 if( mpInfoPrinter->m_aPaperFormats.empty() || nPaper < 0 || nPaper >= int(mpInfoPrinter->m_aPaperFormats.size()) ) 1342 return ImplGetEmptyPaper(); 1343 return mpInfoPrinter->m_aPaperFormats[nPaper]; | 1337 if( ! mpInfoPrinter ) 1338 return ImplGetEmptyPaper(); 1339 if( ! mpInfoPrinter->m_bPapersInit ) 1340 mpInfoPrinter->InitPaperFormats( maJobSetup.ImplGetConstData() ); 1341 if( mpInfoPrinter->m_aPaperFormats.empty() || nPaper < 0 || nPaper >= int(mpInfoPrinter->m_aPaperFormats.size()) ) 1342 return ImplGetEmptyPaper(); 1343 return mpInfoPrinter->m_aPaperFormats[nPaper]; |
| 1344} 1345 1346// ----------------------------------------------------------------------- 1347 1348DuplexMode Printer::GetDuplexMode() const 1349{ 1350 return maJobSetup.ImplGetConstData()->meDuplexMode; 1351} --- 34 unchanged lines hidden (view full) --- 1386 1387 return sal_True; 1388} 1389 1390// ----------------------------------------------------------------------- 1391 1392int Printer::GetLandscapeAngle() const 1393{ | 1344} 1345 1346// ----------------------------------------------------------------------- 1347 1348DuplexMode Printer::GetDuplexMode() const 1349{ 1350 return maJobSetup.ImplGetConstData()->meDuplexMode; 1351} --- 34 unchanged lines hidden (view full) --- 1386 1387 return sal_True; 1388} 1389 1390// ----------------------------------------------------------------------- 1391 1392int Printer::GetLandscapeAngle() const 1393{ |
| 1394 return mpInfoPrinter ? mpInfoPrinter->GetLandscapeAngle( maJobSetup.ImplGetConstData() ) : 900; | 1394 return mpInfoPrinter ? mpInfoPrinter->GetLandscapeAngle( maJobSetup.ImplGetConstData() ) : 900; |
| 1395} 1396 1397// ----------------------------------------------------------------------- 1398 1399Paper Printer::GetPaper() const 1400{ 1401 return maJobSetup.ImplGetConstData()->mePaperFormat; 1402} --- 21 unchanged lines hidden (view full) --- 1424 return ImplGetSVEmptyStr(); 1425} 1426 1427// ----------------------------------------------------------------------- 1428 1429sal_Bool Printer::SetCopyCount( sal_uInt16 nCopy, sal_Bool bCollate ) 1430{ 1431 mnCopyCount = nCopy; | 1395} 1396 1397// ----------------------------------------------------------------------- 1398 1399Paper Printer::GetPaper() const 1400{ 1401 return maJobSetup.ImplGetConstData()->mePaperFormat; 1402} --- 21 unchanged lines hidden (view full) --- 1424 return ImplGetSVEmptyStr(); 1425} 1426 1427// ----------------------------------------------------------------------- 1428 1429sal_Bool Printer::SetCopyCount( sal_uInt16 nCopy, sal_Bool bCollate ) 1430{ 1431 mnCopyCount = nCopy; |
| 1432 mbCollateCopy = bCollate; | 1432 mbCollateCopy = bCollate; |
| 1433 return sal_True; 1434} 1435 1436// ----------------------------------------------------------------------- 1437 1438void Printer::Error() 1439{ 1440 maErrorHdl.Call( this ); --- 61 unchanged lines hidden (view full) --- 1502 bRet = sal_True; 1503 1504 mbPrinting = sal_False; 1505 mnCurPrintPage = 0; 1506 maJobName.Erase(); 1507 1508 mbDevOutput = sal_False; 1509 bRet = mpPrinter->EndJob(); | 1433 return sal_True; 1434} 1435 1436// ----------------------------------------------------------------------- 1437 1438void Printer::Error() 1439{ 1440 maErrorHdl.Call( this ); --- 61 unchanged lines hidden (view full) --- 1502 bRet = sal_True; 1503 1504 mbPrinting = sal_False; 1505 mnCurPrintPage = 0; 1506 maJobName.Erase(); 1507 1508 mbDevOutput = sal_False; 1509 bRet = mpPrinter->EndJob(); |
| 1510 // Hier den Drucker nicht asyncron zerstoeren, da es | 1510 // Hier den Drucker nicht asyncron zerstören, da es |
| 1511 // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird | 1511 // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird |
| 1512 // und ein Druckerobjekt zerstoert wird | 1512 // und ein Druckerobjekt zerstört wird |
| 1513 ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter ); 1514 mpPrinter = NULL; 1515 } 1516 1517 return bRet; 1518} 1519 1520// ----------------------------------------------------------------------- 1521 1522sal_Bool Printer::AbortJob() 1523{ 1524 // Wenn wir einen Queue-Printer haben, kann man diesen noch mit 1525 // AbortJob() abbrechen, solange dieser noch am Drucken ist 1526 if ( !IsJobActive() && !IsPrinting() ) 1527 return sal_False; 1528 | 1513 ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter ); 1514 mpPrinter = NULL; 1515 } 1516 1517 return bRet; 1518} 1519 1520// ----------------------------------------------------------------------- 1521 1522sal_Bool Printer::AbortJob() 1523{ 1524 // Wenn wir einen Queue-Printer haben, kann man diesen noch mit 1525 // AbortJob() abbrechen, solange dieser noch am Drucken ist 1526 if ( !IsJobActive() && !IsPrinting() ) 1527 return sal_False; 1528 |
| 1529 mbJobActive = sal_False; | 1529 mbJobActive = sal_False; |
| 1530 mbInPrintPage = sal_False; 1531 mpJobGraphics = NULL; 1532 1533 if ( mpPrinter ) 1534 { 1535 mbPrinting = sal_False; 1536 mnCurPage = 0; | 1530 mbInPrintPage = sal_False; 1531 mpJobGraphics = NULL; 1532 1533 if ( mpPrinter ) 1534 { 1535 mbPrinting = sal_False; 1536 mnCurPage = 0; |
| 1537 mnCurPrintPage = 0; | 1537 mnCurPrintPage = 0; |
| 1538 maJobName.Erase(); 1539 1540 ImplReleaseGraphics(); 1541 mbDevOutput = sal_False; 1542 mpPrinter->AbortJob(); 1543 Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); 1544 mpPrinter = NULL; 1545 --- 56 unchanged lines hidden (view full) --- 1602{ 1603 ImplSVData* pSVData = ImplGetSVData(); 1604 ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList; 1605 1606 if ( pPrnList ) 1607 { 1608 ImplPrnQueueList* pNewList = new ImplPrnQueueList; 1609 pSVData->mpDefInst->GetPrinterQueueInfo( pNewList ); | 1538 maJobName.Erase(); 1539 1540 ImplReleaseGraphics(); 1541 mbDevOutput = sal_False; 1542 mpPrinter->AbortJob(); 1543 Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); 1544 mpPrinter = NULL; 1545 --- 56 unchanged lines hidden (view full) --- 1602{ 1603 ImplSVData* pSVData = ImplGetSVData(); 1604 ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList; 1605 1606 if ( pPrnList ) 1607 { 1608 ImplPrnQueueList* pNewList = new ImplPrnQueueList; 1609 pSVData->mpDefInst->GetPrinterQueueInfo( pNewList ); |
| 1610 | 1610 |
| 1611 bool bChanged = pPrnList->m_aQueueInfos.size() != pNewList->m_aQueueInfos.size(); 1612 for( unsigned int i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ ) 1613 { 1614 ImplPrnQueueData& rInfo = pPrnList->m_aQueueInfos[i]; 1615 ImplPrnQueueData& rNewInfo = pNewList->m_aQueueInfos[i]; 1616 if( ! rInfo.mpSalQueueInfo || ! rNewInfo.mpSalQueueInfo || // sanity check 1617 rInfo.mpSalQueueInfo->maPrinterName != rNewInfo.mpSalQueueInfo->maPrinterName ) 1618 { --- 20 unchanged lines hidden --- | 1611 bool bChanged = pPrnList->m_aQueueInfos.size() != pNewList->m_aQueueInfos.size(); 1612 for( unsigned int i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ ) 1613 { 1614 ImplPrnQueueData& rInfo = pPrnList->m_aQueueInfos[i]; 1615 ImplPrnQueueData& rNewInfo = pNewList->m_aQueueInfos[i]; 1616 if( ! rInfo.mpSalQueueInfo || ! rNewInfo.mpSalQueueInfo || // sanity check 1617 rInfo.mpSalQueueInfo->maPrinterName != rNewInfo.mpSalQueueInfo->maPrinterName ) 1618 { --- 20 unchanged lines hidden --- |