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