Line data Source code
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 _SV_VIRDEV_HXX
21 : #define _SV_VIRDEV_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/outdev.hxx>
26 : #include <basebmp/bitmapdevice.hxx>
27 :
28 : // -----------------
29 : // - VirtualDevice -
30 : // -----------------
31 :
32 : class SalVirtualDevice;
33 : struct SystemGraphicsData;
34 :
35 : class VCL_DLLPUBLIC VirtualDevice : public OutputDevice
36 : {
37 : friend class Application;
38 : friend class OutputDevice;
39 :
40 : private:
41 : SalVirtualDevice* mpVirDev;
42 : VirtualDevice* mpPrev;
43 : VirtualDevice* mpNext;
44 : sal_uInt16 mnBitCount;
45 : sal_Bool mbScreenComp;
46 : sal_Int8 mnAlphaDepth;
47 : sal_uInt8 meRefDevMode;
48 :
49 : SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL );
50 : SAL_DLLPRIVATE sal_Bool InnerImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer );
51 : SAL_DLLPRIVATE sal_Bool ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer );
52 :
53 : // Copy assignment is forbidden and not implemented.
54 : VirtualDevice (const VirtualDevice &);
55 : VirtualDevice & operator= (const VirtualDevice &);
56 :
57 : /** Used for alpha VDev, to set areas to opaque
58 :
59 : @since #i32109#
60 : */
61 : SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const Rectangle& rRect );
62 :
63 : // TODO: add extra member for refdev backward compatibility options
64 : #define REFDEV_FORCE_ZERO_EXTLEAD 0x80
65 43868 : SAL_DLLPRIVATE bool ForceZeroExtleadBug() const
66 43868 : { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); }
67 : public:
68 : VirtualDevice( sal_uInt16 nBitCount = 0 );
69 : VirtualDevice( const OutputDevice& rCompDev,
70 : sal_uInt16 nBitCount = 0 );
71 : /** Create a virtual device with alpha channel
72 :
73 : @param rCompDev
74 : The generated vdev will be compatible to this device. By
75 : default, Application::GetDefaultDevice() is used here.
76 :
77 : @param nBitCount
78 : Bit depth of the generated virtual device. Use 0 here, to
79 : indicate: take default screen depth. Currently, only 0 and 1
80 : are allowed here, with 1 denoting binary mask.
81 :
82 : @param nAlphaBitCount
83 : Bit depth of the generated virtual device. Use 0 here, to
84 : indicate: take default screen depth. Currently, only 0 and 1
85 : are allowed here, with 1 denoting binary mask.
86 : */
87 : VirtualDevice( const OutputDevice& rCompDev,
88 : sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount );
89 :
90 : /** Create a virtual device using an existing system dependent device or graphics context
91 : Any rendering will happen directly on the context and not on any intermediate bitmap.
92 : Note: This might not be suported on all platforms !
93 : */
94 : VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount );
95 :
96 : virtual ~VirtualDevice();
97 :
98 : sal_Bool SetOutputSizePixel( const Size& rNewSize, sal_Bool bErase = sal_True );
99 : sal_Bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer );
100 0 : sal_Bool SetOutputSize( const Size& rNewSize, sal_Bool bErase = sal_True )
101 0 : { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); }
102 :
103 : // reference device modes for different compatibility levels
104 : enum RefDevMode { REFDEV_NONE = 0,
105 : REFDEV_MODE06 = 1, // 600 dpi
106 : REFDEV_MODE_MSO1 = 3,
107 : REFDEV_MODE_PDF1 = 4,
108 : REFDEV_CUSTOM = 5
109 : };
110 :
111 : void SetReferenceDevice( RefDevMode );
112 :
113 : void Compat_ZeroExtleadBug(); // enable workaround for #i60495#
114 :
115 : void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
116 :
117 : private:
118 : SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
119 :
120 : };
121 :
122 : #endif // _SV_VIRDEV_HXX
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|