merge the formfield patch from ooo-build
[ooovba.git] / canvas / source / null / null_canvasbitmap.cxx
blob6e91081aa7ddb88a73a94229883204a1f28cc4da
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: null_canvasbitmap.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_canvas.hxx"
34 #include <canvas/debug.hxx>
35 #include <tools/diagnose_ex.h>
36 #include <canvas/canvastools.hxx>
38 #include "null_canvasbitmap.hxx"
41 using namespace ::com::sun::star;
43 namespace nullcanvas
45 CanvasBitmap::CanvasBitmap( const ::basegfx::B2ISize& rSize,
46 const DeviceRef& rDevice,
47 bool bHasAlpha ) :
48 mpDevice( rDevice )
50 ENSURE_OR_THROW( mpDevice.is(),
51 "CanvasBitmap::CanvasBitmap(): Invalid surface or device" );
53 maCanvasHelper.init( rSize,
54 *mpDevice.get(),
55 bHasAlpha );
58 void SAL_CALL CanvasBitmap::disposing()
60 mpDevice.clear();
62 // forward to parent
63 CanvasBitmap_Base::disposing();
66 #define IMPLEMENTATION_NAME "NullCanvas.CanvasBitmap"
67 #define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
69 ::rtl::OUString SAL_CALL CanvasBitmap::getImplementationName( ) throw (uno::RuntimeException)
71 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
74 sal_Bool SAL_CALL CanvasBitmap::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
76 return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
79 uno::Sequence< ::rtl::OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames( ) throw (uno::RuntimeException)
81 uno::Sequence< ::rtl::OUString > aRet(1);
82 aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
84 return aRet;