LCOV - code coverage report
Current view: top level - svl/source/items - imageitm.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 46 53 86.8 %
Date: 2015-06-13 12:38:46 Functions: 18 21 85.7 %
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             : 
      21             : #include <svl/imageitm.hxx>
      22             : #include <com/sun/star/uno/Sequence.hxx>
      23             : 
      24        9738 : TYPEINIT1( SfxImageItem, SfxInt16Item );
      25             : 
      26       17138 : struct SfxImageItem_Impl
      27             : {
      28             :     OUString aURL;
      29             :     long    nAngle;
      30             :     bool    bMirrored;
      31         724 :     bool    operator == ( const SfxImageItem_Impl& rOther ) const
      32         724 :             { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; }
      33             : };
      34             : 
      35             : 
      36        4284 : SfxImageItem::SfxImageItem( sal_uInt16 which, sal_uInt16 nImage )
      37        4284 :     : SfxInt16Item( which, nImage )
      38             : {
      39        4284 :     pImp = new SfxImageItem_Impl;
      40        4284 :     pImp->nAngle = 0;
      41        4284 :     pImp->bMirrored = false;
      42        4284 : }
      43             : 
      44        4285 : SfxImageItem::SfxImageItem( const SfxImageItem& rItem )
      45        4285 :     : SfxInt16Item( rItem )
      46             : {
      47        4285 :     pImp = new SfxImageItem_Impl( *(rItem.pImp) );
      48        4285 : }
      49             : 
      50       21423 : SfxImageItem::~SfxImageItem()
      51             : {
      52        8569 :     delete pImp;
      53       12854 : }
      54             : 
      55             : 
      56        4285 : SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
      57             : {
      58        4285 :     return new SfxImageItem( *this );
      59             : }
      60             : 
      61             : 
      62         724 : bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const
      63             : {
      64        1448 :     return (static_cast<const SfxImageItem&>(rItem).GetValue() == GetValue()) &&
      65        1448 :            (*pImp == *static_cast<const SfxImageItem&>(rItem).pImp);
      66             : }
      67             : 
      68        1647 : bool SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
      69             : {
      70        1647 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 );
      71        1647 :     aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() );
      72        1647 :     aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle );
      73        1647 :     aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored );
      74        1647 :     aSeq[3] = ::com::sun::star::uno::makeAny( OUString( pImp->aURL ));
      75             : 
      76        1647 :     rVal = ::com::sun::star::uno::makeAny( aSeq );
      77        1647 :     return true;
      78             : }
      79             : 
      80        1913 : bool SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
      81             : {
      82        1913 :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
      83        1913 :     if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 ))
      84             :     {
      85        1913 :         sal_Int16     nVal = sal_Int16();
      86        1913 :         OUString aURL;
      87        1913 :         if ( aSeq[0] >>= nVal )
      88        1913 :             SetValue( nVal );
      89        1913 :         aSeq[1] >>= pImp->nAngle;
      90        1913 :         aSeq[2] >>= pImp->bMirrored;
      91        1913 :         if ( aSeq[3] >>= aURL )
      92        1913 :             pImp->aURL = aURL;
      93        1913 :         return true;
      94             :     }
      95             : 
      96           0 :     return false;
      97             : }
      98             : 
      99           0 : void SfxImageItem::SetRotation( long nValue )
     100             : {
     101           0 :     pImp->nAngle = nValue;
     102           0 : }
     103             : 
     104        1913 : long SfxImageItem::GetRotation() const
     105             : {
     106        1913 :     return pImp->nAngle;
     107             : }
     108             : 
     109           0 : void SfxImageItem::SetMirrored( bool bSet )
     110             : {
     111           0 :     pImp->bMirrored = bSet;
     112           0 : }
     113             : 
     114        1913 : bool SfxImageItem::IsMirrored() const
     115             : {
     116        1913 :     return pImp->bMirrored;
     117             : }
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11