Update ooo320-m1
[ooovba.git] / toolkit / source / awt / vclxbitmap.cxx
blob688234f87845885a59ce4d54ffa871b9d9a1e825
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: vclxbitmap.cxx,v $
10 * $Revision: 1.4 $
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_toolkit.hxx"
35 #include <toolkit/awt/vclxbitmap.hxx>
36 #include <toolkit/helper/macros.hxx>
37 #include <cppuhelper/typeprovider.hxx>
38 #include <tools/stream.hxx>
39 #include <rtl/memory.h>
40 #include <rtl/uuid.h>
42 // ----------------------------------------------------
43 // class VCLXBitmap
44 // ----------------------------------------------------
46 // ::com::sun::star::uno::XInterface
47 ::com::sun::star::uno::Any VCLXBitmap::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
49 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
50 SAL_STATIC_CAST( ::com::sun::star::awt::XBitmap*, this ),
51 SAL_STATIC_CAST( ::com::sun::star::awt::XDisplayBitmap*, this ),
52 SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
53 SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
54 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
57 // ::com::sun::star::lang::XUnoTunnel
58 IMPL_XUNOTUNNEL( VCLXBitmap )
60 // ::com::sun::star::lang::XTypeProvider
61 IMPL_XTYPEPROVIDER_START( VCLXBitmap )
62 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ),
63 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap>* ) NULL )
64 IMPL_XTYPEPROVIDER_END
67 // ::com::sun::star::awt::XBitmap
68 ::com::sun::star::awt::Size VCLXBitmap::getSize() throw(::com::sun::star::uno::RuntimeException)
70 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
72 ::com::sun::star::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() );
73 return aSize;
76 ::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB() throw(::com::sun::star::uno::RuntimeException)
78 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
80 SvMemoryStream aMem;
81 aMem << maBitmap.GetBitmap();
82 return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
85 ::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() throw(::com::sun::star::uno::RuntimeException)
87 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
89 SvMemoryStream aMem;
90 aMem << maBitmap.GetMask();
91 return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );