LCOV - code coverage report
Current view: top level - svl/source/items - imageitm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 46 52 88.5 %
Date: 2012-08-25 Functions: 18 21 85.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 39 78 50.0 %

           Branch data     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                 :            : 
      21                 :            : #include <svl/imageitm.hxx>
      22                 :            : #include <com/sun/star/uno/Sequence.hxx>
      23                 :            : 
      24 [ -  + ][ -  + ]:      20891 : TYPEINIT1( SfxImageItem, SfxInt16Item );
      25                 :            : 
      26                 :      37108 : struct SfxImageItem_Impl
      27                 :            : {
      28                 :            :     String  aURL;
      29                 :            :     long    nAngle;
      30                 :            :     sal_Bool    bMirrored;
      31                 :       1500 :     int     operator == ( const SfxImageItem_Impl& rOther ) const
      32 [ +  - ][ +  - ]:       1500 :             { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; }
      33                 :            : };
      34                 :            : 
      35                 :            : //---------------------------------------------------------
      36                 :            : 
      37                 :       9279 : SfxImageItem::SfxImageItem( sal_uInt16 which, sal_uInt16 nImage )
      38                 :       9279 :     : SfxInt16Item( which, nImage )
      39                 :            : {
      40 [ +  - ][ +  - ]:       9279 :     pImp = new SfxImageItem_Impl;
      41                 :       9279 :     pImp->nAngle = 0;
      42                 :       9279 :     pImp->bMirrored = sal_False;
      43                 :       9279 : }
      44                 :            : 
      45                 :       9278 : SfxImageItem::SfxImageItem( const SfxImageItem& rItem )
      46                 :       9278 :     : SfxInt16Item( rItem )
      47                 :            : {
      48 [ +  - ][ +  - ]:       9278 :     pImp = new SfxImageItem_Impl( *(rItem.pImp) );
      49                 :       9278 : }
      50                 :            : 
      51                 :            : //---------------------------------------------------------
      52                 :      18551 : SfxImageItem::~SfxImageItem()
      53                 :            : {
      54 [ +  - ][ +  - ]:      18551 :     delete pImp;
      55         [ -  + ]:      27823 : }
      56                 :            : 
      57                 :            : //---------------------------------------------------------
      58                 :            : 
      59                 :       9278 : SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
      60                 :            : {
      61         [ +  - ]:       9278 :     return new SfxImageItem( *this );
      62                 :            : }
      63                 :            : 
      64                 :            : //---------------------------------------------------------
      65                 :            : 
      66                 :       1500 : int SfxImageItem::operator==( const SfxPoolItem& rItem ) const
      67                 :            : {
      68 [ +  - ][ +  - ]:       1500 :     return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) );
      69                 :            : }
      70                 :            : 
      71                 :       3614 : bool SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
      72                 :            : {
      73         [ +  - ]:       3614 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 );
      74 [ +  - ][ +  - ]:       3614 :     aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() );
      75 [ +  - ][ +  - ]:       3614 :     aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle );
      76 [ +  - ][ +  - ]:       3614 :     aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored );
      77 [ +  - ][ +  - ]:       3614 :     aSeq[3] = ::com::sun::star::uno::makeAny( rtl::OUString( pImp->aURL ));
                 [ +  - ]
      78                 :            : 
      79         [ +  - ]:       3614 :     rVal = ::com::sun::star::uno::makeAny( aSeq );
      80         [ +  - ]:       3614 :     return true;
      81                 :            : }
      82                 :            : 
      83                 :       4165 : bool SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
      84                 :            : {
      85         [ +  - ]:       4165 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
      86 [ +  - ][ +  - ]:       4165 :     if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 ))
         [ +  - ][ +  - ]
      87                 :            :     {
      88                 :       4165 :         sal_Int16     nVal = sal_Int16();
      89                 :       4165 :         rtl::OUString aURL;
      90 [ +  - ][ +  - ]:       4165 :         if ( aSeq[0] >>= nVal )
      91                 :       4165 :             SetValue( nVal );
      92         [ +  - ]:       4165 :         aSeq[1] >>= pImp->nAngle;
      93         [ +  - ]:       4165 :         aSeq[2] >>= pImp->bMirrored;
      94 [ +  - ][ +  - ]:       4165 :         if ( aSeq[3] >>= aURL )
      95         [ +  - ]:       4165 :             pImp->aURL = aURL;
      96                 :       4165 :         return true;
      97                 :            :     }
      98                 :            : 
      99         [ +  - ]:       4165 :     return false;
     100                 :            : }
     101                 :            : 
     102                 :          0 : void SfxImageItem::SetRotation( long nValue )
     103                 :            : {
     104                 :          0 :     pImp->nAngle = nValue;
     105                 :          0 : }
     106                 :            : 
     107                 :       4165 : long SfxImageItem::GetRotation() const
     108                 :            : {
     109                 :       4165 :     return pImp->nAngle;
     110                 :            : }
     111                 :            : 
     112                 :          0 : void SfxImageItem::SetMirrored( sal_Bool bSet )
     113                 :            : {
     114                 :          0 :     pImp->bMirrored = bSet;
     115                 :          0 : }
     116                 :            : 
     117                 :       4165 : sal_Bool SfxImageItem::IsMirrored() const
     118                 :            : {
     119                 :       4165 :     return pImp->bMirrored;
     120                 :            : }
     121                 :            : 
     122                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10