LCOV - code coverage report
Current view: top level - editeng/source/items - writingmodeitem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 46 58.7 %
Date: 2012-08-25 Functions: 11 17 64.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 29 34.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <editeng/writingmodeitem.hxx>
      30                 :            : #include <editeng/eerdll.hxx>
      31                 :            : #include <editeng/editrids.hrc>
      32                 :            : 
      33                 :            : using namespace ::com::sun::star::uno;
      34                 :            : using namespace ::com::sun::star::text;
      35                 :            : 
      36                 :            : 
      37 [ -  + ][ -  + ]:      34098 : TYPEINIT1_FACTORY(SvxWritingModeItem, SfxUInt16Item, new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB, 0));
                 [ #  # ]
      38                 :            : 
      39                 :      59714 : SvxWritingModeItem::SvxWritingModeItem( WritingMode eValue, sal_uInt16 _nWhich )
      40                 :      59714 :     : SfxUInt16Item( _nWhich, (sal_uInt16)eValue )
      41                 :            : {
      42                 :      59714 : }
      43                 :            : 
      44                 :     129686 : SvxWritingModeItem::~SvxWritingModeItem()
      45                 :            : {
      46         [ -  + ]:     203656 : }
      47                 :            : 
      48                 :      53767 : int SvxWritingModeItem::operator==( const SfxPoolItem& rCmp ) const
      49                 :            : {
      50                 :            :     DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal types" );
      51                 :            : 
      52                 :      53767 :     return GetValue() == ((SvxWritingModeItem&)rCmp).GetValue();
      53                 :            : }
      54                 :            : 
      55                 :      70374 : SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const
      56                 :            : {
      57         [ +  - ]:      70374 :     return new SvxWritingModeItem( *this );
      58                 :            : }
      59                 :            : 
      60                 :          0 : SfxPoolItem* SvxWritingModeItem::Create( SvStream & , sal_uInt16  ) const
      61                 :            : {
      62                 :            :     OSL_FAIL("SvxWritingModeItem should not be streamed!");
      63                 :          0 :     return NULL;
      64                 :            : }
      65                 :            : 
      66                 :          0 : SvStream& SvxWritingModeItem::Store( SvStream & rStrm, sal_uInt16  ) const
      67                 :            : {
      68                 :            :     OSL_FAIL("SvxWritingModeItem should not be streamed!");
      69                 :          0 :     return rStrm;
      70                 :            : }
      71                 :            : 
      72                 :          0 : sal_uInt16 SvxWritingModeItem::GetVersion( sal_uInt16 /*nFVer*/ ) const
      73                 :            : {
      74                 :          0 :     return USHRT_MAX;
      75                 :            : }
      76                 :            : 
      77                 :          0 : SfxItemPresentation SvxWritingModeItem::GetPresentation( SfxItemPresentation ePres,
      78                 :            :         SfxMapUnit /*eCoreMetric*/,
      79                 :            :         SfxMapUnit /*ePresMetric*/,
      80                 :            :         String &rText,
      81                 :            :         const IntlWrapper *  ) const
      82                 :            : {
      83                 :          0 :     SfxItemPresentation eRet = ePres;
      84      [ #  #  # ]:          0 :     switch( ePres )
      85                 :            :     {
      86                 :            :     case SFX_ITEM_PRESENTATION_NONE:
      87                 :          0 :         rText.Erase();
      88                 :          0 :         break;
      89                 :            : 
      90                 :            :     case SFX_ITEM_PRESENTATION_NAMELESS:
      91                 :            :     case SFX_ITEM_PRESENTATION_COMPLETE:
      92 [ #  # ][ #  # ]:          0 :         rText = EE_RESSTR(RID_SVXITEMS_FRMDIR_BEGIN + GetValue());
      93                 :          0 :         break;
      94                 :            : 
      95                 :            :     default:
      96                 :          0 :         eRet = SFX_ITEM_PRESENTATION_NONE;
      97                 :            :     }
      98                 :          0 :     return eRet;
      99                 :            : }
     100                 :            : 
     101                 :         88 : bool SvxWritingModeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 )
     102                 :            : {
     103                 :         88 :     sal_Int32 nVal = 0;
     104                 :         88 :     bool bRet = ( rVal >>= nVal );
     105                 :            : 
     106         [ +  - ]:         88 :     if( !bRet )
     107                 :            :     {
     108                 :            :         WritingMode eMode;
     109         [ +  - ]:         88 :         bRet = rVal >>= eMode;
     110                 :            : 
     111         [ +  - ]:         88 :         if( bRet )
     112                 :            :         {
     113                 :         88 :             nVal = (sal_Int32)eMode;
     114                 :            :         }
     115                 :            :     }
     116                 :            : 
     117         [ +  - ]:         88 :     if( bRet )
     118                 :            :     {
     119         [ +  - ]:         88 :         switch( nVal )
     120                 :            :         {
     121                 :            :             case WritingMode_LR_TB:
     122                 :            :             case WritingMode_RL_TB:
     123                 :            :             case WritingMode_TB_RL:
     124                 :         88 :                 SetValue( (sal_uInt16)nVal );
     125                 :         88 :                 bRet = true;
     126                 :         88 :                 break;
     127                 :            :             default:
     128                 :          0 :                 bRet = false;
     129                 :         88 :                 break;
     130                 :            :         }
     131                 :            :     }
     132                 :            : 
     133                 :         88 :     return bRet;
     134                 :            : }
     135                 :            : 
     136                 :        336 : bool SvxWritingModeItem::QueryValue( com::sun::star::uno::Any& rVal,
     137                 :            :                                             sal_uInt8 ) const
     138                 :            : {
     139         [ +  - ]:        336 :     rVal <<= (WritingMode)GetValue();
     140                 :        336 :     return true;
     141                 :            : }
     142                 :            : 
     143                 :          0 : SvxWritingModeItem& SvxWritingModeItem::operator=( const SvxWritingModeItem& rItem )
     144                 :            : {
     145                 :          0 :     SetValue( rItem.GetValue() );
     146                 :          0 :     return *this;
     147                 :            : }
     148                 :            : 
     149                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10