LCOV - code coverage report
Current view: top level - svl/source/items - flagitem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 25 44.0 %
Date: 2012-08-25 Functions: 7 14 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 10 30.0 %

           Branch data     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/flagitem.hxx>
      22                 :            : #include <svl/poolitem.hxx>
      23                 :            : #include <tools/stream.hxx>
      24                 :            : 
      25                 :            : // STATIC DATA -----------------------------------------------------------
      26                 :            : 
      27                 :            : DBG_NAME(SfxFlagItem)
      28                 :            : 
      29                 :            : sal_uInt16 nSfxFlagVal[16] =
      30                 :            : {
      31                 :            :     0x0001, 0x0002, 0x0004, 0x0008,
      32                 :            :     0x0010, 0x0020, 0x0040, 0x0080,
      33                 :            :     0x0100, 0x0200, 0x0400, 0x0800,
      34                 :            :     0x1000, 0x2000, 0x4000, 0x8000
      35                 :            : };
      36                 :            : 
      37                 :            : 
      38                 :            : // -----------------------------------------------------------------------
      39                 :            : 
      40 [ -  + ][ -  + ]:      21232 : TYPEINIT1(SfxFlagItem, SfxPoolItem);
      41                 :            : 
      42                 :            : // -----------------------------------------------------------------------
      43                 :            : 
      44                 :      23118 : SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV ) :
      45                 :            :     SfxPoolItem( nW ),
      46                 :      23118 :     nVal(nV)
      47                 :            : {
      48                 :            :     DBG_CTOR(SfxFlagItem, 0);
      49                 :      23118 : }
      50                 :            : 
      51                 :            : // -----------------------------------------------------------------------
      52                 :            : 
      53                 :      32845 : SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) :
      54                 :            :     SfxPoolItem( rItem ),
      55                 :      32845 :     nVal( rItem.nVal )
      56                 :            : {
      57                 :            :     DBG_CTOR(SfxFlagItem, 0);
      58                 :      32845 : }
      59                 :            : 
      60                 :            : // -----------------------------------------------------------------------
      61                 :            : 
      62                 :          0 : SvStream& SfxFlagItem::Store(SvStream &rStream, sal_uInt16) const
      63                 :            : {
      64                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
      65                 :          0 :     rStream << nVal;
      66                 :          0 :     return rStream;
      67                 :            : }
      68                 :            : 
      69                 :            : // -----------------------------------------------------------------------
      70                 :            : 
      71                 :          0 : SfxItemPresentation SfxFlagItem::GetPresentation
      72                 :            : (
      73                 :            :     SfxItemPresentation     /*ePresentation*/,
      74                 :            :     SfxMapUnit              /*eCoreMetric*/,
      75                 :            :     SfxMapUnit              /*ePresentationMetric*/,
      76                 :            :     XubString&              rText,
      77                 :            :     const IntlWrapper *
      78                 :            : )   const
      79                 :            : {
      80                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
      81                 :          0 :     rText.Erase();
      82         [ #  # ]:          0 :     for ( sal_uInt8 nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
      83         [ #  # ]:          0 :         rText += XubString::CreateFromInt32( (int)GetFlag(nFlag) );
      84                 :          0 :     return SFX_ITEM_PRESENTATION_NAMELESS;
      85                 :            : }
      86                 :            : 
      87                 :            : // -----------------------------------------------------------------------
      88                 :            : 
      89                 :          0 : XubString SfxFlagItem::GetFlagText( sal_uInt8 ) const
      90                 :            : {
      91                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
      92                 :            :     DBG_WARNING( "calling GetValueText(sal_uInt16) on SfxFlagItem -- overload!" );
      93                 :          0 :     return XubString();
      94                 :            : }
      95                 :            : 
      96                 :            : // -----------------------------------------------------------------------
      97                 :            : 
      98                 :          0 : sal_uInt8 SfxFlagItem::GetFlagCount() const
      99                 :            : {
     100                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
     101                 :            :     DBG_WARNING( "calling GetValueText(sal_uInt16) on SfxFlagItem -- overload!" );
     102                 :          0 :     return 0;
     103                 :            : }
     104                 :            : 
     105                 :            : // -----------------------------------------------------------------------
     106                 :            : 
     107                 :          0 : SfxPoolItem* SfxFlagItem::Create(SvStream &, sal_uInt16) const
     108                 :            : {
     109                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
     110                 :            :     DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" );
     111                 :          0 :     return 0;
     112                 :            : }
     113                 :            : 
     114                 :            : // -----------------------------------------------------------------------
     115                 :            : 
     116                 :       6390 : int SfxFlagItem::operator==( const SfxPoolItem& rItem ) const
     117                 :            : {
     118                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
     119                 :            :     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
     120                 :       6390 :     return (((SfxFlagItem&)rItem).nVal == nVal);
     121                 :            : }
     122                 :            : 
     123                 :            : // -----------------------------------------------------------------------
     124                 :            : 
     125                 :            : 
     126                 :        157 : SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const
     127                 :            : {
     128                 :            :     DBG_CHKTHIS(SfxFlagItem, 0);
     129         [ +  - ]:        157 :     return new SfxFlagItem( *this );
     130                 :            : }
     131                 :            : 
     132                 :            : 
     133                 :            : 
     134                 :            : 
     135                 :            : 
     136                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10