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_CANVASBITMAP_HXX
29 #define _NULLCANVAS_CANVASBITMAP_HXX
30 
31 #include <cppuhelper/compbase3.hxx>
32 
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
35 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
36 
37 #include <basegfx/vector/b2isize.hxx>
38 
39 #include <boost/shared_ptr.hpp>
40 
41 #include <canvas/base/integerbitmapbase.hxx>
42 
43 #include "null_canvashelper.hxx"
44 #include "null_spritecanvas.hxx"
45 #include "null_usagecounter.hxx"
46 
47 
48 /* Definition of CanvasBitmap class */
49 
50 namespace nullcanvas
51 {
52     typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas,
53 											  ::com::sun::star::rendering::XIntegerBitmap,
54                          					  ::com::sun::star::lang::XServiceInfo >  	CanvasBitmapBase_Base;
55     typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >,
56                                          CanvasHelper,
57                                          ::osl::MutexGuard,
58                                          ::cppu::OWeakObject >							CanvasBitmap_Base;
59 
60     class CanvasBitmap : public CanvasBitmap_Base,
61                          private UsageCounter< CanvasBitmap >
62     {
63     public:
64         /** Create a canvas bitmap for the given surface
65 
66             @param rSize
67             Size of the bitmap
68 
69             @param rDevice
70             Reference device, with which bitmap should be compatible
71          */
72         CanvasBitmap( const ::basegfx::B2ISize& rSize,
73                       const DeviceRef&          rDevice,
74                       bool                      bHasAlpha );
75 
76         /// Dispose all internal references
77         virtual void SAL_CALL disposing();
78 
79         // XServiceInfo
80         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
81         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
82         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
83 
84     private:
85         /** MUST hold here, too, since CanvasHelper only contains a
86             raw pointer (without refcounting)
87         */
88         DeviceRef               mpDevice;
89     };
90 }
91 
92 #endif /* _NULLCANVAS_CANVASBITMAP_HXX */
93