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;
57
58 SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, tools::Long nDX, tools::Long nDY, const SystemGraphicsData *pData = nullptr );
59 SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
60 sal_uInt8* pBuffer );
61 SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
62 sal_uInt8* pBuffer );
63
64 VirtualDevice (const VirtualDevice &) = delete;
66
71 SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const tools::Rectangle& rRect );
72
73protected:
74 virtual bool AcquireGraphics() const override;
75 virtual void ReleaseGraphics( bool bRelease = true ) override;
76
94 explicit VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
95 DeviceFormat eAlphaFormat, OutDevType eOutDevType);
96
97public:
98
110 : VirtualDevice(nullptr, eFormat, eAlphaFormat, OUTDEV_VIRDEV) {}
111
121 explicit VirtualDevice(const OutputDevice& rCompDev,
123 : VirtualDevice(&rCompDev, eFormat, DeviceFormat::NONE, OUTDEV_VIRDEV) {}
124
138 explicit VirtualDevice(const OutputDevice& rCompDev,
139 DeviceFormat eFormat, DeviceFormat eAlphaFormat)
140 : VirtualDevice(&rCompDev, eFormat, eAlphaFormat, OUTDEV_VIRDEV) {}
141
146 explicit VirtualDevice(const SystemGraphicsData& rData, const Size &rSize,
147 DeviceFormat eFormat);
148
149 virtual ~VirtualDevice() override;
150 virtual void dispose() override;
151
152 bool CanEnableNativeWidget() const override;
153
154 virtual void EnableRTL( bool bEnable = true ) override;
155
156 bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true );
157 bool SetOutputSizePixelScaleOffsetAndLOKBuffer( const Size& rNewSize,
158 const Fraction& rScale,
159 const Point& rNewOffset,
160 sal_uInt8* pBuffer);
161
162 bool SetOutputSize( const Size& rNewSize )
163 { return SetOutputSizePixel( LogicToPixel( rNewSize ) ); }
164
165 void SetReferenceDevice( RefDevMode );
166
167 void Compat_ZeroExtleadBug(); // enable workaround for #i60495#
168
169 void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
170
171 virtual sal_uInt16 GetBitCount() const override;
172
173 bool IsVirtual() const override;
174
175 bool IsScreenComp() const override { return mbScreenComp; }
176
177private:
178 SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
179
180protected:
181 virtual bool UsePolyPolygonForComplexGradient() override;
182
183 virtual tools::Long GetFontExtLeading() const override;
184
185};
186
187#endif // INCLUDED_VCL_VIRDEV_HXX
188
189/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _cairo_surface cairo_surface_t
Definition: CairoCommon.hxx:72
Base class used mainly for the LibreOffice Desktop class.
Definition: svapp.hxx:233
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
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:1843
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:892
virtual void EnableRTL(bool bEnable=true)
Definition: outdev.cxx:647
friend class VirtualDevice
Definition: outdev.hxx:173
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
const DeviceFormat meFormat
Definition: virdev.hxx:53
const DeviceFormat meAlphaFormat
Definition: virdev.hxx:54
bool mbScreenComp
Definition: virdev.hxx:52
bool IsScreenComp() const override
Definition: virdev.hxx:175
VirtualDevice(const OutputDevice &rCompDev, DeviceFormat eFormat=DeviceFormat::DEFAULT)
Create a virtual device of size 1x1.
Definition: virdev.hxx:121
VirtualDevice(const OutputDevice &rCompDev, DeviceFormat eFormat, DeviceFormat eAlphaFormat)
Create a virtual device of size 1x1 with alpha channel.
Definition: virdev.hxx:138
sal_uInt16 mnBitCount
Definition: virdev.hxx:51
bool SetOutputSize(const Size &rNewSize)
Definition: virdev.hxx:162
VirtualDevice(DeviceFormat eFormat=DeviceFormat::DEFAULT, DeviceFormat eAlphaFormat=DeviceFormat::NONE)
Create a virtual device of size 1x1.
Definition: virdev.hxx:109
RefDevMode meRefDevMode
Definition: virdev.hxx:55
friend cairo_surface_t * get_underlying_cairo_surface(const VirtualDevice &)
std::unique_ptr< SalVirtualDevice > mpVirDev
Definition: virdev.hxx:48
bool mbForceZeroExtleadBug
Definition: virdev.hxx:56
VclPtr< VirtualDevice > mpNext
Definition: virdev.hxx:50
VirtualDevice(const VirtualDevice &)=delete
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
NONE
long Long
OutDevType
Definition: outdev.hxx:144
@ OUTDEV_VIRDEV
Definition: outdev.hxx:144
DeviceFormat
Definition: salgtype.hxx:28
unsigned char sal_uInt8
#define SAL_WARN_UNUSED