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
92 PrinterOptions::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 )
161  SetReducedBitmapIncludesTransparency( bValue );
162  if( xSet->getPropertyValue("ConvertToGreyscales") >>= bValue )
163  SetConvertToGreyscales( bValue );
164  if( xSet->getPropertyValue("PDFAsStandardPrintJobFormat") >>= bValue )
165  SetPDFAsStandardPrintJobFormat( 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  Point aPageOffset = Point( 0, 0 ) - this->GetPageOffsetPixel();
322  Size aSize = this->GetPaperSizePixel();
323  return tools::Rectangle( aPageOffset, aSize );
324 }
325 
326 void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions )
327 {
328  *mpPrinterOptions = i_rOptions;
329 }
330 
332 {
333  // due to a "hotfix" for AOO bug i55719, this needs to return false
334  return false;
335 }
336 
337 // QueueInfo
338 QueueInfo::QueueInfo()
339 {
340  mnStatus = PrintQueueFlags::NONE;
341  mnJobs = 0;
342 }
343 
345 {
348 }
349 
351 {
352 }
353 
355 {
356 }
357 
358 void ImplPrnQueueList::Add( std::unique_ptr<SalPrinterQueueInfo> pData )
359 {
360  std::unordered_map< OUString, sal_Int32 >::iterator it =
361  m_aNameToIndex.find( pData->maPrinterName );
362  if( it == m_aNameToIndex.end() )
363  {
364  m_aNameToIndex[ pData->maPrinterName ] = m_aQueueInfos.size();
365  m_aPrinterList.push_back( pData->maPrinterName );
366  m_aQueueInfos.push_back( ImplPrnQueueData() );
367  m_aQueueInfos.back().mpQueueInfo = nullptr;
368  m_aQueueInfos.back().mpSalQueueInfo = std::move(pData);
369  }
370  else // this should not happen, but ...
371  {
372  ImplPrnQueueData& rData = m_aQueueInfos[ it->second ];
373  rData.mpQueueInfo.reset();
374  rData.mpSalQueueInfo = std::move(pData);
375  }
376 }
377 
378 ImplPrnQueueData* ImplPrnQueueList::Get( const OUString& rPrinter )
379 {
380  ImplPrnQueueData* pData = nullptr;
381  std::unordered_map<OUString,sal_Int32>::iterator it =
382  m_aNameToIndex.find( rPrinter );
383  if( it != m_aNameToIndex.end() )
384  pData = &m_aQueueInfos[it->second];
385  return pData;
386 }
387 
388 static void ImplInitPrnQueueList()
389 {
390  ImplSVData* pSVData = ImplGetSVData();
391 
392  pSVData->maGDIData.mpPrinterQueueList.reset(new ImplPrnQueueList);
393 
394  static const char* pEnv = getenv( "SAL_DISABLE_PRINTERLIST" );
395  if( !pEnv || !*pEnv )
396  pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList.get() );
397 }
398 
400 {
401  ImplSVData* pSVData = ImplGetSVData();
402  pSVData->maGDIData.mpPrinterQueueList.reset();
403 }
404 
405 const std::vector<OUString>& Printer::GetPrinterQueues()
406 {
407  ImplSVData* pSVData = ImplGetSVData();
408  if ( !pSVData->maGDIData.mpPrinterQueueList )
410  return pSVData->maGDIData.mpPrinterQueueList->m_aPrinterList;
411 }
412 
413 const QueueInfo* Printer::GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate )
414 {
415  ImplSVData* pSVData = ImplGetSVData();
416 
417  if ( !pSVData->maGDIData.mpPrinterQueueList )
419 
420  if ( !pSVData->maGDIData.mpPrinterQueueList )
421  return nullptr;
422 
423  ImplPrnQueueData* pInfo = pSVData->maGDIData.mpPrinterQueueList->Get( rPrinterName );
424  if( pInfo )
425  {
426  if( !pInfo->mpQueueInfo || bStatusUpdate )
427  pSVData->mpDefInst->GetPrinterQueueState( pInfo->mpSalQueueInfo.get() );
428 
429  if ( !pInfo->mpQueueInfo )
430  pInfo->mpQueueInfo.reset(new QueueInfo);
431 
432  pInfo->mpQueueInfo->maPrinterName = pInfo->mpSalQueueInfo->maPrinterName;
433  pInfo->mpQueueInfo->maDriver = pInfo->mpSalQueueInfo->maDriver;
434  pInfo->mpQueueInfo->maLocation = pInfo->mpSalQueueInfo->maLocation;
435  pInfo->mpQueueInfo->maComment = pInfo->mpSalQueueInfo->maComment;
436  pInfo->mpQueueInfo->mnStatus = pInfo->mpSalQueueInfo->mnStatus;
437  pInfo->mpQueueInfo->mnJobs = pInfo->mpSalQueueInfo->mnJobs;
438  return pInfo->mpQueueInfo.get();
439  }
440  return nullptr;
441 }
442 
444 {
445  static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" );
446  if( !pEnv || !*pEnv )
447  {
448  ImplSVData* pSVData = ImplGetSVData();
449 
450  return pSVData->mpDefInst->GetDefaultPrinter();
451  }
452  return OUString();
453 }
454 
456 {
457  mbDevOutput = false;
458  mbDefPrinter = false;
460  mnPageQueueSize = 0;
461  mnCopyCount = 1;
462  mbCollateCopy = false;
463  mbPrinting = false;
464  mbJobActive = false;
465  mbPrintFile = false;
466  mbInPrintPage = false;
467  mbNewJobSetup = false;
468  mpInfoPrinter = nullptr;
469  mpPrinter = nullptr;
470  mpDisplayDev = nullptr;
471  mpPrinterOptions.reset(new PrinterOptions);
472 
473  // Add printer to the list
474  ImplSVData* pSVData = ImplGetSVData();
475  mpNext = pSVData->maGDIData.mpFirstPrinter;
476  mpPrev = nullptr;
477  if ( mpNext )
478  mpNext->mpPrev = this;
479  pSVData->maGDIData.mpFirstPrinter = this;
480 }
481 
483 {
485 
486  if ( mpGraphics )
487  return true;
488 
489  mbInitLineColor = true;
490  mbInitFillColor = true;
491  mbInitFont = true;
492  mbInitTextColor = true;
493  mbInitClipRegion = true;
494 
495  ImplSVData* pSVData = ImplGetSVData();
496 
497  if ( mpJobGraphics )
499  else if ( mpDisplayDev )
500  {
501  const VirtualDevice* pVirDev = mpDisplayDev;
502  mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
503  // if needed retry after releasing least recently used virtual device graphics
504  while ( !mpGraphics )
505  {
506  if ( !pSVData->maGDIData.mpLastVirGraphics )
507  break;
509  mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
510  }
511  // update global LRU list of virtual device graphics
512  if ( mpGraphics )
513  {
515  pSVData->maGDIData.mpFirstVirGraphics = const_cast<Printer*>(this);
516  if ( mpNextGraphics )
517  mpNextGraphics->mpPrevGraphics = const_cast<Printer*>(this);
518  if ( !pSVData->maGDIData.mpLastVirGraphics )
519  pSVData->maGDIData.mpLastVirGraphics = const_cast<Printer*>(this);
520  }
521  }
522  else
523  {
525  // if needed retry after releasing least recently used printer graphics
526  while ( !mpGraphics )
527  {
528  if ( !pSVData->maGDIData.mpLastPrnGraphics )
529  break;
532  }
533  // update global LRU list of printer graphics
534  if ( mpGraphics )
535  {
537  pSVData->maGDIData.mpFirstPrnGraphics = const_cast<Printer*>(this);
538  if ( mpNextGraphics )
539  mpNextGraphics->mpPrevGraphics = const_cast<Printer*>(this);
540  if ( !pSVData->maGDIData.mpLastPrnGraphics )
541  pSVData->maGDIData.mpLastPrnGraphics = const_cast<Printer*>(this);
542  }
543  }
544 
545  if ( mpGraphics )
546  {
549  }
550 
551  return mpGraphics != nullptr;
552 }
553 
555 {
556 #ifdef UNX
557  // HACK to fix an urgent P1 printing issue fast
558  // WinSalPrinter does not respect GetGraphics/ReleaseGraphics conventions
559  // so Printer::mpGraphics often points to a dead WinSalGraphics
560  // TODO: fix WinSalPrinter's GetGraphics/ReleaseGraphics handling
562 #endif
563  mbNewFont = true;
564  mbInitFont = true;
565 
566  mpFontInstance.clear();
567  mpDeviceFontList.reset();
568  mpDeviceFontSizeList.reset();
569 }
570 
571 void Printer::ReleaseGraphics( bool bRelease )
572 {
574 
575  if ( !mpGraphics )
576  return;
577 
578  // release the fonts of the physically released graphics device
579  if( bRelease )
581 
582  ImplSVData* pSVData = ImplGetSVData();
583 
584  Printer* pPrinter = this;
585 
586  if ( !pPrinter->mpJobGraphics )
587  {
588  if ( pPrinter->mpDisplayDev )
589  {
590  VirtualDevice* pVirDev = pPrinter->mpDisplayDev;
591  if ( bRelease )
592  pVirDev->mpVirDev->ReleaseGraphics( mpGraphics );
593  // remove from global LRU list of virtual device graphics
594  if ( mpPrevGraphics )
596  else
598  if ( mpNextGraphics )
600  else
602  }
603  else
604  {
605  if ( bRelease )
607  // remove from global LRU list of printer graphics
608  if ( mpPrevGraphics )
610  else
612  if ( mpNextGraphics )
614  else
616  }
617  }
618 
619  mpGraphics = nullptr;
620  mpPrevGraphics = nullptr;
621  mpNextGraphics = nullptr;
622 }
623 
625 {
626  ImplSVData* pSVData = ImplGetSVData();
627  // #i74084# update info for this specific SalPrinterQueueInfo
628  pSVData->mpDefInst->GetPrinterQueueState( pInfo );
629 
630  // Test whether the driver actually matches the JobSetup
632  if ( rData.GetDriverData() )
633  {
634  if ( rData.GetPrinterName() != pInfo->maPrinterName ||
635  rData.GetDriver() != pInfo->maDriver )
636  {
637  std::free( const_cast<sal_uInt8*>(rData.GetDriverData()) );
638  rData.SetDriverData(nullptr);
639  rData.SetDriverDataLen(0);
640  }
641  }
642 
643  // Remember printer name
644  maPrinterName = pInfo->maPrinterName;
645  maDriver = pInfo->maDriver;
646 
647  // Add printer name to JobSetup
648  rData.SetPrinterName( maPrinterName );
649  rData.SetDriver( maDriver );
650 
651  mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, &rData );
652  mpPrinter = nullptr;
653  mpJobGraphics = nullptr;
655 
656  if ( !mpInfoPrinter )
657  {
658  ImplInitDisplay();
659  return;
660  }
661 
662  // we need a graphics
663  if ( !AcquireGraphics() )
664  {
665  ImplInitDisplay();
666  return;
667  }
668 
669  // Init data
671  mxFontCollection = std::make_shared<PhysicalFontCollection>();
672  mxFontCache = std::make_shared<ImplFontCache>();
674 }
675 
677 {
678  ImplSVData* pSVData = ImplGetSVData();
679 
680  mpInfoPrinter = nullptr;
681  mpPrinter = nullptr;
682  mpJobGraphics = nullptr;
683 
687  mnDPIX = mpDisplayDev->mnDPIX;
688  mnDPIY = mpDisplayDev->mnDPIY;
689 }
690 
691 void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
692  const Point& rDestPt, const Size& rDestSize,
693  const Point& rSrcPtPixel, const Size& rSrcSizePixel )
694 {
695  Point aDestPt( LogicToPixel( rDestPt ) );
696  Size aDestSz( LogicToPixel( rDestSize ) );
697  tools::Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
698 
699  aSrcRect.Justify();
700 
701  if( !(!rMask.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height()) )
702  return;
703 
704  Bitmap aMask( rMask );
706 
707  if( aMask.GetBitCount() > 1 )
709 
710  // mirrored horizontically
711  if( aDestSz.Width() < 0 )
712  {
713  aDestSz.setWidth( -aDestSz.Width() );
714  aDestPt.AdjustX( -( aDestSz.Width() - 1 ) );
715  nMirrFlags |= BmpMirrorFlags::Horizontal;
716  }
717 
718  // mirrored vertically
719  if( aDestSz.Height() < 0 )
720  {
721  aDestSz.setHeight( -aDestSz.Height() );
722  aDestPt.AdjustY( -( aDestSz.Height() - 1 ) );
723  nMirrFlags |= BmpMirrorFlags::Vertical;
724  }
725 
726  // source cropped?
727  if( aSrcRect != tools::Rectangle( Point(), aMask.GetSizePixel() ) )
728  aMask.Crop( aSrcRect );
729 
730  // destination mirrored
731  if( nMirrFlags != BmpMirrorFlags::NONE)
732  aMask.Mirror( nMirrFlags );
733 
734  // do painting
735  const long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
736  long nX, nY; //, nWorkX, nWorkY, nWorkWidth, nWorkHeight;
737  std::unique_ptr<long[]> pMapX( new long[ nSrcWidth + 1 ] );
738  std::unique_ptr<long[]> pMapY( new long[ nSrcHeight + 1 ] );
739  GDIMetaFile* pOldMetaFile = mpMetaFile;
740  const bool bOldMap = mbMap;
741 
742  mpMetaFile = nullptr;
743  mbMap = false;
745  SetLineColor( rMaskColor );
746  SetFillColor( rMaskColor );
747  InitLineColor();
748  InitFillColor();
749 
750  // create forward mapping tables
751  for( nX = 0; nX <= nSrcWidth; nX++ )
752  pMapX[ nX ] = aDestPt.X() + FRound( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
753 
754  for( nY = 0; nY <= nSrcHeight; nY++ )
755  pMapY[ nY ] = aDestPt.Y() + FRound( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
756 
757  // walk through all rectangles of mask
758  const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
759  RectangleVector aRectangles;
760  aWorkRgn.GetRegionRectangles(aRectangles);
761 
762  for (auto const& rectangle : aRectangles)
763  {
764  const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
765  const Size aMapSz(
766  pMapX[rectangle.Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
767  pMapY[rectangle.Bottom() + 1] - aMapPt.Y()); // same for Y
768 
769  DrawRect(tools::Rectangle(aMapPt, aMapSz));
770  }
771 
772  Pop();
773  mbMap = bOldMap;
774  mpMetaFile = pOldMetaFile;
775 }
776 
777 SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
778  const OUString* pDriver )
779 {
780  ImplSVData* pSVData = ImplGetSVData();
781  if ( !pSVData->maGDIData.mpPrinterQueueList )
783 
784  ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList.get();
785  if ( pPrnList && !pPrnList->m_aQueueInfos.empty() )
786  {
787  // first search for the printer name directly
788  ImplPrnQueueData* pInfo = pPrnList->Get( rPrinterName );
789  if( pInfo )
790  return pInfo->mpSalQueueInfo.get();
791 
792  // then search case insensitive
793  for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
794  {
795  if( rQueueInfo.mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
796  return rQueueInfo.mpSalQueueInfo.get();
797  }
798 
799  // then search for driver name
800  if ( pDriver )
801  {
802  for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
803  {
804  if( rQueueInfo.mpSalQueueInfo->maDriver == *pDriver )
805  return rQueueInfo.mpSalQueueInfo.get();
806  }
807  }
808 
809  // then the default printer
810  pInfo = pPrnList->Get( GetDefaultPrinterName() );
811  if( pInfo )
812  return pInfo->mpSalQueueInfo.get();
813 
814  // last chance: the first available printer
815  return pPrnList->m_aQueueInfos[0].mpSalQueueInfo.get();
816  }
817 
818  return nullptr;
819 }
820 
822 {
823  // we need a graphics
824  if ( !AcquireGraphics() )
825  return;
826 
830  maPageOffset,
831  maPaperSize );
832 }
833 
835 {
837 }
838 
839 long Printer::GetGradientStepCount( long nMinRect )
840 {
841  // use display-equivalent step size calculation
842  long nInc = (nMinRect < 800) ? 10 : 20;
843 
844  return nInc;
845 }
846 
849 {
850  ImplInitData();
852  if ( pInfo )
853  {
854  ImplInit( pInfo );
855  if ( !IsDisplayPrinter() )
856  mbDefPrinter = true;
857  }
858  else
859  ImplInitDisplay();
860 }
861 
862 Printer::Printer( const JobSetup& rJobSetup )
864  , maJobSetup(rJobSetup)
865 {
866  ImplInitData();
867  const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
868  OUString aDriver = rConstData.GetDriver();
869  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rConstData.GetPrinterName(),
870  &aDriver );
871  if ( pInfo )
872  {
873  ImplInit( pInfo );
874  SetJobSetup( rJobSetup );
875  }
876  else
877  {
878  ImplInitDisplay();
879  maJobSetup = JobSetup();
880  }
881 }
882 
883 Printer::Printer( const QueueInfo& rQueueInfo )
885 {
886  ImplInitData();
887  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rQueueInfo.GetPrinterName(),
888  &rQueueInfo.GetDriver() );
889  if ( pInfo )
890  ImplInit( pInfo );
891  else
892  ImplInitDisplay();
893 }
894 
895 Printer::Printer( const OUString& rPrinterName )
897 {
898  ImplInitData();
899  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rPrinterName, nullptr );
900  if ( pInfo )
901  ImplInit( pInfo );
902  else
903  ImplInitDisplay();
904 }
905 
907 {
908  disposeOnce();
909 }
910 
912 {
913  SAL_WARN_IF( IsPrinting(), "vcl.gdi", "Printer::~Printer() - Job is printing" );
914  SAL_WARN_IF( IsJobActive(), "vcl.gdi", "Printer::~Printer() - Job is active" );
915 
916  mpPrinterOptions.reset();
917 
918  ReleaseGraphics();
919  if ( mpInfoPrinter )
921  if ( mpDisplayDev )
923  else
924  {
925  // OutputDevice Dtor is trying the same thing; that why we need to set
926  // the FontEntry to NULL here
927  // TODO: consolidate duplicate cleanup by Printer and OutputDevice
928  mpFontInstance.clear();
929  mpDeviceFontList.reset();
930  mpDeviceFontSizeList.reset();
931  mxFontCache.reset();
932  // font list deleted by OutputDevice dtor
933  }
934 
935  // Add printer from the list
936  ImplSVData* pSVData = ImplGetSVData();
937  if ( mpPrev )
938  mpPrev->mpNext = mpNext;
939  else
940  pSVData->maGDIData.mpFirstPrinter = mpNext;
941  if ( mpNext )
942  mpNext->mpPrev = mpPrev;
943 
944  mpPrev.clear();
945  mpNext.clear();
947 }
948 
949 sal_uInt32 Printer::GetCapabilities( PrinterCapType nType ) const
950 {
951  if ( IsDisplayPrinter() )
952  return 0;
953 
954  if( mpInfoPrinter )
956  else
957  return 0;
958 }
959 
960 bool Printer::HasSupport( PrinterSupport eFeature ) const
961 {
962  switch ( eFeature )
963  {
974  }
975 
976  return true;
977 }
978 
979 bool Printer::SetJobSetup( const JobSetup& rSetup )
980 {
981  if ( IsDisplayPrinter() || mbInPrintPage )
982  return false;
983 
984  JobSetup aJobSetup = rSetup;
985 
986  ReleaseGraphics();
987  if ( mpInfoPrinter->SetPrinterData( &aJobSetup.ImplGetData() ) )
988  {
989  ImplUpdateJobSetupPaper( aJobSetup );
990  mbNewJobSetup = true;
991  maJobSetup = aJobSetup;
994  return true;
995  }
996 
997  return false;
998 }
999 
1001 {
1002  if ( IsDisplayPrinter() )
1003  return false;
1004 
1005  if ( IsJobActive() || IsPrinting() )
1006  return false;
1007 
1008  JobSetup aJobSetup = maJobSetup;
1009  ImplJobSetup& rData = aJobSetup.ImplGetData();
1010  rData.SetPrinterSetupMode( eMode );
1011  // TODO: orig page size
1012 
1013  if (!pWindow)
1014  {
1015  vcl::Window* pDefWin = ImplGetDefaultWindow();
1016  pWindow = pDefWin ? pDefWin->GetFrameWeld() : nullptr;
1017  }
1018  if( !pWindow )
1019  return false;
1020 
1021  ReleaseGraphics();
1022  ImplSVData* pSVData = ImplGetSVData();
1023  pSVData->maAppData.mnModalMode++;
1024  nImplSysDialog++;
1025  bool bSetup = mpInfoPrinter->Setup(pWindow, &rData);
1026  pSVData->maAppData.mnModalMode--;
1027  nImplSysDialog--;
1028  if ( bSetup )
1029  {
1030  ImplUpdateJobSetupPaper( aJobSetup );
1031  mbNewJobSetup = true;
1032  maJobSetup = aJobSetup;
1035  return true;
1036  }
1037  return false;
1038 }
1039 
1040 bool Printer::SetPrinterProps( const Printer* pPrinter )
1041 {
1042  if ( IsJobActive() || IsPrinting() )
1043  return false;
1044 
1045  ImplSVData* pSVData = ImplGetSVData();
1046 
1047  mbDefPrinter = pPrinter->mbDefPrinter;
1048  maPrintFile = pPrinter->maPrintFile;
1049  mbPrintFile = pPrinter->mbPrintFile;
1050  mnCopyCount = pPrinter->mnCopyCount;
1051  mbCollateCopy = pPrinter->mbCollateCopy;
1052  mnPageQueueSize = pPrinter->mnPageQueueSize;
1053  *mpPrinterOptions = *pPrinter->mpPrinterOptions;
1054 
1055  if ( pPrinter->IsDisplayPrinter() )
1056  {
1057  // Destroy old printer
1058  if ( !IsDisplayPrinter() )
1059  {
1060  ReleaseGraphics();
1062  mpFontInstance.clear();
1063  mpDeviceFontList.reset();
1064  mpDeviceFontSizeList.reset();
1065  // clean up font list
1066  mxFontCache.reset();
1067  mxFontCollection.reset();
1068 
1069  mbInitFont = true;
1070  mbNewFont = true;
1071  mpInfoPrinter = nullptr;
1072  }
1073 
1074  // Construct new printer
1075  ImplInitDisplay();
1076  return true;
1077  }
1078 
1079  // Destroy old printer?
1080  if ( GetName() != pPrinter->GetName() )
1081  {
1082  ReleaseGraphics();
1083  if ( mpDisplayDev )
1084  {
1086  }
1087  else
1088  {
1090 
1091  mpFontInstance.clear();
1092  mpDeviceFontList.reset();
1093  mpDeviceFontSizeList.reset();
1094  mxFontCache.reset();
1095  mxFontCollection.reset();
1096  mbInitFont = true;
1097  mbNewFont = true;
1098  mpInfoPrinter = nullptr;
1099  }
1100 
1101  // Construct new printer
1102  OUString aDriver = pPrinter->GetDriverName();
1103  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( pPrinter->GetName(), &aDriver );
1104  if ( pInfo )
1105  {
1106  ImplInit( pInfo );
1107  SetJobSetup( pPrinter->GetJobSetup() );
1108  }
1109  else
1110  ImplInitDisplay();
1111  }
1112  else
1113  SetJobSetup( pPrinter->GetJobSetup() );
1114 
1115  return false;
1116 }
1117 
1119 {
1120  if ( mbInPrintPage )
1121  return false;
1122 
1123  if ( maJobSetup.ImplGetConstData().GetOrientation() != eOrientation )
1124  {
1125  JobSetup aJobSetup = maJobSetup;
1126  ImplJobSetup& rData = aJobSetup.ImplGetData();
1127 
1128  rData.SetOrientation(eOrientation);
1129 
1130  if ( IsDisplayPrinter() )
1131  {
1132  mbNewJobSetup = true;
1133  maJobSetup = aJobSetup;
1134  return true;
1135  }
1136 
1137  ReleaseGraphics();
1139  {
1140  ImplUpdateJobSetupPaper( aJobSetup );
1141  mbNewJobSetup = true;
1142  maJobSetup = aJobSetup;
1145  return true;
1146  }
1147  else
1148  return false;
1149  }
1150 
1151  return true;
1152 }
1153 
1155 {
1157 }
1158 
1159 bool Printer::SetPaperBin( sal_uInt16 nPaperBin )
1160 {
1161  if ( mbInPrintPage )
1162  return false;
1163 
1164  if ( maJobSetup.ImplGetConstData().GetPaperBin() != nPaperBin &&
1165  nPaperBin < GetPaperBinCount() )
1166  {
1167  JobSetup aJobSetup = maJobSetup;
1168  ImplJobSetup& rData = aJobSetup.ImplGetData();
1169  rData.SetPaperBin(nPaperBin);
1170 
1171  if ( IsDisplayPrinter() )
1172  {
1173  mbNewJobSetup = true;
1174  maJobSetup = aJobSetup;
1175  return true;
1176  }
1177 
1178  ReleaseGraphics();
1179  if ( mpInfoPrinter->SetData( JobSetFlags::PAPERBIN, &rData ) )
1180  {
1181  ImplUpdateJobSetupPaper( aJobSetup );
1182  mbNewJobSetup = true;
1183  maJobSetup = aJobSetup;
1186  return true;
1187  }
1188  else
1189  return false;
1190  }
1191 
1192  return true;
1193 }
1194 
1195 sal_uInt16 Printer::GetPaperBin() const
1196 {
1198 }
1199 
1201 {
1203 }
1204 
1205 // dear loplugins, DO NOT REMOVE this code
1206 // it will be used in follow-up commits
1207 void Printer::SetPrinterSettingsPreferred( bool bPaperSizeFromSetup)
1208 {
1209  if ( maJobSetup.ImplGetConstData().GetPapersizeFromSetup() != bPaperSizeFromSetup )
1210  {
1211  JobSetup aJobSetup = maJobSetup;
1212  ImplJobSetup& rData = aJobSetup.ImplGetData();
1213  rData.SetPapersizeFromSetup(bPaperSizeFromSetup);
1214 
1215  mbNewJobSetup = true;
1216  maJobSetup = aJobSetup;
1217  }
1218 }
1219 
1220 // Map user paper format to an available printer paper format
1221 void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest )
1222 {
1223  ImplJobSetup& rData = aJobSetup.ImplGetData();
1224 
1225  // The angle that a landscape page will be turned counterclockwise wrt to portrait.
1226  int nLandscapeAngle = mpInfoPrinter ? mpInfoPrinter->GetLandscapeAngle( &maJobSetup.ImplGetConstData() ) : 900;
1227 
1228  int nPaperCount = GetPaperInfoCount();
1229  bool bFound = false;
1230 
1231  PaperInfo aInfo(rData.GetPaperWidth(), rData.GetPaperHeight());
1232 
1233  // Compare all paper formats and get the appropriate one
1234  for ( int i = 0; i < nPaperCount; i++ )
1235  {
1236  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1237 
1238  if ( aInfo.sloppyEqual(rPaperInfo) )
1239  {
1240  rData.SetPaperFormat(
1241  ImplGetPaperFormat( rPaperInfo.getWidth(),
1242  rPaperInfo.getHeight() ));
1244  bFound = true;
1245  break;
1246  }
1247  }
1248 
1249  // If the printer supports landscape orientation, check paper sizes again
1250  // with landscape orientation. This is necessary as a printer driver provides
1251  // all paper sizes with portrait orientation only!!
1252  if ( rData.GetPaperFormat() == PAPER_USER &&
1253  nLandscapeAngle != 0 &&
1255  {
1256  const long nRotatedWidth = rData.GetPaperHeight();
1257  const long nRotatedHeight = rData.GetPaperWidth();
1258  PaperInfo aRotatedInfo(nRotatedWidth, nRotatedHeight);
1259 
1260  for ( int i = 0; i < nPaperCount; i++ )
1261  {
1262  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1263 
1264  if ( aRotatedInfo.sloppyEqual( rPaperInfo ) )
1265  {
1266  rData.SetPaperFormat(
1267  ImplGetPaperFormat( rPaperInfo.getWidth(),
1268  rPaperInfo.getHeight() ));
1270  bFound = true;
1271  break;
1272  }
1273  }
1274  }
1275 
1276  if( ! bFound && bMatchNearest )
1277  {
1278  sal_Int64 nBestMatch = SAL_MAX_INT64;
1279  int nBestIndex = 0;
1280  Orientation eBestOrientation = Orientation::Portrait;
1281  for( int i = 0; i < nPaperCount; i++ )
1282  {
1283  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1284 
1285  // check portrait match
1286  sal_Int64 nDX = rData.GetPaperWidth() - rPaperInfo.getWidth();
1287  sal_Int64 nDY = rData.GetPaperHeight() - rPaperInfo.getHeight();
1288  sal_Int64 nMatch = nDX*nDX + nDY*nDY;
1289  if( nMatch < nBestMatch )
1290  {
1291  nBestMatch = nMatch;
1292  nBestIndex = i;
1293  eBestOrientation = Orientation::Portrait;
1294  }
1295 
1296  // check landscape match
1297  nDX = rData.GetPaperWidth() - rPaperInfo.getHeight();
1298  nDY = rData.GetPaperHeight() - rPaperInfo.getWidth();
1299  nMatch = nDX*nDX + nDY*nDY;
1300  if( nMatch < nBestMatch )
1301  {
1302  nBestMatch = nMatch;
1303  nBestIndex = i;
1304  eBestOrientation = Orientation::Landscape;
1305  }
1306  }
1307  const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex );
1308  rData.SetPaperFormat(
1309  ImplGetPaperFormat( rBestInfo.getWidth(),
1310  rBestInfo.getHeight() ));
1311  rData.SetOrientation(eBestOrientation);
1312  }
1313 }
1314 
1315 void Printer::SetPaper( Paper ePaper )
1316 {
1317  if ( mbInPrintPage )
1318  return;
1319 
1320  if ( maJobSetup.ImplGetConstData().GetPaperFormat() != ePaper )
1321  {
1322  JobSetup aJobSetup = maJobSetup;
1323  ImplJobSetup& rData = aJobSetup.ImplGetData();
1324 
1325  rData.SetPaperFormat( ePaper );
1326  if ( ePaper != PAPER_USER )
1327  {
1328  PaperInfo aInfo(ePaper);
1329  rData.SetPaperWidth( aInfo.getWidth() );
1330  rData.SetPaperHeight( aInfo.getHeight() );
1331  }
1332 
1333  if ( IsDisplayPrinter() )
1334  {
1335  mbNewJobSetup = true;
1336  maJobSetup = aJobSetup;
1337  return;
1338  }
1339 
1340  ReleaseGraphics();
1341  if ( ePaper == PAPER_USER )
1342  ImplFindPaperFormatForUserSize( aJobSetup, false );
1344  {
1345  ImplUpdateJobSetupPaper( aJobSetup );
1346  mbNewJobSetup = true;
1347  maJobSetup = aJobSetup;
1350  }
1351  }
1352 }
1353 
1354 bool Printer::SetPaperSizeUser( const Size& rSize )
1355 {
1356  return SetPaperSizeUser( rSize, false );
1357 }
1358 
1359 bool Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest )
1360 {
1361  if ( mbInPrintPage )
1362  return false;
1363 
1364  const Size aPixSize = LogicToPixel( rSize );
1365  const Size aPageSize = PixelToLogic(aPixSize, MapMode(MapUnit::Map100thMM));
1366  bool bNeedToChange(maJobSetup.ImplGetConstData().GetPaperWidth() != aPageSize.Width() ||
1367  maJobSetup.ImplGetConstData().GetPaperHeight() != aPageSize.Height());
1368 
1369  if(!bNeedToChange)
1370  {
1371  // #i122984# only need to change when Paper is different from PAPER_USER and
1372  // the mapped Paper which will created below in the call to ImplFindPaperFormatForUserSize
1373  // and will replace maJobSetup.ImplGetConstData()->GetPaperFormat(). This leads to
1374  // unnecessary JobSetups, e.g. when printing a multi-page fax, but also with
1375  // normal print
1376  const Paper aPaper = ImplGetPaperFormat(aPageSize.Width(), aPageSize.Height());
1377 
1378  bNeedToChange = maJobSetup.ImplGetConstData().GetPaperFormat() != PAPER_USER &&
1380  }
1381 
1382  if(bNeedToChange)
1383  {
1384  JobSetup aJobSetup = maJobSetup;
1385  ImplJobSetup& rData = aJobSetup.ImplGetData();
1386  rData.SetPaperFormat( PAPER_USER );
1387  rData.SetPaperWidth( aPageSize.Width() );
1388  rData.SetPaperHeight( aPageSize.Height() );
1389 
1390  if ( IsDisplayPrinter() )
1391  {
1392  mbNewJobSetup = true;
1393  maJobSetup = aJobSetup;
1394  return true;
1395  }
1396 
1397  ReleaseGraphics();
1398  ImplFindPaperFormatForUserSize( aJobSetup, bMatchNearest );
1399 
1400  // Changing the paper size can also change the orientation!
1402  {
1403  ImplUpdateJobSetupPaper( aJobSetup );
1404  mbNewJobSetup = true;
1405  maJobSetup = aJobSetup;
1408  return true;
1409  }
1410  else
1411  return false;
1412  }
1413 
1414  return true;
1415 }
1416 
1418 {
1419  if( ! mpInfoPrinter )
1420  return 0;
1421  if( ! mpInfoPrinter->m_bPapersInit )
1423  return mpInfoPrinter->m_aPaperFormats.size();
1424 }
1425 
1426 OUString Printer::GetPaperName( Paper ePaper )
1427 {
1428  ImplSVData* pSVData = ImplGetSVData();
1429  if( pSVData->maPaperNames.empty() )
1430  {
1431  static const int PaperIndex[] =
1432  {
1445  };
1446  assert(SAL_N_ELEMENTS(PaperIndex) == SAL_N_ELEMENTS(RID_STR_PAPERNAMES) && "localized paper name count wrong");
1447  for (size_t i = 0; i < SAL_N_ELEMENTS(PaperIndex); ++i)
1448  pSVData->maPaperNames[PaperIndex[i]] = VclResId(RID_STR_PAPERNAMES[i]);
1449  }
1450 
1451  std::unordered_map<int,OUString>::const_iterator it = pSVData->maPaperNames.find( static_cast<int>(ePaper) );
1452  return (it != pSVData->maPaperNames.end()) ? it->second : OUString();
1453 }
1454 
1455 const PaperInfo& Printer::GetPaperInfo( int nPaper ) const
1456 {
1457  if( ! mpInfoPrinter )
1458  return ImplGetEmptyPaper();
1459  if( ! mpInfoPrinter->m_bPapersInit )
1461  if( mpInfoPrinter->m_aPaperFormats.empty() || nPaper < 0 || nPaper >= int(mpInfoPrinter->m_aPaperFormats.size()) )
1462  return ImplGetEmptyPaper();
1463  return mpInfoPrinter->m_aPaperFormats[nPaper];
1464 }
1465 
1467 {
1468  PaperInfo aInfo = GetPaperInfo( nPaper );
1469  return PixelToLogic( Size( aInfo.getWidth(), aInfo.getHeight() ) );
1470 }
1471 
1473 {
1474  if ( mbInPrintPage )
1475  return;
1476 
1477  if ( maJobSetup.ImplGetConstData().GetDuplexMode() != eDuplex )
1478  {
1479  JobSetup aJobSetup = maJobSetup;
1480  ImplJobSetup& rData = aJobSetup.ImplGetData();
1481 
1482  rData.SetDuplexMode( eDuplex );
1483 
1484  if ( IsDisplayPrinter() )
1485  {
1486  mbNewJobSetup = true;
1487  maJobSetup = aJobSetup;
1488  return;
1489  }
1490 
1491  ReleaseGraphics();
1492  if ( mpInfoPrinter->SetData( JobSetFlags::DUPLEXMODE, &rData ) )
1493  {
1494  ImplUpdateJobSetupPaper( aJobSetup );
1495  mbNewJobSetup = true;
1496  maJobSetup = aJobSetup;
1499  }
1500  }
1501 }
1502 
1504 {
1506 }
1507 
1509 {
1511 }
1512 
1513 sal_uInt16 Printer::GetPaperBinCount() const
1514 {
1515  if ( IsDisplayPrinter() )
1516  return 0;
1517 
1519 }
1520 
1521 OUString Printer::GetPaperBinName( sal_uInt16 nPaperBin ) const
1522 {
1523  if ( IsDisplayPrinter() )
1524  return OUString();
1525 
1526  if ( nPaperBin < GetPaperBinCount() )
1527  return mpInfoPrinter->GetPaperBinName( &maJobSetup.ImplGetConstData(), nPaperBin );
1528  else
1529  return OUString();
1530 }
1531 
1532 void Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate )
1533 {
1534  mnCopyCount = nCopy;
1535  mbCollateCopy = bCollate;
1536 }
1537 
1539 {
1540  ErrCode nVCLError;
1541  switch ( nError )
1542  {
1543  case SalPrinterError::NONE:
1544  nVCLError = ERRCODE_NONE;
1545  break;
1547  nVCLError = PRINTER_ABORT;
1548  break;
1549  default:
1550  nVCLError = PRINTER_GENERALERROR;
1551  break;
1552  }
1553 
1554  return nVCLError;
1555 }
1556 
1558 {
1559  if ( !IsJobActive() )
1560  return;
1561 
1562  SAL_WARN_IF( mbInPrintPage, "vcl.gdi", "Printer::EndJob() - StartPage() without EndPage() called" );
1563 
1564  mbJobActive = false;
1565 
1566  if ( mpPrinter )
1567  {
1568  ReleaseGraphics();
1569 
1570  mbPrinting = false;
1571 
1572  mbDevOutput = false;
1573  mpPrinter->EndJob();
1574  mpPrinter.reset();
1575  }
1576 }
1577 
1579 {
1580  if ( !IsJobActive() )
1581  return;
1582 
1583  if ( mpPrinter )
1584  {
1585  SalGraphics* pGraphics = mpPrinter->StartPage( &maJobSetup.ImplGetData(),
1586  mbNewJobSetup );
1587  if ( pGraphics )
1588  {
1589  ReleaseGraphics();
1590  mpJobGraphics = pGraphics;
1591  }
1592  mbDevOutput = true;
1593 
1594  // PrintJob not aborted ???
1595  if ( IsJobActive() )
1596  mbInPrintPage = true;
1597  }
1598 }
1599 
1601 {
1602  if ( !IsJobActive() )
1603  return;
1604 
1605  mbInPrintPage = false;
1606 
1607  if ( mpPrinter )
1608  {
1609  mpPrinter->EndPage();
1610  ReleaseGraphics();
1611  mbDevOutput = false;
1612 
1613  mpJobGraphics = nullptr;
1614  mbNewJobSetup = false;
1615  }
1616 }
1617 
1619 {
1620  ImplSVData* pSVData = ImplGetSVData();
1621  ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList.get();
1622 
1623  if ( pPrnList )
1624  {
1625  std::unique_ptr<ImplPrnQueueList> pNewList(new ImplPrnQueueList);
1626  pSVData->mpDefInst->GetPrinterQueueInfo( pNewList.get() );
1627 
1628  bool bChanged = pPrnList->m_aQueueInfos.size() != pNewList->m_aQueueInfos.size();
1629  for( decltype(pPrnList->m_aQueueInfos)::size_type i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ )
1630  {
1631  ImplPrnQueueData& rInfo = pPrnList->m_aQueueInfos[i];
1632  ImplPrnQueueData& rNewInfo = pNewList->m_aQueueInfos[i];
1633  if( ! rInfo.mpSalQueueInfo || ! rNewInfo.mpSalQueueInfo || // sanity check
1634  rInfo.mpSalQueueInfo->maPrinterName != rNewInfo.mpSalQueueInfo->maPrinterName )
1635  {
1636  bChanged = true;
1637  }
1638  }
1639  if( bChanged )
1640  {
1642  pSVData->maGDIData.mpPrinterQueueList = std::move(pNewList);
1643 
1644  Application* pApp = GetpApp();
1645  if( pApp )
1646  {
1650  }
1651  }
1652  }
1653 }
1654 
1656 {
1657  return true;
1658 }
1659 
1660 void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly )
1661 {
1662  const tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
1663 
1665  IntersectClipRegion(vcl::Region(rPolyPoly));
1666  DrawGradient( aBoundRect, rGradient );
1667  Pop();
1668 }
1669 
1670 void Printer::SetFontOrientation( LogicalFontInstance* const pFontEntry ) const
1671 {
1672  pFontEntry->mnOrientation = pFontEntry->mxFontMetric->GetOrientation();
1673 }
1674 
1676 {
1677  return aRegion;
1678 }
1679 
1680 Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
1681 {
1682  SAL_WARN("vcl.gdi", "GetBitmap(): This should never be called on by a Printer instance");
1683 
1684  return OutputDevice::GetBitmap( rSrcPt, rSize );
1685 }
1686 
1687 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point TopLeft() const
long Width() const
bool mbJobActive
Definition: print.hxx:197
void SetPrinterSetupMode(PrinterSetupMode eMode)
Definition: jobset.cxx:160
PAPER_B1_ISO
virtual void ClipAndDrawGradientMetafile(const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly) override
Definition: print.cxx:1660
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:554
sal_uInt16 GetPaperBinCount() const
Definition: print.cxx:1513
PAPER_B9_ISO
PAPER_EXECUTIVE
const OUString & GetName() const
Definition: print.hxx:277
long GetPaperWidth() const
Definition: jobset.h:82
long GetHeight() const
SalGraphics * mpJobGraphics
Definition: print.hxx:181
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
virtual tools::Rectangle SetBackgroundComponentBounds() override
Definition: print.cxx:319
virtual int GetLandscapeAngle(const ImplJobSetup *pSetupData)=0
long GetPaperHeight() const
Definition: jobset.h:85
bool IsDisplayPrinter() const
Definition: print.hxx:280
PAPER_ENV_INVITE
long FRound(double fVal)
JobSetup maJobSetup
Definition: print.hxx:189
PAPER_SCREEN_16_10
bool SetPaperBin(sal_uInt16 nPaperBin)
Definition: print.cxx:1159
PAPER_KAI32BIG
PAPER_A9
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
Definition: svapp.cxx:741
sal_uInt16 GetPaperBin() const
Definition: print.cxx:1195
DuplexMode GetDuplexMode() const
Definition: print.cxx:1503
Size maPaperSize
Definition: print.hxx:191
PrinterCapType
Definition: prntypes.hxx:71
std::unique_ptr< ContentProperties > pData
VCL_DLLPRIVATE void ImplInit(SalPrinterQueueInfo *pInfo)
Definition: print.cxx:624
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:482
long Height() const
void doSloppyFit()
std::unique_ptr< SalPrinterQueueInfo > mpSalQueueInfo
Definition: print.h:39
PAPER_LEGAL
ImplSVAppData maAppData
Definition: svdata.hxx:393
PAPER_A1
VCL_DLLPRIVATE void ImplInitDisplay()
Definition: print.cxx:676
void disposeAndClear()
Definition: vclptr.hxx:200
static VCL_DLLPRIVATE SalPrinterQueueInfo * ImplGetQueueInfo(const OUString &rPrinterName, const OUString *pDriver)
Definition: print.cxx:777
VclPtr< OutputDevice > mpLastVirGraphics
Definition: svdata.hxx:215
PAPER_KAI32
void SetPrinterSettingsPreferred(bool bPaperSizeFromSetup)
Definition: print.cxx:1207
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
const JobSetup & GetJobSetup() const
Definition: print.hxx:287
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:906
static OUString GetDefaultPrinterName()
Definition: print.cxx:443
VCL_DLLPRIVATE void ImplUpdateFontList()
Definition: print.cxx:834
const ContentProperties & rData
PAPER_A7
std::shared_ptr< PhysicalFontCollection > mxFontCollection
Definition: outdev.hxx:322
void SetCopyCount(sal_uInt16 nCopy, bool bCollate)
Definition: print.cxx:1532
sal_Int32 mnDPIY
Definition: outdev.hxx:348
PAPER_ENV_C65
static void updatePrinters()
Checks the printer list and updates it necessary.
Definition: print.cxx:1618
std::unique_ptr< ImplDeviceFontSizeList > mpDeviceFontSizeList
Definition: outdev.hxx:324
void IntersectClipRegion(const tools::Rectangle &rRect)
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:180
PrinterSetupMode
Definition: prntypes.hxx:85
const OUString & GetDriver() const
Definition: jobset.h:67
Orientation GetOrientation() const
Definition: print.cxx:1154
VCL_DLLPRIVATE void ImplInitData()
Definition: print.cxx:455
ImplSVGDIData maGDIData
Definition: svdata.hxx:394
PAPER_ENV_PERSONAL
PAPER_ARCHA
PAPER_KAI16
SAL_DLLPRIVATE const ImplJobSetup & ImplGetConstData() const
Definition: jobset.cxx:210
void Move(long nHorzMoveDelta, long nVertMoveDelta)
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:37
virtual void dispose() override
Definition: print.cxx:911
virtual OUString GetDefaultPrinter()=0
void SetDriverDataLen(sal_uInt32 nDriverDataLen)
Definition: jobset.cxx:145
DuplexMode GetDuplexMode() const
Definition: jobset.h:73
PAPER_D
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
SAL_DLLPRIVATE void InitLineColor()
bool mbCollateCopy
Definition: print.hxx:198
std::unique_ptr< ImplPrnQueueList > mpPrinterQueueList
Definition: svdata.hxx:221
void SetDuplexMode(DuplexMode)
Definition: print.cxx:1472
weld::Window * GetFrameWeld() const
Definition: window2.cxx:853
Paper
VclPtr< Printer > mpNext
Definition: print.hxx:183
DuplexMode
Definition: prntypes.hxx:28
sal_uInt16 mnPageQueueSize
Definition: print.hxx:193
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:760
long Right() const
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize(JobSetup &, bool bMatchNearest)
Definition: print.cxx:1221
virtual bool Setup(weld::Window *pFrame, ImplJobSetup *pSetupData)=0
PAPER_ENV_14
PAPER_A6
virtual bool UsePolyPolygonForComplexGradient() override
Definition: print.cxx:1655
AntialiasingFlags mnAntialiasing
Definition: outdev.hxx:373
PAPER_A4
PAPER_ENV_DL
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
VCL_DLLPRIVATE void ImplEndPage()
Definition: print.cxx:1600
const Size & GetPaperSizePixel() const
Definition: print.hxx:330
void SetDuplexMode(DuplexMode eDuplexMode)
Definition: jobset.cxx:120
#define PRINTER_GENERALERROR
Definition: errcode.hxx:268
PAPER_A8
long Top() const
void SetDriverData(sal_uInt8 *pDriverData)
Definition: jobset.cxx:150
Application * GetpApp()
Definition: svapp.cxx:149
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:215
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:342
PAPER_FANFOLD_DE
PAPER_A2
PAPER_C
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
Point maPageOffset
Definition: print.hxx:190
#define SAL_N_ELEMENTS(arr)
OUString GetPaperBinName(sal_uInt16 nPaperBin) const
Definition: print.cxx:1521
SalGraphics * mpGraphics
Graphics context to draw on.
Definition: outdev.hxx:316
VclPtr< VirtualDevice > mpDisplayDev
Definition: print.hxx:184
bool SetPaperSizeUser(const Size &rSize)
Definition: print.cxx:1354
bool HasSupport(PrinterSupport eFeature) const
Definition: print.cxx:960
bool sloppyEqual(const PaperInfo &rOther) const
PAPER_LEDGER
PAPER_ENV_ITALY
PAPER_A5
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:75
VclPtr< Printer > mpFirstPrinter
Definition: svdata.hxx:220
PAPER_ARCHC
PAPER_ENV_C5
virtual bool HasMirroredGraphics() const override
Definition: print.cxx:331
void SetLineColor()
SAL_DLLPRIVATE void InitFillColor()
void clear()
Definition: vclptr.hxx:190
PAPER_ARCHE
PAPER_B0_ISO
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
sal_uInt16 mnModalMode
Definition: svdata.hxx:149
long getHeight() const
int i
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:115
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:1670
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:278
PAPER_A0
VCL_DLLPRIVATE void ImplStartPage()
Definition: print.cxx:1578
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:196
ImplPrnQueueData * Get(const OUString &rPrinter)
Definition: print.cxx:378
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:1455
void SetPapersizeFromSetup(bool bPapersizeFromSetup)
Definition: jobset.cxx:155
virtual OUString GetPaperBinName(const ImplJobSetup *pSetupData, sal_uInt16 nPaperBin)=0
bool mbNewJobSetup
Definition: print.hxx:201
long getWidth() const
PAPER_POSTCARD_JP
RasterOp meRasterOp
Definition: outdev.hxx:368
OUString maDriver
Definition: salprn.hxx:40
Printer()
Definition: print.cxx:847
Orientation GetOrientation() const
Definition: jobset.h:70
OUString maDriver
Definition: print.hxx:187
bool mbInitTextColor
Definition: outdev.hxx:387
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:237
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:1675
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:195
Paper getPaper() const
void SetPaperWidth(long nWidth)
Definition: jobset.cxx:135
PAPER_ENV_MONARCH
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:131
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:571
PAPER_B6_ISO
PAPER_TABLOID
static const std::vector< OUString > & GetPrinterQueues()
Definition: print.cxx:405
PAPER_LETTER_PLUS
void SetPaper(Paper ePaper)
Definition: print.cxx:1315
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData)=0
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: bitmapex.cxx:236
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const override
Definition: print.cxx:1680
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1179
Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:934
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:340
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:331
sal_uInt16 GetPaperBin() const
Definition: jobset.h:76
const Point & GetPageOffsetPixel() const
Definition: print.hxx:333
def rectangle(l)
AlphaMask GetAlpha() const
Definition: bitmapex.cxx:268
bool Setup(weld::Window *pWindow, PrinterSetupMode eMode=PrinterSetupMode::DocumentGlobal)
Definition: print.cxx:1000
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:821
PAPER_A_PLUS
PAPER_10x11
#define PRINTER_ABORT
Definition: errcode.hxx:267
void SetPaperBin(sal_uInt16 nPaperBin)
Definition: jobset.cxx:125
#define SAL_WARN_IF(condition, area, stream)
#define ERRCODE_NONE
Definition: errcode.hxx:198
VCL_DLLPRIVATE void EndJob()
Definition: print.cxx:1557
bool Convert(BmpConversion eConversion)
Convert bitmap format.
Definition: bitmap3.cxx:227
VclPtr< Printer > mpPrev
Definition: print.hxx:182
PAPER_A3
bool SetOrientation(Orientation eOrient)
Definition: print.cxx:1118
bool mbPrintFile
Definition: print.hxx:199
bool mbInitClipRegion
Definition: outdev.hxx:388
ErrCode mnError
Definition: print.hxx:192
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList)=0
SAL_DLLPRIVATE void ImplUpdateFontData()
OUString maPrinterName
Definition: print.hxx:186
PAPER_DOUBLEPOSTCARD_JP
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1659
int GetPaperInfoCount() const
Definition: print.cxx:1417
PAPER_ENV_9
VclPtr< OutputDevice > mpFirstVirGraphics
Definition: svdata.hxx:214
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:223
sal_uInt16 mnCopyCount
Definition: print.hxx:194
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:84
static VCL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL(SalPrinterError nError)
Definition: print.cxx:1538
bool IsEmpty() const
Definition: bitmap.hxx:553
Orientation
Definition: prntypes.hxx:31
void SetPrinterName(const OUString &rPrinterName)
Definition: jobset.cxx:105
Reference< XComponentContext > getProcessComponentContext()
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
Definition: print.cxx:413
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:140
bool GetPrinterSettingsPreferred() const
Definition: print.cxx:1200
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:179
Paper GetPaperFormat() const
Definition: jobset.h:79
PAPER_A4_PLUS
void SetDriver(const OUString &rDriver)
Definition: jobset.cxx:110
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:1508
VclPtr< OutputDevice > mpFirstPrnGraphics
Definition: svdata.hxx:216
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:266
bool m_bPapersInit
Definition: salprn.hxx:55
void SetPaperFormat(Paper ePaperFormat)
Definition: jobset.cxx:130
#define DBG_TESTSOLARMUTEX()
sal_uInt16 GetBitCount() const
PAPER_12x11
bool mbInPrintPage
Definition: print.hxx:200
PAPER_B7_ISO
PAPER_E
VclPtr< OutputDevice > mpLastPrnGraphics
Definition: svdata.hxx:217
bool SetJobSetup(const JobSetup &rSetup)
Definition: print.cxx:979
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:691
PAPER_B8_ISO
static OUString GetPaperName(Paper ePaper)
Definition: print.cxx:1426
PAPER_FANFOLD_US
bool Replace(const Bitmap &rMask, const Color &rReplaceColor)
Replace all pixel where the given mask is on with the specified color.
long mnOutHeight
Definition: outdev.hxx:346
virtual long GetGradientStepCount(long nMinRect) override
Definition: print.cxx:839
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
Definition: svdata.cxx:210
sal_uInt32 GetCapabilities(PrinterCapType nType) const
Definition: print.cxx:949
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:222
PAPER_LETTER
VCL_DLLPRIVATE void SetPrinterOptions(const PrinterOptions &rOptions)
SetPrinterOptions is used internally only now.
Definition: print.cxx:326
bool SetPrinterProps(const Printer *pPrinter)
Definition: print.cxx:1040
#define SAL_MAX_INT64
OUString maPrintFile
Definition: print.hxx:188
SalInstance * mpDefInst
Definition: svdata.hxx:382
std::unique_ptr< PrinterOptions > mpPrinterOptions
Definition: print.hxx:185
PAPER_ENV_C2
PAPER_ARCHB
const Color & GetFillColor() const
Definition: outdev.hxx:629
std::unordered_map< int, OUString > maPaperNames
Definition: svdata.hxx:411
SalPrinterError
Definition: salptype.hxx:41
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:319
PAPER_15x11
PAPER_SCREEN_16_9
OUString maPrinterName
Definition: salprn.hxx:39
sal_Int16 nValue
virtual void GetDevFontList(PhysicalFontCollection *)=0
PAPER_B4_JIS
sal_uInt32 mnJobs
Definition: salprn.hxx:44
Size GetPaperSize() const
Definition: print.hxx:331
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:358