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