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

Generated by: LCOV version 1.10