LCOV - code coverage report
Current view: top level - sfx2/source/dialog - tplpitem.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 27 30 90.0 %
Date: 2014-11-03 Functions: 12 13 92.3 %
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 <sfx2/tplpitem.hxx>
      21             : #include <com/sun/star/frame/status/Template.hpp>
      22             : 
      23             : 
      24             : // STATIC DATA -----------------------------------------------------------
      25             : 
      26       62875 : TYPEINIT1_AUTOFACTORY(SfxTemplateItem, SfxFlagItem);
      27             : 
      28             : 
      29             : 
      30        7135 : SfxTemplateItem::SfxTemplateItem() :
      31        7135 :     SfxFlagItem()
      32             : {
      33        7135 : }
      34             : 
      35        8023 : SfxTemplateItem::SfxTemplateItem
      36             : (
      37             :     sal_uInt16 nWhichId,      // Slot-ID
      38             :     const OUString& rStyle, // Name of the current Styles
      39             :     sal_uInt16 nValue         // Flags for the filters of the automatic display
      40             : ) : SfxFlagItem( nWhichId, nValue ),
      41        8023 :     aStyle( rStyle )
      42             : {
      43        8023 : }
      44             : 
      45             : 
      46             : 
      47             : // copy constuctor
      48       21467 : SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem& rCopy ) :
      49             : 
      50             :     SfxFlagItem( rCopy ),
      51             : 
      52       21467 :     aStyle( rCopy.aStyle )
      53             : {
      54       21467 : }
      55             : 
      56             : 
      57             : 
      58             : // op ==
      59             : 
      60         857 : bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
      61             : {
      62        1714 :     return ( SfxFlagItem::operator==( rCmp ) &&
      63        1714 :              aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle );
      64             : }
      65             : 
      66             : 
      67             : 
      68       16117 : SfxPoolItem* SfxTemplateItem::Clone( SfxItemPool *) const
      69             : {
      70       16117 :     return new SfxTemplateItem(*this);
      71             : }
      72             : 
      73             : 
      74        7141 : bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
      75             : {
      76        7141 :     ::com::sun::star::frame::status::Template aTemplate;
      77             : 
      78        7141 :     aTemplate.Value = GetValue();
      79        7141 :     aTemplate.StyleName = aStyle;
      80        7141 :     rVal <<= aTemplate;
      81             : 
      82        7141 :     return true;
      83             : }
      84             : 
      85             : 
      86        7135 : bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
      87             : {
      88        7135 :     ::com::sun::star::frame::status::Template aTemplate;
      89             : 
      90        7135 :     if ( rVal >>= aTemplate )
      91             :     {
      92        7135 :         SetValue( sal::static_int_cast< sal_uInt16 >( aTemplate.Value ) );
      93        7135 :         aStyle = aTemplate.StyleName;
      94        7135 :         return true;
      95             :     }
      96             : 
      97           0 :     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