LCOV - code coverage report
Current view: top level - editeng/source/items - writingmodeitem.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 26 46 56.5 %
Date: 2014-04-11 Functions: 11 17 64.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             : #include <editeng/writingmodeitem.hxx>
      21             : #include <editeng/eerdll.hxx>
      22             : #include <editeng/editrids.hrc>
      23             : 
      24             : using namespace ::com::sun::star::uno;
      25             : using namespace ::com::sun::star::text;
      26             : 
      27             : 
      28       22309 : TYPEINIT1_FACTORY(SvxWritingModeItem, SfxUInt16Item, new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB, 0));
      29             : 
      30       61915 : SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, sal_uInt16 _nWhich )
      31       61915 :     : SfxUInt16Item( _nWhich, (sal_uInt16)eValue )
      32             : {
      33       61915 : }
      34             : 
      35      157384 : SvxWritingModeItem::~SvxWritingModeItem()
      36             : {
      37      157384 : }
      38             : 
      39       56137 : bool SvxWritingModeItem::operator==( const SfxPoolItem& rCmp ) const
      40             : {
      41             :     DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
      42             : 
      43       56137 :     return GetValue() == ((SvxWritingModeItem&)rCmp).GetValue();
      44             : }
      45             : 
      46       48519 : SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const
      47             : {
      48       48519 :     return new SvxWritingModeItem( *this );
      49             : }
      50             : 
      51           0 : SfxPoolItem* SvxWritingModeItem::Create( SvStream & , sal_uInt16  ) const
      52             : {
      53             :     OSL_FAIL("SvxWritingModeItem should not be streamed!");
      54           0 :     return NULL;
      55             : }
      56             : 
      57           0 : SvStream& SvxWritingModeItem::Store( SvStream & rStrm, sal_uInt16  ) const
      58             : {
      59             :     OSL_FAIL("SvxWritingModeItem should not be streamed!");
      60           0 :     return rStrm;
      61             : }
      62             : 
      63           0 : sal_uInt16 SvxWritingModeItem::GetVersion( sal_uInt16 /*nFVer*/ ) const
      64             : {
      65           0 :     return USHRT_MAX;
      66             : }
      67             : 
      68           0 : SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePres,
      69             :         SfxMapUnit /*eCoreMetric*/,
      70             :         SfxMapUnit /*ePresMetric*/,
      71             :         OUString &rText,
      72             :         const IntlWrapper *  ) const
      73             : {
      74           0 :     SfxItemPresentation eRet = ePres;
      75           0 :     switch( ePres )
      76             :     {
      77             :     case SFX_ITEM_PRESENTATION_NONE:
      78           0 :         rText = OUString();
      79           0 :         break;
      80             : 
      81             :     case SFX_ITEM_PRESENTATION_NAMELESS:
      82             :     case SFX_ITEM_PRESENTATION_COMPLETE:
      83           0 :         rText = EE_RESSTR(RID_SVXITEMS_FRMDIR_BEGIN + GetValue());
      84           0 :         break;
      85             : 
      86             :     default:
      87           0 :         eRet = SFX_ITEM_PRESENTATION_NONE;
      88             :     }
      89           0 :     return eRet;
      90             : }
      91             : 
      92         156 : bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
      93             : {
      94         156 :     sal_Int32 nVal = 0;
      95         156 :     bool bRet = ( rVal >>= nVal );
      96             : 
      97         156 :     if( !bRet )
      98             :     {
      99             :         WritingMode eMode;
     100         156 :         bRet = rVal >>= eMode;
     101             : 
     102         156 :         if( bRet )
     103             :         {
     104         156 :             nVal = (sal_Int32)eMode;
     105             :         }
     106             :     }
     107             : 
     108         156 :     if( bRet )
     109             :     {
     110         156 :         switch( nVal )
     111             :         {
     112             :             case WritingMode_LR_TB:
     113             :             case WritingMode_RL_TB:
     114             :             case WritingMode_TB_RL:
     115         156 :                 SetValue( (sal_uInt16)nVal );
     116         156 :                 bRet = true;
     117         156 :                 break;
     118             :             default:
     119           0 :                 bRet = false;
     120           0 :                 break;
     121             :         }
     122             :     }
     123             : 
     124         156 :     return bRet;
     125             : }
     126             : 
     127         300 : bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal,
     128             :                                             sal_uInt8 ) const
     129             : {
     130         300 :     rVal <<= (WritingMode)GetValue();
     131         300 :     return true;
     132             : }
     133             : 
     134           0 : SvxWritingModeItem& SvxWritingModeItem::operator=( const SvxWritingModeItem& rItem )
     135             : {
     136           0 :     SetValue( rItem.GetValue() );
     137           0 :     return *this;
     138             : }
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10