LibreOffice Module vcl (master) 1
virdev.hxx
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#ifndef INCLUDED_VCL_VIRDEV_HXX
21#define INCLUDED_VCL_VIRDEV_HXX
22
23#include <vcl/dllapi.h>
24#include <vcl/outdev.hxx>
25#include <vcl/salgtype.hxx>
26#include <memory>
27
30typedef struct _cairo_surface cairo_surface_t;
31
33{
34 friend class Application;
35 friend class ::OutputDevice;
36 friend class Printer;
38public:
39 // reference device modes for different compatibility levels
40 enum class RefDevMode { NONE = 0,
41 Dpi600 = 1, // 600 dpi
42 MSO1 = 3,
43 PDF1 = 4,
44 Custom = 5
45 };
46
47private:
48 std::unique_ptr<SalVirtualDevice> mpVirDev;
51 sal_uInt16 mnBitCount;
56
57 SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, tools::Long nDX, tools::Long nDY, const SystemGraphicsData *pData = nullptr );
58 SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
59 sal_uInt8* pBuffer );
60 SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
61 sal_uInt8* pBuffer, bool bAlphaMaskTransparent = false );
62
63 VirtualDevice (const VirtualDevice &) = delete;
65
70 SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const tools::Rectangle& rRect );
71
72protected:
73 virtual bool AcquireGraphics() const override;
74 virtual void ReleaseGraphics( bool bRelease = true ) override;
75
88 explicit VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
89 OutDevType eOutDevType);
90
91public:
92
99 : VirtualDevice(nullptr, eFormat, OUTDEV_VIRDEV) {}
100
109 explicit VirtualDevice(const OutputDevice& rCompDev,
111 : VirtualDevice(&rCompDev, eFormat, OUTDEV_VIRDEV) {}
112
117 explicit VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
118 DeviceFormat eFormat);
119
120 virtual ~VirtualDevice() override;
121 virtual void dispose() override;
122
123 bool CanEnableNativeWidget() const override;
124
125 virtual void EnableRTL( bool bEnable = true ) override;
126
127 bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true, bool bAlphaMaskTransparent = false );
128 bool SetOutputSizePixelScaleOffsetAndLOKBuffer( const Size& rNewSize,
129 const Fraction& rScale,
130 const Point& rNewOffset,
131 sal_uInt8* pBuffer);
132
133 bool SetOutputSize( const Size& rNewSize )
134 { return SetOutputSizePixel( LogicToPixel( rNewSize ) ); }
135
136 void SetReferenceDevice( RefDevMode );
137
138 void Compat_ZeroExtleadBug(); // enable workaround for #i60495#
139
140 void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
141
142 virtual sal_uInt16 GetBitCount() const override;
143
144 bool IsVirtual() const override;
145
146 bool IsScreenComp() const override { return mbScreenComp; }
147
148private:
149 SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
150
151protected:
152 virtual bool UsePolyPolygonForComplexGradient() override;
153
154 virtual tools::Long GetFontExtLeading() const override;
155
156};
157
158#endif // INCLUDED_VCL_VIRDEV_HXX
159
160/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _cairo_surface cairo_surface_t
Definition: CairoCommon.hxx:46
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:237
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
virtual tools::Long GetFontExtLeading() const
virtual bool CanEnableNativeWidget() const
Determine if native widgets can be enabled.
Definition: outdev.hxx:1840
OutputDevice & operator=(const OutputDevice &)=delete
virtual void dispose() override
Definition: outdev.cxx:144
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
virtual sal_uInt16 GetBitCount() const
Definition: outdev.cxx:372
virtual bool UsePolyPolygonForComplexGradient()=0
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
virtual void EnableRTL(bool bEnable=true)
Definition: outdev.cxx:647
friend class VirtualDevice
Definition: outdev.hxx:172
virtual bool IsVirtual() const
Definition: outdev.cxx:185
A non-visible drawable/buffer (e.g. an X11 Pixmap).
Definition: salvd.hxx:30
VclPtr< VirtualDevice > mpPrev
Definition: virdev.hxx:49
bool mbScreenComp
Definition: virdev.hxx:52
bool IsScreenComp() const override
Definition: virdev.hxx:146
VirtualDevice(DeviceFormat eFormat=DeviceFormat::WITHOUT_ALPHA)
Create a virtual device of size 1x1.
Definition: virdev.hxx:98
sal_uInt16 mnBitCount
Definition: virdev.hxx:51
bool SetOutputSize(const Size &rNewSize)
Definition: virdev.hxx:133
RefDevMode meRefDevMode
Definition: virdev.hxx:54
friend cairo_surface_t * get_underlying_cairo_surface(const VirtualDevice &)
std::unique_ptr< SalVirtualDevice > mpVirDev
Definition: virdev.hxx:48
bool mbForceZeroExtleadBug
Definition: virdev.hxx:55
const DeviceFormat meFormatAndAlpha
Definition: virdev.hxx:53
VclPtr< VirtualDevice > mpNext
Definition: virdev.hxx:50
VirtualDevice(const OutputDevice &rCompDev, DeviceFormat eFormat=DeviceFormat::WITHOUT_ALPHA)
Create a virtual device of size 1x1.
Definition: virdev.hxx:109
VirtualDevice(const VirtualDevice &)=delete
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
NONE
long Long
OutDevType
Definition: outdev.hxx:145
@ OUTDEV_VIRDEV
Definition: outdev.hxx:145
DeviceFormat
Definition: salgtype.hxx:28
unsigned char sal_uInt8
#define SAL_WARN_UNUSED