xref: /AOO41X/main/canvas/source/null/null_devicehelper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _NULLCANVAS_DEVICEHELPER_HXX
29 #define _NULLCANVAS_DEVICEHELPER_HXX
30 
31 #include <com/sun/star/awt/Rectangle.hpp>
32 #include <com/sun/star/rendering/XGraphicDevice.hpp>
33 #include <com/sun/star/rendering/XBufferController.hpp>
34 
35 #include <boost/utility.hpp>
36 
37 
38 /* Definition of DeviceHelper class */
39 
40 namespace nullcanvas
41 {
42     class SpriteCanvas;
43     class SpriteCanvasHelper;
44 
45     class DeviceHelper : private ::boost::noncopyable
46     {
47     public:
48         DeviceHelper();
49 
50         void init( SpriteCanvas&				rSpriteCanvas,
51                    const ::basegfx::B2ISize&	rSize,
52                    bool                         bFullscreen );
53 
54         /// Dispose all internal references
55         void disposing();
56 
57         // XWindowGraphicDevice
58         ::com::sun::star::geometry::RealSize2D getPhysicalResolution();
59         ::com::sun::star::geometry::RealSize2D getPhysicalSize();
60         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(
61             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 								 rDevice,
62             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points );
63         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(
64             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 								 		 rDevice,
65             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points );
66         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap(
67             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
68             const ::com::sun::star::geometry::IntegerSize2D& 										size );
69         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap(
70             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
71             const ::com::sun::star::geometry::IntegerSize2D& 										size );
72         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap(
73             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
74             const ::com::sun::star::geometry::IntegerSize2D& 										size );
75         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
76             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
77             const ::com::sun::star::geometry::IntegerSize2D& 										size );
78         sal_Bool hasFullScreenMode(  );
79         sal_Bool enterFullScreenMode( sal_Bool bEnter );
80 
81         ::sal_Int32 createBuffers( ::sal_Int32 nBuffers );
82         void 		destroyBuffers(  );
83         ::sal_Bool  showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll );
84         ::sal_Bool  switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll );
85 
86         ::com::sun::star::uno::Any isAccelerated() const;
87         ::com::sun::star::uno::Any getDeviceHandle() const;
88         ::com::sun::star::uno::Any getSurfaceHandle() const;
89         ::com::sun::star::uno::Reference<
90             ::com::sun::star::rendering::XColorSpace> getColorSpace() const;
91 
92         void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds );
93 
94         /** called when DumpScreenContent property is enabled on
95             XGraphicDevice, and writes out bitmaps of current screen.
96          */
97         void dumpScreenContent() const;
98 
99     private:
100         /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
101         SpriteCanvas*			mpSpriteCanvas;
102         ::basegfx::B2ISize      maSize;
103         bool                    mbFullScreen;
104     };
105 }
106 
107 #endif /* _NULLCANVAS_WINDOWGRAPHICDEVICE_HXX */
108