LibreOffice Module vcl (master)  1
print.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/types.h>
21 #include <sal/log.hxx>
22 
23 #include <tools/helpers.hxx>
24 #include <tools/debug.hxx>
25 
26 #include <vcl/event.hxx>
27 #include <vcl/virdev.hxx>
28 #include <vcl/print.hxx>
29 
31 
32 #include <salinst.hxx>
33 #include <salvd.hxx>
34 #include <salgdi.hxx>
35 #include <salptype.hxx>
36 #include <salprn.hxx>
37 #include <svdata.hxx>
38 #include <print.hrc>
39 #include <jobset.h>
40 #include <outdev.h>
42 #include <print.h>
43 
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/configuration/theDefaultProvider.hpp>
46 #include <com/sun/star/container/XNameAccess.hpp>
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/uno/Sequence.h>
49 
51 
52 namespace
53 {
54  Paper ImplGetPaperFormat( long nWidth100thMM, long nHeight100thMM )
55  {
56  PaperInfo aInfo(nWidth100thMM, nHeight100thMM);
57  aInfo.doSloppyFit();
58  return aInfo.getPaper();
59  }
60 
61  const PaperInfo& ImplGetEmptyPaper()
62  {
63  static PaperInfo aInfo(PAPER_USER);
64  return aInfo;
65  }
66 }
67 
69 {
70  const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
71 
72  if ( !rConstData.GetPaperWidth() || !rConstData.GetPaperHeight() )
73  {
74  if ( rConstData.GetPaperFormat() != PAPER_USER )
75  {
76  PaperInfo aInfo(rConstData.GetPaperFormat());
77 
78  ImplJobSetup& rData = rJobSetup.ImplGetData();
79  rData.SetPaperWidth( aInfo.getWidth() );
80  rData.SetPaperHeight( aInfo.getHeight() );
81  }
82  }
83  else if ( rConstData.GetPaperFormat() == PAPER_USER )
84  {
85  Paper ePaper = ImplGetPaperFormat( rConstData.GetPaperWidth(), rConstData.GetPaperHeight() );
86  if ( ePaper != PAPER_USER )
87  rJobSetup.ImplGetData().SetPaperFormat(ePaper);
88  }
89 }
90 
91 // PrinterOptions
93  mbReduceTransparency( false ),
94  meReducedTransparencyMode( PrinterTransparencyMode::Auto ),
95  mbReduceGradients( false ),
96  meReducedGradientsMode( PrinterGradientMode::Stripes ),
97  mnReducedGradientStepCount( 64 ),
98  mbReduceBitmaps( false ),
99  meReducedBitmapMode( PrinterBitmapMode::Normal ),
100  mnReducedBitmapResolution( 200 ),
101  mbReducedBitmapsIncludeTransparency( true ),
102  mbConvertToGreyscales( false ),
103  mbPDFAsStandardPrintJobFormat( false )
104 {
105 }
106 
107 void PrinterOptions::ReadFromConfig( bool i_bFile )
108 {
109  bool bSuccess = false;
110  // save old state in case something goes wrong
111  PrinterOptions aOldValues( *this );
112 
113  // get the configuration service
114  css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider;
115  css::uno::Reference< css::container::XNameAccess > xConfigAccess;
116  try
117  {
118  // get service provider
119  css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
120  // create configuration hierarchical access name
121  try
122  {
123  xConfigProvider = css::configuration::theDefaultProvider::get( xContext );
124 
125  css::uno::Sequence< css::uno::Any > aArgs(1);
126  css::beans::PropertyValue aVal;
127  aVal.Name = "nodepath";
128  if( i_bFile )
129  aVal.Value <<= OUString( "/org.openoffice.Office.Common/Print/Option/File" );
130  else
131  aVal.Value <<= OUString( "/org.openoffice.Office.Common/Print/Option/Printer" );
132  aArgs.getArray()[0] <<= aVal;
133  xConfigAccess.set(
134  xConfigProvider->createInstanceWithArguments(
135  "com.sun.star.configuration.ConfigurationAccess", aArgs ),
136  css::uno::UNO_QUERY );
137  if( xConfigAccess.is() )
138  {
139  css::uno::Reference< css::beans::XPropertySet > xSet( xConfigAccess, css::uno::UNO_QUERY );
140  if( xSet.is() )
141  {
142  sal_Int32 nValue = 0;
143  bool bValue = false;
144  if( xSet->getPropertyValue("ReduceTransparency") >>= bValue )
145  SetReduceTransparency( bValue );
146  if( xSet->getPropertyValue("ReducedTransparencyMode") >>= nValue )
147  SetReducedTransparencyMode( static_cast<PrinterTransparencyMode>(nValue) );
148  if( xSet->getPropertyValue("ReduceGradients") >>= bValue )
149  SetReduceGradients( bValue );
150  if( xSet->getPropertyValue("ReducedGradientMode") >>= nValue )
151  SetReducedGradientMode( static_cast<PrinterGradientMode>(nValue) );
152  if( xSet->getPropertyValue("ReducedGradientStepCount") >>= nValue )
153  SetReducedGradientStepCount( static_cast<sal_uInt16>(nValue) );
154  if( xSet->getPropertyValue("ReduceBitmaps") >>= bValue )
155  SetReduceBitmaps( bValue );
156  if( xSet->getPropertyValue("ReducedBitmapMode") >>= nValue )
157  SetReducedBitmapMode( static_cast<PrinterBitmapMode>(nValue) );
158  if( xSet->getPropertyValue("ReducedBitmapResolution") >>= nValue )
159  SetReducedBitmapResolution( static_cast<sal_uInt16>(nValue) );
160  if( xSet->getPropertyValue("ReducedBitmapIncludesTransparency") >>= bValue )
162  if( xSet->getPropertyValue("ConvertToGreyscales") >>= bValue )
163  SetConvertToGreyscales( bValue );
164  if( xSet->getPropertyValue("PDFAsStandardPrintJobFormat") >>= bValue )
166 
167  bSuccess = true;
168  }
169  }
170  }
171  catch( const css::uno::Exception& )
172  {
173  }
174  }
175  catch( const css::lang::WrappedTargetException& )
176  {
177  }
178 
179  if( ! bSuccess )
180  *this = aOldValues;
181 }
182 
184  const basegfx::B2DHomMatrix& /*aFullTransform*/,
185  const BitmapEx& /*rBitmapEx*/)
186 {
187  // printers can't draw bitmaps directly
188  return false;
189 }
190 
192  const basegfx::B2DHomMatrix& /*aFullTransform*/,
193  basegfx::B2DRange& /*aVisibleRange*/,
194  double& /*fMaximumArea*/)
195 {
196  // deliberately do nothing - you can't reduce the
197  // target range for a printer at all
198  return true;
199 }
200 
201 void Printer::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
202  const Point& rSrcPtPixel, const Size& rSrcSizePixel,
203  BitmapEx& rBmpEx )
204 {
205  if( rBmpEx.IsAlpha() )
206  {
207  // #107169# For true alpha bitmaps, no longer masking the
208  // bitmap, but perform a full alpha blend against a white
209  // background here.
210  Bitmap aBmp( rBmpEx.GetBitmap() );
211  aBmp.Blend( rBmpEx.GetAlpha(), COL_WHITE );
212  DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmp );
213  }
214  else
215  {
216  Bitmap aBmp( rBmpEx.GetBitmap() ), aMask( rBmpEx.GetMask() );
217  aBmp.Replace( aMask, COL_WHITE );
218  ImplPrintTransparent( aBmp, aMask, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
219  }
220 }
221 
223  sal_uInt16 nTransparencePercent )
224 {
225  // #110958# Disable alpha VDev, we perform the necessary
226  VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
227 
228  // operation explicitly further below.
229  if( mpAlphaVDev )
230  mpAlphaVDev = nullptr;
231 
232  GDIMetaFile* pOldMetaFile = mpMetaFile;
233  mpMetaFile = nullptr;
234 
235  mpMetaFile = pOldMetaFile;
236 
237  // #110958# Restore disabled alpha VDev
238  mpAlphaVDev = pOldAlphaVDev;
239 
240  tools::Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
241  const Size aDPISize( LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch)) );
242  const long nBaseExtent = std::max( FRound( aDPISize.Width() / 300. ), 1L );
243  long nMove;
244  const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
245  ( nTransparencePercent < 38 ) ? 25 :
246  ( nTransparencePercent < 63 ) ? 50 :
247  ( nTransparencePercent < 88 ) ? 75 : 100;
248 
249  switch( nTrans )
250  {
251  case 25: nMove = nBaseExtent * 3; break;
252  case 50: nMove = nBaseExtent * 4; break;
253  case 75: nMove = nBaseExtent * 6; break;
254 
255  // #i112959# very transparent (88 < nTransparencePercent <= 99)
256  case 100: nMove = nBaseExtent * 8; break;
257 
258  // #i112959# not transparent (nTransparencePercent < 13)
259  default: nMove = 0; break;
260  }
261 
263  IntersectClipRegion(vcl::Region(rPolyPoly));
265  const bool bOldMap = mbMap;
266  EnableMapMode( false );
267 
268  if(nMove)
269  {
270  tools::Rectangle aRect( aPolyRect.TopLeft(), Size( aPolyRect.GetWidth(), nBaseExtent ) );
271  while( aRect.Top() <= aPolyRect.Bottom() )
272  {
273  DrawRect( aRect );
274  aRect.Move( 0, nMove );
275  }
276 
277  aRect = tools::Rectangle( aPolyRect.TopLeft(), Size( nBaseExtent, aPolyRect.GetHeight() ) );
278  while( aRect.Left() <= aPolyRect.Right() )
279  {
280  DrawRect( aRect );
281  aRect.Move( nMove, 0 );
282  }
283  }
284  else
285  {
286  // #i112959# if not transparent, draw full rectangle in clip region
287  DrawRect( aPolyRect );
288  }
289 
290  EnableMapMode( bOldMap );
291  Pop();
292 
293  mpMetaFile = pOldMetaFile;
294 
295  // #110958# Restore disabled alpha VDev
296  mpAlphaVDev = pOldAlphaVDev;
297 }
298 
299 void Printer::DrawOutDev( const Point& /*rDestPt*/, const Size& /*rDestSize*/,
300  const Point& /*rSrcPt*/, const Size& /*rSrcSize*/ )
301 {
302  SAL_WARN( "vcl.gdi", "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
303 }
304 
305 void Printer::DrawOutDev( const Point& /*rDestPt*/, const Size& /*rDestSize*/,
306  const Point& /*rSrcPt*/, const Size& /*rSrcSize*/,
307  const OutputDevice& /*rOutDev*/ )
308 {
309  SAL_WARN( "vcl.gdi", "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
310 }
311 
312 void Printer::CopyArea( const Point& /*rDestPt*/,
313  const Point& /*rSrcPt*/, const Size& /*rSrcSize*/,
314  bool /*bWindowInvalidate*/ )
315 {
316  SAL_WARN( "vcl.gdi", "Don't use OutputDevice::CopyArea(...) with printer devices!" );
317 }
318 
320 {
321  *mpPrinterOptions = i_rOptions;
322 }
323 
325 {
326  // due to a "hotfix" for AOO bug i55719, this needs to return false
327  return false;
328 }
329 
330 // QueueInfo
332 {
334  mnJobs = 0;
335 }
336 
338 {
341 }
342 
344 {
345 }
346 
348 {
349 }
350 
351 void ImplPrnQueueList::Add( std::unique_ptr<SalPrinterQueueInfo> pData )
352 {
353  std::unordered_map< OUString, sal_Int32 >::iterator it =
354  m_aNameToIndex.find( pData->maPrinterName );
355  if( it == m_aNameToIndex.end() )
356  {
357  m_aNameToIndex[ pData->maPrinterName ] = m_aQueueInfos.size();
358  m_aPrinterList.push_back( pData->maPrinterName );
359  m_aQueueInfos.push_back( ImplPrnQueueData() );
360  m_aQueueInfos.back().mpQueueInfo = nullptr;
361  m_aQueueInfos.back().mpSalQueueInfo = std::move(pData);
362  }
363  else // this should not happen, but ...
364  {
365  ImplPrnQueueData& rData = m_aQueueInfos[ it->second ];
366  rData.mpQueueInfo.reset();
367  rData.mpSalQueueInfo = std::move(pData);
368  }
369 }
370 
371 ImplPrnQueueData* ImplPrnQueueList::Get( const OUString& rPrinter )
372 {
373  ImplPrnQueueData* pData = nullptr;
374  std::unordered_map<OUString,sal_Int32>::iterator it =
375  m_aNameToIndex.find( rPrinter );
376  if( it != m_aNameToIndex.end() )
377  pData = &m_aQueueInfos[it->second];
378  return pData;
379 }
380 
381 static void ImplInitPrnQueueList()
382 {
383  ImplSVData* pSVData = ImplGetSVData();
384 
385  pSVData->maGDIData.mpPrinterQueueList.reset(new ImplPrnQueueList);
386 
387  static const char* pEnv = getenv( "SAL_DISABLE_PRINTERLIST" );
388  if( !pEnv || !*pEnv )
389  pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList.get() );
390 }
391 
393 {
394  ImplSVData* pSVData = ImplGetSVData();
395  pSVData->maGDIData.mpPrinterQueueList.reset();
396 }
397 
398 const std::vector<OUString>& Printer::GetPrinterQueues()
399 {
400  ImplSVData* pSVData = ImplGetSVData();
401  if ( !pSVData->maGDIData.mpPrinterQueueList )
403  return pSVData->maGDIData.mpPrinterQueueList->m_aPrinterList;
404 }
405 
406 const QueueInfo* Printer::GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate )
407 {
408  ImplSVData* pSVData = ImplGetSVData();
409 
410  if ( !pSVData->maGDIData.mpPrinterQueueList )
412 
413  if ( !pSVData->maGDIData.mpPrinterQueueList )
414  return nullptr;
415 
416  ImplPrnQueueData* pInfo = pSVData->maGDIData.mpPrinterQueueList->Get( rPrinterName );
417  if( pInfo )
418  {
419  if( !pInfo->mpQueueInfo || bStatusUpdate )
420  pSVData->mpDefInst->GetPrinterQueueState( pInfo->mpSalQueueInfo.get() );
421 
422  if ( !pInfo->mpQueueInfo )
423  pInfo->mpQueueInfo.reset(new QueueInfo);
424 
425  pInfo->mpQueueInfo->maPrinterName = pInfo->mpSalQueueInfo->maPrinterName;
426  pInfo->mpQueueInfo->maDriver = pInfo->mpSalQueueInfo->maDriver;
427  pInfo->mpQueueInfo->maLocation = pInfo->mpSalQueueInfo->maLocation;
428  pInfo->mpQueueInfo->maComment = pInfo->mpSalQueueInfo->maComment;
429  pInfo->mpQueueInfo->mnStatus = pInfo->mpSalQueueInfo->mnStatus;
430  pInfo->mpQueueInfo->mnJobs = pInfo->mpSalQueueInfo->mnJobs;
431  return pInfo->mpQueueInfo.get();
432  }
433  return nullptr;
434 }
435 
437 {
438  static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" );
439  if( !pEnv || !*pEnv )
440  {
441  ImplSVData* pSVData = ImplGetSVData();
442 
443  return pSVData->mpDefInst->GetDefaultPrinter();
444  }
445  return OUString();
446 }
447 
449 {
450  mbDevOutput = false;
451  mbDefPrinter = false;
453  mnPageQueueSize = 0;
454  mnCopyCount = 1;
455  mbCollateCopy = false;
456  mbPrinting = false;
457  mbJobActive = false;
458  mbPrintFile = false;
459  mbInPrintPage = false;
460  mbNewJobSetup = false;
461  mpInfoPrinter = nullptr;
462  mpPrinter = nullptr;
463  mpDisplayDev = nullptr;
464  mpPrinterOptions.reset(new PrinterOptions);
465 
466  // Add printer to the list
467  ImplSVData* pSVData = ImplGetSVData();
468  mpNext = pSVData->maGDIData.mpFirstPrinter;
469  mpPrev = nullptr;
470  if ( mpNext )
471  mpNext->mpPrev = this;
472  pSVData->maGDIData.mpFirstPrinter = this;
473 }
474 
476 {
478 
479  if ( mpGraphics )
480  return true;
481 
482  mbInitLineColor = true;
483  mbInitFillColor = true;
484  mbInitFont = true;
485  mbInitTextColor = true;
486  mbInitClipRegion = true;
487 
488  ImplSVData* pSVData = ImplGetSVData();
489 
490  if ( mpJobGraphics )
492  else if ( mpDisplayDev )
493  {
494  const VirtualDevice* pVirDev = mpDisplayDev;
495  mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
496  // if needed retry after releasing least recently used virtual device graphics
497  while ( !mpGraphics )
498  {
499  if ( !pSVData->maGDIData.mpLastVirGraphics )
500  break;
502  mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
503  }
504  // update global LRU list of virtual device graphics
505  if ( mpGraphics )
506  {
508  pSVData->maGDIData.mpFirstVirGraphics = const_cast<Printer*>(this);
509  if ( mpNextGraphics )
510  mpNextGraphics->mpPrevGraphics = const_cast<Printer*>(this);
511  if ( !pSVData->maGDIData.mpLastVirGraphics )
512  pSVData->maGDIData.mpLastVirGraphics = const_cast<Printer*>(this);
513  }
514  }
515  else
516  {
518  // if needed retry after releasing least recently used printer graphics
519  while ( !mpGraphics )
520  {
521  if ( !pSVData->maGDIData.mpLastPrnGraphics )
522  break;
525  }
526  // update global LRU list of printer graphics
527  if ( mpGraphics )
528  {
530  pSVData->maGDIData.mpFirstPrnGraphics = const_cast<Printer*>(this);
531  if ( mpNextGraphics )
532  mpNextGraphics->mpPrevGraphics = const_cast<Printer*>(this);
533  if ( !pSVData->maGDIData.mpLastPrnGraphics )
534  pSVData->maGDIData.mpLastPrnGraphics = const_cast<Printer*>(this);
535  }
536  }
537 
538  if ( mpGraphics )
539  {
542  }
543 
544  return mpGraphics != nullptr;
545 }
546 
548 {
549 #ifdef UNX
550  // HACK to fix an urgent P1 printing issue fast
551  // WinSalPrinter does not respect GetGraphics/ReleaseGraphics conventions
552  // so Printer::mpGraphics often points to a dead WinSalGraphics
553  // TODO: fix WinSalPrinter's GetGraphics/ReleaseGraphics handling
555 #endif
556  mbNewFont = true;
557  mbInitFont = true;
558 
559  mpFontInstance.clear();
560  mpDeviceFontList.reset();
561  mpDeviceFontSizeList.reset();
562 }
563 
564 void Printer::ReleaseGraphics( bool bRelease )
565 {
567 
568  if ( !mpGraphics )
569  return;
570 
571  // release the fonts of the physically released graphics device
572  if( bRelease )
574 
575  ImplSVData* pSVData = ImplGetSVData();
576 
577  Printer* pPrinter = this;
578 
579  if ( !pPrinter->mpJobGraphics )
580  {
581  if ( pPrinter->mpDisplayDev )
582  {
583  VirtualDevice* pVirDev = pPrinter->mpDisplayDev;
584  if ( bRelease )
585  pVirDev->mpVirDev->ReleaseGraphics( mpGraphics );
586  // remove from global LRU list of virtual device graphics
587  if ( mpPrevGraphics )
589  else
591  if ( mpNextGraphics )
593  else
595  }
596  else
597  {
598  if ( bRelease )
600  // remove from global LRU list of printer graphics
601  if ( mpPrevGraphics )
603  else
605  if ( mpNextGraphics )
607  else
609  }
610  }
611 
612  mpGraphics = nullptr;
613  mpPrevGraphics = nullptr;
614  mpNextGraphics = nullptr;
615 }
616 
618 {
619  ImplSVData* pSVData = ImplGetSVData();
620  // #i74084# update info for this specific SalPrinterQueueInfo
621  pSVData->mpDefInst->GetPrinterQueueState( pInfo );
622 
623  // Test whether the driver actually matches the JobSetup
625  if ( rData.GetDriverData() )
626  {
627  if ( rData.GetPrinterName() != pInfo->maPrinterName ||
628  rData.GetDriver() != pInfo->maDriver )
629  {
630  std::free( const_cast<sal_uInt8*>(rData.GetDriverData()) );
631  rData.SetDriverData(nullptr);
632  rData.SetDriverDataLen(0);
633  }
634  }
635 
636  // Remember printer name
637  maPrinterName = pInfo->maPrinterName;
638  maDriver = pInfo->maDriver;
639 
640  // Add printer name to JobSetup
641  rData.SetPrinterName( maPrinterName );
642  rData.SetDriver( maDriver );
643 
644  mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, &rData );
645  mpPrinter = nullptr;
646  mpJobGraphics = nullptr;
648 
649  if ( !mpInfoPrinter )
650  {
651  ImplInitDisplay();
652  return;
653  }
654 
655  // we need a graphics
656  if ( !AcquireGraphics() )
657  {
658  ImplInitDisplay();
659  return;
660  }
661 
662  // Init data
665  mxFontCache.reset(new ImplFontCache);
667 }
668 
670 {
671  ImplSVData* pSVData = ImplGetSVData();
672 
673  mpInfoPrinter = nullptr;
674  mpPrinter = nullptr;
675  mpJobGraphics = nullptr;
676 
680  mnDPIX = mpDisplayDev->mnDPIX;
681  mnDPIY = mpDisplayDev->mnDPIY;
682 }
683 
684 void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
685  const Point& rDestPt, const Size& rDestSize,
686  const Point& rSrcPtPixel, const Size& rSrcSizePixel )
687 {
688  Point aDestPt( LogicToPixel( rDestPt ) );
689  Size aDestSz( LogicToPixel( rDestSize ) );
690  tools::Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
691 
692  aSrcRect.Justify();
693 
694  if( !(!rMask.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height()) )
695  return;
696 
697  Bitmap aMask( rMask );
699 
700  if( aMask.GetBitCount() > 1 )
702 
703  // mirrored horizontically
704  if( aDestSz.Width() < 0 )
705  {
706  aDestSz.setWidth( -aDestSz.Width() );
707  aDestPt.AdjustX( -( aDestSz.Width() - 1 ) );
708  nMirrFlags |= BmpMirrorFlags::Horizontal;
709  }
710 
711  // mirrored vertically
712  if( aDestSz.Height() < 0 )
713  {
714  aDestSz.setHeight( -aDestSz.Height() );
715  aDestPt.AdjustY( -( aDestSz.Height() - 1 ) );
716  nMirrFlags |= BmpMirrorFlags::Vertical;
717  }
718 
719  // source cropped?
720  if( aSrcRect != tools::Rectangle( Point(), aMask.GetSizePixel() ) )
721  aMask.Crop( aSrcRect );
722 
723  // destination mirrored
724  if( nMirrFlags != BmpMirrorFlags::NONE)
725  aMask.Mirror( nMirrFlags );
726 
727  // do painting
728  const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
729  long nX, nY; //, nWorkX, nWorkY, nWorkWidth, nWorkHeight;
730  std::unique_ptr<long[]> pMapX( new long[ nSrcWidth + 1 ] );
731  std::unique_ptr<long[]> pMapY( new long[ nSrcHeight + 1 ] );
732  GDIMetaFile* pOldMetaFile = mpMetaFile;
733  const bool bOldMap = mbMap;
734 
735  mpMetaFile = nullptr;
736  mbMap = false;
738  SetLineColor( rMaskColor );
739  SetFillColor( rMaskColor );
740  InitLineColor();
741  InitFillColor();
742 
743  // create forward mapping tables
744  for( nX = 0; nX <= nSrcWidth; nX++ )
745  pMapX[ nX ] = aDestPt.X() + FRound( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
746 
747  for( nY = 0; nY <= nSrcHeight; nY++ )
748  pMapY[ nY ] = aDestPt.Y() + FRound( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
749 
750  // walk through all rectangles of mask
751  const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
752  RectangleVector aRectangles;
753  aWorkRgn.GetRegionRectangles(aRectangles);
754 
755  for (auto const& rectangle : aRectangles)
756  {
757  const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
758  const Size aMapSz(
759  pMapX[rectangle.Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
760  pMapY[rectangle.Bottom() + 1] - aMapPt.Y()); // same for Y
761 
762  DrawRect(tools::Rectangle(aMapPt, aMapSz));
763  }
764 
765  Pop();
766  mbMap = bOldMap;
767  mpMetaFile = pOldMetaFile;
768 }
769 
770 SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
771  const OUString* pDriver )
772 {
773  ImplSVData* pSVData = ImplGetSVData();
774  if ( !pSVData->maGDIData.mpPrinterQueueList )
776 
777  ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList.get();
778  if ( pPrnList && !pPrnList->m_aQueueInfos.empty() )
779  {
780  // first search for the printer name directly
781  ImplPrnQueueData* pInfo = pPrnList->Get( rPrinterName );
782  if( pInfo )
783  return pInfo->mpSalQueueInfo.get();
784 
785  // then search case insensitive
786  for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
787  {
788  if( rQueueInfo.mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
789  return rQueueInfo.mpSalQueueInfo.get();
790  }
791 
792  // then search for driver name
793  if ( pDriver )
794  {
795  for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
796  {
797  if( rQueueInfo.mpSalQueueInfo->maDriver == *pDriver )
798  return rQueueInfo.mpSalQueueInfo.get();
799  }
800  }
801 
802  // then the default printer
803  pInfo = pPrnList->Get( GetDefaultPrinterName() );
804  if( pInfo )
805  return pInfo->mpSalQueueInfo.get();
806 
807  // last chance: the first available printer
808  return pPrnList->m_aQueueInfos[0].mpSalQueueInfo.get();
809  }
810 
811  return nullptr;
812 }
813 
815 {
816  // we need a graphics
817  if ( !AcquireGraphics() )
818  return;
819 
823  maPageOffset,
824  maPaperSize );
825 }
826 
828 {
830 }
831 
832 long Printer::GetGradientStepCount( long nMinRect )
833 {
834  // use display-equivalent step size calculation
835  long nInc = (nMinRect < 800) ? 10 : 20;
836 
837  return nInc;
838 }
839 
842 {
843  ImplInitData();
845  if ( pInfo )
846  {
847  ImplInit( pInfo );
848  if ( !IsDisplayPrinter() )
849  mbDefPrinter = true;
850  }
851  else
852  ImplInitDisplay();
853 }
854 
855 Printer::Printer( const JobSetup& rJobSetup )
857  , maJobSetup(rJobSetup)
858 {
859  ImplInitData();
860  const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
861  OUString aDriver = rConstData.GetDriver();
862  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rConstData.GetPrinterName(),
863  &aDriver );
864  if ( pInfo )
865  {
866  ImplInit( pInfo );
867  SetJobSetup( rJobSetup );
868  }
869  else
870  {
871  ImplInitDisplay();
872  maJobSetup = JobSetup();
873  }
874 }
875 
876 Printer::Printer( const QueueInfo& rQueueInfo )
878 {
879  ImplInitData();
880  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rQueueInfo.GetPrinterName(),
881  &rQueueInfo.GetDriver() );
882  if ( pInfo )
883  ImplInit( pInfo );
884  else
885  ImplInitDisplay();
886 }
887 
888 Printer::Printer( const OUString& rPrinterName )
890 {
891  ImplInitData();
892  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rPrinterName, nullptr );
893  if ( pInfo )
894  ImplInit( pInfo );
895  else
896  ImplInitDisplay();
897 }
898 
900 {
901  disposeOnce();
902 }
903 
905 {
906  SAL_WARN_IF( IsPrinting(), "vcl.gdi", "Printer::~Printer() - Job is printing" );
907  SAL_WARN_IF( IsJobActive(), "vcl.gdi", "Printer::~Printer() - Job is active" );
908 
909  mpPrinterOptions.reset();
910 
911  ReleaseGraphics();
912  if ( mpInfoPrinter )
914  if ( mpDisplayDev )
916  else
917  {
918  // OutputDevice Dtor is trying the same thing; that why we need to set
919  // the FontEntry to NULL here
920  // TODO: consolidate duplicate cleanup by Printer and OutputDevice
921  mpFontInstance.clear();
922  mpDeviceFontList.reset();
923  mpDeviceFontSizeList.reset();
924  mxFontCache.reset();
925  // font list deleted by OutputDevice dtor
926  }
927 
928  // Add printer from the list
929  ImplSVData* pSVData = ImplGetSVData();
930  if ( mpPrev )
931  mpPrev->mpNext = mpNext;
932  else
933  pSVData->maGDIData.mpFirstPrinter = mpNext;
934  if ( mpNext )
935  mpNext->mpPrev = mpPrev;
936 
937  mpPrev.clear();
938  mpNext.clear();
940 }
941 
942 sal_uInt32 Printer::GetCapabilities( PrinterCapType nType ) const
943 {
944  if ( IsDisplayPrinter() )
945  return 0;
946 
947  if( mpInfoPrinter )
949  else
950  return 0;
951 }
952 
953 bool Printer::HasSupport( PrinterSupport eFeature ) const
954 {
955  switch ( eFeature )
956  {
967  }
968 
969  return true;
970 }
971 
972 bool Printer::SetJobSetup( const JobSetup& rSetup )
973 {
974  if ( IsDisplayPrinter() || mbInPrintPage )
975  return false;
976 
977  JobSetup aJobSetup = rSetup;
978 
979  ReleaseGraphics();
980  if ( mpInfoPrinter->SetPrinterData( &aJobSetup.ImplGetData() ) )
981  {
982  ImplUpdateJobSetupPaper( aJobSetup );
983  mbNewJobSetup = true;
984  maJobSetup = aJobSetup;
987  return true;
988  }
989 
990  return false;
991 }
992 
994 {
995  if ( IsDisplayPrinter() )
996  return false;
997 
998  if ( IsJobActive() || IsPrinting() )
999  return false;
1000 
1001  JobSetup aJobSetup = maJobSetup;
1002  ImplJobSetup& rData = aJobSetup.ImplGetData();
1003  rData.SetPrinterSetupMode( eMode );
1004  // TODO: orig page size
1005 
1006  if (!pWindow)
1007  {
1008  vcl::Window* pDefWin = ImplGetDefaultWindow();
1009  pWindow = pDefWin ? pDefWin->GetFrameWeld() : nullptr;
1010  }
1011  if( !pWindow )
1012  return false;
1013 
1014  ReleaseGraphics();
1015  ImplSVData* pSVData = ImplGetSVData();
1016  pSVData->maAppData.mnModalMode++;
1017  nImplSysDialog++;
1018  bool bSetup = mpInfoPrinter->Setup(pWindow, &rData);
1019  pSVData->maAppData.mnModalMode--;
1020  nImplSysDialog--;
1021  if ( bSetup )
1022  {
1023  ImplUpdateJobSetupPaper( aJobSetup );
1024  mbNewJobSetup = true;
1025  maJobSetup = aJobSetup;
1028  return true;
1029  }
1030  return false;
1031 }
1032 
1033 bool Printer::SetPrinterProps( const Printer* pPrinter )
1034 {
1035  if ( IsJobActive() || IsPrinting() )
1036  return false;
1037 
1038  ImplSVData* pSVData = ImplGetSVData();
1039 
1040  mbDefPrinter = pPrinter->mbDefPrinter;
1041  maPrintFile = pPrinter->maPrintFile;
1042  mbPrintFile = pPrinter->mbPrintFile;
1043  mnCopyCount = pPrinter->mnCopyCount;
1044  mbCollateCopy = pPrinter->mbCollateCopy;
1045  mnPageQueueSize = pPrinter->mnPageQueueSize;
1046  *mpPrinterOptions = *pPrinter->mpPrinterOptions;
1047 
1048  if ( pPrinter->IsDisplayPrinter() )
1049  {
1050  // Destroy old printer
1051  if ( !IsDisplayPrinter() )
1052  {
1053  ReleaseGraphics();
1055  mpFontInstance.clear();
1056  mpDeviceFontList.reset();
1057  mpDeviceFontSizeList.reset();
1058  // clean up font list
1059  mxFontCache.reset();
1060  mxFontCollection.reset();
1061 
1062  mbInitFont = true;
1063  mbNewFont = true;
1064  mpInfoPrinter = nullptr;
1065  }
1066 
1067  // Construct new printer
1068  ImplInitDisplay();
1069  return true;
1070  }
1071 
1072  // Destroy old printer?
1073  if ( GetName() != pPrinter->GetName() )
1074  {
1075  ReleaseGraphics();
1076  if ( mpDisplayDev )
1077  {
1079  }
1080  else
1081  {
1083 
1084  mpFontInstance.clear();
1085  mpDeviceFontList.reset();
1086  mpDeviceFontSizeList.reset();
1087  mxFontCache.reset();
1088  mxFontCollection.reset();
1089  mbInitFont = true;
1090  mbNewFont = true;
1091  mpInfoPrinter = nullptr;
1092  }
1093 
1094  // Construct new printer
1095  OUString aDriver = pPrinter->GetDriverName();
1096  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( pPrinter->GetName(), &aDriver );
1097  if ( pInfo )
1098  {
1099  ImplInit( pInfo );
1100  SetJobSetup( pPrinter->GetJobSetup() );
1101  }
1102  else
1103  ImplInitDisplay();
1104  }
1105  else
1106  SetJobSetup( pPrinter->GetJobSetup() );
1107 
1108  return false;
1109 }
1110 
1112 {
1113  if ( mbInPrintPage )
1114  return false;
1115 
1116  if ( maJobSetup.ImplGetConstData().GetOrientation() != eOrientation )
1117  {
1118  JobSetup aJobSetup = maJobSetup;
1119  ImplJobSetup& rData = aJobSetup.ImplGetData();
1120 
1121  rData.SetOrientation(eOrientation);
1122 
1123  if ( IsDisplayPrinter() )
1124  {
1125  mbNewJobSetup = true;
1126  maJobSetup = aJobSetup;
1127  return true;
1128  }
1129 
1130  ReleaseGraphics();
1132  {
1133  ImplUpdateJobSetupPaper( aJobSetup );
1134  mbNewJobSetup = true;
1135  maJobSetup = aJobSetup;
1138  return true;
1139  }
1140  else
1141  return false;
1142  }
1143 
1144  return true;
1145 }
1146 
1148 {
1150 }
1151 
1152 bool Printer::SetPaperBin( sal_uInt16 nPaperBin )
1153 {
1154  if ( mbInPrintPage )
1155  return false;
1156 
1157  if ( maJobSetup.ImplGetConstData().GetPaperBin() != nPaperBin &&
1158  nPaperBin < GetPaperBinCount() )
1159  {
1160  JobSetup aJobSetup = maJobSetup;
1161  ImplJobSetup& rData = aJobSetup.ImplGetData();
1162  rData.SetPaperBin(nPaperBin);
1163 
1164  if ( IsDisplayPrinter() )
1165  {
1166  mbNewJobSetup = true;
1167  maJobSetup = aJobSetup;
1168  return true;
1169  }
1170 
1171  ReleaseGraphics();
1172  if ( mpInfoPrinter->SetData( JobSetFlags::PAPERBIN, &rData ) )
1173  {
1174  ImplUpdateJobSetupPaper( aJobSetup );
1175  mbNewJobSetup = true;
1176  maJobSetup = aJobSetup;
1179  return true;
1180  }
1181  else
1182  return false;
1183  }
1184 
1185  return true;
1186 }
1187 
1188 sal_uInt16 Printer::GetPaperBin() const
1189 {
1191 }
1192 
1194 {
1196 }
1197 
1198 // dear loplugins, DO NOT REMOVE this code
1199 // it will be used in follow-up commits
1200 void Printer::SetPrinterSettingsPreferred( bool bPaperSizeFromSetup)
1201 {
1202  if ( maJobSetup.ImplGetConstData().GetPapersizeFromSetup() != bPaperSizeFromSetup )
1203  {
1204  JobSetup aJobSetup = maJobSetup;
1205  ImplJobSetup& rData = aJobSetup.ImplGetData();
1206  rData.SetPapersizeFromSetup(bPaperSizeFromSetup);
1207 
1208  mbNewJobSetup = true;
1209  maJobSetup = aJobSetup;
1210  }
1211 }
1212 
1213 // Map user paper format to an available printer paper format
1214 void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest )
1215 {
1216  ImplJobSetup& rData = aJobSetup.ImplGetData();
1217 
1218  // The angle that a landscape page will be turned counterclockwise wrt to portrait.
1219  int nLandscapeAngle = mpInfoPrinter ? mpInfoPrinter->GetLandscapeAngle( &maJobSetup.ImplGetConstData() ) : 900;
1220 
1221  int nPaperCount = GetPaperInfoCount();
1222  bool bFound = false;
1223 
1224  PaperInfo aInfo(rData.GetPaperWidth(), rData.GetPaperHeight());
1225 
1226  // Compare all paper formats and get the appropriate one
1227  for ( int i = 0; i < nPaperCount; i++ )
1228  {
1229  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1230 
1231  if ( aInfo.sloppyEqual(rPaperInfo) )
1232  {
1233  rData.SetPaperFormat(
1234  ImplGetPaperFormat( rPaperInfo.getWidth(),
1235  rPaperInfo.getHeight() ));
1237  bFound = true;
1238  break;
1239  }
1240  }
1241 
1242  // If the printer supports landscape orientation, check paper sizes again
1243  // with landscape orientation. This is necessary as a printer driver provides
1244  // all paper sizes with portrait orientation only!!
1245  if ( rData.GetPaperFormat() == PAPER_USER &&
1246  nLandscapeAngle != 0 &&
1248  {
1249  const long nRotatedWidth = rData.GetPaperHeight();
1250  const long nRotatedHeight = rData.GetPaperWidth();
1251  PaperInfo aRotatedInfo(nRotatedWidth, nRotatedHeight);
1252 
1253  for ( int i = 0; i < nPaperCount; i++ )
1254  {
1255  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1256 
1257  if ( aRotatedInfo.sloppyEqual( rPaperInfo ) )
1258  {
1259  rData.SetPaperFormat(
1260  ImplGetPaperFormat( rPaperInfo.getWidth(),
1261  rPaperInfo.getHeight() ));
1263  bFound = true;
1264  break;
1265  }
1266  }
1267  }
1268 
1269  if( ! bFound && bMatchNearest )
1270  {
1271  sal_Int64 nBestMatch = SAL_MAX_INT64;
1272  int nBestIndex = 0;
1273  Orientation eBestOrientation = Orientation::Portrait;
1274  for( int i = 0; i < nPaperCount; i++ )
1275  {
1276  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1277 
1278  // check portrait match
1279  sal_Int64 nDX = rData.GetPaperWidth() - rPaperInfo.getWidth();
1280  sal_Int64 nDY = rData.GetPaperHeight() - rPaperInfo.getHeight();
1281  sal_Int64 nMatch = nDX*nDX + nDY*nDY;
1282  if( nMatch < nBestMatch )
1283  {
1284  nBestMatch = nMatch;
1285  nBestIndex = i;
1286  eBestOrientation = Orientation::Portrait;
1287  }
1288 
1289  // check landscape match
1290  nDX = rData.GetPaperWidth() - rPaperInfo.getHeight();
1291  nDY = rData.GetPaperHeight() - rPaperInfo.getWidth();
1292  nMatch = nDX*nDX + nDY*nDY;
1293  if( nMatch < nBestMatch )
1294  {
1295  nBestMatch = nMatch;
1296  nBestIndex = i;
1297  eBestOrientation = Orientation::Landscape;
1298  }
1299  }
1300  const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex );
1301  rData.SetPaperFormat(
1302  ImplGetPaperFormat( rBestInfo.getWidth(),
1303  rBestInfo.getHeight() ));
1304  rData.SetOrientation(eBestOrientation);
1305  }
1306 }
1307 
1308 void Printer::SetPaper( Paper ePaper )
1309 {
1310  if ( mbInPrintPage )
1311  return;
1312 
1313  if ( maJobSetup.ImplGetConstData().GetPaperFormat() != ePaper )
1314  {
1315  JobSetup aJobSetup = maJobSetup;
1316  ImplJobSetup& rData = aJobSetup.ImplGetData();
1317 
1318  rData.SetPaperFormat( ePaper );
1319  if ( ePaper != PAPER_USER )
1320  {
1321  PaperInfo aInfo(ePaper);
1322  rData.SetPaperWidth( aInfo.getWidth() );
1323  rData.SetPaperHeight( aInfo.getHeight() );
1324  }
1325 
1326  if ( IsDisplayPrinter() )
1327  {
1328  mbNewJobSetup = true;
1329  maJobSetup = aJobSetup;
1330  return;
1331  }
1332 
1333  ReleaseGraphics();
1334  if ( ePaper == PAPER_USER )
1335  ImplFindPaperFormatForUserSize( aJobSetup, false );
1337  {
1338  ImplUpdateJobSetupPaper( aJobSetup );
1339  mbNewJobSetup = true;
1340  maJobSetup = aJobSetup;
1343  }
1344  }
1345 }
1346 
1347 bool Printer::SetPaperSizeUser( const Size& rSize )
1348 {
1349  return SetPaperSizeUser( rSize, false );
1350 }
1351 
1352 bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest )
1353 {
1354  if ( mbInPrintPage )
1355  return false;
1356 
1357  const Size aPixSize = LogicToPixel( rSize );
1358  const Size aPageSize = PixelToLogic(aPixSize, MapMode(MapUnit::Map100thMM));
1359  bool bNeedToChange(maJobSetup.ImplGetConstData().GetPaperWidth() != aPageSize.Width() ||
1360  maJobSetup.ImplGetConstData().GetPaperHeight() != aPageSize.Height());
1361 
1362  if(!bNeedToChange)
1363  {
1364  // #i122984# only need to change when Paper is different from PAPER_USER and
1365  // the mapped Paper which will created below in the call to ImplFindPaperFormatForUserSize
1366  // and will replace maJobSetup.ImplGetConstData()->GetPaperFormat(). This leads to
1367  // unnecessary JobSetups, e.g. when printing a multi-page fax, but also with
1368  // normal print
1369  const Paper aPaper = ImplGetPaperFormat(aPageSize.Width(), aPageSize.Height());
1370 
1371  bNeedToChange = maJobSetup.ImplGetConstData().GetPaperFormat() != PAPER_USER &&
1373  }
1374 
1375  if(bNeedToChange)
1376  {
1377  JobSetup aJobSetup = maJobSetup;
1378  ImplJobSetup& rData = aJobSetup.ImplGetData();
1379  rData.SetPaperFormat( PAPER_USER );
1380  rData.SetPaperWidth( aPageSize.Width() );
1381  rData.SetPaperHeight( aPageSize.Height() );
1382 
1383  if ( IsDisplayPrinter() )
1384  {
1385  mbNewJobSetup = true;
1386  maJobSetup = aJobSetup;
1387  return true;
1388  }
1389 
1390  ReleaseGraphics();
1391  ImplFindPaperFormatForUserSize( aJobSetup, bMatchNearest );
1392 
1393  // Changing the paper size can also change the orientation!
1395  {
1396  ImplUpdateJobSetupPaper( aJobSetup );
1397  mbNewJobSetup = true;
1398  maJobSetup = aJobSetup;
1401  return true;
1402  }
1403  else
1404  return false;
1405  }
1406 
1407  return true;
1408 }
1409 
1411 {
1412  if( ! mpInfoPrinter )
1413  return 0;
1414  if( ! mpInfoPrinter->m_bPapersInit )
1416  return mpInfoPrinter->m_aPaperFormats.size();
1417 }
1418 
1419 OUString Printer::GetPaperName( Paper ePaper )
1420 {
1421  ImplSVData* pSVData = ImplGetSVData();
1422  if( pSVData->maPaperNames.empty() )
1423  {
1424  static const int PaperIndex[] =
1425  {
1438  };
1439  assert(SAL_N_ELEMENTS(PaperIndex) == SAL_N_ELEMENTS(RID_STR_PAPERNAMES) && "localized paper name count wrong");
1440  for (size_t i = 0; i < SAL_N_ELEMENTS(PaperIndex); ++i)
1441  pSVData->maPaperNames[PaperIndex[i]] = VclResId(RID_STR_PAPERNAMES[i]);
1442  }
1443 
1444  std::unordered_map<int,OUString>::const_iterator it = pSVData->maPaperNames.find( static_cast<int>(ePaper) );
1445  return (it != pSVData->maPaperNames.end()) ? it->second : OUString();
1446 }
1447 
1448 const PaperInfo& Printer::GetPaperInfo( int nPaper ) const
1449 {
1450  if( ! mpInfoPrinter )
1451  return ImplGetEmptyPaper();
1452  if( ! mpInfoPrinter->m_bPapersInit )
1454  if( mpInfoPrinter->m_aPaperFormats.empty() || nPaper < 0 || nPaper >= int(mpInfoPrinter->m_aPaperFormats.size()) )
1455  return ImplGetEmptyPaper();
1456  return mpInfoPrinter->m_aPaperFormats[nPaper];
1457 }
1458 
1460 {
1461  PaperInfo aInfo = GetPaperInfo( nPaper );
1462  return PixelToLogic( Size( aInfo.getWidth(), aInfo.getHeight() ) );
1463 }
1464 
1466 {
1467  if ( mbInPrintPage )
1468  return;
1469 
1470  if ( maJobSetup.ImplGetConstData().GetDuplexMode() != eDuplex )
1471  {
1472  JobSetup aJobSetup = maJobSetup;
1473  ImplJobSetup& rData = aJobSetup.ImplGetData();
1474 
1475  rData.SetDuplexMode( eDuplex );
1476 
1477  if ( IsDisplayPrinter() )
1478  {
1479  mbNewJobSetup = true;
1480  maJobSetup = aJobSetup;
1481  return;
1482  }
1483 
1484  ReleaseGraphics();
1485  if ( mpInfoPrinter->SetData( JobSetFlags::DUPLEXMODE, &rData ) )
1486  {
1487  ImplUpdateJobSetupPaper( aJobSetup );
1488  mbNewJobSetup = true;
1489  maJobSetup = aJobSetup;
1492  }
1493  }
1494 }
1495 
1497 {
1499 }
1500 
1502 {
1504 }
1505 
1506 sal_uInt16 Printer::GetPaperBinCount() const
1507 {
1508  if ( IsDisplayPrinter() )
1509  return 0;
1510 
1512 }
1513 
1514 OUString Printer::GetPaperBinName( sal_uInt16 nPaperBin ) const
1515 {
1516  if ( IsDisplayPrinter() )
1517  return OUString();
1518 
1519  if ( nPaperBin < GetPaperBinCount() )
1520  return mpInfoPrinter->GetPaperBinName( &maJobSetup.ImplGetConstData(), nPaperBin );
1521  else
1522  return OUString();
1523 }
1524 
1525 void Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate )
1526 {
1527  mnCopyCount = nCopy;
1528  mbCollateCopy = bCollate;
1529 }
1530 
1532 {
1533  ErrCode nVCLError;
1534  switch ( nError )
1535  {
1536  case SalPrinterError::NONE:
1537  nVCLError = ERRCODE_NONE;
1538  break;
1540  nVCLError = PRINTER_ABORT;
1541  break;
1542  default:
1543  nVCLError = PRINTER_GENERALERROR;
1544  break;
1545  }
1546 
1547  return nVCLError;
1548 }
1549 
1551 {
1552  if ( !IsJobActive() )
1553  return;
1554 
1555  SAL_WARN_IF( mbInPrintPage, "vcl.gdi", "Printer::EndJob() - StartPage() without EndPage() called" );
1556 
1557  mbJobActive = false;
1558 
1559  if ( mpPrinter )
1560  {
1561  ReleaseGraphics();
1562 
1563  mbPrinting = false;
1564 
1565  mbDevOutput = false;
1566  mpPrinter->EndJob();
1567  // FIXME: Do not destroy the printer asynchronously as Win95
1568  // can't handle destroying a printer object and printing
1569  // at the same time
1570  mpPrinter.reset();
1571  }
1572 }
1573 
1575 {
1576  if ( !IsJobActive() )
1577  return;
1578 
1579  if ( mpPrinter )
1580  {
1581  SalGraphics* pGraphics = mpPrinter->StartPage( &maJobSetup.ImplGetData(),
1582  mbNewJobSetup );
1583  if ( pGraphics )
1584  {
1585  ReleaseGraphics();
1586  mpJobGraphics = pGraphics;
1587  }
1588  mbDevOutput = true;
1589 
1590  // PrintJob not aborted ???
1591  if ( IsJobActive() )
1592  mbInPrintPage = true;
1593  }
1594 }
1595 
1597 {
1598  if ( !IsJobActive() )
1599  return;
1600 
1601  mbInPrintPage = false;
1602 
1603  if ( mpPrinter )
1604  {
1605  mpPrinter->EndPage();
1606  ReleaseGraphics();
1607  mbDevOutput = false;
1608 
1609  mpJobGraphics = nullptr;
1610  mbNewJobSetup = false;
1611  }
1612 }
1613 
1615 {
1616  ImplSVData* pSVData = ImplGetSVData();
1617  ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList.get();
1618 
1619  if ( pPrnList )
1620  {
1621  std::unique_ptr<ImplPrnQueueList> pNewList(new ImplPrnQueueList);
1622  pSVData->mpDefInst->GetPrinterQueueInfo( pNewList.get() );
1623 
1624  bool bChanged = pPrnList->m_aQueueInfos.size() != pNewList->m_aQueueInfos.size();
1625  for( decltype(pPrnList->m_aQueueInfos)::size_type i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ )
1626  {
1627  ImplPrnQueueData& rInfo = pPrnList->m_aQueueInfos[i];
1628  ImplPrnQueueData& rNewInfo = pNewList->m_aQueueInfos[i];
1629  if( ! rInfo.mpSalQueueInfo || ! rNewInfo.mpSalQueueInfo || // sanity check
1630  rInfo.mpSalQueueInfo->maPrinterName != rNewInfo.mpSalQueueInfo->maPrinterName )
1631  {
1632  bChanged = true;
1633  }
1634  }
1635  if( bChanged )
1636  {
1638  pSVData->maGDIData.mpPrinterQueueList = std::move(pNewList);
1639 
1640  Application* pApp = GetpApp();
1641  if( pApp )
1642  {
1646  }
1647  }
1648  }
1649 }
1650 
1652 {
1653  return true;
1654 }
1655 
1656 void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly )
1657 {
1658  const tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
1659 
1661  IntersectClipRegion(vcl::Region(rPolyPoly));
1662  DrawGradient( aBoundRect, rGradient );
1663  Pop();
1664 }
1665 
1666 void Printer::SetFontOrientation( LogicalFontInstance* const pFontEntry ) const
1667 {
1668  pFontEntry->mnOrientation = pFontEntry->mxFontMetric->GetOrientation();
1669 }
1670 
1672 {
1673  return aRegion;
1674 }
1675 
1676 Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
1677 {
1678  SAL_WARN("vcl.gdi", "GetBitmap(): This should never be called on by a Printer instance");
1679 
1680  return OutputDevice::GetBitmap( rSrcPt, rSize );
1681 }
1682 
1683 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
long Width() const
bool mbJobActive
Definition: print.hxx:196
void SetPrinterSetupMode(PrinterSetupMode eMode)
Definition: jobset.cxx:156
PAPER_B1_ISO
virtual void ClipAndDrawGradientMetafile(const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly) override
Definition: print.cxx:1656
VclPtr< OutputDevice > mpNextGraphics
Next output device in list.
Definition: outdev.hxx:318
virtual SalGraphics * AcquireGraphics()=0
Bitmap GetMask() const
Definition: bitmapex.cxx:258
long GetWidth() const
virtual void ImplReleaseFonts() override
Definition: print.cxx:547
void SetReduceTransparency(bool bSet)
Definition: print.hxx:128
sal_uInt16 GetPaperBinCount() const
Definition: print.cxx:1506
PAPER_B9_ISO
PAPER_EXECUTIVE
const OUString & GetName() const
Definition: print.hxx:276
Orientation
Definition: Exif.hxx:25
long GetPaperWidth() const
Definition: jobset.h:82
long GetHeight() const
SalGraphics * mpJobGraphics
Definition: print.hxx:180
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
virtual int GetLandscapeAngle(const ImplJobSetup *pSetupData)=0
long GetPaperHeight() const
Definition: jobset.h:85
bool IsDisplayPrinter() const
Definition: print.hxx:279
PAPER_ENV_INVITE
long FRound(double fVal)
JobSetup maJobSetup
Definition: print.hxx:188
PAPER_SCREEN_16_10
bool SetPaperBin(sal_uInt16 nPaperBin)
Definition: print.cxx:1152
PAPER_KAI32BIG
long AdjustX(long nHorzMove)
PAPER_A9
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
Definition: svapp.cxx:732
sal_uInt16 GetPaperBin() const
Definition: print.cxx:1188
DuplexMode GetDuplexMode() const
Definition: print.cxx:1496
Size maPaperSize
Definition: print.hxx:190
PrinterCapType
Definition: prntypes.hxx:71
VCL_DLLPRIVATE void ImplInit(SalPrinterQueueInfo *pInfo)
Definition: print.cxx:617
const OUString & GetDriver() const
Definition: print.hxx:78
PAPER_ENV_12
std::vector< PaperInfo > m_aPaperFormats
Definition: salprn.hxx:54
virtual bool AcquireGraphics() const override
Acquire a graphics device that the output device uses to draw on.
Definition: print.cxx:475
long Height() const
void doSloppyFit()
std::unique_ptr< SalPrinterQueueInfo > mpSalQueueInfo
Definition: print.h:39
PAPER_LEGAL
void SetPDFAsStandardPrintJobFormat(bool bSet)
Definition: print.hxx:162
ImplSVAppData maAppData
Definition: svdata.hxx:352
PAPER_A1
VCL_DLLPRIVATE void ImplInitDisplay()
Definition: print.cxx:669
void disposeAndClear()
Definition: vclptr.hxx:200
static VCL_DLLPRIVATE SalPrinterQueueInfo * ImplGetQueueInfo(const OUString &rPrinterName, const OUString *pDriver)
Definition: print.cxx:770
VclPtr< OutputDevice > mpLastVirGraphics
Definition: svdata.hxx:175
void SetReduceGradients(bool bSet)
Definition: print.hxx:135
PAPER_KAI32
void SetPrinterSettingsPreferred(bool bPaperSizeFromSetup)
Definition: print.cxx:1200
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
const JobSetup & GetJobSetup() const
Definition: print.hxx:286
bool DrawTransformBitmapExDirect(const basegfx::B2DHomMatrix &aFullTransform, const BitmapEx &rBitmapEx) override
Transform and draw a bitmap directly.
Definition: print.cxx:183
virtual ~Printer() override
Definition: print.cxx:899
static OUString GetDefaultPrinterName()
Definition: print.cxx:436
VCL_DLLPRIVATE void ImplUpdateFontList()
Definition: print.cxx:827
QueueInfo()
Definition: print.cxx:331
PAPER_A7
std::shared_ptr< PhysicalFontCollection > mxFontCollection
Definition: outdev.hxx:322
void SetCopyCount(sal_uInt16 nCopy, bool bCollate)
Definition: print.cxx:1525
sal_Int32 mnDPIY
Definition: outdev.hxx:348
PAPER_ENV_C65
static void updatePrinters()
Checks the printer list and updates it necessary.
Definition: print.cxx:1614
std::unique_ptr< ImplDeviceFontSizeList > mpDeviceFontSizeList
Definition: outdev.hxx:324
void IntersectClipRegion(const tools::Rectangle &rRect)
void SetReducedGradientStepCount(sal_uInt16 nStepCount)
Definition: print.hxx:141
sal_Int32 mnDPIX
Definition: outdev.hxx:347
void EnableMapMode(bool bEnable=true)
Definition: map.cxx:647
Size GetSizePixel() const
bool mbMap
Definition: outdev.hxx:376
ImplFontMetricDataRef mxFontMetric
PAPER_16K_195x270
PAPER_SCREEN_4_3
std::unique_ptr< SalPrinter > mpPrinter
Definition: print.hxx:179
PrinterSetupMode
Definition: prntypes.hxx:85
const OUString & GetDriver() const
Definition: jobset.h:67
Orientation GetOrientation() const
Definition: print.cxx:1147
VCL_DLLPRIVATE void ImplInitData()
Definition: print.cxx:448
ImplSVGDIData maGDIData
Definition: svdata.hxx:353
PAPER_ENV_PERSONAL
PAPER_ARCHA
PAPER_KAI16
SAL_DLLPRIVATE const ImplJobSetup & ImplGetConstData() const
Definition: jobset.cxx:206
void Move(long nHorzMoveDelta, long nVertMoveDelta)
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:37
virtual void dispose() override
Definition: print.cxx:904
virtual OUString GetDefaultPrinter()=0
void SetDriverDataLen(sal_uInt32 nDriverDataLen)
Definition: jobset.cxx:141
DuplexMode GetDuplexMode() const
Definition: jobset.h:73
PAPER_D
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
sal_uInt32 mnJobs
Definition: print.hxx:72
SAL_DLLPRIVATE void InitLineColor()
bool mbCollateCopy
Definition: print.hxx:197
std::unique_ptr< ImplPrnQueueList > mpPrinterQueueList
Definition: svdata.hxx:181
void SetDuplexMode(DuplexMode)
Definition: print.cxx:1465
weld::Window * GetFrameWeld() const
Definition: window2.cxx:858
Paper
VclPtr< Printer > mpNext
Definition: print.hxx:182
DuplexMode
Definition: prntypes.hxx:28
sal_uInt16 mnPageQueueSize
Definition: print.hxx:192
void DrawDeviceBitmap(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel, BitmapEx &rBitmapEx) override
Definition: print.cxx:201
bool IsAlpha() const
Definition: bitmapex.cxx:226
static void ImplCallEventListenersApplicationDataChanged(void *pData)
Send event to all VCL application event listeners.
Definition: svapp.cxx:751
long Right() const
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize(JobSetup &, bool bMatchNearest)
Definition: print.cxx:1214
virtual bool Setup(weld::Window *pFrame, ImplJobSetup *pSetupData)=0
PAPER_ENV_14
PAPER_A6
virtual bool UsePolyPolygonForComplexGradient() override
Definition: print.cxx:1651
AntialiasingFlags mnAntialiasing
Definition: outdev.hxx:373
PAPER_A4
PAPER_ENV_DL
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
PrinterOptions()
Definition: print.cxx:92
VCL_DLLPRIVATE void ImplEndPage()
Definition: print.cxx:1596
void SetDuplexMode(DuplexMode eDuplexMode)
Definition: jobset.cxx:116
#define PRINTER_GENERALERROR
Definition: errcode.hxx:268
PAPER_A8
long Top() const
void SetDriverData(sal_uInt8 *pDriverData)
Definition: jobset.cxx:146
Application * GetpApp()
Definition: svapp.cxx:148
bool Blend(const AlphaMask &rAlpha, const Color &rBackgroundColor)
Alpha-blend the given bitmap against a specified uniform background color.
SAL_DLLPRIVATE ImplJobSetup & ImplGetData()
Definition: jobset.cxx:211
void ReadFromConfig(bool bFile)
Read printer options from configuration.
Definition: print.cxx:107
SAL_DLLPRIVATE void ImplPrintTransparent(const Bitmap &rBmp, const Bitmap &rMask, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel)
bool IsJobActive() const
Definition: print.hxx:341
PAPER_FANFOLD_DE
PAPER_A2
PAPER_C
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
Point maPageOffset
Definition: print.hxx:189
#define SAL_N_ELEMENTS(arr)
OUString GetPaperBinName(sal_uInt16 nPaperBin) const
Definition: print.cxx:1514
SalGraphics * mpGraphics
Graphics context to draw on.
Definition: outdev.hxx:316
VclPtr< VirtualDevice > mpDisplayDev
Definition: print.hxx:183
Bitmap GetBitmap(const Color *pTransReplaceColor=nullptr) const
Definition: bitmapex.cxx:236
bool SetPaperSizeUser(const Size &rSize)
Definition: print.cxx:1347
bool HasSupport(PrinterSupport eFeature) const
Definition: print.cxx:953
void SetReducedBitmapResolution(sal_uInt16 nResolution)
Definition: print.hxx:151
bool sloppyEqual(const PaperInfo &rOther) const
PAPER_LEDGER
PAPER_ENV_ITALY
PAPER_A5
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:67
VclPtr< Printer > mpFirstPrinter
Definition: svdata.hxx:180
PAPER_ARCHC
PAPER_ENV_C5
virtual bool HasMirroredGraphics() const override
Definition: print.cxx:324
void SetLineColor()
SAL_DLLPRIVATE void InitFillColor()
void clear()
Definition: vclptr.hxx:190
PAPER_ARCHE
PAPER_B0_ISO
void SetReducedBitmapMode(PrinterBitmapMode eMode)
Definition: print.hxx:148
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY)=0
bool GetPapersizeFromSetup() const
Definition: jobset.h:94
std::unordered_map< OUString, sal_Int32 > m_aNameToIndex
Definition: print.h:54
PAPER_10x14
void SetReducedBitmapIncludesTransparency(bool bSet)
Definition: print.hxx:155
sal_uInt16 mnModalMode
Definition: svdata.hxx:147
long getHeight() const
long AdjustY(long nVertMove)
bool TransformAndReduceBitmapExToTargetRange(const basegfx::B2DHomMatrix &aFullTransform, basegfx::B2DRange &aVisibleRange, double &fMaximumArea) override
Transform and reduce the area that needs to be drawn of the bitmap and return the new visible range a...
Definition: print.cxx:191
void SetOrientation(Orientation eOrientation)
Definition: jobset.cxx:111
virtual void ReleaseGraphics(SalGraphics *pGraphics)=0
PAPER_B3_ISO
virtual void dispose() override
Definition: outdev.cxx:141
PAPER_QUARTO
virtual void SetFontOrientation(LogicalFontInstance *const pFontInstance) const override
Definition: print.cxx:1666
const OUString & GetPrinterName() const
Definition: jobset.h:64
PAPER_9x11
std::unique_ptr< ImplDeviceFontList > mpDeviceFontList
Definition: outdev.hxx:323
PAPER_B4_ISO
PAPER_B10_ISO
const OUString & GetDriverName() const
Definition: print.hxx:277
PAPER_A0
int i
VCL_DLLPRIVATE void ImplStartPage()
Definition: print.cxx:1574
PAPER_ENV_C4
bool mbInitLineColor
Definition: outdev.hxx:384
const sal_uInt8 * GetDriverData() const
Definition: jobset.h:91
void SetFillColor()
bool mbNewFont
Definition: outdev.hxx:390
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
std::vector< OUString > m_aPrinterList
Definition: print.h:56
bool mbPrinting
Definition: print.hxx:195
ImplPrnQueueData * Get(const OUString &rPrinter)
Definition: print.cxx:371
std::unique_ptr< SalVirtualDevice > mpVirDev
Definition: virdev.hxx:48
long Bottom() const
vcl::Region CreateRegion(const Color &rColor, const tools::Rectangle &rRect) const
Create region of similar colors in a given rectangle.
BmpMirrorFlags
Definition: bitmap.hxx:36
const PaperInfo & GetPaperInfo(int nPaper) const
Definition: print.cxx:1448
void SetPapersizeFromSetup(bool bPapersizeFromSetup)
Definition: jobset.cxx:151
virtual OUString GetPaperBinName(const ImplJobSetup *pSetupData, sal_uInt16 nPaperBin)=0
bool mbNewJobSetup
Definition: print.hxx:200
long getWidth() const
void SetReduceBitmaps(bool bSet)
Definition: print.hxx:145
PAPER_POSTCARD_JP
RasterOp meRasterOp
Definition: outdev.hxx:368
OUString maDriver
Definition: salprn.hxx:40
Printer()
Definition: print.cxx:840
Orientation GetOrientation() const
Definition: jobset.h:70
OUString maDriver
Definition: print.hxx:186
bool mbInitTextColor
Definition: outdev.hxx:387
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:238
void SetReducedTransparencyMode(PrinterTransparencyMode eMode)
Definition: print.hxx:131
vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override
Perform actual rect clip against outdev dimensions, to generate empty clips whenever one of the value...
Definition: print.cxx:1671
PAPER_B_PLUS
virtual bool SetPrinterData(ImplJobSetup *pSetupData)=0
void DrawBitmap(const Point &rDestPt, const Bitmap &rBitmap)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool mbDefPrinter
Definition: print.hxx:194
Paper getPaper() const
void SetPaperWidth(long nWidth)
Definition: jobset.cxx:131
PAPER_ENV_MONARCH
long X() const
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize) override
Definition: print.cxx:299
PrintQueueFlags mnStatus
Definition: salprn.hxx:43
void ReleaseFonts()
Definition: salgdi.hxx:130
constexpr sal_uInt32 QUEUE_JOBS_DONTKNOW
Definition: prntypes.hxx:68
virtual void ReleaseGraphics(bool bRelease=true) override
Release the graphics device, and remove it from the graphics device list.
Definition: print.cxx:564
PAPER_B6_ISO
PAPER_TABLOID
static const std::vector< OUString > & GetPrinterQueues()
Definition: print.cxx:398
PAPER_LETTER_PLUS
void SetPaper(Paper ePaper)
Definition: print.cxx:1308
void SetConvertToGreyscales(bool bSet)
Definition: print.hxx:159
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData)=0
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const override
Definition: print.cxx:1676
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1185
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:940
std::vector< ImplPrnQueueData > m_aQueueInfos
Definition: print.h:55
PAPER_ARCHD
PAPER_ENV_C8
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
VclPtr< OutputDevice > mpPrevGraphics
Previous output device in list.
Definition: outdev.hxx:317
PAPER_ENV_C6
bool IsPrinting() const
Definition: print.hxx:339
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:331
sal_uInt16 GetPaperBin() const
Definition: jobset.h:76
def rectangle(l)
AlphaMask GetAlpha() const
Definition: bitmapex.cxx:268
bool Setup(weld::Window *pWindow, PrinterSetupMode eMode=PrinterSetupMode::DocumentGlobal)
Definition: print.cxx:993
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
PAPER_A10
VCL_DLLPRIVATE void ImplUpdatePageData()
Definition: print.cxx:814
PAPER_A_PLUS
PAPER_10x11
#define PRINTER_ABORT
Definition: errcode.hxx:267
void SetPaperBin(sal_uInt16 nPaperBin)
Definition: jobset.cxx:121
#define SAL_WARN_IF(condition, area, stream)
#define ERRCODE_NONE
Definition: errcode.hxx:198
VCL_DLLPRIVATE void EndJob()
Definition: print.cxx:1550
bool Convert(BmpConversion eConversion)
Convert bitmap format.
Definition: bitmap3.cxx:226
VclPtr< Printer > mpPrev
Definition: print.hxx:181
PAPER_A3
bool SetOrientation(Orientation eOrient)
Definition: print.cxx:1111
bool mbPrintFile
Definition: print.hxx:198
bool mbInitClipRegion
Definition: outdev.hxx:388
ErrCode mnError
Definition: print.hxx:191
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList)=0
SAL_DLLPRIVATE void ImplUpdateFontData()
OUString maPrinterName
Definition: print.hxx:185
PAPER_DOUBLEPOSTCARD_JP
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1659
int GetPaperInfoCount() const
Definition: print.cxx:1410
PAPER_ENV_9
VclPtr< OutputDevice > mpFirstVirGraphics
Definition: svdata.hxx:174
PAPER_ENV_11
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
std::shared_ptr< ImplFontCache > mxScreenFontCache
Definition: svdata.hxx:183
sal_uInt16 mnCopyCount
Definition: print.hxx:193
std::unique_ptr< QueueInfo > mpQueueInfo
Definition: print.h:38
PAPER_B5_ISO
PAPER_B5_JIS
short GetOrientation() const
PAPER_B6_JIS
void setAntiAliasB2DDraw(bool bNew)
Definition: salgdi.hxx:83
static VCL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL(SalPrinterError nError)
Definition: print.cxx:1531
bool IsEmpty() const
Definition: bitmap.hxx:551
void SetPrinterName(const OUString &rPrinterName)
Definition: jobset.cxx:101
Reference< XComponentContext > getProcessComponentContext()
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
Definition: print.cxx:406
PAPER_ENV_C3
PAPER_ENV_10
bool mbInitFont
Definition: outdev.hxx:386
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
void SetPaperHeight(long nHeight)
Definition: jobset.cxx:136
bool GetPrinterSettingsPreferred() const
Definition: print.cxx:1193
PAPER_SLIDE_DIA
PAPER_STATEMENT
long Left() const
rtl::Reference< LogicalFontInstance > mpFontInstance
Definition: outdev.hxx:320
virtual void CopyArea(const Point &rDestPt, const Point &rSrcPt, const Size &rSrcSize, bool bWindowInvalidate=false) override
Definition: print.cxx:312
virtual void GetPageInfo(const ImplJobSetup *pSetupData, long &rOutWidth, long &rOutHeight, Point &rPageOffset, Size &rPaperSize)=0
PAPER_ENV_C7
bool mbInitFillColor
Definition: outdev.hxx:385
virtual void InitPaperFormats(const ImplJobSetup *pSetupData)=0
PAPER_FANFOLD_LEGAL_DE
SalInfoPrinter * mpInfoPrinter
Definition: print.hxx:178
Paper GetPaperFormat() const
Definition: jobset.h:79
PAPER_A4_PLUS
void SetDriver(const OUString &rDriver)
Definition: jobset.cxx:106
long mnOutWidth
Definition: outdev.hxx:345
virtual sal_uInt16 GetPaperBinCount(const ImplJobSetup *pSetupData)=0
virtual void EmulateDrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent) override
Definition: print.cxx:222
Paper GetPaper() const
Definition: print.cxx:1501
VclPtr< OutputDevice > mpFirstPrnGraphics
Definition: svdata.hxx:176
virtual bool SetData(JobSetFlags nFlags, ImplJobSetup *pSetupData)=0
bool mbDevOutput
Definition: outdev.hxx:380
std::shared_ptr< ImplFontCache > mxFontCache
Definition: outdev.hxx:321
tools::Rectangle GetBoundRect() const
#define SAL_WARN(area, stream)
OUString VclResId(const char *pId)
Definition: svdata.cxx:258
bool m_bPapersInit
Definition: salprn.hxx:55
void SetPaperFormat(Paper ePaperFormat)
Definition: jobset.cxx:126
#define DBG_TESTSOLARMUTEX()
const OUString & GetPrinterName() const
Definition: print.hxx:77
sal_uInt16 GetBitCount() const
PAPER_12x11
bool mbInPrintPage
Definition: print.hxx:199
PAPER_B7_ISO
PAPER_E
VclPtr< OutputDevice > mpLastPrnGraphics
Definition: svdata.hxx:177
bool SetJobSetup(const JobSetup &rSetup)
Definition: print.cxx:972
virtual void DrawDeviceMask(const Bitmap &rMask, const Color &rMaskColor, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel) override
Definition: print.cxx:684
PAPER_B8_ISO
static OUString GetPaperName(Paper ePaper)
Definition: print.cxx:1419
PAPER_FANFOLD_US
bool Replace(const Bitmap &rMask, const Color &rReplaceColor)
Replace all pixel where the given mask is on with the specified color.
void SetReducedGradientMode(PrinterGradientMode eMode)
Definition: print.hxx:138
long mnOutHeight
Definition: outdev.hxx:346
virtual long GetGradientStepCount(long nMinRect) override
Definition: print.cxx:832
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
Definition: svdata.cxx:202
sal_uInt32 GetCapabilities(PrinterCapType nType) const
Definition: print.cxx:942
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:60
void DrawGradient(const tools::Rectangle &rRect, const Gradient &rGradient)
PAPER_USER
void setWidth(long nWidth)
PAPER_B2_ISO
PAPER_16K_197x273
virtual sal_uInt32 GetCapabilities(const ImplJobSetup *pSetupData, PrinterCapType nType)=0
std::shared_ptr< PhysicalFontCollection > mxScreenFontList
Definition: svdata.hxx:182
PAPER_LETTER
VCL_DLLPRIVATE void SetPrinterOptions(const PrinterOptions &rOptions)
SetPrinterOptions is used internally only now.
Definition: print.cxx:319
bool SetPrinterProps(const Printer *pPrinter)
Definition: print.cxx:1033
PrintQueueFlags mnStatus
Definition: print.hxx:71
#define SAL_MAX_INT64
OUString maPrintFile
Definition: print.hxx:187
SalInstance * mpDefInst
Definition: svdata.hxx:341
std::unique_ptr< PrinterOptions > mpPrinterOptions
Definition: print.hxx:184
PAPER_ENV_C2
PAPER_ARCHB
long Y() const
const Color & GetFillColor() const
Definition: outdev.hxx:623
std::unordered_map< int, OUString > maPaperNames
Definition: svdata.hxx:369
SalPrinterError
Definition: salptype.hxx:41
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:319
PAPER_15x11
PAPER_SCREEN_16_9
OUString maPrinterName
Definition: salprn.hxx:39
virtual void GetDevFontList(PhysicalFontCollection *)=0
PAPER_B4_JIS
sal_uInt32 mnJobs
Definition: salprn.hxx:44
Size GetPaperSize() const
Definition: print.hxx:330
virtual void DestroyInfoPrinter(SalInfoPrinter *pPrinter)=0
void setHeight(long nHeight)
virtual void GetPrinterQueueState(SalPrinterQueueInfo *pInfo)=0
void Add(std::unique_ptr< SalPrinterQueueInfo > pData)
Definition: print.cxx:351