Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <toolkit/awt/vclxbitmap.hxx>
21 : #include <toolkit/helper/macros.hxx>
22 : #include <cppuhelper/typeprovider.hxx>
23 : #include <tools/stream.hxx>
24 : #include <rtl/uuid.h>
25 : #include <vcl/dibtools.hxx>
26 :
27 :
28 : // class VCLXBitmap
29 :
30 :
31 : // ::com::sun::star::uno::XInterface
32 0 : ::com::sun::star::uno::Any VCLXBitmap::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception)
33 : {
34 : ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
35 : (static_cast< ::com::sun::star::awt::XBitmap* >(this)),
36 : (static_cast< ::com::sun::star::awt::XDisplayBitmap* >(this)),
37 : (static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)),
38 0 : (static_cast< ::com::sun::star::lang::XTypeProvider* >(this)) );
39 0 : return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
40 : }
41 :
42 : // ::com::sun::star::lang::XUnoTunnel
43 0 : IMPL_XUNOTUNNEL( VCLXBitmap )
44 :
45 : // ::com::sun::star::lang::XTypeProvider
46 0 : IMPL_XTYPEPROVIDER_START( VCLXBitmap )
47 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ),
48 0 : getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap>* ) NULL )
49 0 : IMPL_XTYPEPROVIDER_END
50 :
51 :
52 : // ::com::sun::star::awt::XBitmap
53 0 : ::com::sun::star::awt::Size VCLXBitmap::getSize() throw(::com::sun::star::uno::RuntimeException, std::exception)
54 : {
55 0 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
56 :
57 0 : ::com::sun::star::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() );
58 0 : return aSize;
59 : }
60 :
61 0 : ::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB() throw(::com::sun::star::uno::RuntimeException, std::exception)
62 : {
63 0 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
64 :
65 0 : SvMemoryStream aMem;
66 0 : WriteDIB(maBitmap.GetBitmap(), aMem, false, true);
67 0 : return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
68 : }
69 :
70 0 : ::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() throw(::com::sun::star::uno::RuntimeException, std::exception)
71 : {
72 0 : ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
73 :
74 0 : SvMemoryStream aMem;
75 0 : WriteDIB(maBitmap.GetMask(), aMem, false, true);
76 0 : return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
77 : }
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|