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