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

Generated by: LCOV version 1.10