LCOV - code coverage report
Current view: top level - svl/source/items - visitem.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 34 0.0 %
Date: 2014-04-14 Functions: 0 16 0.0 %
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 <svl/visitem.hxx>
      21             : #include <com/sun/star/uno/Any.hxx>
      22             : #include <tools/stream.hxx>
      23             : 
      24           0 : TYPEINIT1_AUTOFACTORY(SfxVisibilityItem, SfxPoolItem);
      25             : 
      26           0 : SfxVisibilityItem::SfxVisibilityItem(sal_uInt16 which, SvStream & rStream):
      27           0 :     SfxPoolItem(which)
      28             : {
      29           0 :     bool bValue = false;
      30           0 :     rStream.ReadCharAsBool( bValue );
      31           0 :     m_nValue.bVisible = bValue;
      32           0 : }
      33             : 
      34             : // virtual
      35           0 : bool SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const
      36             : {
      37             :     DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type");
      38           0 :     return m_nValue.bVisible == (static_cast< const SfxVisibilityItem * >(&rItem))->
      39           0 :                         m_nValue.bVisible;
      40             : }
      41             : 
      42             : // virtual
      43           0 : int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const
      44             : {
      45             :     DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type");
      46           0 :     return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ?
      47           0 :                0 : m_nValue.bVisible ? -1 : 1;
      48             : }
      49             : 
      50             : // virtual
      51           0 : SfxItemPresentation SfxVisibilityItem::GetPresentation(SfxItemPresentation,
      52             :                                                   SfxMapUnit, SfxMapUnit,
      53             :                                                   OUString & rText,
      54             :                                                   const IntlWrapper *) const
      55             : {
      56           0 :     rText = GetValueTextByVal(m_nValue.bVisible);
      57           0 :     return SFX_ITEM_PRESENTATION_NAMELESS;
      58             : }
      59             : 
      60             : 
      61             : // virtual
      62           0 : bool SfxVisibilityItem::QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8) const
      63             : {
      64           0 :     rVal <<= m_nValue;
      65           0 :     return true;
      66             : }
      67             : 
      68             : // virtual
      69           0 : bool SfxVisibilityItem::PutValue(const com::sun::star::uno::Any& rVal, sal_uInt8)
      70             : {
      71           0 :     if (rVal >>= m_nValue)
      72           0 :         return true;
      73             : 
      74             :     OSL_FAIL( "SfxInt16Item::PutValue - Wrong type!" );
      75           0 :     return false;
      76             : }
      77             : 
      78             : // virtual
      79           0 : SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, sal_uInt16) const
      80             : {
      81           0 :     return new SfxVisibilityItem(Which(), rStream);
      82             : }
      83             : 
      84             : // virtual
      85           0 : SvStream & SfxVisibilityItem::Store(SvStream & rStream, sal_uInt16) const
      86             : {
      87           0 :     rStream.WriteUChar( m_nValue.bVisible );
      88           0 :     return rStream;
      89             : }
      90             : 
      91             : // virtual
      92           0 : SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const
      93             : {
      94           0 :     return new SfxVisibilityItem(*this);
      95             : }
      96             : 
      97             : // virtual
      98           0 : sal_uInt16 SfxVisibilityItem::GetValueCount() const
      99             : {
     100           0 :     return 2;
     101             : }
     102             : 
     103             : // virtual
     104           0 : OUString SfxVisibilityItem::GetValueTextByVal(bool bTheValue) const
     105             : {
     106           0 :     return bTheValue ? OUString("TRUE") : OUString("FALSE");
     107             : }
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10