Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_VIRDEV_HXX
30 : : #define _SV_VIRDEV_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <vcl/dllapi.h>
34 : : #include <vcl/outdev.hxx>
35 : : #include <basebmp/bitmapdevice.hxx>
36 : :
37 : : // -----------------
38 : : // - VirtualDevice -
39 : : // -----------------
40 : :
41 : : class SalVirtualDevice;
42 : : struct SystemGraphicsData;
43 : :
44 : : class VCL_DLLPUBLIC VirtualDevice : public OutputDevice
45 : : {
46 : : friend class Application;
47 : : friend class OutputDevice;
48 : :
49 : : private:
50 : : SalVirtualDevice* mpVirDev;
51 : : VirtualDevice* mpPrev;
52 : : VirtualDevice* mpNext;
53 : : sal_uInt16 mnBitCount;
54 : : sal_Bool mbScreenComp;
55 : : sal_Int8 mnAlphaDepth;
56 : : sal_uInt8 meRefDevMode;
57 : :
58 : : SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL );
59 : : SAL_DLLPRIVATE sal_Bool InnerImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer );
60 : : SAL_DLLPRIVATE sal_Bool ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer );
61 : :
62 : : // Copy assignment is forbidden and not implemented.
63 : : VirtualDevice (const VirtualDevice &);
64 : : VirtualDevice & operator= (const VirtualDevice &);
65 : :
66 : : /** Used for alpha VDev, to set areas to opaque
67 : :
68 : : @since #i32109#
69 : : */
70 : : SAL_DLLPRIVATE void ImplFillOpaqueRectangle( const Rectangle& rRect );
71 : :
72 : : // TODO: add extra member for refdev backward compatibility options
73 : : #define REFDEV_FORCE_ZERO_EXTLEAD 0x80
74 : 494067 : SAL_DLLPRIVATE bool ForceZeroExtleadBug() const
75 : 494067 : { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); }
76 : : public:
77 : : VirtualDevice( sal_uInt16 nBitCount = 0 );
78 : : VirtualDevice( const OutputDevice& rCompDev,
79 : : sal_uInt16 nBitCount = 0 );
80 : : /** Create a virtual device with alpha channel
81 : :
82 : : @param rCompDev
83 : : The generated vdev will be compatible to this device. By
84 : : default, Application::GetDefaultDevice() is used here.
85 : :
86 : : @param nBitCount
87 : : Bit depth of the generated virtual device. Use 0 here, to
88 : : indicate: take default screen depth. Currently, only 0 and 1
89 : : are allowed here, with 1 denoting binary mask.
90 : :
91 : : @param nAlphaBitCount
92 : : Bit depth of the generated virtual device. Use 0 here, to
93 : : indicate: take default screen depth. Currently, only 0 and 1
94 : : are allowed here, with 1 denoting binary mask.
95 : : */
96 : : VirtualDevice( const OutputDevice& rCompDev,
97 : : sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount );
98 : :
99 : : /** Create a virtual device using an existing system dependent device or graphics context
100 : : Any rendering will happen directly on the context and not on any intermediate bitmap.
101 : : Note: This might not be suported on all platforms !
102 : : */
103 : : VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount );
104 : :
105 : : virtual ~VirtualDevice();
106 : :
107 : : sal_Bool SetOutputSizePixel( const Size& rNewSize, sal_Bool bErase = sal_True );
108 : : sal_Bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer );
109 : 1726 : sal_Bool SetOutputSize( const Size& rNewSize, sal_Bool bErase = sal_True )
110 [ + - ]: 1726 : { return SetOutputSizePixel( LogicToPixel( rNewSize ), bErase ); }
111 : :
112 : : // reference device modes for different compatibility levels
113 : : enum RefDevMode { REFDEV_NONE = 0,
114 : : REFDEV_MODE06 = 1, // 600 dpi
115 : : REFDEV_MODE_MSO1 = 3,
116 : : REFDEV_MODE_PDF1 = 4,
117 : : REFDEV_CUSTOM = 5
118 : : };
119 : :
120 : : void SetReferenceDevice( RefDevMode );
121 : :
122 : : void Compat_ZeroExtleadBug(); // enable workaround for #i60495#
123 : :
124 : : void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
125 : :
126 : : private:
127 : : SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY );
128 : :
129 : : };
130 : :
131 : : #endif // _SV_VIRDEV_HXX
132 : :
133 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|