1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VCLCANVAS_DEVICEHELPER_HXX
25 #define _VCLCANVAS_DEVICEHELPER_HXX
26 
27 #include <com/sun/star/awt/Rectangle.hpp>
28 #include <com/sun/star/awt/XWindow2.hpp>
29 #include <com/sun/star/rendering/XGraphicDevice.hpp>
30 #include <com/sun/star/rendering/XBufferController.hpp>
31 
32 #include <vcl/outdev.hxx>
33 #include <vcl/window.hxx>
34 
35 #include "outdevprovider.hxx"
36 
37 #include <boost/utility.hpp>
38 
39 
40 /* Definition of DeviceHelper class */
41 
42 namespace vclcanvas
43 {
44     class Canvas;
45 
46     class DeviceHelper : private ::boost::noncopyable
47     {
48     public:
49         DeviceHelper();
50 
51         void init( const OutDevProviderSharedPtr& rOutDev );
52 
53         /// Dispose all internal references
54         void disposing();
55 
56         // XWindowGraphicDevice
57         ::com::sun::star::geometry::RealSize2D getPhysicalResolution();
58         ::com::sun::star::geometry::RealSize2D getPhysicalSize();
59         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon(
60             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 								 rDevice,
61             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points );
62         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon(
63             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 								 		 rDevice,
64             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points );
65         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap(
66             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
67             const ::com::sun::star::geometry::IntegerSize2D& 										size );
68         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap(
69             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
70             const ::com::sun::star::geometry::IntegerSize2D& 										size );
71         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap(
72             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
73             const ::com::sun::star::geometry::IntegerSize2D& 										size );
74         ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap(
75             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
76             const ::com::sun::star::geometry::IntegerSize2D& 										size );
77         sal_Bool hasFullScreenMode(  );
78         sal_Bool enterFullScreenMode( sal_Bool bEnter );
79 
80         ::com::sun::star::uno::Any isAccelerated() const;
81         ::com::sun::star::uno::Any getDeviceHandle() const;
82         ::com::sun::star::uno::Any getSurfaceHandle() const;
83         ::com::sun::star::uno::Reference<
84             ::com::sun::star::rendering::XColorSpace > getColorSpace() const;
85 
getOutDev() const86         OutDevProviderSharedPtr getOutDev() const { return mpOutDev; }
87 
88         /** called when DumpScreenContent property is enabled on
89             XGraphicDevice, and writes out bitmaps of current screen.
90          */
91         void dumpScreenContent() const;
92 
93     private:
94         /// For retrieving device info
95         OutDevProviderSharedPtr mpOutDev;
96     };
97 }
98 
99 #endif /* _VCLCANVAS_DEVICEHELPER_HXX */
100