bump product version to 5.0.4.1
[LibreOffice.git] / toolkit / source / awt / vclxbitmap.cxx
blob670dcd5f76b35b382200e7b0020e20768a8997a7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <toolkit/awt/vclxbitmap.hxx>
21 #include <toolkit/helper/macros.hxx>
22 #include <cppuhelper/typeprovider.hxx>
23 #include <cppuhelper/queryinterface.hxx>
24 #include <tools/stream.hxx>
25 #include <rtl/uuid.h>
26 #include <vcl/dibtools.hxx>
29 // class VCLXBitmap
32 // ::com::sun::star::uno::XInterface
33 ::com::sun::star::uno::Any VCLXBitmap::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
35 ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
36 (static_cast< ::com::sun::star::awt::XBitmap* >(this)),
37 (static_cast< ::com::sun::star::awt::XDisplayBitmap* >(this)),
38 (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)),
39 (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
40 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
43 // ::com::sun::star::lang::XUnoTunnel
44 IMPL_XUNOTUNNEL( VCLXBitmap )
46 // ::com::sun::star::lang::XTypeProvider
47 IMPL_XTYPEPROVIDER_START( VCLXBitmap )
48 cppu::UnoType<com::sun::star::awt::XBitmap>::get(),
49 cppu::UnoType<com::sun::star::awt::XDisplayBitmap>::get()
50 IMPL_XTYPEPROVIDER_END
53 // ::com::sun::star::awt::XBitmap
54 ::com::sun::star::awt::Size VCLXBitmap::getSize() throw(::com::sun::star::uno::RuntimeException, std::exception)
56 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
58 ::com::sun::star::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() );
59 return aSize;
62 ::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB() throw(::com::sun::star::uno::RuntimeException, std::exception)
64 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
66 SvMemoryStream aMem;
67 WriteDIB(maBitmap.GetBitmap(), aMem, false, true);
68 return ::com::sun::star::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() );
71 ::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() throw(::com::sun::star::uno::RuntimeException, std::exception)
73 ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
75 SvMemoryStream aMem;
76 WriteDIB(maBitmap.GetMask(), aMem, false, true);
77 return ::com::sun::star::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() );
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */