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/config.h>
21 
22 #include <sal/types.h>
23 #include <sal/log.hxx>
25 #include <o3tl/safeint.hxx>
26 #include <tools/debug.hxx>
27 #include <tools/helpers.hxx>
28 
29 #include <vcl/QueueInfo.hxx>
30 #include <vcl/event.hxx>
31 #include <vcl/virdev.hxx>
32 #include <vcl/print.hxx>
33 #include <vcl/printer/Options.hxx>
34 
35 #include <jobset.h>
36 #include <print.h>
37 #include <ImplOutDevData.hxx>
41 #include <impfontcache.hxx>
42 #include <print.hrc>
43 #include <salgdi.hxx>
44 #include <salinst.hxx>
45 #include <salprn.hxx>
46 #include <salptype.hxx>
47 #include <salvd.hxx>
48 #include <svdata.hxx>
49 
50 #include <com/sun/star/beans/XPropertySet.hpp>
51 #include <com/sun/star/configuration/theDefaultProvider.hpp>
52 #include <com/sun/star/container/XNameAccess.hpp>
53 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
54 #include <com/sun/star/uno/Sequence.h>
55 
57 
58 namespace
59 {
60  Paper ImplGetPaperFormat( tools::Long nWidth100thMM, tools::Long nHeight100thMM )
61  {
62  PaperInfo aInfo(nWidth100thMM, nHeight100thMM);
63  aInfo.doSloppyFit();
64  return aInfo.getPaper();
65  }
66 
67  const PaperInfo& ImplGetEmptyPaper()
68  {
69  static PaperInfo aInfo(PAPER_USER);
70  return aInfo;
71  }
72 }
73 
75 {
76  const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
77 
78  if ( !rConstData.GetPaperWidth() || !rConstData.GetPaperHeight() )
79  {
80  if ( rConstData.GetPaperFormat() != PAPER_USER )
81  {
82  PaperInfo aInfo(rConstData.GetPaperFormat());
83 
84  ImplJobSetup& rData = rJobSetup.ImplGetData();
85  rData.SetPaperWidth( aInfo.getWidth() );
86  rData.SetPaperHeight( aInfo.getHeight() );
87  }
88  }
89  else if ( rConstData.GetPaperFormat() == PAPER_USER )
90  {
91  Paper ePaper = ImplGetPaperFormat( rConstData.GetPaperWidth(), rConstData.GetPaperHeight() );
92  if ( ePaper != PAPER_USER )
93  rJobSetup.ImplGetData().SetPaperFormat(ePaper);
94  }
95 }
96 
97 void Printer::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
98  const Point& rDestPt, const Size& rDestSize,
99  const Point& rSrcPtPixel, const Size& rSrcSizePixel )
100 {
101  Point aDestPt( LogicToPixel( rDestPt ) );
102  Size aDestSz( LogicToPixel( rDestSize ) );
103  tools::Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
104 
105  aSrcRect.Justify();
106 
107  if( rBmp.IsEmpty() || !aSrcRect.GetWidth() || !aSrcRect.GetHeight() || !aDestSz.Width() || !aDestSz.Height() )
108  return;
109 
110  Bitmap aPaint( rBmp ), aMask( rMask );
112 
115 
116  // mirrored horizontally
117  if( aDestSz.Width() < 0 )
118  {
119  aDestSz.setWidth( -aDestSz.Width() );
120  aDestPt.AdjustX( -( aDestSz.Width() - 1 ) );
121  nMirrFlags |= BmpMirrorFlags::Horizontal;
122  }
123 
124  // mirrored vertically
125  if( aDestSz.Height() < 0 )
126  {
127  aDestSz.setHeight( -aDestSz.Height() );
128  aDestPt.AdjustY( -( aDestSz.Height() - 1 ) );
129  nMirrFlags |= BmpMirrorFlags::Vertical;
130  }
131 
132  // source cropped?
133  if( aSrcRect != tools::Rectangle( Point(), aPaint.GetSizePixel() ) )
134  {
135  aPaint.Crop( aSrcRect );
136  aMask.Crop( aSrcRect );
137  }
138 
139  // destination mirrored
140  if( nMirrFlags != BmpMirrorFlags::NONE )
141  {
142  aPaint.Mirror( nMirrFlags );
143  aMask.Mirror( nMirrFlags );
144  }
145 
146  // we always want to have a mask
147  if( aMask.IsEmpty() )
148  {
149  aMask = Bitmap(aSrcRect.GetSize(), vcl::PixelFormat::N1_BPP);
150  aMask.Erase( COL_BLACK );
151  }
152 
153  // do painting
154  const tools::Long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
155  tools::Long nX, nY; // , nWorkX, nWorkY, nWorkWidth, nWorkHeight;
156  std::unique_ptr<tools::Long[]> pMapX(new tools::Long[ nSrcWidth + 1 ]);
157  std::unique_ptr<tools::Long[]> pMapY(new tools::Long[ nSrcHeight + 1 ]);
158  const bool bOldMap = mbMap;
159 
160  mbMap = false;
161 
162  // create forward mapping tables
163  for( nX = 0; nX <= nSrcWidth; nX++ )
164  pMapX[ nX ] = aDestPt.X() + FRound( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
165 
166  for( nY = 0; nY <= nSrcHeight; nY++ )
167  pMapY[ nY ] = aDestPt.Y() + FRound( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
168 
169  // walk through all rectangles of mask
170  const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
171  RectangleVector aRectangles;
172  aWorkRgn.GetRegionRectangles(aRectangles);
173 
174  for (auto const& rectangle : aRectangles)
175  {
176  const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
177  const Size aMapSz( pMapX[rectangle.Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
178  pMapY[rectangle.Bottom() + 1] - aMapPt.Y()); // same for Y
179  Bitmap aBandBmp(aPaint);
180 
181  aBandBmp.Crop(rectangle);
182  DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
183  }
184 
185  mbMap = bOldMap;
186 
187 }
188 
190  const basegfx::B2DHomMatrix& /*aFullTransform*/,
191  const BitmapEx& /*rBitmapEx*/,
192  double /*fAlpha*/)
193 {
194  // printers can't draw bitmaps directly
195  return false;
196 }
197 
199  const basegfx::B2DHomMatrix& /*aFullTransform*/,
200  basegfx::B2DRange& /*aVisibleRange*/,
201  double& /*fMaximumArea*/)
202 {
203  // deliberately do nothing - you can't reduce the
204  // target range for a printer at all
205  return true;
206 }
207 
208 void Printer::DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSize,
209  const Point& rSrcPtPixel, const Size& rSrcSizePixel,
210  BitmapEx& rBmpEx )
211 {
212  if( rBmpEx.IsAlpha() )
213  {
214  // #107169# For true alpha bitmaps, no longer masking the
215  // bitmap, but perform a full alpha blend against a white
216  // background here.
217  Bitmap aBmp( rBmpEx.GetBitmap() );
218  aBmp.Blend( rBmpEx.GetAlpha(), COL_WHITE );
219  DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmp );
220  }
221  else
222  {
223  Bitmap aBmp( rBmpEx.GetBitmap() );
224  ImplPrintTransparent( aBmp, Bitmap(), rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
225  }
226 }
227 
229  sal_uInt16 nTransparencePercent )
230 {
231  // #110958# Disable alpha VDev, we perform the necessary
232  VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
233 
234  // operation explicitly further below.
235  if( mpAlphaVDev )
236  mpAlphaVDev = nullptr;
237 
238  GDIMetaFile* pOldMetaFile = mpMetaFile;
239  mpMetaFile = nullptr;
240 
241  mpMetaFile = pOldMetaFile;
242 
243  // #110958# Restore disabled alpha VDev
244  mpAlphaVDev = pOldAlphaVDev;
245 
246  tools::Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
247  const Size aDPISize( LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch)) );
248  const tools::Long nBaseExtent = std::max<tools::Long>( FRound( aDPISize.Width() / 300. ), 1 );
249  tools::Long nMove;
250  const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
251  ( nTransparencePercent < 38 ) ? 25 :
252  ( nTransparencePercent < 63 ) ? 50 :
253  ( nTransparencePercent < 88 ) ? 75 : 100;
254 
255  switch( nTrans )
256  {
257  case 25: nMove = nBaseExtent * 3; break;
258  case 50: nMove = nBaseExtent * 4; break;
259  case 75: nMove = nBaseExtent * 6; break;
260 
261  // #i112959# very transparent (88 < nTransparencePercent <= 99)
262  case 100: nMove = nBaseExtent * 8; break;
263 
264  // #i112959# not transparent (nTransparencePercent < 13)
265  default: nMove = 0; break;
266  }
267 
269  IntersectClipRegion(vcl::Region(rPolyPoly));
271  const bool bOldMap = mbMap;
272  EnableMapMode( false );
273 
274  if(nMove)
275  {
276  tools::Rectangle aRect( aPolyRect.TopLeft(), Size( aPolyRect.GetWidth(), nBaseExtent ) );
277  while( aRect.Top() <= aPolyRect.Bottom() )
278  {
279  DrawRect( aRect );
280  aRect.Move( 0, nMove );
281  }
282 
283  aRect = tools::Rectangle( aPolyRect.TopLeft(), Size( nBaseExtent, aPolyRect.GetHeight() ) );
284  while( aRect.Left() <= aPolyRect.Right() )
285  {
286  DrawRect( aRect );
287  aRect.Move( nMove, 0 );
288  }
289  }
290  else
291  {
292  // #i112959# if not transparent, draw full rectangle in clip region
293  DrawRect( aPolyRect );
294  }
295 
296  EnableMapMode( bOldMap );
297  Pop();
298 
299  mpMetaFile = pOldMetaFile;
300 
301  // #110958# Restore disabled alpha VDev
302  mpAlphaVDev = pOldAlphaVDev;
303 }
304 
305 void Printer::DrawOutDev( const Point& /*rDestPt*/, const Size& /*rDestSize*/,
306  const Point& /*rSrcPt*/, const Size& /*rSrcSize*/ )
307 {
308  SAL_WARN( "vcl.gdi", "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
309 }
310 
311 void Printer::DrawOutDev( const Point& /*rDestPt*/, const Size& /*rDestSize*/,
312  const Point& /*rSrcPt*/, const Size& /*rSrcSize*/,
313  const OutputDevice& /*rOutDev*/ )
314 {
315  SAL_WARN( "vcl.gdi", "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
316 }
317 
318 void Printer::CopyArea( const Point& /*rDestPt*/,
319  const Point& /*rSrcPt*/, const Size& /*rSrcSize*/,
320  bool /*bWindowInvalidate*/ )
321 {
322  SAL_WARN( "vcl.gdi", "Don't use OutputDevice::CopyArea(...) with printer devices!" );
323 }
324 
326 {
327  Point aPageOffset = Point( 0, 0 ) - this->GetPageOffsetPixel();
328  Size aSize = this->GetPaperSizePixel();
329  return tools::Rectangle( aPageOffset, aSize );
330 }
331 
332 void Printer::SetPrinterOptions( const vcl::printer::Options& i_rOptions )
333 {
334  *mpPrinterOptions = i_rOptions;
335 }
336 
338 {
339  // due to a "hotfix" for AOO bug i55719, this needs to return false
340  return false;
341 }
342 
344 {
347 }
348 
350 {
351 }
352 
354 {
355 }
356 
357 void ImplPrnQueueList::Add( std::unique_ptr<SalPrinterQueueInfo> pData )
358 {
359  std::unordered_map< OUString, sal_Int32 >::iterator it =
360  m_aNameToIndex.find( pData->maPrinterName );
361  if( it == m_aNameToIndex.end() )
362  {
363  m_aNameToIndex[ pData->maPrinterName ] = m_aQueueInfos.size();
364  m_aPrinterList.push_back( pData->maPrinterName );
365  m_aQueueInfos.push_back( ImplPrnQueueData() );
366  m_aQueueInfos.back().mpQueueInfo = nullptr;
367  m_aQueueInfos.back().mpSalQueueInfo = std::move(pData);
368  }
369  else // this should not happen, but ...
370  {
371  ImplPrnQueueData& rData = m_aQueueInfos[ it->second ];
372  rData.mpQueueInfo.reset();
373  rData.mpSalQueueInfo = std::move(pData);
374  }
375 }
376 
377 ImplPrnQueueData* ImplPrnQueueList::Get( const OUString& rPrinter )
378 {
379  ImplPrnQueueData* pData = nullptr;
380  std::unordered_map<OUString,sal_Int32>::iterator it =
381  m_aNameToIndex.find( rPrinter );
382  if( it != m_aNameToIndex.end() )
383  pData = &m_aQueueInfos[it->second];
384  return pData;
385 }
386 
387 static void ImplInitPrnQueueList()
388 {
389  ImplSVData* pSVData = ImplGetSVData();
390 
391  pSVData->maGDIData.mpPrinterQueueList.reset(new ImplPrnQueueList);
392 
393  static const char* pEnv = getenv( "SAL_DISABLE_PRINTERLIST" );
394  if( !pEnv || !*pEnv )
395  pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList.get() );
396 }
397 
399 {
400  ImplSVData* pSVData = ImplGetSVData();
401  pSVData->maGDIData.mpPrinterQueueList.reset();
402 }
403 
404 const std::vector<OUString>& Printer::GetPrinterQueues()
405 {
406  ImplSVData* pSVData = ImplGetSVData();
407  if ( !pSVData->maGDIData.mpPrinterQueueList )
409  assert(pSVData->maGDIData.mpPrinterQueueList && "mpPrinterQueueList exists by now");
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  mbSinglePrintJobs = false;
469  mpInfoPrinter = nullptr;
470  mpPrinter = nullptr;
471  mpDisplayDev = nullptr;
472  mpPrinterOptions.reset(new vcl::printer::Options);
473 
474  // Add printer to the list
475  ImplSVData* pSVData = ImplGetSVData();
476  mpNext = pSVData->maGDIData.mpFirstPrinter;
477  mpPrev = nullptr;
478  if ( mpNext )
479  mpNext->mpPrev = this;
480  pSVData->maGDIData.mpFirstPrinter = this;
481 }
482 
484 {
486 
487  if ( mpGraphics )
488  return true;
489 
490  mbInitLineColor = true;
491  mbInitFillColor = true;
492  mbInitFont = true;
493  mbInitTextColor = true;
494  mbInitClipRegion = true;
495 
496  ImplSVData* pSVData = ImplGetSVData();
497 
498  if ( mpJobGraphics )
500  else if ( mpDisplayDev )
501  {
502  const VirtualDevice* pVirDev = mpDisplayDev;
503  mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
504  // if needed retry after releasing least recently used virtual device graphics
505  while ( !mpGraphics )
506  {
507  if ( !pSVData->maGDIData.mpLastVirGraphics )
508  break;
510  mpGraphics = pVirDev->mpVirDev->AcquireGraphics();
511  }
512  // update global LRU list of virtual device graphics
513  if ( mpGraphics )
514  {
516  pSVData->maGDIData.mpFirstVirGraphics = const_cast<Printer*>(this);
517  if ( mpNextGraphics )
518  mpNextGraphics->mpPrevGraphics = const_cast<Printer*>(this);
519  if ( !pSVData->maGDIData.mpLastVirGraphics )
520  pSVData->maGDIData.mpLastVirGraphics = const_cast<Printer*>(this);
521  }
522  }
523  else
524  {
526  // if needed retry after releasing least recently used printer graphics
527  while ( !mpGraphics )
528  {
529  if ( !pSVData->maGDIData.mpLastPrnGraphics )
530  break;
533  }
534  // update global LRU list of printer graphics
535  if ( mpGraphics )
536  {
538  pSVData->maGDIData.mpFirstPrnGraphics = const_cast<Printer*>(this);
539  if ( mpNextGraphics )
540  mpNextGraphics->mpPrevGraphics = const_cast<Printer*>(this);
541  if ( !pSVData->maGDIData.mpLastPrnGraphics )
542  pSVData->maGDIData.mpLastPrnGraphics = const_cast<Printer*>(this);
543  }
544  }
545 
546  if ( mpGraphics )
547  {
550  }
551 
552  return mpGraphics != nullptr;
553 }
554 
556 {
558  mbNewFont = true;
559  mbInitFont = true;
560 
561  mpFontInstance.clear();
562  mpFontFaceCollection.reset();
563 }
564 
565 void Printer::ImplReleaseGraphics(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
605  pSVData->maGDIData.mpFirstPrnGraphics = static_cast<Printer*>(mpNextGraphics.get());
606  if ( mpNextGraphics )
608  else
609  pSVData->maGDIData.mpLastPrnGraphics = static_cast<Printer*>(mpPrevGraphics.get());
610  }
611  }
612 
613  mpGraphics = nullptr;
614  mpPrevGraphics = nullptr;
615  mpNextGraphics = nullptr;
616 }
617 
618 void Printer::ReleaseGraphics(bool bRelease)
619 {
620  ImplReleaseGraphics(bRelease);
621 }
622 
624 {
625  ImplSVData* pSVData = ImplGetSVData();
626  // #i74084# update info for this specific SalPrinterQueueInfo
627  pSVData->mpDefInst->GetPrinterQueueState( pInfo );
628 
629  // Test whether the driver actually matches the JobSetup
631  if ( rData.GetDriverData() )
632  {
633  if ( rData.GetPrinterName() != pInfo->maPrinterName ||
634  rData.GetDriver() != pInfo->maDriver )
635  {
636  std::free( const_cast<sal_uInt8*>(rData.GetDriverData()) );
637  rData.SetDriverData(nullptr);
638  rData.SetDriverDataLen(0);
639  }
640  }
641 
642  // Remember printer name
643  maPrinterName = pInfo->maPrinterName;
644  maDriver = pInfo->maDriver;
645 
646  // Add printer name to JobSetup
647  rData.SetPrinterName( maPrinterName );
648  rData.SetDriver( maDriver );
649 
650  mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, &rData );
651  mpPrinter = nullptr;
652  mpJobGraphics = nullptr;
654 
655  if ( !mpInfoPrinter )
656  {
657  ImplInitDisplay();
658  return;
659  }
660 
661  // we need a graphics
662  if ( !AcquireGraphics() )
663  {
664  ImplInitDisplay();
665  return;
666  }
667 
668  // Init data
670  mxFontCollection = std::make_shared<vcl::font::PhysicalFontCollection>();
671  mxFontCache = std::make_shared<ImplFontCache>();
673 }
674 
676 {
677  ImplSVData* pSVData = ImplGetSVData();
678 
679  mpInfoPrinter = nullptr;
680  mpPrinter = nullptr;
681  mpJobGraphics = nullptr;
682 
686  mnDPIX = mpDisplayDev->mnDPIX;
687  mnDPIY = mpDisplayDev->mnDPIY;
688 }
689 
690 void Printer::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
691  const Point& rDestPt, const Size& rDestSize,
692  const Point& rSrcPtPixel, const Size& rSrcSizePixel )
693 {
694  Point aDestPt( LogicToPixel( rDestPt ) );
695  Size aDestSz( LogicToPixel( rDestSize ) );
696  tools::Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
697 
698  aSrcRect.Justify();
699 
700  if( !(!rMask.IsEmpty() && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height()) )
701  return;
702 
703  Bitmap aMask( rMask );
705 
708 
709  // mirrored horizontally
710  if( aDestSz.Width() < 0 )
711  {
712  aDestSz.setWidth( -aDestSz.Width() );
713  aDestPt.AdjustX( -( aDestSz.Width() - 1 ) );
714  nMirrFlags |= BmpMirrorFlags::Horizontal;
715  }
716 
717  // mirrored vertically
718  if( aDestSz.Height() < 0 )
719  {
720  aDestSz.setHeight( -aDestSz.Height() );
721  aDestPt.AdjustY( -( aDestSz.Height() - 1 ) );
722  nMirrFlags |= BmpMirrorFlags::Vertical;
723  }
724 
725  // source cropped?
726  if( aSrcRect != tools::Rectangle( Point(), aMask.GetSizePixel() ) )
727  aMask.Crop( aSrcRect );
728 
729  // destination mirrored
730  if( nMirrFlags != BmpMirrorFlags::NONE)
731  aMask.Mirror( nMirrFlags );
732 
733  // do painting
734  const tools::Long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = aSrcRect.GetHeight();
735  tools::Long nX, nY; //, nWorkX, nWorkY, nWorkWidth, nWorkHeight;
736  std::unique_ptr<tools::Long[]> pMapX( new tools::Long[ nSrcWidth + 1 ] );
737  std::unique_ptr<tools::Long[]> pMapY( new tools::Long[ nSrcHeight + 1 ] );
738  GDIMetaFile* pOldMetaFile = mpMetaFile;
739  const bool bOldMap = mbMap;
740 
741  mpMetaFile = nullptr;
742  mbMap = false;
744  SetLineColor( rMaskColor );
745  SetFillColor( rMaskColor );
746  InitLineColor();
747  InitFillColor();
748 
749  // create forward mapping tables
750  for( nX = 0; nX <= nSrcWidth; nX++ )
751  pMapX[ nX ] = aDestPt.X() + FRound( static_cast<double>(aDestSz.Width()) * nX / nSrcWidth );
752 
753  for( nY = 0; nY <= nSrcHeight; nY++ )
754  pMapY[ nY ] = aDestPt.Y() + FRound( static_cast<double>(aDestSz.Height()) * nY / nSrcHeight );
755 
756  // walk through all rectangles of mask
757  const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, tools::Rectangle(Point(), aMask.GetSizePixel())));
758  RectangleVector aRectangles;
759  aWorkRgn.GetRegionRectangles(aRectangles);
760 
761  for (auto const& rectangle : aRectangles)
762  {
763  const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
764  const Size aMapSz(
765  pMapX[rectangle.Right() + 1] - aMapPt.X(), // pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
766  pMapY[rectangle.Bottom() + 1] - aMapPt.Y()); // same for Y
767 
768  DrawRect(tools::Rectangle(aMapPt, aMapSz));
769  }
770 
771  Pop();
772  mbMap = bOldMap;
773  mpMetaFile = pOldMetaFile;
774 }
775 
776 SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
777  const OUString* pDriver )
778 {
779  ImplSVData* pSVData = ImplGetSVData();
780  if ( !pSVData->maGDIData.mpPrinterQueueList )
782 
783  ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList.get();
784  if ( pPrnList && !pPrnList->m_aQueueInfos.empty() )
785  {
786  // first search for the printer name directly
787  ImplPrnQueueData* pInfo = pPrnList->Get( rPrinterName );
788  if( pInfo )
789  return pInfo->mpSalQueueInfo.get();
790 
791  // then search case insensitive
792  for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
793  {
794  if( rQueueInfo.mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
795  return rQueueInfo.mpSalQueueInfo.get();
796  }
797 
798  // then search for driver name
799  if ( pDriver )
800  {
801  for(const ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
802  {
803  if( rQueueInfo.mpSalQueueInfo->maDriver == *pDriver )
804  return rQueueInfo.mpSalQueueInfo.get();
805  }
806  }
807 
808  // then the default printer
809  pInfo = pPrnList->Get( GetDefaultPrinterName() );
810  if( pInfo )
811  return pInfo->mpSalQueueInfo.get();
812 
813  // last chance: the first available printer
814  return pPrnList->m_aQueueInfos[0].mpSalQueueInfo.get();
815  }
816 
817  return nullptr;
818 }
819 
821 {
822  // we need a graphics
823  if ( !AcquireGraphics() )
824  return;
825 
829  maPageOffset,
830  maPaperSize );
831 }
832 
834 {
836 }
837 
839 {
840  // use display-equivalent step size calculation
841  tools::Long nInc = (nMinRect < 800) ? 10 : 20;
842 
843  return nInc;
844 }
845 
848 {
849  ImplInitData();
851  if ( pInfo )
852  {
853  ImplInit( pInfo );
854  if ( !IsDisplayPrinter() )
855  mbDefPrinter = true;
856  }
857  else
858  ImplInitDisplay();
859 }
860 
861 Printer::Printer( const JobSetup& rJobSetup )
863  , maJobSetup(rJobSetup)
864 {
865  ImplInitData();
866  const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
867  OUString aDriver = rConstData.GetDriver();
868  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rConstData.GetPrinterName(),
869  &aDriver );
870  if ( pInfo )
871  {
872  ImplInit( pInfo );
873  SetJobSetup( rJobSetup );
874  }
875  else
876  {
877  ImplInitDisplay();
878  maJobSetup = JobSetup();
879  }
880 }
881 
882 Printer::Printer( const QueueInfo& rQueueInfo )
884 {
885  ImplInitData();
886  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rQueueInfo.GetPrinterName(),
887  &rQueueInfo.GetDriver() );
888  if ( pInfo )
889  ImplInit( pInfo );
890  else
891  ImplInitDisplay();
892 }
893 
894 Printer::Printer( const OUString& rPrinterName )
896 {
897  ImplInitData();
898  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rPrinterName, nullptr );
899  if ( pInfo )
900  ImplInit( pInfo );
901  else
902  ImplInitDisplay();
903 }
904 
906 {
907  disposeOnce();
908 }
909 
911 {
912  SAL_WARN_IF( IsPrinting(), "vcl.gdi", "Printer::~Printer() - Job is printing" );
913  SAL_WARN_IF( IsJobActive(), "vcl.gdi", "Printer::~Printer() - Job is active" );
914 
915  mpPrinterOptions.reset();
916 
918  if ( mpInfoPrinter )
920  if ( mpDisplayDev )
922  else
923  {
924  // OutputDevice Dtor is trying the same thing; that why we need to set
925  // the FontEntry to NULL here
926  // TODO: consolidate duplicate cleanup by Printer and OutputDevice
927  mpFontInstance.clear();
928  mpFontFaceCollection.reset();
929  mxFontCache.reset();
930  // font list deleted by OutputDevice dtor
931  }
932 
933  // Add printer from the list
934  ImplSVData* pSVData = ImplGetSVData();
935  if ( mpPrev )
936  mpPrev->mpNext = mpNext;
937  else
938  pSVData->maGDIData.mpFirstPrinter = mpNext;
939  if ( mpNext )
940  mpNext->mpPrev = mpPrev;
941 
942  mpPrev.clear();
943  mpNext.clear();
945 }
946 
948 {
949  Size aBrdSize(LogicToPixel(Size(20, 20), MapMode(MapUnit::Map100thMM)));
950 
951  if (!aBrdSize.Width())
952  aBrdSize.setWidth(1);
953 
954  if (!aBrdSize.Height())
955  aBrdSize.setHeight(1);
956 
957  return aBrdSize;
958 }
959 
960 sal_uInt32 Printer::GetCapabilities( PrinterCapType nType ) const
961 {
962  if ( IsDisplayPrinter() )
963  return 0;
964 
965  if( mpInfoPrinter )
967  else
968  return 0;
969 }
970 
971 bool Printer::HasSupport( PrinterSupport eFeature ) const
972 {
973  switch ( eFeature )
974  {
985  }
986 
987  return true;
988 }
989 
990 bool Printer::SetJobSetup( const JobSetup& rSetup )
991 {
992  if ( IsDisplayPrinter() || mbInPrintPage )
993  return false;
994 
995  JobSetup aJobSetup = rSetup;
996 
997  ReleaseGraphics();
998  if ( mpInfoPrinter->SetPrinterData( &aJobSetup.ImplGetData() ) )
999  {
1000  ImplUpdateJobSetupPaper( aJobSetup );
1001  mbNewJobSetup = true;
1002  maJobSetup = aJobSetup;
1005  return true;
1006  }
1007 
1008  return false;
1009 }
1010 
1012 {
1013  if ( IsDisplayPrinter() )
1014  return false;
1015 
1016  if ( IsJobActive() || IsPrinting() )
1017  return false;
1018 
1019  JobSetup aJobSetup = maJobSetup;
1020  ImplJobSetup& rData = aJobSetup.ImplGetData();
1021  rData.SetPrinterSetupMode( eMode );
1022  // TODO: orig page size
1023 
1024  if (!pWindow)
1025  {
1026  vcl::Window* pDefWin = ImplGetDefaultWindow();
1027  pWindow = pDefWin ? pDefWin->GetFrameWeld() : nullptr;
1028  }
1029  if( !pWindow )
1030  return false;
1031 
1032  ReleaseGraphics();
1033  ImplSVData* pSVData = ImplGetSVData();
1034  pSVData->maAppData.mnModalMode++;
1035  nImplSysDialog++;
1036  bool bSetup = mpInfoPrinter->Setup(pWindow, &rData);
1037  pSVData->maAppData.mnModalMode--;
1038  nImplSysDialog--;
1039  if ( bSetup )
1040  {
1041  ImplUpdateJobSetupPaper( aJobSetup );
1042  mbNewJobSetup = true;
1043  maJobSetup = aJobSetup;
1046  return true;
1047  }
1048  return false;
1049 }
1050 
1051 bool Printer::SetPrinterProps( const Printer* pPrinter )
1052 {
1053  if ( IsJobActive() || IsPrinting() )
1054  return false;
1055 
1056  ImplSVData* pSVData = ImplGetSVData();
1057 
1058  mbDefPrinter = pPrinter->mbDefPrinter;
1059  maPrintFile = pPrinter->maPrintFile;
1060  mbPrintFile = pPrinter->mbPrintFile;
1061  mnCopyCount = pPrinter->mnCopyCount;
1062  mbCollateCopy = pPrinter->mbCollateCopy;
1063  mnPageQueueSize = pPrinter->mnPageQueueSize;
1064  *mpPrinterOptions = *pPrinter->mpPrinterOptions;
1065 
1066  if ( pPrinter->IsDisplayPrinter() )
1067  {
1068  // Destroy old printer
1069  if ( !IsDisplayPrinter() )
1070  {
1071  ReleaseGraphics();
1073  mpFontInstance.clear();
1074  mpFontFaceCollection.reset();
1075  // clean up font list
1076  mxFontCache.reset();
1077  mxFontCollection.reset();
1078 
1079  mbInitFont = true;
1080  mbNewFont = true;
1081  mpInfoPrinter = nullptr;
1082  }
1083 
1084  // Construct new printer
1085  ImplInitDisplay();
1086  return true;
1087  }
1088 
1089  // Destroy old printer?
1090  if ( GetName() != pPrinter->GetName() )
1091  {
1092  ReleaseGraphics();
1093  if ( mpDisplayDev )
1094  {
1096  }
1097  else
1098  {
1100 
1101  mpFontInstance.clear();
1102  mpFontFaceCollection.reset();
1103  mxFontCache.reset();
1104  mxFontCollection.reset();
1105  mbInitFont = true;
1106  mbNewFont = true;
1107  mpInfoPrinter = nullptr;
1108  }
1109 
1110  // Construct new printer
1111  OUString aDriver = pPrinter->GetDriverName();
1112  SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( pPrinter->GetName(), &aDriver );
1113  if ( pInfo )
1114  {
1115  ImplInit( pInfo );
1116  SetJobSetup( pPrinter->GetJobSetup() );
1117  }
1118  else
1119  ImplInitDisplay();
1120  }
1121  else
1122  SetJobSetup( pPrinter->GetJobSetup() );
1123 
1124  return false;
1125 }
1126 
1128 {
1129  if ( mbInPrintPage )
1130  return false;
1131 
1132  if ( maJobSetup.ImplGetConstData().GetOrientation() != eOrientation )
1133  {
1134  JobSetup aJobSetup = maJobSetup;
1135  ImplJobSetup& rData = aJobSetup.ImplGetData();
1136 
1137  rData.SetOrientation(eOrientation);
1138 
1139  if ( IsDisplayPrinter() )
1140  {
1141  mbNewJobSetup = true;
1142  maJobSetup = aJobSetup;
1143  return true;
1144  }
1145 
1146  ReleaseGraphics();
1148  {
1149  ImplUpdateJobSetupPaper( aJobSetup );
1150  mbNewJobSetup = true;
1151  maJobSetup = aJobSetup;
1154  return true;
1155  }
1156  else
1157  return false;
1158  }
1159 
1160  return true;
1161 }
1162 
1164 {
1166 }
1167 
1168 bool Printer::SetPaperBin( sal_uInt16 nPaperBin )
1169 {
1170  if ( mbInPrintPage )
1171  return false;
1172 
1173  if ( maJobSetup.ImplGetConstData().GetPaperBin() != nPaperBin &&
1174  nPaperBin < GetPaperBinCount() )
1175  {
1176  JobSetup aJobSetup = maJobSetup;
1177  ImplJobSetup& rData = aJobSetup.ImplGetData();
1178  rData.SetPaperBin(nPaperBin);
1179 
1180  if ( IsDisplayPrinter() )
1181  {
1182  mbNewJobSetup = true;
1183  maJobSetup = aJobSetup;
1184  return true;
1185  }
1186 
1187  ReleaseGraphics();
1188  if ( mpInfoPrinter->SetData( JobSetFlags::PAPERBIN, &rData ) )
1189  {
1190  ImplUpdateJobSetupPaper( aJobSetup );
1191  mbNewJobSetup = true;
1192  maJobSetup = aJobSetup;
1195  return true;
1196  }
1197  else
1198  return false;
1199  }
1200 
1201  return true;
1202 }
1203 
1204 sal_uInt16 Printer::GetPaperBin() const
1205 {
1207 }
1208 
1210 {
1212 }
1213 
1214 // dear loplugins, DO NOT REMOVE this code
1215 // it will be used in follow-up commits
1216 void Printer::SetPrinterSettingsPreferred( bool bPaperSizeFromSetup)
1217 {
1218  if ( maJobSetup.ImplGetConstData().GetPapersizeFromSetup() != bPaperSizeFromSetup )
1219  {
1220  JobSetup aJobSetup = maJobSetup;
1221  ImplJobSetup& rData = aJobSetup.ImplGetData();
1222  rData.SetPapersizeFromSetup(bPaperSizeFromSetup);
1223 
1224  mbNewJobSetup = true;
1225  maJobSetup = aJobSetup;
1226  }
1227 }
1228 
1229 // Map user paper format to an available printer paper format
1231 {
1232  ImplJobSetup& rData = aJobSetup.ImplGetData();
1233 
1234  // The angle that a landscape page will be turned counterclockwise wrt to portrait.
1235  int nLandscapeAngle = mpInfoPrinter ? mpInfoPrinter->GetLandscapeAngle( &maJobSetup.ImplGetConstData() ) : 900;
1236  int nPaperCount = GetPaperInfoCount();
1237  PaperInfo aInfo(rData.GetPaperWidth(), rData.GetPaperHeight());
1238 
1239  // Compare all paper formats and get the appropriate one
1240  for ( int i = 0; i < nPaperCount; i++ )
1241  {
1242  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1243 
1244  if ( aInfo.sloppyEqual(rPaperInfo) )
1245  {
1246  rData.SetPaperFormat(
1247  ImplGetPaperFormat( rPaperInfo.getWidth(),
1248  rPaperInfo.getHeight() ));
1250  return;
1251  }
1252  }
1253 
1254  // If the printer supports landscape orientation, check paper sizes again
1255  // with landscape orientation. This is necessary as a printer driver provides
1256  // all paper sizes with portrait orientation only!!
1257  if ( !(rData.GetPaperFormat() == PAPER_USER &&
1258  nLandscapeAngle != 0 &&
1260  return;
1261 
1262  const tools::Long nRotatedWidth = rData.GetPaperHeight();
1263  const tools::Long nRotatedHeight = rData.GetPaperWidth();
1264  PaperInfo aRotatedInfo(nRotatedWidth, nRotatedHeight);
1265 
1266  for ( int i = 0; i < nPaperCount; i++ )
1267  {
1268  const PaperInfo& rPaperInfo = GetPaperInfo( i );
1269 
1270  if ( aRotatedInfo.sloppyEqual( rPaperInfo ) )
1271  {
1272  rData.SetPaperFormat(
1273  ImplGetPaperFormat( rPaperInfo.getWidth(),
1274  rPaperInfo.getHeight() ));
1276  return;
1277  }
1278  }
1279 }
1280 
1281 void Printer::SetPaper( Paper ePaper )
1282 {
1283  if ( mbInPrintPage )
1284  return;
1285 
1286  if ( maJobSetup.ImplGetConstData().GetPaperFormat() == ePaper )
1287  return;
1288 
1289  JobSetup aJobSetup = maJobSetup;
1290  ImplJobSetup& rData = aJobSetup.ImplGetData();
1291 
1292  rData.SetPaperFormat( ePaper );
1293  if ( ePaper != PAPER_USER )
1294  {
1295  PaperInfo aInfo(ePaper);
1296  rData.SetPaperWidth( aInfo.getWidth() );
1297  rData.SetPaperHeight( aInfo.getHeight() );
1298  }
1299 
1300  if ( IsDisplayPrinter() )
1301  {
1302  mbNewJobSetup = true;
1303  maJobSetup = aJobSetup;
1304  return;
1305  }
1306 
1307  ReleaseGraphics();
1308  if ( ePaper == PAPER_USER )
1309  ImplFindPaperFormatForUserSize( aJobSetup );
1311  {
1312  ImplUpdateJobSetupPaper( aJobSetup );
1313  mbNewJobSetup = true;
1314  maJobSetup = aJobSetup;
1317  }
1318 }
1319 
1320 bool Printer::SetPaperSizeUser( const Size& rSize )
1321 {
1322  if ( mbInPrintPage )
1323  return false;
1324 
1325  const Size aPixSize = LogicToPixel( rSize );
1326  const Size aPageSize = PixelToLogic(aPixSize, MapMode(MapUnit::Map100thMM));
1327  bool bNeedToChange(maJobSetup.ImplGetConstData().GetPaperWidth() != aPageSize.Width() ||
1328  maJobSetup.ImplGetConstData().GetPaperHeight() != aPageSize.Height());
1329 
1330  if(!bNeedToChange)
1331  {
1332  // #i122984# only need to change when Paper is different from PAPER_USER and
1333  // the mapped Paper which will created below in the call to ImplFindPaperFormatForUserSize
1334  // and will replace maJobSetup.ImplGetConstData()->GetPaperFormat(). This leads to
1335  // unnecessary JobSetups, e.g. when printing a multi-page fax, but also with
1336  // normal print
1337  const Paper aPaper = ImplGetPaperFormat(aPageSize.Width(), aPageSize.Height());
1338 
1339  bNeedToChange = maJobSetup.ImplGetConstData().GetPaperFormat() != PAPER_USER &&
1341  }
1342 
1343  if(bNeedToChange)
1344  {
1345  JobSetup aJobSetup = maJobSetup;
1346  ImplJobSetup& rData = aJobSetup.ImplGetData();
1347  rData.SetPaperFormat( PAPER_USER );
1348  rData.SetPaperWidth( aPageSize.Width() );
1349  rData.SetPaperHeight( aPageSize.Height() );
1350 
1351  if ( IsDisplayPrinter() )
1352  {
1353  mbNewJobSetup = true;
1354  maJobSetup = aJobSetup;
1355  return true;
1356  }
1357 
1358  ReleaseGraphics();
1359  ImplFindPaperFormatForUserSize( aJobSetup );
1360 
1361  // Changing the paper size can also change the orientation!
1363  {
1364  ImplUpdateJobSetupPaper( aJobSetup );
1365  mbNewJobSetup = true;
1366  maJobSetup = aJobSetup;
1369  return true;
1370  }
1371  else
1372  return false;
1373  }
1374 
1375  return true;
1376 }
1377 
1379 {
1380  if( ! mpInfoPrinter )
1381  return 0;
1382  if( ! mpInfoPrinter->m_bPapersInit )
1384  return mpInfoPrinter->m_aPaperFormats.size();
1385 }
1386 
1387 OUString Printer::GetPaperName( Paper ePaper )
1388 {
1389  ImplSVData* pSVData = ImplGetSVData();
1390  if( pSVData->maPaperNames.empty() )
1391  {
1392  // This array must (probably) match exactly the enum Paper in <i18nutil/paper.hxx>
1393  static const int PaperIndex[] =
1394  {
1408  };
1409  static_assert(SAL_N_ELEMENTS(PaperIndex) == SAL_N_ELEMENTS(RID_STR_PAPERNAMES), "localized paper name count wrong");
1410  for (size_t i = 0; i < SAL_N_ELEMENTS(PaperIndex); ++i)
1411  pSVData->maPaperNames[PaperIndex[i]] = VclResId(RID_STR_PAPERNAMES[i]);
1412  }
1413 
1414  std::unordered_map<int,OUString>::const_iterator it = pSVData->maPaperNames.find( static_cast<int>(ePaper) );
1415  return (it != pSVData->maPaperNames.end()) ? it->second : OUString();
1416 }
1417 
1418 const PaperInfo& Printer::GetPaperInfo( int nPaper ) const
1419 {
1420  if( ! mpInfoPrinter )
1421  return ImplGetEmptyPaper();
1422  if( ! mpInfoPrinter->m_bPapersInit )
1424  if( mpInfoPrinter->m_aPaperFormats.empty() || nPaper < 0 || o3tl::make_unsigned(nPaper) >= mpInfoPrinter->m_aPaperFormats.size() )
1425  return ImplGetEmptyPaper();
1426  return mpInfoPrinter->m_aPaperFormats[nPaper];
1427 }
1428 
1429 Size Printer::GetPaperSize( int nPaper ) const
1430 {
1431  PaperInfo aInfo = GetPaperInfo( nPaper );
1432  return PixelToLogic( Size( aInfo.getWidth(), aInfo.getHeight() ) );
1433 }
1434 
1436 {
1437  if ( mbInPrintPage )
1438  return;
1439 
1440  if ( maJobSetup.ImplGetConstData().GetDuplexMode() == eDuplex )
1441  return;
1442 
1443  JobSetup aJobSetup = maJobSetup;
1444  ImplJobSetup& rData = aJobSetup.ImplGetData();
1445 
1446  rData.SetDuplexMode( eDuplex );
1447 
1448  if ( IsDisplayPrinter() )
1449  {
1450  mbNewJobSetup = true;
1451  maJobSetup = aJobSetup;
1452  return;
1453  }
1454 
1455  ReleaseGraphics();
1456  if ( mpInfoPrinter->SetData( JobSetFlags::DUPLEXMODE, &rData ) )
1457  {
1458  ImplUpdateJobSetupPaper( aJobSetup );
1459  mbNewJobSetup = true;
1460  maJobSetup = aJobSetup;
1463  }
1464 }
1465 
1467 {
1469 }
1470 
1472 {
1474 }
1475 
1477 {
1479 }
1480 
1481 sal_uInt16 Printer::GetPaperBinCount() const
1482 {
1483  if ( IsDisplayPrinter() )
1484  return 0;
1485 
1487 }
1488 
1489 OUString Printer::GetPaperBinName( sal_uInt16 nPaperBin ) const
1490 {
1491  if ( IsDisplayPrinter() )
1492  return OUString();
1493 
1494  if ( nPaperBin < GetPaperBinCount() )
1495  return mpInfoPrinter->GetPaperBinName( &maJobSetup.ImplGetConstData(), nPaperBin );
1496  else
1497  return OUString();
1498 }
1499 
1500 void Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate )
1501 {
1502  mnCopyCount = nCopy;
1503  mbCollateCopy = bCollate;
1504 }
1505 
1507 {
1508  ErrCode nVCLError;
1509  switch ( nError )
1510  {
1511  case SalPrinterError::NONE:
1512  nVCLError = ERRCODE_NONE;
1513  break;
1515  nVCLError = PRINTER_ABORT;
1516  break;
1517  default:
1518  nVCLError = PRINTER_GENERALERROR;
1519  break;
1520  }
1521 
1522  return nVCLError;
1523 }
1524 
1526 {
1527  if ( !IsJobActive() )
1528  return;
1529 
1530  SAL_WARN_IF( mbInPrintPage, "vcl.gdi", "Printer::EndJob() - StartPage() without EndPage() called" );
1531 
1532  mbJobActive = false;
1533 
1534  if ( mpPrinter )
1535  {
1536  ReleaseGraphics();
1537 
1538  mbPrinting = false;
1539 
1540  mbDevOutput = false;
1541  mpPrinter->EndJob();
1542  mpPrinter.reset();
1543  }
1544 }
1545 
1547 {
1548  if ( !IsJobActive() )
1549  return;
1550 
1551  if ( !mpPrinter )
1552  return;
1553 
1554  SalGraphics* pGraphics = mpPrinter->StartPage( &maJobSetup.ImplGetData(),
1555  mbNewJobSetup );
1556  if ( pGraphics )
1557  {
1558  ReleaseGraphics();
1559  mpJobGraphics = pGraphics;
1560  }
1561  mbDevOutput = true;
1562 
1563  // PrintJob not aborted ???
1564  if ( IsJobActive() )
1565  mbInPrintPage = true;
1566 }
1567 
1569 {
1570  if ( !IsJobActive() )
1571  return;
1572 
1573  mbInPrintPage = false;
1574 
1575  if ( mpPrinter )
1576  {
1577  ReleaseGraphics();
1578  mpPrinter->EndPage();
1579  mbDevOutput = false;
1580 
1581  mpJobGraphics = nullptr;
1582  mbNewJobSetup = false;
1583  }
1584 }
1585 
1587 {
1588  ImplSVData* pSVData = ImplGetSVData();
1589  ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList.get();
1590 
1591  if ( !pPrnList )
1592  return;
1593 
1594  std::unique_ptr<ImplPrnQueueList> pNewList(new ImplPrnQueueList);
1595  pSVData->mpDefInst->GetPrinterQueueInfo( pNewList.get() );
1596 
1597  bool bChanged = pPrnList->m_aQueueInfos.size() != pNewList->m_aQueueInfos.size();
1598  for( decltype(pPrnList->m_aQueueInfos)::size_type i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ )
1599  {
1600  ImplPrnQueueData& rInfo = pPrnList->m_aQueueInfos[i];
1601  ImplPrnQueueData& rNewInfo = pNewList->m_aQueueInfos[i];
1602  if( ! rInfo.mpSalQueueInfo || ! rNewInfo.mpSalQueueInfo || // sanity check
1603  rInfo.mpSalQueueInfo->maPrinterName != rNewInfo.mpSalQueueInfo->maPrinterName )
1604  {
1605  bChanged = true;
1606  }
1607  }
1608  if( !bChanged )
1609  return;
1610 
1612  pSVData->maGDIData.mpPrinterQueueList = std::move(pNewList);
1613 
1614  Application* pApp = GetpApp();
1615  if( pApp )
1616  {
1620  }
1621 }
1622 
1624 {
1625  return true;
1626 }
1627 
1628 void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly )
1629 {
1630  const tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
1631 
1633  IntersectClipRegion(vcl::Region(rPolyPoly));
1634  DrawGradient( aBoundRect, rGradient );
1635  Pop();
1636 }
1637 
1638 void Printer::SetFontOrientation( LogicalFontInstance* const pFontEntry ) const
1639 {
1640  pFontEntry->mnOrientation = pFontEntry->mxFontMetric->GetOrientation();
1641 }
1642 
1644 {
1645  return aRegion;
1646 }
1647 
1648 Bitmap Printer::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
1649 {
1650  SAL_WARN("vcl.gdi", "GetBitmap(): This should never be called on by a Printer instance");
1651 
1652  return OutputDevice::GetBitmap( rSrcPt, rSize );
1653 }
1654 
1655 css::awt::DeviceInfo Printer::GetDeviceInfo() const
1656 {
1657  Size aDevSz = GetPaperSizePixel();
1658  css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(aDevSz);
1659  Size aOutSz = GetOutputSizePixel();
1660  Point aOffset = GetPageOffset();
1661  aInfo.LeftInset = aOffset.X();
1662  aInfo.TopInset = aOffset.Y();
1663  aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X();
1664  aInfo.BottomInset = aDevSz.Height() - aOutSz.Height() - aOffset.Y();
1665  aInfo.Capabilities = 0;
1666 
1667  return aInfo;
1668 }
1669 
1671 {
1673  {
1675  mbInitLineColor = true;
1676  }
1677 
1678  mpGraphics->SetFillColor(rColor);
1679  mbInitFillColor = true;
1680 }
1681 
1683 {
1684  // FIXME - do we have a bug here? If the linewidth is 0, then we will return
1685  // Size(0, 0) - is this correct?
1686  return Size(nLineWidth, ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY);
1687 }
1688 
1690 {
1692 }
1693 
1694 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
PAPER_A7
bool DrawTransformBitmapExDirect(const basegfx::B2DHomMatrix &aFullTransform, const BitmapEx &rBitmapEx, double fAlpha=1.0) override
Transform and draw a bitmap directly.
Definition: print.cxx:189
PAPER_FANFOLD_US
bool mbJobActive
Definition: print.hxx:87
PAPER_ENV_C2
void SetPrinterSetupMode(PrinterSetupMode eMode)
Definition: jobset.cxx:159
virtual void ClipAndDrawGradientMetafile(const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly) override
Definition: print.cxx:1628
VclPtr< OutputDevice > mpNextGraphics
Next output device in list.
Definition: outdev.hxx:190
virtual SalGraphics * AcquireGraphics()=0
virtual void ImplReleaseFonts() override
Definition: print.cxx:555
PAPER_SLIDE_DIA
sal_uInt16 GetPaperBinCount() const
Definition: print.cxx:1481
PAPER_KAI32
PAPER_A10
const OUString & GetName() const
Definition: print.hxx:193
PAPER_EXECUTIVE
PAPER_B6_ISO
SalGraphics * mpJobGraphics
Definition: print.hxx:71
virtual int GetLandscapeAngle(const ImplJobSetup *pSetupData)=0
PAPER_FANFOLD_DE
PAPER_ENV_C3
bool IsDisplayPrinter() const
Definition: print.hxx:196
PAPER_A6
void ImplReleaseGraphics(bool bRelease=true)
Definition: print.cxx:565
JobSetup maJobSetup
Definition: print.hxx:79
void setWidth(tools::Long nWidth)
bool SetPaperBin(sal_uInt16 nPaperBin)
Definition: print.cxx:1168
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
Definition: svapp.cxx:787
sal_uInt16 GetPaperBin() const
Definition: print.cxx:1204
DuplexMode GetDuplexMode() const
Definition: print.cxx:1466
PAPER_ENV_MONARCH
Size maPaperSize
Definition: print.hxx:81
PrinterCapType
Definition: prntypes.hxx:71
VCL_DLLPRIVATE void ImplInit(SalPrinterQueueInfo *pInfo)
Definition: print.cxx:623
SAL_DLLPRIVATE void ImplPrintTransparent(const Bitmap &rBmp, const Bitmap &rMask, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel)
Definition: print.cxx:97
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:483
constexpr tools::Long Left() const
PAPER_ENV_C5
PAPER_B5_ISO
std::unique_ptr< SalPrinterQueueInfo > mpSalQueueInfo
Definition: print.h:39
PAPER_B4_JIS
std::unique_ptr< sal_Int32[]> pData
PAPER_ONSCREENSHOW_4_3
ImplSVAppData maAppData
Definition: svdata.hxx:398
PAPER_ENV_PERSONAL
VCL_DLLPRIVATE void ImplInitDisplay()
Definition: print.cxx:675
long Long
void disposeAndClear()
Definition: vclptr.hxx:200
static VCL_DLLPRIVATE SalPrinterQueueInfo * ImplGetQueueInfo(const OUString &rPrinterName, const OUString *pDriver)
Definition: print.cxx:776
VclPtr< OutputDevice > mpLastVirGraphics
Definition: svdata.hxx:222
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:33
void SetPrinterSettingsPreferred(bool bPaperSizeFromSetup)
Definition: print.cxx:1216
PAPER_POSTCARD_JP
PAPER_B5_JIS
const JobSetup & GetJobSetup() const
Definition: print.hxx:203
virtual ~Printer() override
Definition: print.cxx:905
PAPER_ENV_11
static OUString GetDefaultPrinterName()
Definition: print.cxx:443
PAPER_16K_197x273
VCL_DLLPRIVATE void ImplUpdateFontList()
Definition: print.cxx:833
PAPER_ARCHA
const ContentProperties & rData
PAPER_B0_ISO
void SetCopyCount(sal_uInt16 nCopy, bool bCollate)
Definition: print.cxx:1500
sal_Int32 mnDPIY
Definition: outdev.hxx:219
static void updatePrinters()
Checks the printer list and updates it necessary.
Definition: print.cxx:1586
std::shared_ptr< vcl::font::PhysicalFontCollection > mxFontCollection
Definition: outdev.hxx:268
void IntersectClipRegion(const tools::Rectangle &rRect)
PAPER_10x14
sal_Int32 mnDPIX
Definition: outdev.hxx:218
PAPER_A_PLUS
void EnableMapMode(bool bEnable=true)
Definition: map.cxx:641
Size GetSizePixel() const
bool mbMap
Definition: outdev.hxx:247
ImplFontMetricDataRef mxFontMetric
std::unique_ptr< SalPrinter > mpPrinter
Definition: print.hxx:70
PAPER_ONSCREENSHOW_16_9
PrinterSetupMode
Definition: prntypes.hxx:85
void doSloppyFit(bool bAlsoTryRotated=false)
const OUString & GetDriver() const
Definition: jobset.h:67
Orientation GetOrientation() const
Definition: print.cxx:1163
PAPER_A9
VCL_DLLPRIVATE void ImplInitData()
Definition: print.cxx:455
ImplSVGDIData maGDIData
Definition: svdata.hxx:399
SAL_DLLPRIVATE const ImplJobSetup & ImplGetConstData() const
Definition: jobset.cxx:212
Point GetPageOffset() const
Definition: print.hxx:252
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:34
virtual void dispose() override
Definition: print.cxx:910
virtual OUString GetDefaultPrinter()=0
void SetDriverDataLen(sal_uInt32 nDriverDataLen)
Definition: jobset.cxx:144
DuplexMode GetDuplexMode() const
Definition: jobset.h:73
std::unique_ptr< vcl::font::PhysicalFontFaceCollection > mpFontFaceCollection
Definition: outdev.hxx:193
PAPER_ENV_14
constexpr tools::Long Width() const
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
SAL_DLLPRIVATE void InitLineColor()
Definition: line.cxx:84
bool mbCollateCopy
Definition: print.hxx:88
std::unique_ptr< ImplPrnQueueList > mpPrinterQueueList
Definition: svdata.hxx:228
void SetDuplexMode(DuplexMode)
Definition: print.cxx:1435
weld::Window * GetFrameWeld() const
Definition: window2.cxx:871
VclPtr< Printer > mpNext
Definition: print.hxx:73
virtual tools::Long GetGradientStepCount(tools::Long nMinRect) override
Definition: print.cxx:838
DuplexMode
Definition: prntypes.hxx:28
sal_uInt16 mnPageQueueSize
Definition: print.hxx:83
tools::Long getHeight() const
bool IsAlpha() const
Definition: BitmapEx.cxx:193
static void ImplCallEventListenersApplicationDataChanged(void *pData)
Send event to all VCL application event listeners.
Definition: svapp.cxx:806
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
PAPER_ENV_9
Size GetSizeOfPaper() const
Definition: print.cxx:1476
void SetPaperHeight(tools::Long nHeight)
Definition: jobset.cxx:139
PAPER_ARCHE
virtual bool Setup(weld::Window *pFrame, ImplJobSetup *pSetupData)=0
PAPER_QUARTO
PAPER_16K_195x270
VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize(JobSetup &)
Definition: print.cxx:1230
PAPER_ENV_C6
PAPER_KAI16
PAPER_LEGAL
PAPER_ENV_C7
virtual bool UsePolyPolygonForComplexGradient() override
Definition: print.cxx:1623
AntialiasingFlags mnAntialiasing
Definition: outdev.hxx:243
css::awt::DeviceInfo GetDeviceInfo() const override
Definition: print.cxx:1655
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
constexpr tools::Long GetWidth() const
PAPER_ENV_ITALY
VCL_DLLPRIVATE void ImplEndPage()
Definition: print.cxx:1568
SystemTextColorFlags
void Pop()
Definition: stack.cxx:92
const Size & GetPaperSizePixel() const
Definition: print.hxx:248
void SetDuplexMode(DuplexMode eDuplexMode)
Definition: jobset.cxx:119
#define PRINTER_GENERALERROR
Definition: errcode.hxx:266
PAPER_B2_ISO
void SetDriverData(sal_uInt8 *pDriverData)
Definition: jobset.cxx:149
Application * GetpApp()
Definition: svapp.cxx:151
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:217
bool IsJobActive() const
Definition: print.hxx:262
PAPER_KAI32BIG
PAPER_TABLOID
Size GetWaveLineSize(tools::Long nLineWidth) const override
Definition: print.cxx:1682
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
Point maPageOffset
Definition: print.hxx:80
OUString VclResId(TranslateId aId)
Definition: svdata.cxx:260
#define SAL_N_ELEMENTS(arr)
OUString GetPaperBinName(sal_uInt16 nPaperBin) const
Definition: print.cxx:1489
SalGraphics * mpGraphics
Graphics context to draw on.
Definition: outdev.hxx:188
VclPtr< VirtualDevice > mpDisplayDev
Definition: print.hxx:74
bool SetPaperSizeUser(const Size &rSize)
Definition: print.cxx:1320
bool HasSupport(PrinterSupport eFeature) const
Definition: print.cxx:971
PAPER_B_PLUS
bool sloppyEqual(const PaperInfo &rOther) const
VCL_DLLPRIVATE void SetPrinterOptions(const vcl::printer::Options &rOptions)
SetPrinterOptions is used internally only now.
Definition: print.cxx:332
virtual void SetFillColor()=0
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
PAPER_A8
VclPtr< Printer > mpFirstPrinter
Definition: svdata.hxx:227
virtual bool HasMirroredGraphics() const override
Definition: print.cxx:337
void SetLineColor()
Definition: line.cxx:36
SAL_DLLPRIVATE void InitFillColor()
Definition: fill.cxx:76
void clear()
Definition: vclptr.hxx:190
VclPtr< Printer > mpLastPrnGraphics
Definition: svdata.hxx:224
void SetPaperWidth(tools::Long nWidth)
Definition: jobset.cxx:134
PAPER_FANFOLD_LEGAL_DE
vcl::PixelFormat getPixelFormat() const
PAPER_ENV_DL
PAPER_A4_PLUS
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
sal_uInt16 mnModalMode
Definition: svdata.hxx:155
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:198
PAPER_ENV_10
void SetOrientation(Orientation eOrientation)
Definition: jobset.cxx:114
virtual void ReleaseGraphics(SalGraphics *pGraphics)=0
virtual void SetLineColor()=0
virtual void dispose() override
Definition: outdev.cxx:146
tools::Long FRound(double fVal)
PAPER_C
virtual void SetFontOrientation(LogicalFontInstance *const pFontInstance) const override
Definition: print.cxx:1638
const OUString & GetPrinterName() const
Definition: jobset.h:64
PAPER_ENV_INVITE
const OUString & GetDriverName() const
Definition: print.hxx:194
PAPER_ARCHC
VCL_DLLPRIVATE void ImplStartPage()
Definition: print.cxx:1546
bool mbInitLineColor
Definition: outdev.hxx:255
const sal_uInt8 * GetDriverData() const
Definition: jobset.h:91
constexpr tools::Long Right() const
tools::Long mnOutHeight
Definition: outdev.hxx:217
void SetFillColor()
Definition: fill.cxx:29
bool mbNewFont
Definition: outdev.hxx:261
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:175
std::vector< OUString > m_aPrinterList
Definition: print.h:56
PAPER_A1
bool mbPrinting
Definition: print.hxx:86
PAPER_D
VclPtr< Printer > mpFirstPrnGraphics
Definition: svdata.hxx:223
ImplPrnQueueData * Get(const OUString &rPrinter)
Definition: print.cxx:377
void SetTextColor(const Color &rColor)
Definition: text.cxx:714
std::unique_ptr< SalVirtualDevice > mpVirDev
Definition: virdev.hxx:48
virtual tools::Rectangle GetBackgroundComponentBounds() const override
Definition: print.cxx:325
vcl::Region CreateRegion(const Color &rColor, const tools::Rectangle &rRect) const
Create region of similar colors in a given rectangle.
const PaperInfo & GetPaperInfo(int nPaper) const
Definition: print.cxx:1418
constexpr tools::Long Top() const
void SetPapersizeFromSetup(bool bPapersizeFromSetup)
Definition: jobset.cxx:154
virtual OUString GetPaperBinName(const ImplJobSetup *pSetupData, sal_uInt16 nPaperBin)=0
bool mbNewJobSetup
Definition: print.hxx:91
bool mbLineColor
Definition: outdev.hxx:253
RasterOp meRasterOp
Definition: outdev.hxx:238
OUString maDriver
Definition: salprn.hxx:40
Printer()
Definition: print.cxx:846
Paper
Size GetOutputSizePixel() const
Definition: outdev.hxx:321
Orientation GetOrientation() const
Definition: jobset.h:70
OUString maDriver
Definition: print.hxx:77
bool mbInitTextColor
Definition: outdev.hxx:258
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:233
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:1643
virtual void GetPageInfo(const ImplJobSetup *pSetupData, tools::Long &rOutWidth, tools::Long &rOutHeight, Point &rPageOffset, Size &rPaperSize)=0
PAPER_ARCHD
PAPER_WIDESCREEN
virtual bool SetPrinterData(ImplJobSetup *pSetupData)=0
void DrawBitmap(const Point &rDestPt, const Bitmap &rBitmap)
bool mbDefPrinter
Definition: print.hxx:85
Paper getPaper() const
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize) override
Definition: print.cxx:305
PrintQueueFlags mnStatus
Definition: salprn.hxx:43
void ReleaseFonts()
Definition: salgdi.hxx:153
PAPER_12x11
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:618
PAPER_ENV_C4
constexpr Point TopLeft() const
static const std::vector< OUString > & GetPrinterQueues()
Definition: print.cxx:404
PAPER_B7_ISO
void SetPaper(Paper ePaper)
Definition: print.cxx:1281
PAPER_9x11
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData)=0
constexpr tools::Long Bottom() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Definition: BitmapEx.cxx:203
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const override
Definition: print.cxx:1648
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1164
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:933
std::vector< ImplPrnQueueData > m_aQueueInfos
Definition: print.h:55
PAPER_SCREEN_16_10
PAPER_SCREEN_4_3
PAPER_B10_ISO
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
VclPtr< OutputDevice > mpPrevGraphics
Previous output device in list.
Definition: outdev.hxx:189
PAPER_ENV_C8
void setAntiAlias(bool bNew)
Definition: salgdi.hxx:85
bool IsPrinting() const
Definition: print.hxx:260
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:202
sal_uInt16 GetPaperBin() const
Definition: jobset.h:76
constexpr Size GetSize() const
const Point & GetPageOffsetPixel() const
Definition: print.hxx:251
PAPER_LEDGER
def rectangle(l)
PAPER_ARCHB
PAPER_USER
bool mbSinglePrintJobs
Definition: print.hxx:92
AlphaMask GetAlpha() const
Definition: BitmapEx.cxx:215
bool Setup(weld::Window *pWindow, PrinterSetupMode eMode=PrinterSetupMode::DocumentGlobal)
Definition: print.cxx:1011
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
VCL_DLLPRIVATE void ImplUpdatePageData()
Definition: print.cxx:820
PAPER_B9_ISO
#define PRINTER_ABORT
Definition: errcode.hxx:265
const OUString & GetPrinterName() const
Definition: QueueInfo.cxx:28
css::awt::DeviceInfo GetCommonDeviceInfo(Size const &aDevSize) const
Definition: outdev.cxx:732
void SetPaperBin(sal_uInt16 nPaperBin)
Definition: jobset.cxx:124
#define SAL_WARN_IF(condition, area, stream)
#define ERRCODE_NONE
Definition: errcode.hxx:196
constexpr tools::Long Height() const
VCL_DLLPRIVATE void EndJob()
Definition: print.cxx:1525
bool Convert(BmpConversion eConversion)
Convert bitmap format.
VclPtr< Printer > mpPrev
Definition: print.hxx:72
tools::Long GetPaperWidth() const
Definition: jobset.h:82
bool SetOrientation(Orientation eOrient)
Definition: print.cxx:1127
bool mbPrintFile
Definition: print.hxx:89
bool mbInitClipRegion
Definition: outdev.hxx:259
ErrCode mnError
Definition: print.hxx:82
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
PAPER_DOUBLEPOSTCARD_JP
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList)=0
SAL_DLLPRIVATE void ImplUpdateFontData()
PAPER_ENV_12
OUString maPrinterName
Definition: print.hxx:76
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1673
int GetPaperInfoCount() const
Definition: print.cxx:1378
Degree10 GetOrientation() const
VclPtr< OutputDevice > mpFirstVirGraphics
Definition: svdata.hxx:221
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
std::shared_ptr< ImplFontCache > mxScreenFontCache
Definition: svdata.hxx:230
sal_uInt16 mnCopyCount
Definition: print.hxx:84
std::unique_ptr< QueueInfo > mpQueueInfo
Definition: print.h:38
std::unique_ptr< vcl::printer::Options > mpPrinterOptions
Definition: print.hxx:75
PAPER_B8_ISO
static VCL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL(SalPrinterError nError)
Definition: print.cxx:1506
bool IsEmpty() const
Orientation
Definition: prntypes.hxx:31
void SetPrinterName(const OUString &rPrinterName)
Definition: jobset.cxx:104
PAPER_SCREEN_16_9
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
Definition: print.cxx:413
bool mbInitFont
Definition: outdev.hxx:257
PAPER_B4_ISO
PAPER_A3
bool GetPrinterSettingsPreferred() const
Definition: print.cxx:1209
rtl::Reference< LogicalFontInstance > mpFontInstance
Definition: outdev.hxx:192
PAPER_15x11
virtual void CopyArea(const Point &rDestPt, const Point &rSrcPt, const Size &rSrcSize, bool bWindowInvalidate=false) override
Definition: print.cxx:318
bool mbInitFillColor
Definition: outdev.hxx:256
virtual void InitPaperFormats(const ImplJobSetup *pSetupData)=0
tools::Long mnOutWidth
Definition: outdev.hxx:216
SalInfoPrinter * mpInfoPrinter
Definition: print.hxx:69
Paper GetPaperFormat() const
Definition: jobset.h:79
PAPER_LETTER
PAPER_A0
void SetDriver(const OUString &rDriver)
Definition: jobset.cxx:109
PrinterSupport
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: bitmappaint.cxx:34
virtual sal_uInt16 GetPaperBinCount(const ImplJobSetup *pSetupData)=0
void setHeight(tools::Long nHeight)
virtual void EmulateDrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent) override
Definition: print.cxx:228
Paper GetPaper() const
Definition: print.cxx:1471
virtual bool SetData(JobSetFlags nFlags, ImplJobSetup *pSetupData)=0
tools::Long GetPaperHeight() const
Definition: jobset.h:85
bool mbDevOutput
Definition: outdev.hxx:251
std::shared_ptr< vcl::font::PhysicalFontCollection > mxScreenFontList
Definition: svdata.hxx:229
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
std::shared_ptr< ImplFontCache > mxFontCache
Definition: outdev.hxx:269
tools::Rectangle GetBoundRect() const
PAPER_ENV_C65
#define SAL_WARN(area, stream)
virtual void GetDevFontList(vcl::font::PhysicalFontCollection *)=0
bool m_bPapersInit
Definition: salprn.hxx:55
PAPER_LETTER_PLUS
virtual Size GetButtonBorderSize() override
Definition: print.cxx:947
void SetPaperFormat(Paper ePaperFormat)
Definition: jobset.cxx:129
#define DBG_TESTSOLARMUTEX()
PAPER_ONSCREENSHOW_16_10
void SetSystemTextColor(SystemTextColorFlags, bool) override
Definition: print.cxx:1689
bool mbInPrintPage
Definition: print.hxx:90
PAPER_B6_JIS
bool SetJobSetup(const JobSetup &rSetup)
Definition: print.cxx:990
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:690
static OUString GetPaperName(Paper ePaper)
Definition: print.cxx:1387
void SetWaveLineColors(Color const &rColor, tools::Long) override
Definition: print.cxx:1670
const OUString & GetDriver() const
Definition: QueueInfo.cxx:29
PAPER_A5
PAPER_E
tools::Long getWidth() const
PAPER_A4
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:960
void DrawGradient(const tools::Rectangle &rRect, const Gradient &rGradient)
PAPER_B3_ISO
PAPER_STATEMENT
PAPER_10x11
virtual sal_uInt32 GetCapabilities(const ImplJobSetup *pSetupData, PrinterCapType nType)=0
void DrawDeviceBitmapEx(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel, BitmapEx &rBitmapEx) override
Definition: print.cxx:208
bool SetPrinterProps(const Printer *pPrinter)
Definition: print.cxx:1051
PAPER_B1_ISO
OUString maPrintFile
Definition: print.hxx:78
SalInstance * mpDefInst
Definition: svdata.hxx:390
const Color & GetFillColor() const
Definition: outdev.hxx:526
std::unordered_map< int, OUString > maPaperNames
Definition: svdata.hxx:416
SalPrinterError
Definition: salptype.hxx:41
PAPER_A2
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:191
OUString maPrinterName
Definition: salprn.hxx:39
sal_uInt32 mnJobs
Definition: salprn.hxx:44
constexpr tools::Long GetHeight() const
Size GetPaperSize() const
Definition: print.hxx:249
virtual void DestroyInfoPrinter(SalInfoPrinter *pPrinter)=0
BmpMirrorFlags
virtual void GetPrinterQueueState(SalPrinterQueueInfo *pInfo)=0
void Add(std::unique_ptr< SalPrinterQueueInfo > pData)
Definition: print.cxx:357