LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/graphic - descriptor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 68 199 34.2 %
Date: 2012-12-27 Functions: 9 21 42.9 %
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 "descriptor.hxx"
      21             : 
      22             : #include <osl/mutex.hxx>
      23             : #include <unotools/ucbstreamhelper.hxx>
      24             : #include <svtools/filter.hxx>
      25             : #include <svl/itemprop.hxx>
      26             : #include <comphelper/servicehelper.hxx>
      27             : 
      28             : #include <com/sun/star/beans/PropertyState.hpp>
      29             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      30             : #include <com/sun/star/awt/Size.hpp>
      31             : #include <com/sun/star/graphic/GraphicType.hpp>
      32             : 
      33             : #include "vcl/graph.hxx"
      34             : #include "vcl/svapp.hxx"
      35             : 
      36             : #define UNOGRAPHIC_GRAPHICTYPE  1
      37             : #define UNOGRAPHIC_MIMETYPE     2
      38             : #define UNOGRAPHIC_SIZEPIXEL    3
      39             : #define UNOGRAPHIC_SIZE100THMM  4
      40             : #define UNOGRAPHIC_BITSPERPIXEL 5
      41             : #define UNOGRAPHIC_TRANSPARENT  6
      42             : #define UNOGRAPHIC_ALPHA        7
      43             : #define UNOGRAPHIC_ANIMATED     8
      44             : 
      45             : using namespace ::com::sun::star;
      46             : 
      47             : namespace unographic {
      48             : 
      49             : // ---------------------
      50             : // - GraphicDescriptor -
      51             : // ---------------------
      52             : 
      53         132 : GraphicDescriptor::GraphicDescriptor() :
      54             :     ::comphelper::PropertySetHelper( createPropertySetInfo(), SAL_NO_ACQUIRE ),
      55             :     mpGraphic( NULL ),
      56             :     meType( GRAPHIC_NONE ),
      57             :     mnBitsPerPixel ( 0 ),
      58             :     mbTransparent ( false ),
      59             :     mbAlpha( false ),
      60         132 :     mbAnimated( false )
      61             : {
      62         132 : }
      63             : 
      64             : // ------------------------------------------------------------------------------
      65             : 
      66         132 : GraphicDescriptor::~GraphicDescriptor()
      67         132 :     throw()
      68             : {
      69         132 : }
      70             : 
      71             : // ------------------------------------------------------------------------------
      72             : 
      73         132 : void GraphicDescriptor::init( const ::Graphic& rGraphic )
      74             :     throw()
      75             : {
      76         132 :     mpGraphic = &rGraphic;
      77         132 : }
      78             : 
      79             : // ------------------------------------------------------------------------------
      80             : 
      81           0 : void GraphicDescriptor::init( const ::rtl::OUString& rURL )
      82             :     throw()
      83             : {
      84           0 :     SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rURL, STREAM_READ );
      85             : 
      86           0 :     if( pIStm )
      87             :     {
      88           0 :         implCreate( *pIStm, &rURL );
      89           0 :         delete pIStm;
      90             :     }
      91           0 : }
      92             : 
      93             : // ------------------------------------------------------------------------------
      94             : 
      95           0 : void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, const ::rtl::OUString& rURL )
      96             :     throw()
      97             : {
      98           0 :     SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rxIStm );
      99             : 
     100           0 :     if( pIStm )
     101             :     {
     102           0 :         implCreate( *pIStm, &rURL );
     103           0 :         delete pIStm;
     104             :     }
     105           0 : }
     106             : 
     107             : // ------------------------------------------------------------------------------
     108             : 
     109           0 : void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL )
     110             : {
     111           0 :     String aURL;
     112           0 :     if( pURL )
     113           0 :         aURL = *pURL;
     114           0 :     ::GraphicDescriptor aDescriptor( rIStm, &aURL );
     115             : 
     116           0 :     mpGraphic = NULL;
     117           0 :     maMimeType = ::rtl::OUString();
     118           0 :     meType = GRAPHIC_NONE;
     119           0 :     mnBitsPerPixel = 0;
     120           0 :     mbTransparent = false;
     121             : 
     122           0 :     if( aDescriptor.Detect( true ) && aDescriptor.GetFileFormat() != GFF_NOT )
     123             :     {
     124           0 :         const char*             pMimeType = NULL;
     125           0 :         sal_uInt8               cType = graphic::GraphicType::EMPTY;
     126             : 
     127           0 :         switch( aDescriptor.GetFileFormat() )
     128             :         {
     129           0 :             case( GFF_BMP ): pMimeType = MIMETYPE_BMP; cType = graphic::GraphicType::PIXEL; break;
     130           0 :             case( GFF_GIF ): pMimeType = MIMETYPE_GIF; cType = graphic::GraphicType::PIXEL; break;
     131           0 :             case( GFF_JPG ): pMimeType = MIMETYPE_JPG; cType = graphic::GraphicType::PIXEL; break;
     132           0 :             case( GFF_PCD ): pMimeType = MIMETYPE_PCD; cType = graphic::GraphicType::PIXEL; break;
     133           0 :             case( GFF_PCX ): pMimeType = MIMETYPE_PCX; cType = graphic::GraphicType::PIXEL; break;
     134           0 :             case( GFF_PNG ): pMimeType = MIMETYPE_PNG; cType = graphic::GraphicType::PIXEL; break;
     135           0 :             case( GFF_TIF ): pMimeType = MIMETYPE_TIF; cType = graphic::GraphicType::PIXEL; break;
     136           0 :             case( GFF_XBM ): pMimeType = MIMETYPE_XBM; cType = graphic::GraphicType::PIXEL; break;
     137           0 :             case( GFF_XPM ): pMimeType = MIMETYPE_XPM; cType = graphic::GraphicType::PIXEL; break;
     138           0 :             case( GFF_PBM ): pMimeType = MIMETYPE_PBM; cType = graphic::GraphicType::PIXEL; break;
     139           0 :             case( GFF_PGM ): pMimeType = MIMETYPE_PGM; cType = graphic::GraphicType::PIXEL; break;
     140           0 :             case( GFF_PPM ): pMimeType = MIMETYPE_PPM; cType = graphic::GraphicType::PIXEL; break;
     141           0 :             case( GFF_RAS ): pMimeType = MIMETYPE_RAS; cType = graphic::GraphicType::PIXEL; break;
     142           0 :             case( GFF_TGA ): pMimeType = MIMETYPE_TGA; cType = graphic::GraphicType::PIXEL; break;
     143           0 :             case( GFF_PSD ): pMimeType = MIMETYPE_PSD; cType = graphic::GraphicType::PIXEL; break;
     144             : 
     145           0 :             case( GFF_EPS ): pMimeType = MIMETYPE_EPS; cType = graphic::GraphicType::VECTOR; break;
     146           0 :             case( GFF_DXF ): pMimeType = MIMETYPE_DXF; cType = graphic::GraphicType::VECTOR; break;
     147           0 :             case( GFF_MET ): pMimeType = MIMETYPE_MET; cType = graphic::GraphicType::VECTOR; break;
     148           0 :             case( GFF_PCT ): pMimeType = MIMETYPE_PCT; cType = graphic::GraphicType::VECTOR; break;
     149           0 :             case( GFF_SGF ): pMimeType = MIMETYPE_SGF; cType = graphic::GraphicType::VECTOR; break;
     150           0 :             case( GFF_SVM ): pMimeType = MIMETYPE_SVM; cType = graphic::GraphicType::VECTOR; break;
     151           0 :             case( GFF_WMF ): pMimeType = MIMETYPE_WMF; cType = graphic::GraphicType::VECTOR; break;
     152           0 :             case( GFF_SGV ): pMimeType = MIMETYPE_SGV; cType = graphic::GraphicType::VECTOR; break;
     153           0 :             case( GFF_EMF ): pMimeType = MIMETYPE_EMF; cType = graphic::GraphicType::VECTOR; break;
     154           0 :             case( GFF_SVG ): pMimeType = MIMETYPE_SVG; cType = graphic::GraphicType::VECTOR; break;
     155             : 
     156             :             default:
     157           0 :             break;
     158             :         }
     159             : 
     160           0 :         if( graphic::GraphicType::EMPTY != cType )
     161             :         {
     162           0 :             meType = ( ( graphic::GraphicType::PIXEL == cType ) ? GRAPHIC_BITMAP : GRAPHIC_GDIMETAFILE );
     163           0 :             maMimeType = String( pMimeType, RTL_TEXTENCODING_ASCII_US );
     164           0 :             maSizePixel = aDescriptor.GetSizePixel();
     165           0 :             maSize100thMM = aDescriptor.GetSize_100TH_MM();
     166           0 :             mnBitsPerPixel = aDescriptor.GetBitsPerPixel();
     167           0 :             mbTransparent = ( graphic::GraphicType::VECTOR == cType );
     168           0 :             mbAlpha = mbAnimated = false;
     169             :         }
     170           0 :     }
     171           0 : }
     172             : 
     173             : // ------------------------------------------------------------------------------
     174             : 
     175           0 : ::rtl::OUString GraphicDescriptor::getImplementationName_Static()
     176             :     throw()
     177             : {
     178           0 :     return ::rtl::OUString( "com.sun.star.comp.graphic.GraphicDescriptor"  );
     179             : }
     180             : 
     181             : // ------------------------------------------------------------------------------
     182             : 
     183           0 : uno::Sequence< ::rtl::OUString > GraphicDescriptor::getSupportedServiceNames_Static()
     184             :     throw(  )
     185             : {
     186           0 :     uno::Sequence< ::rtl::OUString > aSeq( 1 );
     187             : 
     188           0 :     aSeq.getArray()[ 0 ] = ::rtl::OUString( "com.sun.star.graphic.GraphicDescriptor"  );
     189             : 
     190           0 :     return aSeq;
     191             : }
     192             : 
     193             : // ------------------------------------------------------------------------------
     194             : 
     195          73 : uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType )
     196             :     throw( uno::RuntimeException )
     197             : {
     198          73 :     uno::Any aAny;
     199             : 
     200          73 :     if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) )
     201           0 :         aAny <<= uno::Reference< lang::XServiceInfo >(this);
     202          73 :     else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) )
     203          53 :         aAny <<= uno::Reference< lang::XTypeProvider >(this);
     204          20 :     else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) )
     205          15 :         aAny <<= uno::Reference< beans::XPropertySet >(this);
     206           5 :     else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) )
     207           0 :         aAny <<= uno::Reference< beans::XPropertyState >(this);
     208           5 :     else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) )
     209           5 :         aAny <<= uno::Reference< beans::XMultiPropertySet >(this);
     210             :     else
     211           0 :         aAny <<= OWeakAggObject::queryAggregation( rType );
     212             : 
     213          73 :     return aAny;
     214             : }
     215             : 
     216             : // ------------------------------------------------------------------------------
     217             : 
     218         225 : uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType )
     219             :     throw( uno::RuntimeException )
     220             : {
     221         225 :     return OWeakAggObject::queryInterface( rType );
     222             : }
     223             : 
     224             : // ------------------------------------------------------------------------------
     225             : 
     226        1584 : void SAL_CALL GraphicDescriptor::acquire()
     227             :     throw()
     228             : {
     229        1584 :     OWeakAggObject::acquire();
     230        1584 : }
     231             : 
     232             : // ------------------------------------------------------------------------------
     233             : 
     234        1584 : void SAL_CALL GraphicDescriptor::release()
     235             :     throw()
     236             : {
     237        1584 :     OWeakAggObject::release();
     238        1584 : }
     239             : 
     240             : // ------------------------------------------------------------------------------
     241             : 
     242           0 : ::rtl::OUString SAL_CALL GraphicDescriptor::getImplementationName()
     243             :     throw( uno::RuntimeException )
     244             : {
     245           0 :     return getImplementationName_Static();
     246             : }
     247             : 
     248             : // ------------------------------------------------------------------------------
     249             : 
     250           0 : sal_Bool SAL_CALL GraphicDescriptor::supportsService( const rtl::OUString& ServiceName )
     251             :     throw( uno::RuntimeException )
     252             : {
     253           0 :     uno::Sequence< ::rtl::OUString >    aSNL( getSupportedServiceNames() );
     254           0 :     const ::rtl::OUString*              pArray = aSNL.getConstArray();
     255             : 
     256           0 :     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
     257           0 :         if( pArray[i] == ServiceName )
     258           0 :             return true;
     259             : 
     260           0 :     return false;
     261             : }
     262             : 
     263             : // ------------------------------------------------------------------------------
     264             : 
     265           0 : uno::Sequence< rtl::OUString > SAL_CALL GraphicDescriptor::getSupportedServiceNames()
     266             :     throw( uno::RuntimeException )
     267             : {
     268           0 :     return getSupportedServiceNames_Static();
     269             : }
     270             : 
     271             : // ------------------------------------------------------------------------------
     272             : 
     273           0 : uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes()
     274             :     throw( uno::RuntimeException )
     275             : {
     276           0 :     uno::Sequence< uno::Type >  aTypes( 6 );
     277           0 :     uno::Type*                  pTypes = aTypes.getArray();
     278             : 
     279           0 :     *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0);
     280           0 :     *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0);
     281           0 :     *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
     282           0 :     *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0);
     283           0 :     *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0);
     284           0 :     *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0);
     285             : 
     286           0 :     return aTypes;
     287             : }
     288             : 
     289             : namespace
     290             : {
     291             :     class theGraphicDescriptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicDescriptorUnoTunnelId > {};
     292             : }
     293             : 
     294           0 : uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId()
     295             :     throw( uno::RuntimeException )
     296             : {
     297           0 :     return theGraphicDescriptorUnoTunnelId::get().getSeq();
     298             : }
     299             : 
     300             : // ------------------------------------------------------------------------------
     301             : 
     302         132 : ::comphelper::PropertySetInfo* GraphicDescriptor::createPropertySetInfo()
     303             : {
     304         132 :     SolarMutexGuard aGuard;
     305         132 :     ::comphelper::PropertySetInfo*  pRet = new ::comphelper::PropertySetInfo();
     306             : 
     307             :     static ::comphelper::PropertyMapEntry aEntries[] =
     308             :     {
     309           5 :         { MAP_CHAR_LEN( "GraphicType" ), UNOGRAPHIC_GRAPHICTYPE, &::getCppuType( (const sal_Int8*)(0)), beans::PropertyAttribute::READONLY, 0 },
     310           5 :         { MAP_CHAR_LEN( "MimeType" ), UNOGRAPHIC_MIMETYPE, &::getCppuType( (const ::rtl::OUString*)(0)), beans::PropertyAttribute::READONLY, 0 },
     311           5 :         { MAP_CHAR_LEN( "SizePixel" ), UNOGRAPHIC_SIZEPIXEL, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 },
     312           5 :         { MAP_CHAR_LEN( "Size100thMM" ), UNOGRAPHIC_SIZE100THMM,    &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 },
     313           5 :         { MAP_CHAR_LEN( "BitsPerPixel" ), UNOGRAPHIC_BITSPERPIXEL, &::getCppuType( (const sal_uInt8*)(0)), beans::PropertyAttribute::READONLY, 0 },
     314           5 :         { MAP_CHAR_LEN( "Transparent" ), UNOGRAPHIC_TRANSPARENT, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 },
     315           5 :         { MAP_CHAR_LEN( "Alpha" ), UNOGRAPHIC_ALPHA, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 },
     316           5 :         { MAP_CHAR_LEN( "Animated" ), UNOGRAPHIC_ANIMATED, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 },
     317             : 
     318             :         { 0,0,0,0,0,0 }
     319         172 :     };
     320             : 
     321         132 :     pRet->acquire();
     322         132 :     pRet->add( aEntries );
     323             : 
     324         132 :     return pRet;
     325             : }
     326             : 
     327             : // ------------------------------------------------------------------------------
     328             : 
     329           0 : void GraphicDescriptor::_setPropertyValues( const comphelper::PropertyMapEntry** /*ppEntries*/, const uno::Any* /*pValues*/ )
     330             :     throw( beans::UnknownPropertyException,
     331             :            beans::PropertyVetoException,
     332             :            lang::IllegalArgumentException,
     333             :               lang::WrappedTargetException )
     334             : {
     335             :     // we only have readonly attributes
     336           0 : }
     337             : 
     338             : // ------------------------------------------------------------------------------
     339             : 
     340          20 : void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues )
     341             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException )
     342             : {
     343          20 :     SolarMutexGuard aGuard;
     344             : 
     345          60 :     while( *ppEntries )
     346             :     {
     347          20 :         switch( (*ppEntries)->mnHandle )
     348             :         {
     349             :             case( UNOGRAPHIC_GRAPHICTYPE ):
     350             :             {
     351           1 :                 const GraphicType eType( mpGraphic ? mpGraphic->GetType() : meType );
     352             : 
     353             :                 *pValues <<= ( ( eType == GRAPHIC_BITMAP ? graphic::GraphicType::PIXEL :
     354             :                                 ( eType == GRAPHIC_GDIMETAFILE ? graphic::GraphicType::VECTOR :
     355           1 :                                 graphic::GraphicType::EMPTY ) ) );
     356             :             }
     357           1 :             break;
     358             : 
     359             :             case( UNOGRAPHIC_MIMETYPE ):
     360             :             {
     361           0 :                 ::rtl::OUString aMimeType;
     362             : 
     363           0 :                 if( mpGraphic )
     364             :                 {
     365           0 :                     if( mpGraphic->IsLink() )
     366             :                     {
     367             :                         const char* pMimeType;
     368             : 
     369           0 :                         switch( const_cast< Graphic* >( mpGraphic )->GetLink().GetType() )
     370             :                         {
     371           0 :                             case( GFX_LINK_TYPE_NATIVE_GIF ): pMimeType = MIMETYPE_GIF; break;
     372           0 :                             case( GFX_LINK_TYPE_NATIVE_JPG ): pMimeType = MIMETYPE_JPG; break;
     373           0 :                             case( GFX_LINK_TYPE_NATIVE_PNG ): pMimeType = MIMETYPE_PNG; break;
     374           0 :                             case( GFX_LINK_TYPE_NATIVE_WMF ): pMimeType = MIMETYPE_WMF; break;
     375           0 :                             case( GFX_LINK_TYPE_NATIVE_MET ): pMimeType = MIMETYPE_MET; break;
     376           0 :                             case( GFX_LINK_TYPE_NATIVE_PCT ): pMimeType = MIMETYPE_PCT; break;
     377             : 
     378             :                             // added Svg mimetype support
     379           0 :                             case( GFX_LINK_TYPE_NATIVE_SVG ): pMimeType = MIMETYPE_SVG; break;
     380             : 
     381             :                             default:
     382           0 :                                 pMimeType = NULL;
     383           0 :                             break;
     384             :                         }
     385             : 
     386           0 :                         if( pMimeType )
     387           0 :                             aMimeType = ::rtl::OUString::createFromAscii( pMimeType );
     388             :                     }
     389             : 
     390           0 :                     if( aMimeType.isEmpty() && ( mpGraphic->GetType() != GRAPHIC_NONE ) )
     391           0 :                         aMimeType = ::rtl::OUString(MIMETYPE_VCLGRAPHIC );
     392             :                 }
     393             :                 else
     394           0 :                     aMimeType = maMimeType;
     395             : 
     396           0 :                  *pValues <<= aMimeType;
     397             :             }
     398           0 :             break;
     399             : 
     400             :             case( UNOGRAPHIC_SIZEPIXEL ):
     401             :             {
     402           7 :                 awt::Size aAWTSize( 0, 0 );
     403             : 
     404           7 :                 if( mpGraphic )
     405             :                 {
     406           7 :                     if( mpGraphic->GetType() == GRAPHIC_BITMAP )
     407             :                     {
     408           6 :                         const Size aSizePix( mpGraphic->GetBitmapEx().GetSizePixel() );
     409           6 :                         aAWTSize = awt::Size( aSizePix.Width(), aSizePix.Height() );
     410             :                     }
     411             :                 }
     412             :                 else
     413           0 :                     aAWTSize = awt::Size( maSizePixel.Width(), maSizePixel.Height() );
     414             : 
     415           7 :                 *pValues <<= aAWTSize;
     416             :             }
     417           7 :             break;
     418             : 
     419             :             case( UNOGRAPHIC_SIZE100THMM ):
     420             :             {
     421          12 :                 awt::Size aAWTSize( 0, 0 );
     422             : 
     423          12 :                 if( mpGraphic )
     424             :                 {
     425          12 :                     if( mpGraphic->GetPrefMapMode().GetMapUnit() != MAP_PIXEL )
     426             :                     {
     427          10 :                         const Size aSizeLog( OutputDevice::LogicToLogic( mpGraphic->GetPrefSize(), mpGraphic->GetPrefMapMode(), MAP_100TH_MM ) );
     428          10 :                         aAWTSize = awt::Size( aSizeLog.Width(), aSizeLog.Height() );
     429             :                     }
     430             :                 }
     431             :                 else
     432           0 :                     aAWTSize = awt::Size( maSize100thMM.Width(), maSize100thMM.Height() );
     433             : 
     434          12 :                 *pValues <<= aAWTSize;
     435             :             }
     436          12 :             break;
     437             : 
     438             :             case( UNOGRAPHIC_BITSPERPIXEL ):
     439             :             {
     440           0 :                 sal_uInt16 nBitsPerPixel = 0;
     441             : 
     442           0 :                 if( mpGraphic )
     443             :                 {
     444           0 :                     if( mpGraphic->GetType() == GRAPHIC_BITMAP )
     445           0 :                         nBitsPerPixel = mpGraphic->GetBitmapEx().GetBitmap().GetBitCount();
     446             :                 }
     447             :                 else
     448           0 :                     nBitsPerPixel = mnBitsPerPixel;
     449             : 
     450           0 :                 *pValues <<= sal::static_int_cast< sal_Int8 >(nBitsPerPixel);
     451             :             }
     452           0 :             break;
     453             : 
     454             :             case( UNOGRAPHIC_TRANSPARENT ):
     455             :             {
     456           0 :                 *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsTransparent() : mbTransparent );
     457             :             }
     458           0 :             break;
     459             : 
     460             :             case( UNOGRAPHIC_ALPHA ):
     461             :             {
     462           0 :                 *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAlpha() : mbAlpha );
     463             :             }
     464           0 :             break;
     465             : 
     466             :             case( UNOGRAPHIC_ANIMATED ):
     467             :             {
     468           0 :                 *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAnimated() : mbAnimated );
     469             :             }
     470           0 :             break;
     471             :         }
     472             : 
     473          20 :         ++ppEntries;
     474          20 :         ++pValues;
     475          20 :     }
     476          20 : }
     477             : 
     478             : }
     479             : 
     480             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10