LCOV - code coverage report
Current view: top level - svl/source/items - intitem.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 26 66 39.4 %
Date: 2014-11-03 Functions: 30 48 62.5 %
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             : 
      21             : #include <svl/intitem.hxx>
      22             : #include <com/sun/star/uno/Any.hxx>
      23             : #include <tools/bigint.hxx>
      24             : #include <tools/stream.hxx>
      25             : #include <svl/metitem.hxx>
      26             : 
      27             : 
      28             : //  class SfxByteItem
      29             : 
      30             : 
      31       50875 : TYPEINIT1_AUTOFACTORY(SfxByteItem, CntByteItem);
      32             : 
      33             : // virtual
      34           0 : SfxPoolItem * SfxByteItem::Create(SvStream & rStream, sal_uInt16) const
      35             : {
      36           0 :     short nValue = 0;
      37           0 :     rStream.ReadInt16( nValue );
      38           0 :     return new SfxByteItem(Which(), sal_uInt8(nValue));
      39             : }
      40             : 
      41     1714986 : TYPEINIT1_AUTOFACTORY(SfxInt16Item, SfxPoolItem);
      42             : 
      43           0 : SfxInt16Item::SfxInt16Item(sal_uInt16 which, SvStream & rStream):
      44           0 :     SfxPoolItem(which)
      45             : {
      46           0 :     short nTheValue = 0;
      47           0 :     rStream.ReadInt16( nTheValue );
      48           0 :     m_nValue = nTheValue;
      49           0 : }
      50             : 
      51             : // virtual
      52      734987 : bool SfxInt16Item::operator ==(const SfxPoolItem & rItem) const
      53             : {
      54             :     DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type");
      55      734987 :     return m_nValue == (static_cast< const SfxInt16Item * >(&rItem))->
      56      734987 :                         m_nValue;
      57             : }
      58             : 
      59             : // virtual
      60           0 : int SfxInt16Item::Compare(const SfxPoolItem & rWith) const
      61             : {
      62             :     DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type");
      63             :     return (static_cast< const SfxInt16Item * >(&rWith))->m_nValue
      64           0 :              < m_nValue ?
      65             :             -1 :
      66             :            (static_cast< const SfxInt16Item * >(&rWith))->m_nValue
      67             :              == m_nValue ?
      68           0 :             0 : 1;
      69             : }
      70             : 
      71             : // virtual
      72           0 : bool SfxInt16Item::GetPresentation(SfxItemPresentation,
      73             :                                                   SfxMapUnit, SfxMapUnit,
      74             :                                                   OUString & rText,
      75             :                                                   const IntlWrapper *) const
      76             : {
      77           0 :     rText = OUString::number(m_nValue);
      78           0 :     return true;
      79             : }
      80             : 
      81             : 
      82             : // virtual
      83        2184 : bool SfxInt16Item::QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8) const
      84             : {
      85        2184 :     sal_Int16 nValue = m_nValue;
      86        2184 :     rVal <<= nValue;
      87        2184 :     return true;
      88             : }
      89             : 
      90             : // virtual
      91         674 : bool SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal, sal_uInt8 )
      92             : {
      93         674 :     sal_Int16 nValue = sal_Int16();
      94         674 :     if (rVal >>= nValue)
      95             :     {
      96         674 :         m_nValue = nValue;
      97         674 :         return true;
      98             :     }
      99             : 
     100             :     OSL_FAIL( "SfxInt16Item::PutValue - Wrong type!" );
     101           0 :     return false;
     102             : }
     103             : 
     104             : // virtual
     105           0 : SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, sal_uInt16) const
     106             : {
     107           0 :     return new SfxInt16Item(Which(), rStream);
     108             : }
     109             : 
     110             : // virtual
     111           0 : SvStream & SfxInt16Item::Store(SvStream & rStream, sal_uInt16) const
     112             : {
     113           0 :     rStream.WriteInt16( short(m_nValue) );
     114           0 :     return rStream;
     115             : }
     116             : 
     117       20674 : SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const
     118             : {
     119       20674 :     return new SfxInt16Item(*this);
     120             : }
     121             : 
     122           0 : sal_Int16 SfxInt16Item::GetMin() const
     123             : {
     124           0 :     return -32768;
     125             : }
     126             : 
     127           0 : sal_Int16 SfxInt16Item::GetMax() const
     128             : {
     129           0 :     return 32767;
     130             : }
     131             : 
     132           0 : SfxFieldUnit SfxInt16Item::GetUnit() const
     133             : {
     134           0 :     return SFX_FUNIT_NONE;
     135             : }
     136             : 
     137             : 
     138             : //  class SfxUInt16Item
     139             : 
     140             : 
     141     1505157 : TYPEINIT1_AUTOFACTORY(SfxUInt16Item, CntUInt16Item);
     142             : 
     143             : 
     144             : 
     145             : //  class SfxInt32Item
     146             : 
     147             : 
     148     1135913 : TYPEINIT1_AUTOFACTORY(SfxInt32Item, CntInt32Item);
     149             : 
     150             : 
     151             : 
     152             : //  class SfxUInt32Item
     153             : 
     154             : 
     155      277049 : TYPEINIT1_AUTOFACTORY(SfxUInt32Item, CntUInt32Item);
     156             : 
     157      137220 : TYPEINIT1_AUTOFACTORY(SfxMetricItem, SfxInt32Item);
     158             : 
     159       75636 : SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_uInt32 nValue):
     160       75636 :     SfxInt32Item(which, nValue)
     161             : {
     162       75636 : }
     163             : 
     164           0 : SfxMetricItem::SfxMetricItem(sal_uInt16 which, SvStream & rStream):
     165           0 :     SfxInt32Item(which, rStream)
     166             : {
     167           0 : }
     168             : 
     169       56461 : SfxMetricItem::SfxMetricItem(const SfxMetricItem & rItem):
     170       56461 :     SfxInt32Item(rItem)
     171             : {
     172       56461 : }
     173             : 
     174             : // virtual
     175           0 : bool SfxMetricItem::ScaleMetrics(long nMult, long nDiv)
     176             : {
     177           0 :     BigInt aTheValue(GetValue());
     178           0 :     aTheValue *= nMult;
     179           0 :     aTheValue += nDiv / 2;
     180           0 :     aTheValue /= nDiv;
     181           0 :     SetValue(aTheValue);
     182           0 :     return true;
     183             : }
     184             : 
     185             : // virtual
     186           0 : bool SfxMetricItem::HasMetrics() const
     187             : {
     188           0 :     return true;
     189             : }
     190             : 
     191             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10