LCOV - code coverage report
Current view: top level - svl/source/inc - poolio.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 Functions: 0 7 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             : #include <svl/brdcst.hxx>
      20             : #include <boost/shared_ptr.hpp>
      21             : #include <deque>
      22             : #include <vector>
      23             : 
      24             : #ifndef DELETEZ
      25             : #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
      26             : #endif
      27             : 
      28             : 
      29             : struct SfxPoolVersion_Impl
      30             : {
      31             :     sal_uInt16          _nVer;
      32             :     sal_uInt16          _nStart, _nEnd;
      33             :     const sal_uInt16*         _pMap;
      34             : 
      35           0 :                     SfxPoolVersion_Impl( sal_uInt16 nVer, sal_uInt16 nStart, sal_uInt16 nEnd,
      36             :                                          const sal_uInt16 *pMap )
      37             :                     :   _nVer( nVer ),
      38             :                         _nStart( nStart ),
      39             :                         _nEnd( nEnd ),
      40           0 :                         _pMap( pMap )
      41           0 :                     {}
      42           0 :                     SfxPoolVersion_Impl( const SfxPoolVersion_Impl &rOrig )
      43             :                     :   _nVer( rOrig._nVer ),
      44             :                         _nStart( rOrig._nStart ),
      45             :                         _nEnd( rOrig._nEnd ),
      46           0 :                         _pMap( rOrig._pMap )
      47           0 :                     {}
      48             : };
      49             : 
      50             : typedef std::vector<SfxPoolItem*> SfxPoolItemArrayBase_Impl;
      51             : 
      52             : typedef boost::shared_ptr< SfxPoolVersion_Impl > SfxPoolVersion_ImplPtr;
      53             : typedef std::deque< SfxPoolVersion_ImplPtr > SfxPoolVersionArr_Impl;
      54             : 
      55           0 : struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
      56             : {
      57             :     size_t  nFirstFree;
      58             : 
      59           0 :     SfxPoolItemArray_Impl ()
      60           0 :         : nFirstFree( 0 )
      61           0 :     {}
      62             : };
      63             : 
      64             : struct SfxItemPool_Impl
      65             : {
      66             :     SfxBroadcaster                  aBC;
      67             :     std::vector<SfxPoolItemArray_Impl*> maPoolItems;
      68             :     std::vector<SfxItemPoolUser*> maSfxItemPoolUsers; /// ObjectUser section
      69             :     OUString                   aName;
      70             :     SfxPoolItem**                   ppPoolDefaults;
      71             :     SfxPoolItem**                   ppStaticDefaults;
      72             :     SfxItemPool*                    mpMaster;
      73             :     SfxItemPool*                    mpSecondary;
      74             :     sal_uInt16*                     mpPoolRanges;
      75             :     SfxPoolVersionArr_Impl          aVersions;
      76             :     sal_uInt16                      mnStart;
      77             :     sal_uInt16                      mnEnd;
      78             :     sal_uInt16                      mnFileFormatVersion;
      79             :     sal_uInt16                          nVersion;
      80             :     sal_uInt16                          nLoadingVersion;
      81             :     sal_uInt16                          nInitRefCount; // 1, beim Laden ggf. 2
      82             :     sal_uInt16                          nVerStart, nVerEnd; // WhichRange in Versions
      83             :     sal_uInt16                          nStoringStart, nStoringEnd; // zu speichernder Range
      84             :     sal_uInt8                           nMajorVer, nMinorVer; // Pool selbst
      85             :     SfxMapUnit                      eDefMetric;
      86             :     bool                            bInSetItem;
      87             :     bool                            bStreaming; // in Load() bzw. Store()
      88             :     bool                            mbPersistentRefCounts;
      89             : 
      90           0 :     SfxItemPool_Impl( SfxItemPool* pMaster, const OUString& rName, sal_uInt16 nStart, sal_uInt16 nEnd )
      91           0 :         : maPoolItems(nEnd - nStart + 1, static_cast<SfxPoolItemArray_Impl*>(NULL))
      92             :         , aName(rName)
      93           0 :         , ppPoolDefaults(new SfxPoolItem* [nEnd - nStart + 1])
      94             :         , ppStaticDefaults(0)
      95             :         , mpMaster(pMaster)
      96             :         , mpSecondary(NULL)
      97             :         , mpPoolRanges(NULL)
      98             :         , mnStart(nStart)
      99             :         , mnEnd(nEnd)
     100             :         , mnFileFormatVersion(0)
     101             :         , nVersion(0)
     102             :         , nLoadingVersion(0)
     103             :         , nInitRefCount(0)
     104             :         , nVerStart(0)
     105             :         , nVerEnd(0)
     106             :         , nStoringStart(0)
     107             :         , nStoringEnd(0)
     108             :         , nMajorVer(0)
     109             :         , nMinorVer(0)
     110             :         , eDefMetric(SFX_MAPUNIT_CM)
     111             :         , bInSetItem(false)
     112             :         , bStreaming(false)
     113           0 :         , mbPersistentRefCounts(false)
     114             :     {
     115             :         DBG_ASSERT(mnStart, "Start-Which-Id must be greater 0" );
     116           0 :         memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1));
     117           0 :     }
     118             : 
     119           0 :     ~SfxItemPool_Impl()
     120           0 :     {
     121           0 :         DeleteItems();
     122           0 :     }
     123             : 
     124           0 :     void DeleteItems()
     125             :     {
     126           0 :         std::vector<SfxPoolItemArray_Impl*>::iterator itr = maPoolItems.begin(), itrEnd = maPoolItems.end();
     127           0 :         for (; itr != itrEnd; ++itr)
     128           0 :             delete *itr;
     129           0 :         maPoolItems.clear();
     130             : 
     131           0 :         delete[] mpPoolRanges;
     132           0 :         mpPoolRanges = NULL;
     133           0 :         delete[] ppPoolDefaults;
     134           0 :         ppPoolDefaults = NULL;
     135           0 :     }
     136             : 
     137             :     void readTheItems(SvStream & rStream, sal_uInt32 nCount, sal_uInt16 nVersion,
     138             :                       SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** pArr);
     139             : };
     140             : 
     141             : 
     142             : 
     143             : // IBM-C-Set mag keine doppelten Defines
     144             : #ifdef DBG
     145             : #  undef DBG
     146             : #endif
     147             : 
     148             : #if defined(DBG_UTIL) && defined(_MSC_VER)
     149             : #define DBG(x) x
     150             : #else
     151             : #define DBG(x)
     152             : #endif
     153             : 
     154             : #define CHECK_FILEFORMAT( rStream, nTag ) \
     155             :     {   sal_uInt16 nFileTag; \
     156             :         rStream.ReadUInt16( nFileTag ); \
     157             :         if ( nTag != nFileTag ) \
     158             :         { \
     159             :             OSL_FAIL( #nTag ); /*! s.u. */ \
     160             :             /*! error-code setzen und auswerten! */ \
     161             :             (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
     162             :             pImp->bStreaming = false; \
     163             :             return rStream; \
     164             :         } \
     165             :     }
     166             : 
     167             : #define CHECK_FILEFORMAT_RELEASE( rStream, nTag, pPointer ) \
     168             :    {   sal_uInt16 nFileTag; \
     169             :        rStream.ReadUInt16( nFileTag ); \
     170             :        if ( nTag != nFileTag ) \
     171             :         { \
     172             :            OSL_FAIL( #nTag ); /*! s.u. */ \
     173             :            /*! error-code setzen und auswerten! */ \
     174             :            (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
     175             :            pImp->bStreaming = false; \
     176             :            delete pPointer; \
     177             :             return rStream; \
     178             :         } \
     179             :     }
     180             : 
     181             : #define CHECK_FILEFORMAT2( rStream, nTag1, nTag2 ) \
     182             :     {   sal_uInt16 nFileTag; \
     183             :         rStream.ReadUInt16( nFileTag ); \
     184             :         if ( nTag1 != nFileTag && nTag2 != nFileTag ) \
     185             :         { \
     186             :             OSL_FAIL( #nTag1 ); /*! s.u. */ \
     187             :             /*! error-code setzen und auswerten! */ \
     188             :             (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
     189             :             pImp->bStreaming = false; \
     190             :             return rStream; \
     191             :         } \
     192             :     }
     193             : 
     194             : #define SFX_ITEMPOOL_VER_MAJOR          sal_uInt8(2)
     195             : #define SFX_ITEMPOOL_VER_MINOR          sal_uInt8(0)
     196             : 
     197             : #define SFX_ITEMPOOL_TAG_STARTPOOL_4    sal_uInt16(0x1111)
     198             : #define SFX_ITEMPOOL_TAG_STARTPOOL_5    sal_uInt16(0xBBBB)
     199             : #define SFX_ITEMPOOL_TAG_ITEMPOOL       sal_uInt16(0xAAAA)
     200             : #define SFX_ITEMPOOL_TAG_ITEMS          sal_uInt16(0x2222)
     201             : #define SFX_ITEMPOOL_TAG_ITEM           sal_uInt16(0x7777)
     202             : #define SFX_ITEMPOOL_TAG_SIZES          sal_uInt16(0x3333)
     203             : #define SFX_ITEMPOOL_TAG_DEFAULTS       sal_uInt16(0x4444)
     204             : #define SFX_ITEMPOOL_TAG_VERSIONMAP     sal_uInt16(0x5555)
     205             : #define SFX_ITEMPOOL_TAG_HEADER         sal_uInt16(0x6666)
     206             : #define SFX_ITEMPOOL_TAG_ENDPOOL        sal_uInt16(0xEEEE)
     207             : #define SFX_ITEMPOOL_TAG_TRICK4OLD      sal_uInt16(0xFFFF)
     208             : 
     209             : #define SFX_ITEMPOOL_REC                sal_uInt8(0x01)
     210             : #define SFX_ITEMPOOL_REC_HEADER         sal_uInt8(0x10)
     211             : #define SFX_ITEMPOOL_REC_VERSIONMAP     sal_uInt16(0x0020)
     212             : #define SFX_ITEMPOOL_REC_WHICHIDS       sal_uInt16(0x0030)
     213             : #define SFX_ITEMPOOL_REC_ITEMS          sal_uInt16(0x0040)
     214             : #define SFX_ITEMPOOL_REC_DEFAULTS       sal_uInt16(0x0050)
     215             : 
     216             : #define SFX_ITEMSET_REC                 sal_uInt8(0x02)
     217             : 
     218             : #define SFX_STYLES_REC                  sal_uInt8(0x03)
     219             : #define SFX_STYLES_REC_HEADER       sal_uInt16(0x0010)
     220             : #define SFX_STYLES_REC_STYLES       sal_uInt16(0x0020)
     221             : 
     222             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10