LCOV - code coverage report
Current view: top level - sfx2/source/dialog - tplpitem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 28 30 93.3 %
Date: 2012-08-25 Functions: 12 13 92.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 16 28 57.1 %

           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                 :            : #include "sfx2/tplpitem.hxx"
      21                 :            : #include <com/sun/star/frame/status/Template.hpp>
      22                 :            : 
      23                 :            : 
      24                 :            : // STATIC DATA -----------------------------------------------------------
      25                 :            : 
      26 [ +  + ][ -  + ]:      93486 : TYPEINIT1_AUTOFACTORY(SfxTemplateItem, SfxFlagItem);
                 [ +  - ]
      27                 :            : 
      28                 :            : //=========================================================================
      29                 :            : 
      30                 :       7977 : SfxTemplateItem::SfxTemplateItem() :
      31         [ +  - ]:       7977 :     SfxFlagItem()
      32                 :            : {
      33                 :       7977 : }
      34                 :            : 
      35                 :      15013 : SfxTemplateItem::SfxTemplateItem
      36                 :            : (
      37                 :            :     sal_uInt16 nWhichId,      // Slot-ID
      38                 :            :     const String& rStyle, // Name of the current Styles
      39                 :            :     sal_uInt16 nValue         // Flags for the filters of the automatic display
      40                 :            : ) : SfxFlagItem( nWhichId, nValue ),
      41         [ +  - ]:      15013 :     aStyle( rStyle )
      42                 :            : {
      43                 :      15013 : }
      44                 :            : 
      45                 :            : //-------------------------------------------------------------------------
      46                 :            : 
      47                 :            : // copy constuctor
      48                 :      32688 : SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem& rCopy ) :
      49                 :            : 
      50                 :            :     SfxFlagItem( rCopy ),
      51                 :            : 
      52         [ +  - ]:      32688 :     aStyle( rCopy.aStyle )
      53                 :            : {
      54                 :      32688 : }
      55                 :            : 
      56                 :            : //-------------------------------------------------------------------------
      57                 :            : 
      58                 :            : // op ==
      59                 :            : 
      60                 :       6376 : int SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
      61                 :            : {
      62                 :       6376 :     return ( SfxFlagItem::operator==( rCmp ) &&
      63 [ +  + ][ +  - ]:       6376 :              aStyle == ( (const SfxTemplateItem&)rCmp ).aStyle );
      64                 :            : }
      65                 :            : 
      66                 :            : //-------------------------------------------------------------------------
      67                 :            : 
      68                 :      26295 : SfxPoolItem* SfxTemplateItem::Clone( SfxItemPool *) const
      69                 :            : {
      70         [ +  - ]:      26295 :     return new SfxTemplateItem(*this);
      71                 :            : }
      72                 :            : 
      73                 :            : //-------------------------------------------------------------------------
      74                 :       7977 : bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
      75                 :            : {
      76                 :       7977 :     ::com::sun::star::frame::status::Template aTemplate;
      77                 :            : 
      78                 :       7977 :     aTemplate.Value = GetValue();
      79         [ +  - ]:       7977 :     aTemplate.StyleName = aStyle;
      80         [ +  - ]:       7977 :     rVal <<= aTemplate;
      81                 :            : 
      82                 :       7977 :     return true;
      83                 :            : }
      84                 :            : 
      85                 :            : //-------------------------------------------------------------------------
      86                 :       7977 : bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
      87                 :            : {
      88                 :       7977 :     ::com::sun::star::frame::status::Template aTemplate;
      89                 :            : 
      90 [ +  - ][ +  - ]:       7977 :     if ( rVal >>= aTemplate )
      91                 :            :     {
      92                 :       7977 :         SetValue( sal::static_int_cast< sal_uInt16 >( aTemplate.Value ) );
      93         [ +  - ]:       7977 :         aStyle = aTemplate.StyleName;
      94                 :       7977 :         return true;
      95                 :            :     }
      96                 :            : 
      97                 :       7977 :     return false;
      98                 :            : }
      99                 :            : 
     100                 :            : //-------------------------------------------------------------------------
     101                 :            : 
     102                 :          0 : sal_uInt8 SfxTemplateItem::GetFlagCount() const
     103                 :            : {
     104                 :          0 :     return sizeof(sal_uInt16) * 8;
     105                 :            : }
     106                 :            : 
     107                 :            : 
     108                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10