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 _DXCANVAS_CANVASBITMAP_HXX
25 #define _DXCANVAS_CANVASBITMAP_HXX
26 
27 #include <cppuhelper/compbase4.hxx>
28 
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
31 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
32 #include <com/sun/star/beans/XFastPropertySet.hpp>
33 
34 #include <basegfx/vector/b2isize.hxx>
35 
36 #include <boost/shared_ptr.hpp>
37 
38 #include <cppuhelper/compbase3.hxx>
39 #include <comphelper/uno3.hxx>
40 #include <canvas/base/basemutexhelper.hxx>
41 #include <canvas/base/integerbitmapbase.hxx>
42 
43 #include "dx_bitmapprovider.hxx"
44 #include "dx_bitmapcanvashelper.hxx"
45 #include "dx_devicehelper.hxx"
46 #include "dx_impltools.hxx"
47 #include "dx_ibitmap.hxx"
48 
49 
50 /* Definition of CanvasBitmap class */
51 
52 namespace dxcanvas
53 {
54     typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
55 											  ::com::sun::star::rendering::XIntegerBitmap,
56                          					  ::com::sun::star::lang::XServiceInfo,
57                          					  ::com::sun::star::beans::XFastPropertySet >  	CanvasBitmapBase_Base;
58     typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >,
59                                          BitmapCanvasHelper,
60                                          ::osl::MutexGuard,
61                                          ::cppu::OWeakObject >							CanvasBitmap_Base;
62 
63     class CanvasBitmap : public CanvasBitmap_Base, public BitmapProvider
64     {
65     public:
66         /** Create a canvas bitmap for the given surface
67 
68             @param rSurface
69             Surface to create API object for.
70 
71             @param rDevice
72             Reference device, with which bitmap should be compatible
73          */
74         CanvasBitmap( const IBitmapSharedPtr& rSurface,
75                       const DeviceRef&        rDevice );
76 
77         /// Dispose all internal references
78         virtual void SAL_CALL disposing();
79 
80         // XServiceInfo
81         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
82         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
83         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
84 
85         // BitmapProvider
getBitmap() const86         virtual IBitmapSharedPtr getBitmap() const { return mpBitmap; }
87 
88         virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException);
setFastPropertyValue(sal_Int32,const::com::sun::star::uno::Any &)89         virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException) {}
90 
91     private:
92         /** MUST hold here, too, since CanvasHelper only contains a
93             raw pointer (without refcounting)
94         */
95         DeviceRef        mpDevice;
96         IBitmapSharedPtr mpBitmap;
97     };
98 }
99 
100 #endif /* _DXCANVAS_CANVASBITMAP_HXX */
101