LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svl - itemset.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 13 100.0 %
Date: 2012-08-25 Functions: 10 10 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     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                 :            : #ifndef _SFXITEMSET_HXX
      20                 :            : #define _SFXITEMSET_HXX
      21                 :            : 
      22                 :            : #include "svl/svldllapi.h"
      23                 :            : 
      24                 :            : #include <cstdarg>  // std::va_list and friends
      25                 :            : #include <svl/poolitem.hxx>
      26                 :            : #include <tools/rtti.hxx>
      27                 :            : #include <tools/solar.h>
      28                 :            : 
      29                 :            : class SfxItemPool;
      30                 :            : class SfxPoolItem;
      31                 :            : class SvStream;
      32                 :            : 
      33                 :            : typedef SfxPoolItem const** SfxItemArray;
      34                 :            : 
      35                 :            : #define USHORT_ARG int
      36                 :            : 
      37                 :            : #ifdef DBG
      38                 :            : #undef DBG
      39                 :            : #endif
      40                 :            : #define DBG(s)
      41                 :            : 
      42                 :            : //========================================================================
      43                 :            : 
      44                 :            : #define SFX_ITEMSET_GET( rSet, pItem, ItemType, nSlotId, bDeep ) \
      45                 :            :     const ItemType *pItem = (const ItemType*) \
      46                 :            :                             (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) )
      47                 :            : 
      48                 :            : //========================================================================
      49                 :            : 
      50                 :            : class SVL_DLLPUBLIC SfxItemSet
      51                 :            : {
      52                 :            :     friend class SfxItemIter;
      53                 :            : 
      54                 :            :     SfxItemPool*                _pPool;         // der verwendete Pool
      55                 :            :     const SfxItemSet*           _pParent;       // Ableitung
      56                 :            :     SfxItemArray                _aItems;        // Item-Feld
      57                 :            :     sal_uInt16*                     _pWhichRanges;  // Array von Which-Bereichen
      58                 :            :     sal_uInt16                      _nCount;        // Anzahl Items
      59                 :            : 
      60                 :            :     //---------------------------------------------------------------------
      61                 :            : #ifndef _SFXITEMS_HXX
      62                 :            : 
      63                 :            : friend class SfxItemPoolCache;
      64                 :            : friend class SfxAllItemSet;
      65                 :            : friend const char *DbgCheckItemSet( const void* );
      66                 :            : 
      67                 :            : private:
      68                 :            :     SVL_DLLPRIVATE void                     InitRanges_Impl(const sal_uInt16 *nWhichPairTable);
      69                 :            :     SVL_DLLPRIVATE void                     InitRanges_Impl(va_list pWhich, sal_uInt16 n1, sal_uInt16 n2, sal_uInt16 n3);
      70                 :            :     SVL_DLLPRIVATE void                     InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2);
      71                 :            : 
      72                 :            : public:
      73                 :     768366 :     SfxItemArray                GetItems_Impl() const { return _aItems; }
      74                 :            : 
      75                 :            : #endif
      76                 :            :     //---------------------------------------------------------------------
      77                 :            : 
      78                 :            : private:
      79                 :            :     const SfxItemSet&           operator=(const SfxItemSet &);   // n.i.!!
      80                 :            : 
      81                 :            : protected:
      82                 :            :     // Notification-Callback
      83                 :            :     virtual void                Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
      84                 :            : 
      85                 :            :     // direkte Put-Methode
      86                 :            :     int                         PutDirect(const SfxPoolItem &rItem);
      87                 :            : 
      88                 :            : public:
      89                 :            :                                 SfxItemSet( const SfxItemSet& );
      90                 :            : 
      91                 :            :                                 SfxItemSet( SfxItemPool&, sal_Bool bTotalPoolRanges = sal_False );
      92                 :            :                                 SfxItemSet( SfxItemPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
      93                 :            :                                 SfxItemSet( SfxItemPool&, USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... );
      94                 :            :                                 SfxItemSet( SfxItemPool&, const sal_uInt16* nWhichPairTable );
      95                 :            :     virtual                     ~SfxItemSet();
      96                 :            : 
      97                 :            :     virtual SfxItemSet *        Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
      98                 :            : 
      99                 :            :     // Items erfragen
     100                 :  115212467 :     sal_uInt16                      Count() const { return _nCount; }
     101                 :            :     sal_uInt16                      TotalCount() const;
     102                 :            : 
     103                 :            :     virtual const SfxPoolItem&  Get( sal_uInt16 nWhich, sal_Bool bSrchInParent = sal_True ) const;
     104                 :            :     const SfxPoolItem*          GetItem( sal_uInt16 nWhich, sal_Bool bSrchInParent = sal_True,
     105                 :            :                                          TypeId aItemType = 0 ) const;
     106                 :            : 
     107                 :            :     // Which-Wert des Items an der Position nPos erfragen
     108                 :            :     sal_uInt16                      GetWhichByPos(sal_uInt16 nPos) const;
     109                 :            : 
     110                 :            :     // Item-Status erfragen
     111                 :            :     SfxItemState                GetItemState(   sal_uInt16 nWhich,
     112                 :            :                                                 sal_Bool bSrchInParent = sal_True,
     113                 :            :                                                 const SfxPoolItem **ppItem = 0 ) const;
     114                 :            : 
     115                 :            :     bool                        HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem = NULL) const;
     116                 :            : 
     117                 :            :     virtual void                DisableItem(sal_uInt16 nWhich);
     118                 :            :     virtual void                InvalidateItem( sal_uInt16 nWhich );
     119                 :            :     virtual sal_uInt16              ClearItem( sal_uInt16 nWhich = 0);
     120                 :            :     virtual void                ClearInvalidItems( sal_Bool bHardDefault = sal_False );
     121                 :            :             void                InvalidateAllItems(); HACK(via nWhich = 0)
     122                 :            : 
     123                 :            :     inline void                 SetParent( const SfxItemSet* pNew );
     124                 :            : 
     125                 :            :     // Items hinzufuegen, loeschen etc.
     126                 :            :     virtual const SfxPoolItem*  Put( const SfxPoolItem&, sal_uInt16 nWhich );
     127                 :    6153757 :     const SfxPoolItem*          Put( const SfxPoolItem& rItem )
     128                 :    6153757 :                                 { return Put(rItem, rItem.Which()); }
     129                 :            :     virtual int                 Put( const SfxItemSet&,
     130                 :            :                                      sal_Bool bInvalidAsDefault = sal_True );
     131                 :            :     void                        PutExtended( const SfxItemSet&,
     132                 :            :                                              SfxItemState eDontCareAs = SFX_ITEM_UNKNOWN,
     133                 :            :                                              SfxItemState eDefaultAs = SFX_ITEM_UNKNOWN );
     134                 :            : 
     135                 :            :     virtual int                 Set( const SfxItemSet&, sal_Bool bDeep = sal_True );
     136                 :            : 
     137                 :            :     virtual void                Intersect( const SfxItemSet& rSet );
     138                 :            :     virtual void                MergeValues( const SfxItemSet& rSet, sal_Bool bOverwriteDefaults = sal_False );
     139                 :            :     virtual void                Differentiate( const SfxItemSet& rSet );
     140                 :            :     virtual void                MergeValue( const SfxPoolItem& rItem, sal_Bool bOverwriteDefaults = sal_False  );
     141                 :            : 
     142                 :    4744397 :     SfxItemPool*                GetPool() const { return _pPool; }
     143                 :    2527176 :     const sal_uInt16*               GetRanges() const { return _pWhichRanges; }
     144                 :            :     void                        SetRanges( const sal_uInt16 *pRanges );
     145                 :            :     void                        MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
     146                 :     124682 :     const SfxItemSet*           GetParent() const { return _pParent; }
     147                 :            : 
     148                 :            :     virtual SvStream &          Load( SvStream &, bool bDirect = false,
     149                 :            :                                       const SfxItemPool *pRefPool = 0 );
     150                 :            :     virtual SvStream &          Store( SvStream &, bool bDirect = false ) const;
     151                 :            : 
     152                 :            :     virtual int                 operator==(const SfxItemSet &) const;
     153                 :            : };
     154                 :            : 
     155                 :            : // --------------- Inline Implementierungen ------------------------
     156                 :            : 
     157                 :     145530 : inline void SfxItemSet::SetParent( const SfxItemSet* pNew )
     158                 :            : {
     159                 :            :     DBG( if (_pParent) --*_pChildCount(_pParent) );
     160                 :     145530 :     _pParent = pNew;
     161                 :            :     DBG( if (_pParent) ++*_pChildCount(_pParent) );
     162                 :     145530 : }
     163                 :            : 
     164                 :            : //========================================================================
     165                 :            : 
     166 [ +  - ][ -  + ]:      35695 : class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet
     167                 :            : 
     168                 :            : /*  versteht alle Ranges; werden durch das Putten der Items
     169                 :            :     automatisch angepasst
     170                 :            : */
     171                 :            : 
     172                 :            : {
     173                 :            :     SfxVoidItem                 aDefault;
     174                 :            :     sal_uInt16                      nFree;
     175                 :            : 
     176                 :            : public:
     177                 :            :                                 SfxAllItemSet( SfxItemPool &rPool );
     178                 :            :                                 SfxAllItemSet( const SfxItemSet & );
     179                 :            :                                 SfxAllItemSet( const SfxAllItemSet & );
     180                 :            : 
     181                 :            :     virtual SfxItemSet *        Clone( sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0 ) const;
     182                 :            :     virtual const SfxPoolItem*  Put( const SfxPoolItem&, sal_uInt16 nWhich );
     183                 :      44428 :     const SfxPoolItem*          Put( const SfxPoolItem& rItem )
     184                 :      44428 :     { return Put(rItem, rItem.Which()); }
     185                 :            :     virtual int                 Put( const SfxItemSet&,
     186                 :            :                                      sal_Bool bInvalidAsDefault = sal_True );
     187                 :            : };
     188                 :            : 
     189                 :            : #endif // #ifndef _SFXITEMSET_HXX
     190                 :            : 
     191                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10