LCOV - code coverage report
Current view: top level - sw/source/core/attr - fmtwrapinfluenceonobjpos.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 46 0.0 %
Date: 2014-04-14 Functions: 0 16 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 <fmtwrapinfluenceonobjpos.hxx>
      21             : #include <unomid.h>
      22             : 
      23             : using namespace ::com::sun::star;
      24             : using namespace ::com::sun::star::uno;
      25             : 
      26           0 : TYPEINIT1(SwFmtWrapInfluenceOnObjPos, SfxPoolItem);
      27             : 
      28           0 : SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition )
      29             :     : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
      30           0 :     mnWrapInfluenceOnPosition( _nWrapInfluenceOnPosition )
      31             : {
      32           0 : }
      33             : 
      34           0 : SwFmtWrapInfluenceOnObjPos::SwFmtWrapInfluenceOnObjPos( const SwFmtWrapInfluenceOnObjPos& _rCpy )
      35             :     : SfxPoolItem( RES_WRAP_INFLUENCE_ON_OBJPOS ),
      36           0 :     mnWrapInfluenceOnPosition( _rCpy.GetWrapInfluenceOnObjPos() )
      37             : {
      38           0 : }
      39             : 
      40           0 : SwFmtWrapInfluenceOnObjPos::~SwFmtWrapInfluenceOnObjPos()
      41             : {
      42           0 : }
      43             : 
      44           0 : SwFmtWrapInfluenceOnObjPos& SwFmtWrapInfluenceOnObjPos::operator=( const SwFmtWrapInfluenceOnObjPos& _rSource )
      45             : {
      46           0 :     mnWrapInfluenceOnPosition = _rSource.GetWrapInfluenceOnObjPos();
      47             : 
      48           0 :     return *this;
      49             : }
      50             : 
      51           0 : bool SwFmtWrapInfluenceOnObjPos::operator==( const SfxPoolItem& _rAttr ) const
      52             : {
      53             :     OSL_ENSURE( SfxPoolItem::operator==( _rAttr ), "no matching attributes" );
      54           0 :     return ( mnWrapInfluenceOnPosition ==
      55             :                     static_cast<const SwFmtWrapInfluenceOnObjPos&>(_rAttr).
      56           0 :                                                 GetWrapInfluenceOnObjPos() );
      57             : }
      58             : 
      59           0 : SfxPoolItem* SwFmtWrapInfluenceOnObjPos::Clone( SfxItemPool * ) const
      60             : {
      61           0 :     return new SwFmtWrapInfluenceOnObjPos(*this);
      62             : }
      63             : 
      64           0 : bool SwFmtWrapInfluenceOnObjPos::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
      65             : {
      66           0 :     nMemberId &= ~CONVERT_TWIPS;
      67           0 :     bool bRet = true;
      68           0 :     if( nMemberId == MID_WRAP_INFLUENCE )
      69             :     {
      70           0 :         rVal <<= GetWrapInfluenceOnObjPos();
      71             :     }
      72             :     else
      73             :     {
      74             :         OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::QueryValue()> - unknown MemberId" );
      75           0 :         bRet = false;
      76             :     }
      77           0 :     return bRet;
      78             : }
      79             : 
      80           0 : bool SwFmtWrapInfluenceOnObjPos::PutValue( const Any& rVal, sal_uInt8 nMemberId )
      81             : {
      82           0 :     nMemberId &= ~CONVERT_TWIPS;
      83           0 :     bool bRet = false;
      84             : 
      85           0 :     if( nMemberId == MID_WRAP_INFLUENCE )
      86             :     {
      87           0 :         sal_Int16 nNewWrapInfluence = 0;
      88           0 :         rVal >>= nNewWrapInfluence;
      89             :         // #i35017# - constant names have changed and <ITERATIVE> has been added
      90           0 :         if ( nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
      91           0 :              nNewWrapInfluence == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
      92           0 :              nNewWrapInfluence == text::WrapInfluenceOnPosition::ITERATIVE )
      93             :         {
      94           0 :             SetWrapInfluenceOnObjPos( nNewWrapInfluence );
      95           0 :             bRet = true;
      96             :         }
      97             :         else
      98             :         {
      99             :             OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - invalid attribute value" );
     100             :         }
     101             :     }
     102             :     else
     103             :     {
     104             :         OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::PutValue(..)> - unknown MemberId" );
     105             :     }
     106           0 :     return bRet;
     107             : }
     108             : 
     109           0 : void SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos( sal_Int16 _nWrapInfluenceOnPosition )
     110             : {
     111             :     // #i35017# - constant names have changed and consider new value <ITERATIVE>
     112           0 :     if ( _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ||
     113           0 :          _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ONCE_CONCURRENT ||
     114             :          _nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ITERATIVE )
     115             :     {
     116           0 :         mnWrapInfluenceOnPosition = _nWrapInfluenceOnPosition;
     117             :     }
     118             :     else
     119             :     {
     120             :         OSL_FAIL( "<SwFmtWrapInfluenceOnObjPos::SetWrapInfluenceOnObjPos(..)> - invalid attribute value" );
     121             :     }
     122           0 : }
     123             : 
     124             : // #i35017# - add parameter <_bIterativeAsOnceConcurrent> to control, if
     125             : // value <ITERATIVE> has to be treated as <ONCE_CONCURRENT>
     126           0 : sal_Int16 SwFmtWrapInfluenceOnObjPos::GetWrapInfluenceOnObjPos(
     127             :                                 const bool _bIterativeAsOnceConcurrent ) const
     128             : {
     129           0 :     sal_Int16 nWrapInfluenceOnPosition( mnWrapInfluenceOnPosition );
     130             : 
     131           0 :     if ( _bIterativeAsOnceConcurrent &&
     132             :          nWrapInfluenceOnPosition == text::WrapInfluenceOnPosition::ITERATIVE )
     133             :     {
     134           0 :         nWrapInfluenceOnPosition = text::WrapInfluenceOnPosition::ONCE_CONCURRENT;
     135             :     }
     136             : 
     137           0 :     return nWrapInfluenceOnPosition;
     138             : }
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10