summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-11-01 16:40:46 +0100
committerVladimir Glazunov <vg@openoffice.org>2010-11-01 16:40:46 +0100
commitf89817da62023a4228dc5c4652d51d1c036d60a5 (patch)
treeae44621a79f7a74289e33c268f6b23f4704f8d70 /svl
parentd33b58aa369a9347727c3bb7361b537024ad2ce0 (diff)
parentd363b075683f89babef27425ed029583b0fb85dd (diff)
CWS-TOOLING: integrate CWS svarray
Diffstat (limited to 'svl')
-rw-r--r--svl/inc/poolcach.hxx13
-rw-r--r--svl/inc/svl/itempool.hxx8
-rw-r--r--svl/inc/svl/poolitem.hxx5
-rw-r--r--svl/inc/svl/svarray.hxx264
-rw-r--r--svl/inc/svl/svstdarr.hxx36
-rw-r--r--svl/source/inc/poolio.hxx19
-rw-r--r--svl/source/items/itempool.cxx89
-rw-r--r--svl/source/items/poolcach.cxx20
-rw-r--r--svl/source/items/poolio.cxx151
-rw-r--r--svl/source/memtools/svarray.cxx14
10 files changed, 157 insertions, 462 deletions
diff --git a/svl/inc/poolcach.hxx b/svl/inc/poolcach.hxx
index 949c0aee5bad..78bdca8177e6 100644
--- a/svl/inc/poolcach.hxx
+++ b/svl/inc/poolcach.hxx
@@ -29,13 +29,24 @@
#include "svl/svldllapi.h"
#include <tools/solar.h>
+#include <vector>
+
+//------------------------------------------------------------------------
-class SfxItemModifyArr_Impl;
class SfxItemPool;
class SfxItemSet;
class SfxPoolItem;
class SfxSetItem;
+struct SfxItemModifyImpl
+{
+ const SfxSetItem *pOrigItem;
+ SfxSetItem *pPoolItem;
+};
+
+typedef std::vector<SfxItemModifyImpl> SfxItemModifyArr_Impl;
+
+
class SVL_DLLPUBLIC SfxItemPoolCache
{
SfxItemPool *pPool;
diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx
index cbc6b7c4dd11..daaa2b481ba3 100644
--- a/svl/inc/svl/itempool.hxx
+++ b/svl/inc/svl/itempool.hxx
@@ -104,7 +104,7 @@ class SVL_DLLPUBLIC SfxItemPool
*/
{
- SVL_DLLPRIVATE void readTheItems(SvStream & rStream, USHORT nCount, USHORT nVersion,
+ SVL_DLLPRIVATE void readTheItems(SvStream & rStream, sal_uInt32 nCount, USHORT nVersion,
SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** pArr);
UniString aName;
@@ -208,9 +208,9 @@ public:
const SfxPoolItem &rItem,
FASTBOOL bDirect = FALSE ) const;
- USHORT GetSurrogate(const SfxPoolItem *) const;
- const SfxPoolItem * GetItem(USHORT nWhich, USHORT nSurrogate) const;
- USHORT GetItemCount(USHORT nWhich) const;
+ sal_uInt32 GetSurrogate(const SfxPoolItem *) const;
+ const SfxPoolItem * GetItem2(USHORT nWhich, sal_uInt32 nSurrogate) const;
+ sal_uInt32 GetItemCount2(USHORT nWhich) const;
const SfxPoolItem* LoadSurrogate(SvStream& rStream,
USHORT &rWhich, USHORT nSlotId,
const SfxItemPool* pRefPool = 0 );
diff --git a/svl/inc/svl/poolitem.hxx b/svl/inc/svl/poolitem.hxx
index c0cf53fb6ded..d78e32877440 100644
--- a/svl/inc/svl/poolitem.hxx
+++ b/svl/inc/svl/poolitem.hxx
@@ -50,8 +50,9 @@ class IntlWrapper;
namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
-#define SFX_ITEMS_DIRECT 0xffff
-#define SFX_ITEMS_NULL 0xfff0 // anstelle StoreSurrogate
+static const sal_uInt32 SFX_ITEMS_DIRECT= 0xffffffff;
+static const sal_uInt32 SFX_ITEMS_NULL= 0xfffffff0; // instead StoreSurrogate
+static const sal_uInt32 SFX_ITEMS_DEFAULT= 0xfffffffe;
#define SFX_ITEMS_POOLDEFAULT 0xffff
#define SFX_ITEMS_STATICDEFAULT 0xfffe
diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx
index 99b2901b95f9..d48998247eeb 100644
--- a/svl/inc/svl/svarray.hxx
+++ b/svl/inc/svl/svarray.hxx
@@ -39,12 +39,6 @@
* enthaelt. (Sie werden im Speicher verschoben, koennen also
* z.B. keine String sein)
*
-* SV_DECL_OBJARR(nm, AE, IS, GS)
-* SV_IMPL_OBJARR( nm, AE )
-* definiere/implementiere ein Array das Objecte enthaelt.
-* (Hier koennen es auch Strings sein)
-*
-*
* SV_DECL_PTRARR(nm, AE, IS, GS)
* SV_IMPL_PTRARR(nm, AE)
* definiere/implementiere ein Array das Pointer haelt. Diese
@@ -86,10 +80,6 @@
* Basiert auf einem VARARR.
* Sortierung mit Hilfe der Object-operatoren "<" und "=="
*
-* JP 23.12.94 neu:
-* SV_DECL_PTRARR_STACK(nm, AE, IS, GS)
-* ein Stack mit einem PtrArray als Grundlage.
-*
* JP 09.10.96: vordefinierte Arrays:
* VarArr: SvBools, SvULongs, SvUShorts, SvLongs, SvShorts
* PtrArr: SvStrings, SvStringsDtor
@@ -207,8 +197,6 @@ public:\
#define _SV_DECL_VARARR(nm, AE, IS, GS ) \
_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE & )
-#define _SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \
-_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE )
#define SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\
_SV_DECL_VARARR_GEN(nm, AE, IS, GS, AERef, vis )\
@@ -219,15 +207,10 @@ nm& operator=( const nm& );\
#define SV_DECL_VARARR(nm, AE, IS, GS ) \
SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, )
-#define SV_DECL_VARARR_PLAIN(nm, AE, IS, GS ) \
-SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, )
#define SV_DECL_VARARR_VISIBILITY(nm, AE, IS, GS, vis ) \
SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, vis )
-#define SV_DECL_VARARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis ) \
-SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE, vis )
-
#define SV_IMPL_VARARR_GEN( nm, AE, AERef )\
nm::nm( USHORT nInit, BYTE )\
: pData (0),\
@@ -329,192 +312,6 @@ _SVVARARR_IMPL_GET_OP_INLINE(nm, AE )\
#define SV_IMPL_VARARR( nm, AE ) \
SV_IMPL_VARARR_GEN( nm, AE, AE & )
-#define SV_IMPL_VARARR_PLAIN( nm, AE ) \
-SV_IMPL_VARARR_GEN( nm, AE, AE )
-
-#if defined(PRODUCT)
-
-#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem )\
-ArrElem& operator[](USHORT nP) const { return *(pData+nP); }\
-\
-void Insert( const nm *pI, USHORT nP,\
- USHORT nS = 0, USHORT nE = USHRT_MAX )\
-{\
- if( USHRT_MAX == nE ) \
- nE = pI->nA; \
- if( nS < nE ) \
- Insert( (const ArrElem*)pI->pData+nS, (USHORT)nE-nS, nP );\
-}
-
-#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem )
-
-#else
-
-#define _SVOBJARR_DEF_GET_OP_INLINE( nm,ArrElem ) \
-ArrElem& operator[](USHORT nP) const;\
-void Insert( const nm *pI, USHORT nP,\
- USHORT nS = 0, USHORT nE = USHRT_MAX );
-
-#define _SVOBJARR_IMPL_GET_OP_INLINE( nm, ArrElem )\
-ArrElem& nm::operator[](USHORT nP) const\
-{\
- DBG_ASSERT( pData && nP < nA,"Op[]");\
- return *(pData+nP);\
-}\
-void nm::Insert( const nm *pI, USHORT nP, USHORT nStt, USHORT nE )\
-{\
- DBG_ASSERT( nP <= nA,"Ins,Ar[Start.End]");\
- if( USHRT_MAX == nE ) \
- nE = pI->nA; \
- if( nStt < nE ) \
- Insert( (const ArrElem*)pI->pData+nStt, (USHORT)nE-nStt, nP );\
-}
-
-#endif
-
-#define _SV_DECL_OBJARR(nm, AE, IS, GS)\
-typedef BOOL (*FnForEach_##nm)( const AE&, void* );\
-class nm\
-{\
-protected:\
- AE *pData;\
- USHORT nFree;\
- USHORT nA;\
-\
- void _resize(size_t n);\
- void _destroy();\
-\
-public:\
- nm( USHORT= IS, BYTE= GS );\
- ~nm() { _destroy(); }\
-\
- _SVOBJARR_DEF_GET_OP_INLINE(nm,AE)\
- AE& GetObject(USHORT nP) const { return (*this)[nP]; } \
-\
- void Insert( const AE &aE, USHORT nP );\
- void Insert( const AE *pE, USHORT nL, USHORT nP );\
- void Remove( USHORT nP, USHORT nL = 1 );\
- USHORT Count() const { return nA; }\
- const AE* GetData() const { return (const AE*)pData; }\
-\
- void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\
- {\
- _ForEach( 0, nA, fnForEach, pArgs );\
- }\
- void ForEach( USHORT nS, USHORT nE, \
- CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\
- {\
- _ForEach( nS, nE, fnForEach, pArgs );\
- }\
-\
- void _ForEach( USHORT nStt, USHORT nE, \
- CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 );\
-\
-
-#define SV_DECL_OBJARR(nm, AE, IS, GS)\
-_SV_DECL_OBJARR(nm, AE, IS, GS)\
-private:\
-nm( const nm& );\
-nm& operator=( const nm& );\
-};
-
-#define SV_IMPL_OBJARR( nm, AE )\
-nm::nm( USHORT nInit, BYTE )\
- : pData (0),\
- nFree (nInit),\
- nA (0)\
-{\
- if( nInit )\
- {\
- pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\
- DBG_ASSERT( pData, "CTOR, allocate");\
- }\
-}\
-\
-void nm::_destroy()\
-{\
- if(pData)\
- {\
- AE* pTmp=pData;\
- for(USHORT n=0; n < nA; n++,pTmp++ )\
- {\
- pTmp->~AE();\
- }\
- rtl_freeMemory(pData);\
- pData = 0;\
- }\
-}\
-\
-void nm::_resize (size_t n)\
-{\
- USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\
- AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\
- if ((pE != 0) || (nL == 0))\
- {\
- pData = pE;\
- nFree = nL - nA;\
- }\
-}\
-\
-void nm::Insert( const AE &aE, USHORT nP )\
-{\
- DBG_ASSERT( nP <= nA && nA < USHRT_MAX,"Ins 1");\
- if (nFree < 1)\
- _resize (nA + ((nA > 1) ? nA : 1));\
- if( pData && nP < nA )\
- memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\
- AE* pTmp = pData+nP;\
- new( (DummyType*) pTmp ) AE( (AE&)aE );\
- ++nA; --nFree;\
-}\
-\
-void nm::Insert( const AE* pE, USHORT nL, USHORT nP )\
-{\
- DBG_ASSERT(nP<=nA && ((long)nA+nL) < USHRT_MAX, "Ins n");\
- if (nFree < nL)\
- _resize (nA + ((nA > nL) ? nA : nL));\
- if( pData && nP < nA )\
- memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\
- if( pE )\
- {\
- AE* pTmp = pData+nP;\
- for( USHORT n = 0; n < nL; n++, pTmp++, pE++)\
- {\
- new( (DummyType*) pTmp ) AE( (AE&)*pE );\
- }\
- }\
- nA = nA + nL; nFree = nFree - nL;\
-}\
-\
-void nm::Remove( USHORT nP, USHORT nL )\
-{\
- if( !nL )\
- return;\
- DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\
- AE* pTmp=pData+nP;\
- USHORT nCtr = nP;\
- for(USHORT n=0; n < nL; n++,pTmp++,nCtr++)\
- {\
- if( nCtr < nA )\
- pTmp->~AE();\
- }\
- if( pData && nP+1 < nA )\
- memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\
- nA = nA - nL; nFree = nFree + nL;\
- if (nFree > nA) \
- _resize (nA);\
-}\
-\
-void nm::_ForEach( USHORT nStt, USHORT nE, \
- CONCAT( FnForEach_, nm ) fnCall, void* pArgs )\
-{\
- if( nStt >= nE || nE > nA )\
- return;\
- for( ; nStt < nE && (*fnCall)( *(pData+nStt), pArgs ); nStt++)\
- ;\
-}\
-\
-_SVOBJARR_IMPL_GET_OP_INLINE(nm, AE)\
#define _SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AERef, vis )\
_SV_DECL_VARARR_GEN( nm, AE, IS, GS, AERef, vis)\
@@ -523,8 +320,6 @@ USHORT GetPos( const AERef aE ) const;\
#define _SV_DECL_PTRARR_DEF( nm, AE, IS, GS, vis )\
_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE &, vis )
-#define _SV_DECL_PTRARR_DEF_PLAIN( nm, AE, IS, GS, vis )\
-_SV_DECL_PTRARR_DEF_GEN( nm, AE, IS, GS, AE, vis )
#define SV_DECL_PTRARR_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\
typedef BOOL (*FnForEach_##nm)( const AERef, void* );\
@@ -580,13 +375,9 @@ private:\
#define SV_DECL_PTRARR(nm, AE, IS, GS )\
SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, )
-#define SV_DECL_PTRARR_PLAIN(nm, AE, IS, GS )\
-SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, )
#define SV_DECL_PTRARR_VISIBILITY(nm, AE, IS, GS, vis )\
SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis )
-#define SV_DECL_PTRARR_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\
-SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis )
#define SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\
typedef BOOL (*FnForEach_##nm)( const AERef, void* );\
@@ -643,13 +434,9 @@ private:\
#define SV_DECL_PTRARR_DEL(nm, AE, IS, GS )\
SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, )
-#define SV_DECL_PTRARR_DEL_PLAIN(nm, AE, IS, GS )\
-SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, )
#define SV_DECL_PTRARR_DEL_VISIBILITY(nm, AE, IS, GS, vis )\
SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis)
-#define SV_DECL_PTRARR_DEL_PLAIN_VISIBILITY(nm, AE, IS, GS, vis )\
-SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarrPlain, AE, VoidPtr, vis)
#define SV_IMPL_PTRARR_GEN(nm, AE, Base)\
void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\
@@ -664,12 +451,9 @@ void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\
#define SV_IMPL_PTRARR(nm, AE )\
SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarr )
-#define SV_IMPL_PTRARR_PLAIN(nm, AE )\
-SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarrPlain )
typedef void* VoidPtr;
_SV_DECL_PTRARR_DEF( SvPtrarr, VoidPtr, 0, 1, SVL_DLLPUBLIC )
-_SV_DECL_PTRARR_DEF_PLAIN( SvPtrarrPlain, VoidPtr, 0, 1, SVL_DLLPUBLIC )
// SORTARR - Begin
@@ -983,69 +767,21 @@ SV_IMPL_VARARR(nm##_SAR, AE)\
_SV_IMPL_SORTAR_ALG( nm,AE )\
_SV_SEEK_OBJECT( nm,AE )
-#define SV_DECL_PTRARR_STACK(nm, AE, IS, GS)\
-class nm: private SvPtrarr \
-{\
-public:\
- nm( USHORT nIni=IS, BYTE nG=GS )\
- : SvPtrarr(nIni,nG) {}\
- void Insert( const nm *pI, USHORT nP,\
- USHORT nS = 0, USHORT nE = USHRT_MAX ) {\
- SvPtrarr::Insert( pI, nP, nS, nE ); \
- }\
- void Remove( USHORT nP, USHORT nL = 1 ) {\
- SvPtrarr::Remove( nP, nL ); \
- }\
- void Push( const AE &aE ) {\
- SvPtrarr::Insert( (const VoidPtr &)aE, SvPtrarr::Count() );\
- }\
- USHORT Count() const { return SvPtrarr::Count(); }\
- AE operator[](USHORT nP) const {\
- return (AE)SvPtrarr::operator[]( nP );\
- }\
- AE GetObject(USHORT nP) const {\
- return (AE)SvPtrarr::GetObject( nP );\
- }\
- AE Pop(){\
- AE pRet = 0;\
- if( SvPtrarr::Count() ){\
- pRet = GetObject( SvPtrarr::Count()-1 );\
- SvPtrarr::Remove(Count()-1);\
- }\
- return pRet;\
- }\
- AE Top() const {\
- AE pRet = 0;\
- if( SvPtrarr::Count() )\
- pRet = GetObject( SvPtrarr::Count()-1 ); \
- return pRet;\
- }\
-};
-
#if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52)
#define C40_INSERT( c, p, n) Insert( (c const *) p, n )
-#define C40_PUSH( c, p) Push( (c const *) p )
#define C40_PTR_INSERT( c, p) Insert( (c const *) p )
-#define C40_REMOVE( c, p ) Remove( (c const *) p )
#define C40_REPLACE( c, p, n) Replace( (c const *) p, n )
-#define C40_PTR_REPLACE( c, p) Replace( (c const *) p )
#define C40_GETPOS( c, r) GetPos( (c const *)r )
#else
#if defined WTC || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400)
#define C40_INSERT( c, p, n ) Insert( (c const *&) p, n )
-#define C40_PUSH( c, p) Push( (c const *&) p )
#define C40_PTR_INSERT( c, p ) Insert( (c const *&) p )
-#define C40_REMOVE( c, p ) Remove( (c const *&) p )
#define C40_REPLACE( c, p, n ) Replace( (c const *&) p, n )
-#define C40_PTR_REPLACE( c, p ) Replace( (c const *&) p )
#define C40_GETPOS( c, r) GetPos( (c const *&) r )
#else
#define C40_INSERT( c, p, n ) Insert( p, n )
-#define C40_PUSH( c, p) Push( p )
#define C40_PTR_INSERT( c, p ) Insert( p )
-#define C40_REMOVE( c, p) Remove( p )
#define C40_REPLACE( c, p, n ) Replace( p, n )
-#define C40_PTR_REPLACE( c, p ) Replace( p )
#define C40_GETPOS( c, r) GetPos( r )
#endif
#endif
diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx
index fa3c94034256..608705dca43d 100644
--- a/svl/inc/svl/svstdarr.hxx
+++ b/svl/inc/svl/svstdarr.hxx
@@ -42,20 +42,11 @@
#include "svl/svldllapi.h"
#include <svl/svarray.hxx>
+#include <deque>
-//#ifdef _SVSTDARR_BOOLS
-#ifndef _SVSTDARR_BOOLS_DECL
-SV_DECL_VARARR_VISIBILITY( SvBools, BOOL, 1, 1, SVL_DLLPUBLIC )
-#define _SVSTDARR_BOOLS_DECL
-#endif
-//#endif
+typedef std::deque< BOOL > SvBools;
-//#ifdef _SVSTDARR_BYTES
-#ifndef _SVSTDARR_BYTES_DECL
-SV_DECL_VARARR_VISIBILITY( SvBytes, BYTE, 1, 1, SVL_DLLPUBLIC )
-#define _SVSTDARR_BYTES_DECL
-#endif
-//#endif
+typedef std::deque< BYTE > SvBytes;
//#ifdef _SVSTDARR_ULONGS
#ifndef _SVSTDARR_ULONGS_DECL
@@ -139,12 +130,7 @@ SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC )
#endif
//#endif
-//#ifdef _SVSTDARR_SHORTS
-#ifndef _SVSTDARR_SHORTS_DECL
-SV_DECL_VARARR_VISIBILITY( SvShorts, short, 1, 1, SVL_DLLPUBLIC )
-#define _SVSTDARR_SHORTS_DECL
-#endif
-//#endif
+typedef std::deque< short > SvShorts;
/*
form here all Arrays for Strings, ByteString and then
@@ -255,17 +241,5 @@ SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsISortDtor, ByteStringPtr, 1, 1,
#endif
//#endif
-//#ifdef _SVSTDARR_XUB_STRLEN
-#ifndef _SVSTDARR_XUB_STRLEN_DECL
-SV_DECL_VARARR_VISIBILITY( SvXub_StrLens, xub_StrLen, 1, 1, SVL_DLLPUBLIC )
-#define _SVSTDARR_XUB_STRLEN_DECL
-#endif
-//#endif
-
-//#ifdef _SVSTDARR_XUB_STRLENSORT
-#ifndef _SVSTDARR_XUB_STRLENSORT_DECL
-SV_DECL_VARARR_SORT_VISIBILITY( SvXub_StrLensSort, xub_StrLen, 1, 1, SVL_DLLPUBLIC )
-#define _SVSTDARR_XUB_STRLENSORT_DECL
-#endif
-//#endif
+typedef std::deque< xub_StrLen > SvXub_StrLens;
diff --git a/svl/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx
index 70122a5b1998..79cbbc463700 100644
--- a/svl/source/inc/poolio.hxx
+++ b/svl/source/inc/poolio.hxx
@@ -25,7 +25,8 @@
*
************************************************************************/
#include <svl/brdcst.hxx>
-
+#include <boost/shared_ptr.hpp>
+#include <deque>
#ifndef DELETEZ
#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
@@ -53,16 +54,17 @@ struct SfxPoolVersion_Impl
{}
};
-SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 )
-SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 )
+typedef std::deque<SfxPoolItem*> SfxPoolItemArrayBase_Impl;
+
+typedef boost::shared_ptr< SfxPoolVersion_Impl > SfxPoolVersion_ImplPtr;
+typedef std::deque< SfxPoolVersion_ImplPtr > SfxPoolVersionArr_Impl;
struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
{
- USHORT nFirstFree;
+ size_t nFirstFree;
- SfxPoolItemArray_Impl (USHORT nInitSize = 0)
- : SfxPoolItemArrayBase_Impl( nInitSize ),
- nFirstFree( 0 )
+ SfxPoolItemArray_Impl ()
+ : nFirstFree( 0 )
{}
};
@@ -96,7 +98,8 @@ struct SfxItemPool_Impl
void DeleteItems()
{
- delete[] ppPoolItems; ppPoolItems = 0;
+ delete[] ppPoolItems;
+ ppPoolItems = 0;
}
};
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 5c5f106a1c36..d8bdeb330776 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -38,14 +38,6 @@
#include <svl/brdcst.hxx>
#include <svl/smplhint.hxx>
#include "poolio.hxx"
-#include <algorithm>
-
-// STATIC DATA -----------------------------------------------------------
-
-
-//========================================================================
-
-SV_IMPL_PTRARR( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl* );
//========================================================================
@@ -275,13 +267,12 @@ SfxItemPool::SfxItemPool
(*( ppPoolDefaults + n ))->SetKind( SFX_ITEMS_POOLDEFAULT );
}
- // Version-Map kopieren
- USHORT nVerCount = rPool.pImp->aVersions.Count();
- for ( USHORT nVer = 0; nVer < nVerCount; ++nVer )
+ // Copy Version-Map
+ for ( size_t nVer = 0; nVer < rPool.pImp->aVersions.size(); ++nVer )
{
- const SfxPoolVersion_Impl *pOld = rPool.pImp->aVersions.GetObject(nVer);
- const SfxPoolVersion_Impl *pNew = new SfxPoolVersion_Impl( *pOld );
- pImp->aVersions.Insert( pNew, nVer );
+ const SfxPoolVersion_ImplPtr pOld = rPool.pImp->aVersions[nVer];
+ SfxPoolVersion_ImplPtr pNew = SfxPoolVersion_ImplPtr( new SfxPoolVersion_Impl( *pOld ) );
+ pImp->aVersions.push_back( pNew );
}
// Verkettung wiederherstellen
@@ -454,9 +445,8 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool )
pSecondary->pImp->ppPoolItems + n;
if ( *ppItemArr )
{
- SfxPoolItem** ppHtArr =
- (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT i = (*ppItemArr)->Count(); i; ++ppHtArr, --i )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for( size_t i = (*ppItemArr)->size(); i; ++ppHtArr, --i )
if ( !(*ppHtArr) )
{
DBG_ERROR( "old secondary pool must be empty" );
@@ -582,8 +572,8 @@ void SfxItemPool::Delete()
{
if ( *ppItemArr )
{
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
#ifdef DBG_UTIL
@@ -614,8 +604,8 @@ void SfxItemPool::Delete()
{
if ( *ppItemArr )
{
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
#ifdef DBG_UTIL
@@ -663,8 +653,8 @@ void SfxItemPool::Cleanup()
((*ppDefaultItem && (*ppDefaultItem)->ISA(SfxSetItem)) ||
(*ppStaticDefaultItem)->ISA(SfxSetItem)) )
{
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr )
if ( *ppHtArr && !(*ppHtArr)->GetRefCount() )
{
DELETEZ(*ppHtArr);
@@ -681,8 +671,8 @@ void SfxItemPool::Cleanup()
{
if ( *ppItemArr )
{
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for ( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr )
if ( *ppHtArr && !(*ppHtArr)->GetRefCount() )
DELETEZ( *ppHtArr );
}
@@ -782,15 +772,16 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich )
if( !*ppItemArr )
*ppItemArr = new SfxPoolItemArray_Impl;
- SfxPoolItem **ppFree = 0;
- SfxPoolItem** ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData();
+ SfxPoolItemArrayBase_Impl::iterator ppFree;
+ BOOL ppFreeIsSet = FALSE;
+ SfxPoolItemArrayBase_Impl::iterator ppHtArray = (*ppItemArr)->begin();
if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) )
{
// wenn es ueberhaupt gepoolt ist, koennte es schon drin sein
if ( IsPooledItem(&rItem) )
{
// 1. Schleife: teste ob der Pointer vorhanden ist.
- for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArray, --n )
+ for( size_t n = (*ppItemArr)->size(); n; ++ppHtArray, --n )
if( &rItem == (*ppHtArray) )
{
AddRef( **ppHtArray );
@@ -799,8 +790,8 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich )
}
// 2. Schleife: dann muessen eben die Attribute verglichen werden
- USHORT n;
- for ( n = (*ppItemArr)->Count(), ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData();
+ size_t n;
+ for ( n = (*ppItemArr)->size(), ppHtArray = (*ppItemArr)->begin();
n; ++ppHtArray, --n )
{
if ( *ppHtArray )
@@ -812,22 +803,26 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich )
}
}
else
- if ( !ppFree )
+ if ( ppFreeIsSet == FALSE )
+ {
ppFree = ppHtArray;
+ ppFreeIsSet = TRUE;
+ }
}
}
else
{
// freien Platz suchen
- SfxPoolItem** ppHtArr;
- USHORT n, nCount = (*ppItemArr)->Count();
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr;
+ size_t n, nCount = (*ppItemArr)->size();
for ( n = (*ppItemArr)->nFirstFree,
- ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData() + n;
+ ppHtArr = (*ppItemArr)->begin() + n;
n < nCount;
++ppHtArr, ++n )
if ( !*ppHtArr )
{
ppFree = ppHtArr;
+ ppFreeIsSet = TRUE;
break;
}
@@ -853,9 +848,9 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich )
#endif
#endif
AddRef( *pNewItem, pImp->nInitRefCount );
- const SfxPoolItem* pTemp = pNewItem;
- if ( !ppFree )
- (*ppItemArr)->Insert( pTemp, (*ppItemArr)->Count() );
+ SfxPoolItem* pTemp = pNewItem;
+ if ( ppFreeIsSet == FALSE )
+ (*ppItemArr)->push_back( pTemp );
else
{
DBG_ASSERT( *ppFree == 0, "using surrogate in use" );
@@ -915,8 +910,8 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
// Item im eigenen Pool suchen
SfxPoolItemArray_Impl** ppItemArr = (pImp->ppPoolItems + nIndex);
SFX_ASSERT( *ppItemArr, rItem.Which(), "removing Item not in Pool" );
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArr, --n )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for( size_t n = (*ppItemArr)->size(); n; ++ppHtArr, --n )
if( *ppHtArr == &rItem )
{
if ( (*ppHtArr)->GetRefCount() ) //!
@@ -928,7 +923,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
}
// ggf. kleinstmoegliche freie Position merken
- USHORT nPos = (*ppItemArr)->Count() - n;
+ size_t nPos = (*ppItemArr)->size() - n;
if ( (*ppItemArr)->nFirstFree > nPos )
(*ppItemArr)->nFirstFree = nPos;
@@ -1009,24 +1004,24 @@ void SfxItemPool::FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const
// -----------------------------------------------------------------------
-const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const
+const SfxPoolItem *SfxItemPool::GetItem2(USHORT nWhich, sal_uInt32 nOfst) const
{
DBG_CHKTHIS(SfxItemPool, 0);
if ( !IsInRange(nWhich) )
{
if ( pSecondary )
- return pSecondary->GetItem( nWhich, nOfst );
+ return pSecondary->GetItem2( nWhich, nOfst );
SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" );
return 0;
}
// dflt-Attribut?
- if ( nOfst == SFX_ITEMS_STATICDEFAULT )
+ if ( nOfst == SFX_ITEMS_DEFAULT )
return *(ppStaticDefaults + GetIndex_Impl(nWhich));
SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich));
- if( pItemArr && nOfst < pItemArr->Count() )
+ if( pItemArr && nOfst < pItemArr->size() )
return (*pItemArr)[nOfst];
return 0;
@@ -1034,21 +1029,21 @@ const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const
// -----------------------------------------------------------------------
-USHORT SfxItemPool::GetItemCount(USHORT nWhich) const
+sal_uInt32 SfxItemPool::GetItemCount2(USHORT nWhich) const
{
DBG_CHKTHIS(SfxItemPool, 0);
if ( !IsInRange(nWhich) )
{
if ( pSecondary )
- return pSecondary->GetItemCount( nWhich );
+ return pSecondary->GetItemCount2( nWhich );
SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" );
return 0;
}
SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich));
if ( pItemArr )
- return pItemArr->Count();
+ return pItemArr->size();
return 0;
}
diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx
index b918add10f0f..fee18724bcc2 100644
--- a/svl/source/items/poolcach.cxx
+++ b/svl/source/items/poolcach.cxx
@@ -41,18 +41,6 @@
DBG_NAME(SfxItemPoolCache)
-
-//------------------------------------------------------------------------
-
-struct SfxItemModifyImpl
-{
- const SfxSetItem *pOrigItem;
- SfxSetItem *pPoolItem;
-};
-
-SV_DECL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl, 8, 8 )
-SV_IMPL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl);
-
//------------------------------------------------------------------------
SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
@@ -84,7 +72,7 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
SfxItemPoolCache::~SfxItemPoolCache()
{
DBG_DTOR(SfxItemPoolCache, 0);
- for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) {
+ for ( size_t nPos = 0; nPos < pCache->size(); ++nPos ) {
pPool->Remove( *(*pCache)[nPos].pPoolItem );
pPool->Remove( *(*pCache)[nPos].pOrigItem );
}
@@ -103,8 +91,8 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL b
DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ),
"original not in pool" );
- // Suchen, ob diese Transformations schon einmal vorkam
- for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos )
+ // Find whether this Transformations ever occurred
+ for ( size_t nPos = 0; nPos < pCache->size(); ++nPos )
{
SfxItemModifyImpl &rMapEntry = (*pCache)[nPos];
if ( rMapEntry.pOrigItem == &rOrigItem )
@@ -143,7 +131,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL b
SfxItemModifyImpl aModify;
aModify.pOrigItem = &rOrigItem;
aModify.pPoolItem = (SfxSetItem*) pNewPoolItem;
- pCache->Insert( aModify, pCache->Count() );
+ pCache->push_back( aModify );
DBG_ASSERT( !pItemToPut ||
&pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut,
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 6aeb64d76d1a..8bf8f2b2434b 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -178,10 +178,10 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
// Version-Maps
{
SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP, 0 );
- for ( USHORT nVerNo = 0; nVerNo < pImp->aVersions.Count(); ++nVerNo )
+ for ( size_t nVerNo = 0; nVerNo < pImp->aVersions.size(); ++nVerNo )
{
aVerRec.NewContent();
- SfxPoolVersion_Impl *pVer = pImp->aVersions[nVerNo];
+ SfxPoolVersion_ImplPtr pVer = pImp->aVersions[nVerNo];
rStream << pVer->_nVer << pVer->_nStart << pVer->_nEnd;
USHORT nCount = pVer->_nEnd - pVer->_nStart + 1;
USHORT nNewWhich = 0;
@@ -207,7 +207,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
SfxPoolItemArray_Impl **pArr = pImp->ppPoolItems;
SfxPoolItem **ppDefItem = ppStaticDefaults;
const USHORT nSize = GetSize_Impl();
- for ( USHORT i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem )
+ for ( size_t i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem )
{
// Version des Items feststellen
USHORT nItemVersion = (*ppDefItem)->GetVersion( _nFileFormatVersion );
@@ -229,16 +229,16 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
aWhichIdsRec.NewContent(nSlotId, 0);
rStream << (*ppDefItem)->Which();
rStream << nItemVersion;
- const USHORT nCount = (*pArr)->Count();
- DBG_ASSERT(nCount, "ItemArr ist leer");
+ const sal_uInt32 nCount = ::std::min<size_t>( (*pArr)->size(), SAL_MAX_UINT32 );
+ DBG_ASSERT(nCount, "ItemArr is empty");
rStream << nCount;
// Items an sich schreiben
SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS, 0 );
- for ( USHORT j = 0; j < nCount; ++j )
+ for ( size_t j = 0; j < nCount; ++j )
{
// Item selbst besorgen
- const SfxPoolItem *pItem = (*pArr)->GetObject(j);
+ const SfxPoolItem *pItem = (*pArr)->operator[](j);
if ( pItem && pItem->GetRefCount() ) //! siehe anderes MI-REF
{
aItemsRec.NewContent(j, 'X' );
@@ -353,8 +353,8 @@ void SfxItemPool::LoadCompleted()
if ( *ppItemArr )
{
// "uber alle Items mit dieser Which-Id iterieren
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
#ifdef DBG_UTIL
@@ -382,15 +382,15 @@ void SfxItemPool::LoadCompleted()
//============================================================================
// This had to be moved to a method of its own to keep Solaris GCC happy:
void SfxItemPool::readTheItems (
- SvStream & rStream, USHORT nItemCount, USHORT nVersion,
+ SvStream & rStream, sal_uInt32 nItemCount, USHORT nVersion,
SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** ppArr)
{
SfxMultiRecordReader aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS );
- SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl( nItemCount );
+ SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl();
SfxPoolItem *pItem = 0;
- USHORT n, nLastSurrogate = USHORT(-1);
+ ULONG n, nLastSurrogate = ULONG(-1);
while (aItemsRec.GetContent())
{
// n"achstes Surrogat holen
@@ -400,7 +400,7 @@ void SfxItemPool::readTheItems (
// fehlende auff"ullen
for ( pItem = 0, n = nLastSurrogate+1; n < nSurrogate; ++n )
- pNewArr->C40_INSERT(SfxPoolItem, pItem, n);
+ pNewArr->push_back( (SfxPoolItem*) pItem );
nLastSurrogate = nSurrogate;
// Ref-Count und Item laden
@@ -408,7 +408,7 @@ void SfxItemPool::readTheItems (
rStream >> nRef;
pItem = pDefItem->Create(rStream, nVersion);
- pNewArr->C40_INSERT(SfxPoolItem, pItem, nSurrogate);
+ pNewArr->push_back( (SfxPoolItem*) pItem );
if ( !bPersistentRefCounts )
// bis <SfxItemPool::LoadCompleted()> festhalten
@@ -424,33 +424,32 @@ void SfxItemPool::readTheItems (
// fehlende auff"ullen
for ( pItem = 0, n = nLastSurrogate+1; n < nItemCount; ++n )
- pNewArr->C40_INSERT(SfxPoolItem, pItem, n);
+ pNewArr->push_back( (SfxPoolItem*) pItem );
SfxPoolItemArray_Impl *pOldArr = *ppArr;
*ppArr = pNewArr;
// die Items merken, die schon im Pool sind
- int bEmpty = TRUE;
+ bool bEmpty = true;
if ( 0 != pOldArr )
- for ( n = 0; bEmpty && n < pOldArr->Count(); ++n )
- bEmpty = pOldArr->GetObject(n) == 0;
+ for ( n = 0; bEmpty && n < pOldArr->size(); ++n )
+ bEmpty = pOldArr->operator[](n) == 0;
DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" );
if ( !bEmpty )
{
// f"ur alle alten suchen, ob ein gleiches neues existiert
- for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld )
+ for ( size_t nOld = 0; nOld < pOldArr->size(); ++nOld )
{
SfxPoolItem *pOldItem = (*pOldArr)[nOld];
if ( pOldItem )
{
- USHORT nFree = USHRT_MAX;
- int bFound = FALSE;
- USHORT nCount = (*ppArr)->Count();
- for ( USHORT nNew = nCount; !bFound && nNew--; )
+ sal_uInt32 nFree = SAL_MAX_UINT32;
+ bool bFound = false;
+ for ( size_t nNew = (*ppArr)->size(); nNew--; )
{
// geladenes Item
SfxPoolItem *&rpNewItem =
- (SfxPoolItem*&)(*ppArr)->GetData()[nNew];
+ (SfxPoolItem*&)(*ppArr)->operator[](nNew);
// surrogat unbenutzt?
if ( !rpNewItem )
@@ -464,17 +463,18 @@ void SfxItemPool::readTheItems (
SetRefCount( *rpNewItem, 0 );
delete rpNewItem;
rpNewItem = pOldItem;
- bFound = TRUE;
+ bFound = true;
+ break;
}
}
// vorhervorhandene, nicht geladene uebernehmen
if ( !bFound )
{
- if ( nFree != USHRT_MAX )
- (SfxPoolItem*&)(*ppArr)->GetData()[nFree] = pOldItem;
+ if ( nFree != SAL_MAX_UINT32 )
+ (SfxPoolItem*&)(*ppArr)->operator[](nFree) = pOldItem;
else
- (*ppArr)->C40_INSERT( SfxPoolItem, pOldItem, nCount );
+ (*ppArr)->push_back( (SfxPoolItem*) pOldItem );
}
}
}
@@ -495,14 +495,14 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
// "uber alle Which-Werte iterieren
SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems;
- for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr )
+ for( size_t nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr )
{
// ist "uberhaupt ein Item mit dem Which-Wert da?
if ( *ppItemArr )
{
// "uber alle Items mit dieser Which-Id iterieren
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
+ SfxPoolItemArrayBase_Impl::iterator ppHtArr = (*ppItemArr)->begin();
+ for( size_t n = (*ppItemArr)->size(); n; --n, ++ppHtArr )
if (*ppHtArr)
{
#ifdef DBG_UTIL
@@ -611,10 +611,10 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
rStream >> nVersion >> nHStart >> nHEnd;
USHORT nCount = nHEnd - nHStart + 1;
- // Version neuer als bekannt?
- if ( nVerNo >= pImp->aVersions.Count() )
+ // Is new version is known?
+ if ( nVerNo >= pImp->aVersions.size() )
{
- // neue Version hinzufuegen
+ // Add new Version
USHORT *pMap = new USHORT[nCount];
for ( USHORT n = 0; n < nCount; ++n )
rStream >> pMap[n];
@@ -632,7 +632,8 @@ SvStream &SfxItemPool::Load(SvStream &rStream)
while ( aWhichIdsRec.GetContent() )
{
// SlotId, Which-Id und Item-Version besorgen
- USHORT nCount, nVersion, nWhich;
+ sal_uInt32 nCount;
+ USHORT nVersion, nWhich;
//!USHORT nSlotId = aWhichIdsRec.GetContentTag();
rStream >> nWhich;
if ( pImp->nLoadingVersion != pImp->nVersion )
@@ -799,10 +800,10 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
USHORT nCount = nHEnd - nHStart + 1;
USHORT nBytes = (nCount)*sizeof(USHORT);
- // Version neuer als bekannt?
- if ( nVerNo >= pImp->aVersions.Count() )
+ // Is new version is known?
+ if ( nVerNo >= pImp->aVersions.size() )
{
- // neue Version hinzufuegen
+ // Add new Version
USHORT *pMap = new USHORT[nCount];
for ( USHORT n = 0; n < nCount; ++n )
rStream >> pMap[n];
@@ -849,7 +850,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
USHORT nIndex = GetIndex_Impl(nWhich);
ppArr = pImp->ppPoolItems + nIndex;
- pNewArr = new SfxPoolItemArray_Impl( nCount );
+ pNewArr = new SfxPoolItemArray_Impl();
pDefItem = *(ppStaticDefaults + nIndex);
}
@@ -897,8 +898,8 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
AddRef(*pItem, nRef);
}
}
-
- pNewArr->C40_INSERT( SfxPoolItem, pItem, j);
+ //pNewArr->insert( pItem, j );
+ pNewArr->push_back( (SfxPoolItem*) pItem );
// restliche gespeicherte Laenge skippen (neueres Format)
nLastPos = rStream.Tell();
@@ -924,24 +925,23 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
// die Items merken, die schon im Pool sind
int bEmpty = TRUE;
if ( 0 != pOldArr )
- for ( USHORT n = 0; bEmpty && n < pOldArr->Count(); ++n )
- bEmpty = pOldArr->GetObject(n) == 0;
+ for ( size_t n = 0; bEmpty && n < pOldArr->size(); ++n )
+ bEmpty = pOldArr->operator[](n) == 0;
DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" );
if ( !bEmpty )
{
// f"ur alle alten suchen, ob ein gleiches neues existiert
- for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld )
+ for ( size_t nOld = 0; nOld < pOldArr->size(); ++nOld )
{
SfxPoolItem *pOldItem = (*pOldArr)[nOld];
if ( pOldItem )
{
- int bFound = FALSE;
- for ( USHORT nNew = 0;
- !bFound && nNew < (*ppArr)->Count();
- ++nNew )
+ bool bFound = false;
+ for ( size_t nNew = 0;
+ nNew < (*ppArr)->size(); ++nNew )
{
SfxPoolItem *&rpNewItem =
- (SfxPoolItem*&)(*ppArr)->GetData()[nNew];
+ (SfxPoolItem*&)(*ppArr)->operator[](nNew);
if ( rpNewItem && *rpNewItem == *pOldItem )
{
@@ -949,11 +949,11 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
SetRefCount( *rpNewItem, 0 );
delete rpNewItem;
rpNewItem = pOldItem;
- bFound = TRUE;
+ bFound = true;
SFX_TRACE( "reusing item", pOldItem );
+ break;
}
}
- //! DBG_ASSERT( bFound, "old-item not found in file" );
if ( !bFound )
{
SFX_TRACE( "item not found: ", pOldItem );
@@ -1039,7 +1039,7 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate
L"adt Surrogat aus 'rStream' und liefert das dadurch in 'rRefPool'
repr"asentierte SfxPoolItem zu"ruck. Ist das im Stream befindliche
Surrogat == SFX_ITEMS_DIRECT (!SFX_ITEM_POOLABLE) wird 0 zur"uckgegeben,
- das Item ist direkt aus dem Stream zu laden. Bei 0xfff0 (SFX_ITEMS_NULL)
+ das Item ist direkt aus dem Stream zu laden. Bei 0xfffffff0 (SFX_ITEMS_NULL)
wird auch 0 zurueckgegeben und rWhich auf 0 gesetzt, das Item ist nicht
verfuegbar.
@@ -1071,15 +1071,15 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate
*/
{
- // erstmal das Surrogat lesen
- USHORT nSurrogat;
+ // Read the first surrogate
+ sal_uInt32 nSurrogat;
rStream >> nSurrogat;
- // direkt gespeichertes Item?
+ // Is item stored directly?
if ( SFX_ITEMS_DIRECT == nSurrogat )
return 0;
- // nicht vorhandenes Item?
+ // Item does not exist?
if ( SFX_ITEMS_NULL == nSurrogat )
{
rWhich = 0;
@@ -1114,13 +1114,13 @@ const SfxPoolItem* SfxItemPool::LoadSurrogate
if ( pTarget->IsInRange(rWhich) )
{
// dflt-Attribut?
- if ( SFX_ITEMS_STATICDEFAULT == nSurrogat )
+ if ( SFX_ITEMS_DEFAULT == nSurrogat )
return *(pTarget->ppStaticDefaults +
pTarget->GetIndex_Impl(rWhich));
SfxPoolItemArray_Impl* pItemArr = *(pTarget->pImp->ppPoolItems +
pTarget->GetIndex_Impl(rWhich));
- pItem = pItemArr && nSurrogat < pItemArr->Count()
+ pItem = pItemArr && nSurrogat < pItemArr->size()
? (*pItemArr)[nSurrogat]
: 0;
if ( !pItem )
@@ -1184,17 +1184,17 @@ FASTBOOL SfxItemPool::StoreSurrogate
FASTBOOL bRealSurrogate = IsItemFlag(*pItem, SFX_ITEM_POOLABLE);
rStream << ( bRealSurrogate
? GetSurrogate( pItem )
- : (UINT16) SFX_ITEMS_DIRECT );
+ : SFX_ITEMS_DIRECT );
return bRealSurrogate;
}
- rStream << (UINT16) SFX_ITEMS_NULL;
+ rStream << SFX_ITEMS_NULL;
return TRUE;
}
// -----------------------------------------------------------------------
-USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const
+sal_uInt32 SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const
{
DBG_CHKTHIS(SfxItemPool, 0);
DBG_ASSERT( pItem, "no 0-Pointer Surrogate" );
@@ -1210,18 +1210,18 @@ USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const
// Pointer auf static- oder pool-dflt-Attribut?
if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) )
- return SFX_ITEMS_STATICDEFAULT;
+ return SFX_ITEMS_DEFAULT;
SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(pItem->Which()));
- DBG_ASSERT(pItemArr, "ItemArr nicht vorhanden");
- const USHORT nCount = pItemArr->Count();
- for ( USHORT i = 0; i < nCount; ++i )
+ DBG_ASSERT(pItemArr, "ItemArr is not available");
+
+ for ( size_t i = 0; i < pItemArr->size(); ++i )
{
const SfxPoolItem *p = (*pItemArr)[i];
if ( p == pItem )
return i;
}
- SFX_ASSERT( 0, pItem->Which(), "Item nicht im Pool");
+ SFX_ASSERT( 0, pItem->Which(), "Item not in the pool");
return SFX_ITEMS_NULL;
}
@@ -1326,10 +1326,10 @@ void SfxItemPool::SetVersionMap
*/
{
- // neuen Map-Eintrag erzeugen und einf"ugen
- const SfxPoolVersion_Impl *pVerMap = new SfxPoolVersion_Impl(
- nVer, nOldStart, nOldEnd, pOldWhichIdTab );
- pImp->aVersions.Insert( pVerMap, pImp->aVersions.Count() );
+ // create new map entry to insert
+ const SfxPoolVersion_ImplPtr pVerMap = SfxPoolVersion_ImplPtr( new SfxPoolVersion_Impl(
+ nVer, nOldStart, nOldEnd, pOldWhichIdTab ) );
+ pImp->aVersions.push_back( pVerMap );
DBG_ASSERT( nVer > pImp->nVersion, "Versions not sorted" );
pImp->nVersion = nVer;
@@ -1398,9 +1398,9 @@ USHORT SfxItemPool::GetNewWhich
if ( nDiff > 0 )
{
// von der Top-Version bis runter zur File-Version stufenweise mappen
- for ( USHORT nMap = pImp->aVersions.Count(); nMap > 0; --nMap )
+ for ( size_t nMap = pImp->aVersions.size(); nMap > 0; --nMap )
{
- SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap-1];
+ SfxPoolVersion_ImplPtr pVerInfo = pImp->aVersions[nMap-1];
if ( pVerInfo->_nVer > pImp->nVersion )
{ USHORT nOfs;
USHORT nCount = pVerInfo->_nEnd - pVerInfo->_nStart + 1;
@@ -1424,9 +1424,9 @@ USHORT SfxItemPool::GetNewWhich
else if ( nDiff < 0 )
{
// von der File-Version bis zur aktuellen Version stufenweise mappen
- for ( USHORT nMap = 0; nMap < pImp->aVersions.Count(); ++nMap )
+ for ( size_t nMap = 0; nMap < pImp->aVersions.size(); ++nMap )
{
- SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap];
+ SfxPoolVersion_ImplPtr pVerInfo = pImp->aVersions[nMap];
if ( pVerInfo->_nVer > pImp->nLoadingVersion )
{
DBG_ASSERT( nFileWhich >= pVerInfo->_nStart &&
@@ -1637,7 +1637,8 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, FASTBOOL bDirect,
else
{
// WID in der Version nicht vorhanden => ueberspringen
- USHORT nSurro, nVersion, nLen;
+ sal_uInt32 nSurro;
+ USHORT nVersion, nLen;
rStream >> nSurro;
if ( SFX_ITEMS_DIRECT == nSurro )
{
diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx
index b2184442ea0e..622533dceae2 100644
--- a/svl/source/memtools/svarray.cxx
+++ b/svl/source/memtools/svarray.cxx
@@ -61,7 +61,6 @@
#include <tools/debug.hxx>
SV_IMPL_VARARR(SvPtrarr,VoidPtr)
-SV_IMPL_VARARR_PLAIN(SvPtrarrPlain,VoidPtr)
USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const
{ USHORT n;
@@ -69,25 +68,12 @@ USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const
return ( n >= nA ? USHRT_MAX : n );
}
-USHORT SvPtrarrPlain::GetPos( const VoidPtr aElement ) const
-{ USHORT n;
- for( n=0; n < nA && *(GetData()+n) != aElement; ) n++;
- return ( n >= nA ? USHRT_MAX : n );
-}
-
-
-SV_IMPL_VARARR( SvBools, BOOL )
-SV_IMPL_VARARR( SvBytes, BYTE )
SV_IMPL_VARARR( SvULongs, ULONG )
SV_IMPL_VARARR( SvUShorts, USHORT )
SV_IMPL_VARARR( SvLongs, long)
-SV_IMPL_VARARR( SvShorts, short )
SV_IMPL_VARARR_SORT( SvULongsSort, ULONG )
SV_IMPL_VARARR_SORT( SvLongsSort, long )
-SV_IMPL_VARARR_SORT( SvXub_StrLensSort, xub_StrLen )
-
-SV_IMPL_VARARR( SvXub_StrLens, xub_StrLen )
SV_IMPL_PTRARR( SvStrings, StringPtr )
SV_IMPL_PTRARR( SvStringsDtor, StringPtr )