LCOV - code coverage report
Current view: top level - include/svl - itemset.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 11 100.0 %
Date: 2015-06-13 12:38:46 Functions: 9 9 100.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             : #define SFX_ITEMSET_GET( rSet, pItem, ItemType, nSlotId, bDeep ) \
      37             :     const ItemType *pItem = static_cast<const ItemType*>( \
      38             :                             (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) ) )
      39             : 
      40             : class SVL_DLLPUBLIC SfxItemSet
      41             : {
      42             :     friend class SfxItemIter;
      43             : 
      44             :     SfxItemPool*      m_pPool;         ///< pool that stores the items
      45             :     const SfxItemSet* m_pParent;       ///< derivation
      46             :     SfxItemArray      m_pItems;        ///< array of items
      47             :     sal_uInt16*       m_pWhichRanges;  ///< array of Which Ranges
      48             :     sal_uInt16        m_nCount;        ///< number of items
      49             : 
      50             : friend class SfxItemPoolCache;
      51             : friend class SfxAllItemSet;
      52             : friend const char *DbgCheckItemSet( const void* );
      53             : 
      54             : private:
      55             :     SVL_DLLPRIVATE void                     InitRanges_Impl(const sal_uInt16 *nWhichPairTable);
      56             :     SVL_DLLPRIVATE void                     InitRanges_Impl(va_list pWhich, sal_uInt16 n1, sal_uInt16 n2, sal_uInt16 n3);
      57             :     SVL_DLLPRIVATE void                     InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2);
      58             : 
      59             : public:
      60     2871870 :     SfxItemArray                GetItems_Impl() const { return m_pItems; }
      61             : 
      62             : private:
      63             :     const SfxItemSet&           operator=(const SfxItemSet &) SAL_DELETED_FUNCTION;
      64             : 
      65             : protected:
      66             :     // Notification-Callback
      67             :     virtual void                Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
      68             : 
      69             :     void                        PutDirect(const SfxPoolItem &rItem);
      70             : 
      71             : public:
      72             :                                 SfxItemSet( const SfxItemSet& );
      73             : 
      74             :                                 SfxItemSet( SfxItemPool&, bool bTotalPoolRanges = false );
      75             :                                 SfxItemSet( SfxItemPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
      76             :                                 SfxItemSet( SfxItemPool&, USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... );
      77             :                                 SfxItemSet( SfxItemPool&, const sal_uInt16* nWhichPairTable );
      78             :     virtual                     ~SfxItemSet();
      79             : 
      80             :     virtual SfxItemSet *        Clone(bool bItems = true, SfxItemPool *pToPool = 0) const;
      81             : 
      82             :     // Get number of items
      83   559757759 :     sal_uInt16                  Count() const { return m_nCount; }
      84             :     sal_uInt16                  TotalCount() const;
      85             : 
      86             :     const SfxPoolItem&          Get( sal_uInt16 nWhich, bool bSrchInParent = true ) const;
      87             :     const SfxPoolItem*          GetItem( sal_uInt16 nWhich, bool bSrchInParent = true,
      88             :                                          TypeId aItemType = 0 ) const;
      89             : 
      90             :     // Get Which-value of the item at position nPos
      91             :     sal_uInt16                  GetWhichByPos(sal_uInt16 nPos) const;
      92             : 
      93             :     // Get item-status
      94             :     SfxItemState                GetItemState(   sal_uInt16 nWhich,
      95             :                                                 bool bSrchInParent = true,
      96             :                                                 const SfxPoolItem **ppItem = 0 ) const;
      97             : 
      98             :     bool                        HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem = NULL) const;
      99             : 
     100             :     void                        DisableItem(sal_uInt16 nWhich);
     101             :     void                        InvalidateItem( sal_uInt16 nWhich );
     102             :     sal_uInt16                  ClearItem( sal_uInt16 nWhich = 0);
     103             :     void                        ClearInvalidItems( bool bHardDefault = false );
     104             :     void                        InvalidateAllItems(); // HACK(via nWhich = 0) ???
     105             :     void                        InvalidateDefaultItems();
     106             : 
     107             :     inline void                 SetParent( const SfxItemSet* pNew );
     108             : 
     109             :     // add, delete items, work on items
     110             :     virtual const SfxPoolItem*  Put( const SfxPoolItem&, sal_uInt16 nWhich );
     111    11348373 :     const SfxPoolItem*          Put( const SfxPoolItem& rItem )
     112    11348373 :                                 { return Put(rItem, rItem.Which()); }
     113             :     bool                        Put( const SfxItemSet&,
     114             :                                      bool bInvalidAsDefault = true );
     115             :     void                        PutExtended( const SfxItemSet&,
     116             :                                              SfxItemState eDontCareAs = SfxItemState::UNKNOWN,
     117             :                                              SfxItemState eDefaultAs = SfxItemState::UNKNOWN );
     118             : 
     119             :     bool                        Set( const SfxItemSet&, bool bDeep = true );
     120             : 
     121             :     void                        Intersect( const SfxItemSet& rSet );
     122             :     void                        MergeValues( const SfxItemSet& rSet, bool bOverwriteDefaults = false );
     123             :     void                        Differentiate( const SfxItemSet& rSet );
     124             :     void                        MergeValue( const SfxPoolItem& rItem, bool bOverwriteDefaults = false  );
     125             : 
     126    45845557 :     SfxItemPool*                GetPool() const { return m_pPool; }
     127    11012221 :     const sal_uInt16*           GetRanges() const { return m_pWhichRanges; }
     128             :     void                        SetRanges( const sal_uInt16 *pRanges );
     129             :     void                        MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
     130      649506 :     const SfxItemSet*           GetParent() const { return m_pParent; }
     131             : 
     132             :     SvStream &                  Load( SvStream &, bool bDirect = false,
     133             :                                       const SfxItemPool *pRefPool = 0 );
     134             :     SvStream &                  Store( SvStream &, bool bDirect = false ) const;
     135             : 
     136             :     bool                        operator==(const SfxItemSet &) const;
     137             :     sal_Int32                   getHash() const;
     138             :     OString                     stringify() const;
     139             :     void dumpAsXml(struct _xmlTextWriter* pWriter) const;
     140             : };
     141             : 
     142     1919124 : inline void SfxItemSet::SetParent( const SfxItemSet* pNew )
     143             : {
     144     1919124 :     m_pParent = pNew;
     145     1919124 : }
     146             : 
     147       68052 : class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet
     148             : 
     149             : //  Handles all Ranges. Ranges are automatically modified by putting items.
     150             : 
     151             : {
     152             :     SfxVoidItem                 aDefault;
     153             :     sal_uInt16                      nFree;
     154             : 
     155             : public:
     156             :                                 SfxAllItemSet( SfxItemPool &rPool );
     157             :                                 SfxAllItemSet( const SfxItemSet & );
     158             :                                 SfxAllItemSet( const SfxAllItemSet & );
     159             : 
     160             :     virtual SfxItemSet *        Clone( bool bItems = true, SfxItemPool *pToPool = 0 ) const SAL_OVERRIDE;
     161             :     virtual const SfxPoolItem*  Put( const SfxPoolItem&, sal_uInt16 nWhich ) SAL_OVERRIDE;
     162             :     using SfxItemSet::Put;
     163             : };
     164             : 
     165             : #endif // INCLUDED_SVL_ITEMSET_HXX
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11