LCOV - code coverage report
Current view: top level - framework/source/fwe/classes - imagewrapper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 35 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          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 <classes/imagewrapper.hxx>
      21             : #include <osl/mutex.hxx>
      22             : #include <vcl/svapp.hxx>
      23             : #include <vcl/bitmap.hxx>
      24             : #include <vcl/bitmapex.hxx>
      25             : #include <tools/stream.hxx>
      26             : #include <cppuhelper/typeprovider.hxx>
      27             : #include <vcl/dibtools.hxx>
      28             : 
      29             : using namespace com::sun::star::lang;
      30             : using namespace com::sun::star::uno;
      31             : 
      32             : namespace framework
      33             : {
      34             : 
      35           0 : static Sequence< sal_Int8 > impl_getStaticIdentifier()
      36             : {
      37             :     static const sal_uInt8 pGUID[16] = { 0x46, 0xAD, 0x69, 0xFB, 0xA7, 0xBE, 0x44, 0x83, 0xB2, 0xA7, 0xB3, 0xEC, 0x59, 0x4A, 0xB7, 0x00 };
      38           0 :     static ::com::sun::star::uno::Sequence< sal_Int8 > seqID((const sal_Int8*)pGUID,16);
      39           0 :     return seqID;
      40             : }
      41             : 
      42           0 : ImageWrapper::ImageWrapper( const Image& aImage ) : m_aImage( aImage )
      43             : {
      44           0 : }
      45             : 
      46           0 : ImageWrapper::~ImageWrapper()
      47             : {
      48           0 : }
      49             : 
      50           0 : Sequence< sal_Int8 > ImageWrapper::GetUnoTunnelId()
      51             : {
      52           0 :     return impl_getStaticIdentifier();
      53             : }
      54             : 
      55             : // XBitmap
      56           0 : com::sun::star::awt::Size SAL_CALL ImageWrapper::getSize() throw ( RuntimeException, std::exception )
      57             : {
      58           0 :     SolarMutexGuard aGuard;
      59             : 
      60           0 :     BitmapEx    aBitmapEx( m_aImage.GetBitmapEx() );
      61           0 :     Size        aBitmapSize( aBitmapEx.GetSizePixel() );
      62             : 
      63           0 :     return com::sun::star::awt::Size( aBitmapSize.Width(), aBitmapSize.Height() );
      64             : }
      65             : 
      66           0 : Sequence< sal_Int8 > SAL_CALL ImageWrapper::getDIB() throw ( RuntimeException, std::exception )
      67             : {
      68           0 :     SolarMutexGuard aGuard;
      69             : 
      70           0 :     SvMemoryStream aMem;
      71           0 :     WriteDIB(m_aImage.GetBitmapEx().GetBitmap(), aMem, false, true);
      72           0 :     return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
      73             : }
      74             : 
      75           0 : Sequence< sal_Int8 > SAL_CALL ImageWrapper::getMaskDIB() throw ( RuntimeException, std::exception )
      76             : {
      77           0 :     SolarMutexGuard aGuard;
      78           0 :     BitmapEx    aBmpEx( m_aImage.GetBitmapEx() );
      79             : 
      80           0 :     if ( aBmpEx.IsAlpha() )
      81             :     {
      82           0 :         SvMemoryStream aMem;
      83           0 :         WriteDIB(aBmpEx.GetAlpha().GetBitmap(), aMem, false, true);
      84           0 :         return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
      85             :     }
      86           0 :     else if ( aBmpEx.IsTransparent() )
      87             :     {
      88           0 :         SvMemoryStream aMem;
      89           0 :         WriteDIB(aBmpEx.GetMask(), aMem, false, true);
      90           0 :         return Sequence< sal_Int8 >( (sal_Int8*) aMem.GetData(), aMem.Tell() );
      91             :     }
      92             : 
      93           0 :     return Sequence< sal_Int8 >();
      94             : }
      95             : 
      96             : // XUnoTunnel
      97           0 : sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw ( RuntimeException, std::exception )
      98             : {
      99           0 :     if ( aIdentifier == impl_getStaticIdentifier() )
     100           0 :         return reinterpret_cast< sal_Int64 >( this );
     101             :     else
     102           0 :         return 0;
     103             : }
     104             : 
     105             : }
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10