LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svl - cenumitm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 20 100.0 %
Date: 2012-12-27 Functions: 13 16 81.2 %
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             : #ifndef _SVTOOLS_CENUMITM_HXX
      21             : #define _SVTOOLS_CENUMITM_HXX
      22             : 
      23             : #include "svl/svldllapi.h"
      24             : #include <tools/debug.hxx>
      25             : #include <svl/poolitem.hxx>
      26             : 
      27             : //============================================================================
      28             : DBG_NAMEEX(SfxEnumItemInterface)
      29             : 
      30      118395 : class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem
      31             : {
      32             : protected:
      33       63656 :     explicit SfxEnumItemInterface(sal_uInt16 which): SfxPoolItem(which) {}
      34             : 
      35       66828 :     SfxEnumItemInterface(const SfxEnumItemInterface & rItem):
      36       66828 :         SfxPoolItem(rItem) {}
      37             : 
      38             : public:
      39             :     TYPEINFO();
      40             : 
      41             :     virtual int operator ==(const SfxPoolItem & rItem) const;
      42             : 
      43             :     virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
      44             :                                                 SfxMapUnit, SfxMapUnit,
      45             :                                                 XubString & rText,
      46             :                                                 const IntlWrapper * = 0)
      47             :         const;
      48             : 
      49             :     virtual bool QueryValue(com::sun::star::uno::Any & rVal, sal_uInt8 = 0) const;
      50             : 
      51             :     virtual bool PutValue(const com::sun::star::uno::Any & rVal, sal_uInt8 = 0);
      52             : 
      53             :     virtual sal_uInt16 GetValueCount() const = 0;
      54             : 
      55             :     virtual rtl::OUString GetValueTextByPos(sal_uInt16 nPos) const;
      56             : 
      57             :     virtual sal_uInt16 GetValueByPos(sal_uInt16 nPos) const;
      58             : 
      59             :     /// Return the position of some value within this enumeration.
      60             :     ///
      61             :     /// @descr  This method is implemented using GetValueCount() and
      62             :     /// GetValueByPos().  Derived classes may replace this with a more
      63             :     /// efficient implementation.
      64             :     ///
      65             :     /// @param nValue  Some value.
      66             :     ///
      67             :     /// @return  The position of nValue within this enumeration, or USHRT_MAX
      68             :     /// if not included.
      69             :     virtual sal_uInt16 GetPosByValue(sal_uInt16 nValue) const;
      70             : 
      71             :     virtual sal_Bool IsEnabled(sal_uInt16 nValue) const;
      72             : 
      73             :     virtual sal_uInt16 GetEnumValue() const = 0;
      74             : 
      75             :     virtual void SetEnumValue(sal_uInt16 nValue) = 0;
      76             : 
      77             :     virtual int HasBoolValue() const;
      78             : 
      79             :     virtual sal_Bool GetBoolValue() const;
      80             : 
      81             :     virtual void SetBoolValue(sal_Bool bValue);
      82             : };
      83             : 
      84             : //============================================================================
      85             : DBG_NAMEEX(CntEnumItem)
      86             : 
      87      110560 : class SVL_DLLPUBLIC CntEnumItem: public SfxEnumItemInterface
      88             : {
      89             :     sal_uInt16 m_nValue;
      90             : 
      91             : protected:
      92       58596 :     explicit CntEnumItem(sal_uInt16 which = 0, sal_uInt16 nTheValue = 0):
      93       58596 :         SfxEnumItemInterface(which), m_nValue(nTheValue) {}
      94             : 
      95             :     CntEnumItem(sal_uInt16 which, SvStream & rStream);
      96             : 
      97       63579 :     CntEnumItem(const CntEnumItem & rItem):
      98       63579 :         SfxEnumItemInterface(rItem), m_nValue(rItem.m_nValue) {}
      99             : 
     100             : public:
     101             :     TYPEINFO();
     102             : 
     103             :     virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
     104             : 
     105             :     virtual sal_uInt16 GetEnumValue() const;
     106             : 
     107             :     virtual void SetEnumValue(sal_uInt16 nTheValue);
     108             : 
     109      935154 :     sal_uInt16 GetValue() const { return m_nValue; }
     110             : 
     111             :     inline void SetValue(sal_uInt16 nTheValue);
     112             : };
     113             : 
     114       22445 : inline void CntEnumItem::SetValue(sal_uInt16 nTheValue)
     115             : {
     116             :     DBG_ASSERT(GetRefCount() == 0, "CntEnumItem::SetValue(): Pooled item");
     117       22445 :     m_nValue = nTheValue;
     118       22445 : }
     119             : 
     120             : //============================================================================
     121             : DBG_NAMEEX(CntBoolItem)
     122             : 
     123       60499 : class SVL_DLLPUBLIC CntBoolItem: public SfxPoolItem
     124             : {
     125             :     sal_Bool m_bValue;
     126             : 
     127             : public:
     128             :     TYPEINFO();
     129             : 
     130       63031 :     explicit CntBoolItem(sal_uInt16 which = 0, sal_Bool bTheValue = sal_False):
     131       63031 :         SfxPoolItem(which), m_bValue(bTheValue) {}
     132             : 
     133             :     CntBoolItem(sal_uInt16 nWhich, SvStream & rStream);
     134             : 
     135       14978 :     CntBoolItem(const CntBoolItem & rItem):
     136       14978 :         SfxPoolItem(rItem), m_bValue(rItem.m_bValue) {}
     137             : 
     138             :     virtual int operator ==(const SfxPoolItem & rItem) const;
     139             : 
     140             :     using SfxPoolItem::Compare;
     141             :     virtual int Compare(const SfxPoolItem & rWith) const;
     142             : 
     143             :     virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
     144             :                                                 SfxMapUnit, SfxMapUnit,
     145             :                                                 UniString & rText,
     146             :                                                 const IntlWrapper * = 0)
     147             :         const;
     148             : 
     149             :     virtual bool QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8 = 0) const;
     150             : 
     151             :     virtual bool PutValue(const com::sun::star::uno::Any& rVal, sal_uInt8 = 0);
     152             : 
     153             :     virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
     154             : 
     155             :     virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
     156             : 
     157             :     virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
     158             : 
     159             :     virtual sal_uInt16 GetValueCount() const;
     160             : 
     161             :     virtual rtl::OUString GetValueTextByVal(sal_Bool bTheValue) const;
     162             : 
     163      902754 :     sal_Bool GetValue() const { return m_bValue; }
     164             : 
     165         670 :     void SetValue(sal_Bool bTheValue) { m_bValue = bTheValue; }
     166             : };
     167             : 
     168             : #endif // _SVTOOLS_CENUMITM_HXX
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10