LibreOffice Module vcl (master) 1
outdev.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/log.hxx>
24#include <tools/debug.hxx>
25
26#include <vcl/graph.hxx>
27#include <vcl/lazydelete.hxx>
28#include <vcl/metaact.hxx>
30#include <vcl/svapp.hxx>
31#include <vcl/sysdata.hxx>
32#include <vcl/virdev.hxx>
33
34#include <ImplOutDevData.hxx>
36#include <salgdi.hxx>
37#include <window.h>
38
39#include <com/sun/star/awt/DeviceCapability.hpp>
40#include <com/sun/star/awt/XWindow.hpp>
41#include <com/sun/star/rendering/CanvasFactory.hpp>
42#include <com/sun/star/rendering/XSpriteCanvas.hpp>
43
44#ifdef DISABLE_DYNLOADING
45// Linking all needed LO code into one .so/executable, these already
46// exist in the tools library, so put them in the anonymous namespace
47// here to avoid clash...
48namespace {
49#endif
50#ifdef DISABLE_DYNLOADING
51}
52#endif
53
54using namespace ::com::sun::star::uno;
55
56// Begin initializer and accessor public functions
57
59 meOutDevType(eOutDevType),
60 maRegion(true),
62 maTextLineColor( COL_TRANSPARENT ),
63 moSettings( Application::GetSettings() )
64{
65 mpGraphics = nullptr;
66 mpUnoGraphicsList = nullptr;
67 mpPrevGraphics = nullptr;
68 mpNextGraphics = nullptr;
69 mpMetaFile = nullptr;
70 mpFontInstance = nullptr;
71 mpFontFaceCollection = nullptr;
72 mpAlphaVDev = nullptr;
73 mpExtOutDevData = nullptr;
74 mnOutOffX = 0;
75 mnOutOffY = 0;
76 mnOutWidth = 0;
77 mnOutHeight = 0;
78 mnDPIX = 0;
79 mnDPIY = 0;
81 mnTextOffX = 0;
82 mnTextOffY = 0;
83 mnOutOffOrigX = 0;
85 mnOutOffOrigY = 0;
91
92 if( AllSettings::GetLayoutRTL() ) //#i84553# tip BiDi preference to RTL
94
96 mbMap = false;
97 mbClipRegion = false;
98 mbBackground = false;
99 mbOutput = true;
100 mbDevOutput = false;
101 mbOutputClipped = false;
106 meTextLanguage = LANGUAGE_SYSTEM; // TODO: get default from configuration?
107 mbLineColor = true;
108 mbFillColor = true;
109 mbInitLineColor = true;
110 mbInitFillColor = true;
111 mbInitFont = true;
112 mbInitTextColor = true;
113 mbInitClipRegion = true;
114 mbClipRegionSet = false;
115 mbNewFont = true;
116 mbTextLines = false;
117 mbTextSpecial = false;
118 mbRefPoint = false;
119 mbEnableRTL = false; // mirroring must be explicitly allowed (typically for windows only)
120
121 // struct ImplMapRes
128
129 // struct ImplOutDevData- see #i82615#
130 mpOutDevData.reset(new ImplOutDevData);
131 mpOutDevData->mpRotateDev = nullptr;
132 mpOutDevData->mpRecordLayout = nullptr;
133
134 // #i75163#
135 mpOutDevData->mpViewTransform = nullptr;
136 mpOutDevData->mpInverseViewTransform = nullptr;
137}
138
140{
141 disposeOnce();
142}
143
145{
146 if ( GetUnoGraphicsList() )
147 {
149 if ( pWrapper )
150 pWrapper->ReleaseAllGraphics( this );
151 delete mpUnoGraphicsList;
152 mpUnoGraphicsList = nullptr;
153 }
154
155 mpOutDevData->mpRotateDev.disposeAndClear();
156
157 // #i75163#
159
160 mpOutDevData.reset();
161
162 // for some reason, we haven't removed state from the stack properly
163 if ( !maOutDevStateStack.empty() )
164 SAL_WARN( "vcl.gdi", "OutputDevice::~OutputDevice(): OutputDevice::Push() calls != OutputDevice::Pop() calls" );
165 maOutDevStateStack.clear();
166
167 // release the active font instance
168 mpFontInstance.clear();
169
170 // remove cached results of GetDevFontList/GetDevSizeList
171 mpFontFaceCollection.reset();
172
173 // release ImplFontCache specific to this OutputDevice
174 mxFontCache.reset();
175
176 // release ImplFontList specific to this OutputDevice
177 mxFontCollection.reset();
178
183}
184
186{
187 return false;
188}
189
191{
193
194 if (!mpGraphics && !AcquireGraphics())
195 SAL_WARN("vcl.gdi", "No mpGraphics set");
196
197 return mpGraphics;
198}
199
201{
203
204 if (!mpGraphics && !AcquireGraphics())
205 SAL_WARN("vcl.gdi", "No mpGraphics set");
206
207 return mpGraphics;
208}
209
211{
212 mpMetaFile = pMtf;
213}
214
216{
217 *moSettings = rSettings;
218
219 if( mpAlphaVDev )
220 mpAlphaVDev->SetSettings( rSettings );
221}
222
224{
225 if (!mpGraphics && !AcquireGraphics())
226 return SystemGraphicsData();
227 assert(mpGraphics);
228
229 return mpGraphics->GetGraphicsData();
230}
231
233{
234 if (!mpGraphics && !AcquireGraphics())
235 return {};
236 assert(mpGraphics);
237
239}
240
241#if ENABLE_CAIRO_CANVAS
242
244{
245 if (!mpGraphics && !AcquireGraphics())
246 return false;
247 assert(mpGraphics);
248
249 return mpGraphics->SupportsCairo();
250}
251
253{
254 if (!mpGraphics && !AcquireGraphics())
256 assert(mpGraphics);
257 return mpGraphics->CreateSurface(rSurface);
258}
259
260cairo::SurfaceSharedPtr OutputDevice::CreateSurface(int x, int y, int width, int height) const
261{
262 if (!mpGraphics && !AcquireGraphics())
264 assert(mpGraphics);
265 return mpGraphics->CreateSurface(*this, x, y, width, height);
266}
267
269{
270 if (!mpGraphics && !AcquireGraphics())
272 assert(mpGraphics);
273 return mpGraphics->CreateBitmapSurface(*this, rData, rSize);
274}
275
276css::uno::Any OutputDevice::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const
277{
278 if (!mpGraphics && !AcquireGraphics())
279 return css::uno::Any();
280 assert(mpGraphics);
281 return mpGraphics->GetNativeSurfaceHandle(rSurface, rSize);
282}
283
284#endif // ENABLE_CAIRO_CANVAS
285
287{
288 const SystemGraphicsData aSysData = GetSystemGfxData();
289 css::uno::Sequence< sal_Int8 > aSeq( reinterpret_cast<sal_Int8 const *>(&aSysData),
290 aSysData.nSize );
291
292 return css::uno::Any(aSeq);
293}
294
296{
297 if ( mpMetaFile )
298 mpMetaFile->AddAction( new MetaRefPointAction( Point(), false ) );
299
300 mbRefPoint = false;
301 maRefPoint.setX(0);
302 maRefPoint.setY(0);
303
304 if( mpAlphaVDev )
306}
307
308void OutputDevice::SetRefPoint( const Point& rRefPoint )
309{
310 if ( mpMetaFile )
311 mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, true ) );
312
313 mbRefPoint = true;
314 maRefPoint = rRefPoint;
315
316 if( mpAlphaVDev )
317 mpAlphaVDev->SetRefPoint( rRefPoint );
318}
319
321{
322 if ( mpMetaFile )
323 mpMetaFile->AddAction( new MetaRasterOpAction( eRasterOp ) );
324
325 if ( meRasterOp != eRasterOp )
326 {
327 meRasterOp = eRasterOp;
329
330 if( mpGraphics || AcquireGraphics() )
331 {
332 assert(mpGraphics);
334 }
335 }
336
337 if( mpAlphaVDev )
338 mpAlphaVDev->SetRasterOp( eRasterOp );
339}
340
341void OutputDevice::EnableOutput( bool bEnable )
342{
343 mbOutput = bEnable;
344
345 if( mpAlphaVDev )
346 mpAlphaVDev->EnableOutput( bEnable );
347}
348
350{
351 if ( mnAntialiasing != nMode )
352 {
353 mnAntialiasing = nMode;
354 mbInitFont = true;
355
356 if (mpGraphics)
358 }
359
360 if( mpAlphaVDev )
362}
363
365{
366 mnDrawMode = nDrawMode;
367
368 if (mpAlphaVDev)
369 mpAlphaVDev->SetDrawMode(nDrawMode);
370}
371
373{
374 // we need a graphics instance
375 if ( !mpGraphics && !AcquireGraphics() )
376 return 0;
377 assert(mpGraphics);
378
379 return mpGraphics->GetBitCount();
380}
381
383{
384 mnOutOffX = nOutOffX;
385}
386
388{
389 mnOutOffY = nOutOffY;
390}
391
392css::uno::Reference< css::awt::XGraphics > OutputDevice::CreateUnoGraphics()
393{
395 return pWrapper ? pWrapper->CreateGraphics( this ) : css::uno::Reference< css::awt::XGraphics >();
396}
397
398std::vector< VCLXGraphics* > *OutputDevice::CreateUnoGraphicsList()
399{
400 mpUnoGraphicsList = new std::vector< VCLXGraphics* >;
401 return mpUnoGraphicsList;
402}
403
404// Helper public function
405
407{
408 if( !mpGraphics && !AcquireGraphics() )
409 return false;
410 assert(mpGraphics);
411 const bool bHasSupport = mpGraphics->supportsOperation( eType );
412 return bHasSupport;
413}
414
415// Direct OutputDevice drawing public functions
416
417void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
418 const Point& rSrcPt, const Size& rSrcSize )
419{
420 if( ImplIsRecordLayout() )
421 return;
422
424 {
425 DrawRect( tools::Rectangle( rDestPt, rDestSize ) );
426 return;
427 }
428
429 if ( mpMetaFile )
430 {
431 const Bitmap aBmp( GetBitmap( rSrcPt, rSrcSize ) );
432 mpMetaFile->AddAction( new MetaBmpScaleAction( rDestPt, rDestSize, aBmp ) );
433 }
434
436 return;
437
438 if ( !mpGraphics && !AcquireGraphics() )
439 return;
440 assert(mpGraphics);
441
442 if ( mbInitClipRegion )
444
445 if ( mbOutputClipped )
446 return;
447
448 tools::Long nSrcWidth = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
449 tools::Long nSrcHeight = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
450 tools::Long nDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
451 tools::Long nDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
452
453 if (nSrcWidth && nSrcHeight && nDestWidth && nDestHeight)
454 {
455 SalTwoRect aPosAry(ImplLogicXToDevicePixel(rSrcPt.X()), ImplLogicYToDevicePixel(rSrcPt.Y()),
456 nSrcWidth, nSrcHeight,
457 ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
458 nDestWidth, nDestHeight);
459
460 AdjustTwoRect( aPosAry, GetOutputRectPixel() );
461
462 if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
463 mpGraphics->CopyBits(aPosAry, *this);
464 }
465
466 if( mpAlphaVDev )
467 mpAlphaVDev->DrawOutDev( rDestPt, rDestSize, rSrcPt, rSrcSize );
468}
469
470void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
471 const Point& rSrcPt, const Size& rSrcSize,
472 const OutputDevice& rOutDev )
473{
474 if ( ImplIsRecordLayout() )
475 return;
476
478 {
479 DrawRect( tools::Rectangle( rDestPt, rDestSize ) );
480 return;
481 }
482
483 if ( mpMetaFile )
484 {
485 if (rOutDev.mpAlphaVDev)
486 {
487 const BitmapEx aBmpEx(rOutDev.GetBitmapEx(rSrcPt, rSrcSize));
488 mpMetaFile->AddAction(new MetaBmpExScaleAction(rDestPt, rDestSize, aBmpEx));
489 }
490 else
491 {
492 const Bitmap aBmp(rOutDev.GetBitmap(rSrcPt, rSrcSize));
493 mpMetaFile->AddAction(new MetaBmpScaleAction(rDestPt, rDestSize, aBmp));
494 }
495 }
496
498 return;
499
500 if ( !mpGraphics && !AcquireGraphics() )
501 return;
502 assert(mpGraphics);
503
504 if ( mbInitClipRegion )
506
507 if ( mbOutputClipped )
508 return;
509
510 if (rOutDev.mpAlphaVDev)
511 {
512 // alpha-blend source over destination
513 DrawBitmapEx(rDestPt, rDestSize, rOutDev.GetBitmapEx(rSrcPt, rSrcSize));
514 }
515 else
516 {
517 SalTwoRect aPosAry(rOutDev.ImplLogicXToDevicePixel(rSrcPt.X()),
518 rOutDev.ImplLogicYToDevicePixel(rSrcPt.Y()),
519 rOutDev.ImplLogicWidthToDevicePixel(rSrcSize.Width()),
520 rOutDev.ImplLogicHeightToDevicePixel(rSrcSize.Height()),
521 ImplLogicXToDevicePixel(rDestPt.X()),
522 ImplLogicYToDevicePixel(rDestPt.Y()),
525
526 drawOutDevDirect(rOutDev, aPosAry);
527
528 // #i32109#: make destination rectangle opaque - source has no alpha
529 if (mpAlphaVDev)
531 }
532}
533
534void OutputDevice::CopyArea( const Point& rDestPt,
535 const Point& rSrcPt, const Size& rSrcSize,
536 bool bWindowInvalidate )
537{
538 if ( ImplIsRecordLayout() )
539 return;
540
541 RasterOp eOldRop = GetRasterOp();
543
545 return;
546
547 if ( !mpGraphics && !AcquireGraphics() )
548 return;
549 assert(mpGraphics);
550
551 if ( mbInitClipRegion )
553
554 if ( mbOutputClipped )
555 return;
556
557 tools::Long nSrcWidth = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
558 tools::Long nSrcHeight = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
559 if (nSrcWidth && nSrcHeight)
560 {
561 SalTwoRect aPosAry(ImplLogicXToDevicePixel(rSrcPt.X()), ImplLogicYToDevicePixel(rSrcPt.Y()),
562 nSrcWidth, nSrcHeight,
563 ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
564 nSrcWidth, nSrcHeight);
565
566 AdjustTwoRect( aPosAry, GetOutputRectPixel() );
567
568 CopyDeviceArea( aPosAry, bWindowInvalidate );
569 }
570
571 SetRasterOp( eOldRop );
572
573 if( mpAlphaVDev )
574 mpAlphaVDev->CopyArea( rDestPt, rSrcPt, rSrcSize, bWindowInvalidate );
575}
576
577// Direct OutputDevice drawing protected function
578
579void OutputDevice::CopyDeviceArea( SalTwoRect& aPosAry, bool /*bWindowInvalidate*/)
580{
581 if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
582 return;
583
584 aPosAry.mnDestWidth = aPosAry.mnSrcWidth;
585 aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
586 mpGraphics->CopyBits(aPosAry, *this);
587}
588
589// Direct OutputDevice drawing private function
591{
592 SalGraphics* pSrcGraphics;
593 if (const OutputDevice* pCheckedSrc = DrawOutDevDirectCheck(rSrcDev))
594 {
595 if (!pCheckedSrc->mpGraphics && !pCheckedSrc->AcquireGraphics())
596 return;
597 pSrcGraphics = pCheckedSrc->mpGraphics;
598 }
599 else
600 pSrcGraphics = nullptr;
601
602 if (!mpGraphics && !AcquireGraphics())
603 return;
604 assert(mpGraphics);
605
606 // #102532# Offset only has to be pseudo window offset
607
608 AdjustTwoRect( rPosAry, rSrcDev.GetOutputRectPixel() );
609
610 if ( rPosAry.mnSrcWidth && rPosAry.mnSrcHeight && rPosAry.mnDestWidth && rPosAry.mnDestHeight )
611 {
612 // if this is no window, but rSrcDev is a window
613 // mirroring may be required
614 // because only windows have a SalGraphicsLayout
615 // mirroring is performed here
616 DrawOutDevDirectProcess(rSrcDev, rPosAry, pSrcGraphics);
617 }
618}
619
621{
622 return this == &rSrcDev ? nullptr : &rSrcDev;
623}
624
626{
627 if( pSrcGraphics && (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) )
628 {
629 SalTwoRect aPosAry2 = rPosAry;
630 pSrcGraphics->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, rSrcDev );
631 mpGraphics->CopyBits( aPosAry2, *pSrcGraphics, *this, rSrcDev );
632 return;
633 }
634 if (pSrcGraphics)
635 mpGraphics->CopyBits( rPosAry, *pSrcGraphics, *this, rSrcDev );
636 else
637 mpGraphics->CopyBits( rPosAry, *this );
638}
639
641{
642 return tools::Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
643}
644
645// Layout public functions
646
647void OutputDevice::EnableRTL( bool bEnable )
648{
649 mbEnableRTL = bEnable;
650
651 if( mpAlphaVDev )
652 mpAlphaVDev->EnableRTL( bEnable );
653}
654
656{
657 bool bRet = false;
658 if( AcquireGraphics() )
659 {
662 {
663 bRet = true;
664 }
665 }
666 return bRet;
667}
668
669// note: the coordinates to be remirrored are in frame coordinates !
670
671void OutputDevice::ReMirror( Point &rPoint ) const
672{
673 rPoint.setX( mnOutOffX + mnOutWidth - 1 - rPoint.X() + mnOutOffX );
674}
676{
677 tools::Long nWidth = rRect.Right() - rRect.Left();
678
679 //long lc_x = rRect.nLeft - mnOutOffX; // normalize
680 //lc_x = mnOutWidth - nWidth - 1 - lc_x; // mirror
681 //rRect.nLeft = lc_x + mnOutOffX; // re-normalize
682
683 rRect.SetLeft( mnOutOffX + mnOutWidth - nWidth - 1 - rRect.Left() + mnOutOffX );
684 rRect.SetRight( rRect.Left() + nWidth );
685}
686
688{
689 RectangleVector aRectangles;
690 rRegion.GetRegionRectangles(aRectangles);
691 vcl::Region aMirroredRegion;
692
693 for (auto & rectangle : aRectangles)
694 {
696 aMirroredRegion.Union(rectangle);
697 }
698
699 rRegion = aMirroredRegion;
700
701}
702
704{
706}
707
709{
710 if (!mpOutDevData)
711 return false;
712
713 return mpOutDevData->mpRecordLayout;
714}
715
716css::awt::DeviceInfo OutputDevice::GetCommonDeviceInfo(Size const& rDevSz) const
717{
718 css::awt::DeviceInfo aInfo;
719
720 aInfo.Width = rDevSz.Width();
721 aInfo.Height = rDevSz.Height();
722
723 Size aTmpSz = LogicToPixel(Size(1000, 1000), MapMode(MapUnit::MapMM));
724 aInfo.PixelPerMeterX = aTmpSz.Width();
725 aInfo.PixelPerMeterY = aTmpSz.Height();
726 aInfo.BitsPerPixel = GetBitCount();
727
728 aInfo.Capabilities = css::awt::DeviceCapability::RASTEROPERATIONS |
729 css::awt::DeviceCapability::GETBITS;
730
731 return aInfo;
732}
733
734css::awt::DeviceInfo OutputDevice::GetDeviceInfo() const
735{
736 css::awt::DeviceInfo aInfo = GetCommonDeviceInfo(GetOutputSizePixel());
737
738 aInfo.LeftInset = 0;
739 aInfo.TopInset = 0;
740 aInfo.RightInset = 0;
741 aInfo.BottomInset = 0;
742
743 return aInfo;
744}
745
746Reference< css::rendering::XCanvas > OutputDevice::GetCanvas() const
747{
748 // try to retrieve hard reference from weak member
749 Reference< css::rendering::XCanvas > xCanvas( mxCanvas );
750 // canvas still valid? Then we're done.
751 if( xCanvas.is() )
752 return xCanvas;
753 xCanvas = ImplGetCanvas( false );
754 mxCanvas = xCanvas;
755 return xCanvas;
756}
757
758Reference< css::rendering::XSpriteCanvas > OutputDevice::GetSpriteCanvas() const
759{
760 Reference< css::rendering::XCanvas > xCanvas( mxCanvas );
761 Reference< css::rendering::XSpriteCanvas > xSpriteCanvas( xCanvas, UNO_QUERY );
762 if( xSpriteCanvas.is() )
763 return xSpriteCanvas;
764 xCanvas = ImplGetCanvas( true );
765 mxCanvas = xCanvas;
766 return Reference< css::rendering::XSpriteCanvas >( xCanvas, UNO_QUERY );
767}
768
769// Generic implementation, Window will override.
771{
772 /* Arguments:
773 0: ptr to creating instance (Window or VirtualDevice)
774 1: current bounds of creating instance
775 2: bool, denoting always on top state for Window (always false for VirtualDevice)
776 3: XWindow for creating Window (or empty for VirtualDevice)
777 4: SystemGraphicsData as a streamed Any
778 */
779 Sequence< Any > aArg{
780 Any(reinterpret_cast<sal_Int64>(this)),
781 Any(css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight )),
782 Any(false),
783 Any(Reference< css::awt::XWindow >()),
785 };
786
787 Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
788
790 css::rendering::CanvasFactory::create( xContext ) );
791 Reference<css::lang::XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get());
792 Reference< css::rendering::XCanvas > xCanvas;
793
794 if(xCanvasFactory.is())
795 {
796 xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext(
797 bSpriteCanvas ?
798 OUString( "com.sun.star.rendering.SpriteCanvas" ) :
799 OUString( "com.sun.star.rendering.Canvas" ),
800 aArg,
801 xContext ),
802 UNO_QUERY );
803 }
804
805 // no factory??? Empty reference, then.
806 return xCanvas;
807}
808
810{
811 css::uno::Reference< css::rendering::XCanvas > xCanvas( mxCanvas );
812 if( xCanvas.is() )
813 {
814 css::uno::Reference< css::lang::XComponent > xCanvasComponent( xCanvas, css::uno::UNO_QUERY );
815 if( xCanvasComponent.is() )
816 xCanvasComponent->dispose();
817 }
818}
819
820/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
AntialiasingFlags
DrawModeFlags
RasterOp
Definition: RasterOp.hxx:23
static bool GetLayoutRTL()
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:233
void AddAction(const rtl::Reference< MetaAction > &pAction)
Definition: gdimtf.cxx:581
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
tools::Long mnEmphasisAscent
Definition: outdev.hxx:218
virtual css::awt::DeviceInfo GetDeviceInfo() const
Definition: outdev.cxx:734
ImplMapRes maMapRes
Definition: outdev.hxx:222
std::vector< VCLXGraphics * > * GetUnoGraphicsList() const
Definition: outdev.hxx:332
virtual void InitClipRegion()
SalGraphics const * GetGraphics() const
Get the graphic context that the output device uses to draw on.
Definition: outdev.cxx:200
OutputDevice(const OutputDevice &)=delete
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:215
SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel(tools::Long nY) const
Convert a logical Y coordinate to a device pixel's Y coordinate.
Definition: map.cxx:284
tools::Rectangle GetOutputRectPixel() const
Definition: outdev.hxx:324
sal_Int32 mnDPIY
Definition: outdev.hxx:213
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
Definition: bitmapex.cxx:33
tools::Long mnTextOffY
Definition: outdev.hxx:217
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:655
void SetAntialiasing(AntialiasingFlags nMode)
Definition: outdev.cxx:349
tools::Long mnOutOffY
Output offset for device output in pixel (pseudo window offset within window system's frames)
Definition: outdev.hxx:209
void EnableOutput(bool bEnable=true)
Definition: outdev.cxx:341
css::awt::DeviceInfo GetCommonDeviceInfo(Size const &aDevSize) const
Definition: outdev.cxx:716
DrawModeFlags mnDrawMode
Definition: outdev.hxx:220
css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const
request XSpriteCanvas render interface
Definition: outdev.cxx:758
bool mbOutputClipped
Definition: outdev.hxx:245
bool mbDevOutput
Definition: outdev.hxx:244
RasterOp GetRasterOp() const
Definition: outdev.hxx:496
std::shared_ptr< ImplFontCache > mxFontCache
Definition: outdev.hxx:262
virtual ~OutputDevice() override
Definition: outdev.cxx:139
virtual void dispose() override
Definition: outdev.cxx:144
bool mbFillColor
Definition: outdev.hxx:247
css::uno::WeakReference< css::rendering::XCanvas > mxCanvas
Definition: outdev.hxx:193
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
tools::Long mnOutOffX
Output offset for device output in pixel (pseudo window offset within window system's frames)
Definition: outdev.hxx:207
tools::Long mnOutOffLogicX
Additional output offset in logical coordinates, applied in PixelToLogic (used by SetPixelOffset/GetP...
Definition: outdev.hxx:201
Size GetOutputSizePixel() const
Definition: outdev.hxx:314
std::unique_ptr< ImplOutDevData > mpOutDevData
Definition: outdev.hxx:189
SAL_DLLPRIVATE bool ImplIsRecordLayout() const
Definition: outdev.cxx:708
bool mbRefPoint
Definition: outdev.hxx:257
std::shared_ptr< vcl::font::PhysicalFontCollection > mxFontCollection
Definition: outdev.hxx:261
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
OutDevViewType meOutDevViewType
Definition: outdev.hxx:224
GDIMetaFile * mpMetaFile
Definition: outdev.hxx:185
bool SupportsCairo() const
virtual void DrawOutDevDirectProcess(const OutputDevice &rSrcDev, SalTwoRect &rPosAry, SalGraphics *pSrcGraphics)
Definition: outdev.cxx:625
bool mbMap
Definition: outdev.hxx:240
SystemGraphicsData GetSystemGfxData() const
Definition: outdev.cxx:223
SAL_DLLPRIVATE tools::Long ImplLogicHeightToDevicePixel(tools::Long nHeight) const
Convert a logical height to a height in units of device pixels.
Definition: map.cxx:301
bool mbClipRegion
Definition: outdev.hxx:241
css::uno::Reference< css::awt::XGraphics > CreateUnoGraphics()
Definition: outdev.cxx:392
vcl::text::ComplexTextLayoutFlags mnTextLayoutMode
Definition: outdev.hxx:221
Color maTextColor
Definition: outdev.hxx:229
bool mbNewFont
Definition: outdev.hxx:254
void SetConnectMetaFile(GDIMetaFile *pMtf)
Definition: outdev.cxx:210
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
Definition: outdev.cxx:417
SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel(tools::Long nWidth) const
Convert a logical width to a width in units of device pixels.
Definition: map.cxx:293
virtual sal_uInt16 GetBitCount() const
Definition: outdev.cxx:372
tools::Long mnEmphasisDescent
Definition: outdev.hxx:219
bool mbInitLineColor
Definition: outdev.hxx:248
bool mbTextSpecial
Definition: outdev.hxx:256
tools::Long mnOutWidth
Definition: outdev.hxx:210
SalGraphics * mpGraphics
Graphics context to draw on.
Definition: outdev.hxx:182
bool mbInitFont
Definition: outdev.hxx:250
VclPtr< OutputDevice > mpNextGraphics
Next output device in list.
Definition: outdev.hxx:184
bool mbInitTextColor
Definition: outdev.hxx:251
cairo::SurfaceSharedPtr CreateBitmapSurface(const BitmapSystemData &rData, const Size &rSize) const
Create Surface for given bitmap data.
void SetOutOffYPixel(tools::Long nOutOffY)
Definition: outdev.cxx:387
virtual css::uno::Reference< css::rendering::XCanvas > ImplGetCanvas(bool bSpriteCanvas) const
Definition: outdev.cxx:770
rtl::Reference< LogicalFontInstance > mpFontInstance
Definition: outdev.hxx:186
SAL_DLLPRIVATE void drawOutDevDirect(const OutputDevice &rSrcDev, SalTwoRect &rPosAry)
Definition: outdev.cxx:590
bool mbInitClipRegion
Definition: outdev.hxx:252
void SetRefPoint()
Definition: outdev.cxx:295
LanguageType meTextLanguage
Definition: outdev.hxx:238
RasterOp meRasterOp
Definition: outdev.hxx:232
bool IsRTLEnabled() const
Definition: outdev.hxx:1269
SAL_DLLPRIVATE void ImplDisposeCanvas()
Definition: outdev.cxx:809
std::vector< vcl::State > maOutDevStateStack
Definition: outdev.hxx:188
bool SupportsOperation(OutDevSupportType) const
Query an OutputDevice to see whether it supports a specific operation.
Definition: outdev.cxx:406
css::uno::Any GetSystemGfxDataAny() const
Definition: outdev.cxx:286
bool mbClipRegionSet
Definition: outdev.hxx:253
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:892
AntialiasingFlags mnAntialiasing
Definition: outdev.hxx:237
SAL_DLLPRIVATE void ImplInvalidateViewTransform()
Invalidate the view transformation.
Definition: map.cxx:186
Point maRefPoint
Definition: outdev.hxx:236
void SetRasterOp(RasterOp eRasterOp)
Definition: outdev.cxx:320
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:671
virtual bool HasMirroredGraphics() const
Definition: outdev.cxx:703
cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr &rSurface) const
Create Surface from given cairo surface.
bool mbOutput
Definition: outdev.hxx:243
bool mbTextLines
Definition: outdev.hxx:255
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
void SetOutOffXPixel(tools::Long nOutOffX)
Definition: outdev.cxx:382
bool IsDeviceOutputNecessary() const
Definition: outdev.hxx:481
virtual void CopyArea(const Point &rDestPt, const Point &rSrcPt, const Size &rSrcSize, bool bWindowInvalidate=false)
Definition: outdev.cxx:534
tools::Long mnOutOffOrigX
Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
Definition: outdev.hxx:199
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:196
sal_Int32 mnDPIScalePercentage
For HiDPI displays, we want to draw elements for a percentage larger.
Definition: outdev.hxx:214
bool mbBackground
Definition: outdev.hxx:242
tools::Long mnOutOffOrigY
Additional output pixel offset, applied in LogicToPixel (used by SetPixelOffset/GetPixelOffset)
Definition: outdev.hxx:203
Color maOverlineColor
Definition: outdev.hxx:231
std::unique_ptr< vcl::font::PhysicalFontFaceCollection > mpFontFaceCollection
Definition: outdev.hxx:187
void SetDrawMode(DrawModeFlags nDrawMode)
Definition: outdev.cxx:364
css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr &rSurface, const basegfx::B2ISize &rSize) const
Return native handle for underlying surface.
bool mbEnableRTL
Definition: outdev.hxx:258
std::vector< VCLXGraphics * > * CreateUnoGraphicsList()
Definition: outdev.cxx:398
tools::Long mnTextOffX
font specific text alignment offsets in pixel units
Definition: outdev.hxx:216
std::optional< AllSettings > moSettings
Definition: outdev.hxx:234
css::uno::Reference< css::rendering::XCanvas > GetCanvas() const
request XCanvas render interface
Definition: outdev.cxx:746
tools::Long mnOutOffLogicY
Additional output offset in logical coordinates, applied in PixelToLogic (used by SetPixelOffset/GetP...
Definition: outdev.hxx:205
std::vector< VCLXGraphics * > * mpUnoGraphicsList
Definition: outdev.hxx:190
virtual const OutputDevice * DrawOutDevDirectCheck(const OutputDevice &rSrcDev) const
Definition: outdev.cxx:620
virtual void EnableRTL(bool bEnable=true)
Definition: outdev.cxx:647
bool mbLineColor
Definition: outdev.hxx:246
vcl::ExtOutDevData * mpExtOutDevData
Definition: outdev.hxx:191
virtual tools::Rectangle GetBackgroundComponentBounds() const
Definition: outdev.cxx:640
SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel(tools::Long nX) const
Convert a logical X coordinate to a device pixel's X coordinate.
Definition: map.cxx:275
OUString GetRenderBackendName() const
Definition: outdev.cxx:232
sal_Int32 mnDPIX
Definition: outdev.hxx:212
bool mbInitFillColor
Definition: outdev.hxx:249
VclPtr< OutputDevice > mpPrevGraphics
Previous output device in list.
Definition: outdev.hxx:183
virtual void CopyDeviceArea(SalTwoRect &aPosAry, bool bWindowInvalidate)
Definition: outdev.cxx:579
tools::Long mnOutHeight
Definition: outdev.hxx:211
BitmapEx GetBitmapEx(const Point &rSrcPt, const Size &rSize) const
Query extended bitmap (with alpha channel, if available).
Definition: bitmapex.cxx:149
virtual bool IsVirtual() const
Definition: outdev.cxx:185
void mirror(tools::Long &nX, const OutputDevice &rOutDev) const
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
virtual SystemGraphicsData GetGraphicsData() const =0
SalLayoutFlags GetLayout() const
Definition: salgdi.hxx:170
void setAntiAlias(bool bNew)
Definition: salgdi.hxx:83
virtual bool supportsOperation(OutDevSupportType) const =0
void CopyBits(const SalTwoRect &rPosAry, const OutputDevice &rOutDev)
virtual OUString getRenderBackendName() const
virtual sal_uInt16 GetBitCount() const =0
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual void ReleaseAllGraphics(OutputDevice *pOutDev)=0
static UnoWrapperBase * GetUnoWrapper(bool bCreateIfNotExists=true)
Get the application's UNO wrapper object.
Definition: svapp.cxx:1605
virtual css::uno::Reference< css::awt::XGraphics > CreateGraphics(OutputDevice *pOutDev)=0
void disposeAndClear()
Definition: vclptr.hxx:200
void clear()
Definition: vclptr.hxx:190
virtual void dispose()
virtual void EnableRTL(bool bEnable=true) override
Definition: virdev.cxx:394
SAL_DLLPRIVATE void ImplFillOpaqueRectangle(const tools::Rectangle &rRect)
Used for alpha VDev, to set areas to opaque.
Definition: virdev.cxx:345
constexpr void SetLeft(tools::Long v)
constexpr void SetRight(tools::Long v)
constexpr tools::Long Right() const
constexpr tools::Long Left() const
Similar to DeleteOnDeinit, the DeleteUnoReferenceOnDeinit template class makes sure that a static UNO...
Definition: lazydelete.hxx:114
css::uno::Reference< I > get()
Definition: lazydelete.hxx:121
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:507
void GetRegionRectangles(RectangleVector &rTarget) const
Definition: region.cxx:1674
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_TESTSOLARMUTEX()
DocumentType eType
#define LANGUAGE_SYSTEM
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
def rectangle(l)
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: cairo.hxx:66
std::shared_ptr< cairo_surface_t > CairoSurfaceSharedPtr
Definition: cairo.hxx:64
Reference< XComponentContext > getProcessComponentContext()
long Long
OutDevType
Definition: outdev.hxx:145
uno::Sequence< double > maFillColor
BmpMirrorFlags AdjustTwoRect(SalTwoRect &rTwoRect, const Size &rSizePix)
Definition: rect.cxx:340
std::vector< tools::Rectangle > RectangleVector
Definition: region.hxx:34
tools::Long mnMapScDenomX
Scaling factor - denominator in X direction.
Definition: ImplMapRes.hxx:32
tools::Long mnMapScDenomY
Scaling factor - denominator in Y direction.
Definition: ImplMapRes.hxx:33
tools::Long mnMapScNumY
Scaling factor - numerator in Y direction.
Definition: ImplMapRes.hxx:31
tools::Long mnMapOfsY
Offset in Y direction.
Definition: ImplMapRes.hxx:29
tools::Long mnMapScNumX
Scaling factor - numerator in X direction.
Definition: ImplMapRes.hxx:30
tools::Long mnMapOfsX
Offset in X direction.
Definition: ImplMapRes.hxx:28
tools::Long mnSrcX
Definition: salgtype.hxx:38
tools::Long mnDestWidth
Definition: salgtype.hxx:44
tools::Long mnSrcHeight
Definition: salgtype.hxx:41
tools::Long mnSrcWidth
Definition: salgtype.hxx:40
tools::Long mnDestHeight
Definition: salgtype.hxx:45
sal_uInt32 nSize
Definition: sysdata.hxx:144
signed char sal_Int8
OutDevSupportType
Definition: vclenum.hxx:174