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