LCOV - code coverage report
Current view: top level - sfx2/source/dialog - tplpitem.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 27 30 90.0 %
Date: 2015-06-13 12:38:46 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       43535 : TYPEINIT1_AUTOFACTORY(SfxTemplateItem, SfxFlagItem);
      27             : 
      28             : 
      29             : 
      30        3760 : SfxTemplateItem::SfxTemplateItem() :
      31        3760 :     SfxFlagItem()
      32             : {
      33        3760 : }
      34             : 
      35        6855 : 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        6855 :     aStyle( rStyle )
      42             : {
      43        6855 : }
      44             : 
      45             : 
      46             : 
      47             : // copy constuctor
      48       14854 : SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem& rCopy ) :
      49             : 
      50             :     SfxFlagItem( rCopy ),
      51             : 
      52       14854 :     aStyle( rCopy.aStyle )
      53             : {
      54       14854 : }
      55             : 
      56             : 
      57             : 
      58             : // op ==
      59             : 
      60        2919 : bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
      61             : {
      62        5838 :     return ( SfxFlagItem::operator==( rCmp ) &&
      63        5838 :              aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle );
      64             : }
      65             : 
      66             : 
      67             : 
      68       12034 : SfxPoolItem* SfxTemplateItem::Clone( SfxItemPool *) const
      69             : {
      70       12034 :     return new SfxTemplateItem(*this);
      71             : }
      72             : 
      73             : 
      74        3942 : bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
      75             : {
      76        3942 :     ::com::sun::star::frame::status::Template aTemplate;
      77             : 
      78        3942 :     aTemplate.Value = GetValue();
      79        3942 :     aTemplate.StyleName = aStyle;
      80        3942 :     rVal <<= aTemplate;
      81             : 
      82        3942 :     return true;
      83             : }
      84             : 
      85             : 
      86        3760 : bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
      87             : {
      88        3760 :     ::com::sun::star::frame::status::Template aTemplate;
      89             : 
      90        3760 :     if ( rVal >>= aTemplate )
      91             :     {
      92        3760 :         SetValue( sal::static_int_cast< sal_uInt16 >( aTemplate.Value ) );
      93        3760 :         aStyle = aTemplate.StyleName;
      94        3760 :         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.11