[Libreoffice-commits] .: 20 commits - sw/inc sw/source

Michael Stahl mst at kemper.freedesktop.org
Thu May 24 15:19:32 PDT 2012


 sw/inc/dbmgr.hxx                                |    4 
 sw/inc/doc.hxx                                  |   10 +-
 sw/inc/docary.hxx                               |   31 ++++--
 sw/inc/editsh.hxx                               |    3 
 sw/inc/flypos.hxx                               |    4 
 sw/inc/rubylist.hxx                             |    4 
 sw/inc/section.hxx                              |    3 
 sw/inc/sortopt.hxx                              |    3 
 sw/source/core/bastyp/swcache.cxx               |   46 +++++----
 sw/source/core/crsr/crstrvl.cxx                 |    4 
 sw/source/core/doc/dbgoutsw.cxx                 |    2 
 sw/source/core/doc/doc.cxx                      |   25 +++--
 sw/source/core/doc/docdesc.cxx                  |   24 ++---
 sw/source/core/doc/docfld.cxx                   |  113 +++++++++++-------------
 sw/source/core/doc/docfmt.cxx                   |    8 -
 sw/source/core/doc/doclay.cxx                   |   12 +-
 sw/source/core/doc/docnew.cxx                   |   47 +++++----
 sw/source/core/doc/docnum.cxx                   |   25 ++---
 sw/source/core/doc/docruby.cxx                  |   18 +--
 sw/source/core/doc/docsort.cxx                  |   12 +-
 sw/source/core/doc/doctxm.cxx                   |   14 +-
 sw/source/core/doc/number.cxx                   |    2 
 sw/source/core/doc/poolfmt.cxx                  |    6 -
 sw/source/core/doc/sortopt.cxx                  |   10 +-
 sw/source/core/docnode/node.cxx                 |    2 
 sw/source/core/docnode/section.cxx              |   64 +++++--------
 sw/source/core/edit/edfld.cxx                   |   10 +-
 sw/source/core/edit/edfldexp.cxx                |    2 
 sw/source/core/edit/editsh.cxx                  |    9 -
 sw/source/core/fields/fldbas.cxx                |   13 ++
 sw/source/core/fields/fldlst.cxx                |    4 
 sw/source/core/inc/docsort.hxx                  |   10 +-
 sw/source/core/inc/rolbck.hxx                   |   21 ++--
 sw/source/core/inc/swcache.hxx                  |   11 +-
 sw/source/core/layout/flypos.cxx                |    2 
 sw/source/core/layout/newfrm.cxx                |    2 
 sw/source/core/layout/pagedesc.cxx              |    6 +
 sw/source/core/table/swtable.cxx                |    1 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |    2 
 sw/source/core/tox/tox.cxx                      |   13 ++
 sw/source/core/undo/rolbck.cxx                  |   41 +++++---
 sw/source/core/undo/unsort.cxx                  |    4 
 sw/source/core/unocore/unocoll.cxx              |    6 -
 sw/source/core/unocore/unofield.cxx             |    8 -
 sw/source/core/unocore/unoidx.cxx               |    2 
 sw/source/core/unocore/unoobj.cxx               |    8 -
 sw/source/core/unocore/unoobj2.cxx              |    4 
 sw/source/core/unocore/unosect.cxx              |    8 -
 sw/source/core/unocore/unostyle.cxx             |    2 
 sw/source/filter/basflt/fltini.cxx              |   24 ++---
 sw/source/filter/html/htmlfly.cxx               |    9 -
 sw/source/filter/rtf/rtffly.cxx                 |   22 ++--
 sw/source/filter/rtf/swparrtf.cxx               |   28 ++---
 sw/source/filter/rtf/swparrtf.hxx               |   15 ++-
 sw/source/filter/writer/writer.cxx              |    2 
 sw/source/filter/ww8/rtfexport.cxx              |    4 
 sw/source/filter/ww8/writerhelper.cxx           |   11 +-
 sw/source/filter/ww8/wrtw8num.cxx               |   28 ++---
 sw/source/filter/ww8/wrtww8.cxx                 |    2 
 sw/source/ui/app/docstyle.cxx                   |    6 -
 sw/source/ui/dbui/dbmgr.cxx                     |   33 +++----
 sw/source/ui/envelp/label1.cxx                  |   16 +--
 sw/source/ui/envelp/labelcfg.cxx                |    2 
 sw/source/ui/envelp/labimp.hxx                  |   10 +-
 sw/source/ui/misc/srtdlg.cxx                    |    6 -
 sw/source/ui/uno/unotxvw.cxx                    |    6 -
 sw/source/ui/utlui/content.cxx                  |    4 
 67 files changed, 496 insertions(+), 417 deletions(-)

New commits:
commit 2733658dd47e86ac72c53565f1fd8700f884c907
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri May 25 00:12:55 2012 +0200

    SwHistory::Move parameter nEnd was unused
    
    ... which is good because apparently the use of the non-default value
    has always been wrong, until the STL conversion fixed it by accident.

diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 0eb6efa..efb6f41 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -398,10 +398,10 @@ public:
 
     // for SwUndoDelete::Undo/Redo
     void Move( sal_uInt16 nPos, SwHistory *pIns,
-               sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX )
+               sal_uInt16 const nStart = 0)
     {
         SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
-        SwpHstry::iterator itSourceEnd = nEnd == USHRT_MAX ? pIns->m_SwpHstry.end() : pIns->m_SwpHstry.begin() + nEnd;
+        SwpHstry::iterator itSourceEnd = pIns->m_SwpHstry.end();
         std::copy( itSourceBegin, itSourceEnd, m_SwpHstry.begin() + nPos );
         pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd );
     }
commit 9c0ca924446933431d736ee0dd37e6852b4947dc
Author: Noel Grandin <noel at peralex.com>
Date:   Thu May 24 09:51:14 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwpHstry) to std::vector
    
    Could not use boost::ptr_vector here because the code moves
    pointers around by hand.
    
    Change-Id: I60d19741ad08add18d99ee3b75e9dc3810d2c675

diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index f030c23..0eb6efa 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -353,8 +353,11 @@ public:
 
 #endif
 
-typedef SwHistoryHint* SwHistoryHintPtr;
-SV_DECL_PTRARR_DEL( SwpHstry, SwHistoryHintPtr, 0 )
+class SwpHstry : public std::vector<SwHistoryHint*> {
+public:
+    // the destructor will free all objects still in the vector
+    ~SwpHstry();
+};
 
 class SwHistory
 {
@@ -386,8 +389,8 @@ public:
     void Add( const SwTxtFtn& );
     void Add( const SfxItemSet & rSet, const SwCharFmt & rCharFmt);
 
-    sal_uInt16 Count() const { return m_SwpHstry.Count(); }
-    sal_uInt16 GetTmpEnd() const { return m_SwpHstry.Count() - m_nEndDiff; }
+    sal_uInt16 Count() const { return m_SwpHstry.size(); }
+    sal_uInt16 GetTmpEnd() const { return m_SwpHstry.size() - m_nEndDiff; }
     sal_uInt16 SetTmpEnd( sal_uInt16 nTmpEnd );        // return previous value
     SwHistoryHint      * operator[]( sal_uInt16 nPos ) { return m_SwpHstry[nPos]; }
     SwHistoryHint const* operator[]( sal_uInt16 nPos ) const
@@ -397,10 +400,10 @@ public:
     void Move( sal_uInt16 nPos, SwHistory *pIns,
                sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX )
     {
-        m_SwpHstry.Insert( &pIns->m_SwpHstry, nPos, nStart, nEnd );
-        pIns->m_SwpHstry.Remove( nStart, (nEnd == USHRT_MAX)
-                                            ? pIns->Count() - nStart
-                                            : nEnd );
+        SwpHstry::iterator itSourceBegin = pIns->m_SwpHstry.begin() + nStart;
+        SwpHstry::iterator itSourceEnd = nEnd == USHRT_MAX ? pIns->m_SwpHstry.end() : pIns->m_SwpHstry.begin() + nEnd;
+        std::copy( itSourceBegin, itSourceEnd, m_SwpHstry.begin() + nPos );
+        pIns->m_SwpHstry.erase( itSourceBegin, itSourceEnd );
     }
 
     // helper methods for recording attribute in History
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 38e02bb..b0ca37d 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -69,8 +69,6 @@
 #include <undo.hrc>
 #include <bookmrk.hxx>
 
-SV_IMPL_PTRARR( SwpHstry, SwHistoryHintPtr)
-
 String SwHistoryHint::GetDescription() const
 {
     return String();
@@ -1015,9 +1013,11 @@ void SwHistoryChangeCharFmt::SetInDoc(SwDoc * pDoc, bool )
 
 
 SwHistory::SwHistory( sal_uInt16 nInitSz )
-    : m_SwpHstry( (sal_uInt8)nInitSz )
+    : m_SwpHstry()
     , m_nEndDiff( 0 )
-{}
+{
+    m_SwpHstry.reserve( (sal_uInt8)nInitSz );
+}
 
 
 SwHistory::~SwHistory()
@@ -1053,7 +1053,7 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
     {
         pHt = new SwHistoryResetFmt( pNewValue, nNodeIdx );
     }
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
@@ -1098,7 +1098,7 @@ void SwHistory::Add( SwTxtAttr* pHint, sal_uLong nNodeIdx, bool bNewAttr )
         pHt = new SwHistoryResetTxt( pHint->Which(), *pHint->GetStart(),
                                     *pHint->GetAnyEnd(), nNodeIdx );
     }
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
@@ -1108,7 +1108,7 @@ void SwHistory::Add( SwFmtColl* pColl, sal_uLong nNodeIdx, sal_uInt8 nWhichNd )
 
     SwHistoryHint * pHt =
         new SwHistoryChangeFmtColl( pColl, nNodeIdx, nWhichNd );
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
@@ -1117,14 +1117,14 @@ void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOth
     OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" );
 
     SwHistoryHint * pHt = new SwHistoryBookmark(rBkmk, bSavePos, bSaveOtherPos);
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 
 void SwHistory::Add( SwFrmFmt& rFmt )
 {
     SwHistoryHint * pHt = new SwHistoryChangeFlyAnchor( rFmt );
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
@@ -1136,7 +1136,7 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
     if( RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh )
     {
         pHint = new SwHistoryTxtFlyCnt( &rFmt );
-        m_SwpHstry.Insert( pHint, Count() );
+        m_SwpHstry.push_back( pHint );
 
         const SwFmtChain* pChainItem;
         if( SFX_ITEM_SET == rFmt.GetItemState( RES_CHAIN, sal_False,
@@ -1146,7 +1146,7 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
             {
                 SwHistoryHint * pHt =
                     new SwHistoryChangeFlyChain( rFmt, *pChainItem );
-                m_SwpHstry.Insert( pHt, rSetPos++ );
+                m_SwpHstry.insert( m_SwpHstry.begin() + rSetPos++, pHt );
                 if ( pChainItem->GetNext() )
                 {
                     SwFmtChain aTmp( pChainItem->GetNext()->GetChain() );
@@ -1168,14 +1168,14 @@ void SwHistory::Add( SwFlyFrmFmt& rFmt, sal_uInt16& rSetPos )
 void SwHistory::Add( const SwTxtFtn& rFtn )
 {
     SwHistoryHint *pHt = new SwHistorySetFootnote( rFtn );
-    m_SwpHstry.Insert( pHt, Count() );
+    m_SwpHstry.push_back( pHt );
 }
 
 // #i27615#
 void SwHistory::Add(const SfxItemSet & rSet, const SwCharFmt & rFmt)
 {
     SwHistoryHint * pHt = new SwHistoryChangeCharFmt(rSet, rFmt.GetName());
-    m_SwpHstry.Insert(pHt, Count());
+    m_SwpHstry.push_back( pHt );
 }
 
 /*************************************************************************
@@ -1200,7 +1200,7 @@ bool SwHistory::Rollback( SwDoc* pDoc, sal_uInt16 nStart )
         pHHt->SetInDoc( pDoc, false );
         delete pHHt;
     }
-    m_SwpHstry.Remove( nStart, Count() - nStart );
+    m_SwpHstry.erase( m_SwpHstry.begin() + nStart, m_SwpHstry.end() );
     m_nEndDiff = 0;
     return true;
 }
@@ -1238,7 +1238,8 @@ void SwHistory::Delete( sal_uInt16 nStart )
 {
     for ( sal_uInt16 n = Count(); n > nStart; )
     {
-        m_SwpHstry.DeleteAndDestroy( --n, 1 );
+        delete m_SwpHstry[ --n ];
+        m_SwpHstry.erase( m_SwpHstry.begin() + n );
     }
     m_nEndDiff = 0;
 }
@@ -1404,7 +1405,7 @@ void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
                     pNewHstr = new SwHistoryResetFmt( pItem, m_nNodeIndex );
                 }
             }
-            m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
+            m_pHistory->m_SwpHstry.push_back( pNewHstr );
         }
     }
 }
@@ -1452,7 +1453,7 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
                                     pTxtNode->GetIndex(), nStart, nEnd );
         // der NodeIndex kann verschoben sein !!
 
-        m_pHistory->m_SwpHstry.Insert( pNewHstr, m_pHistory->Count() );
+        m_pHistory->m_SwpHstry.push_back( pNewHstr );
     }
 
     return bInserted;
@@ -1506,4 +1507,10 @@ void SwRegHistory::_MakeSetWhichIds()
     }
 }
 
+SwpHstry::~SwpHstry()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c271eb95a8519c88af809ee7a0e1c750e08beb27
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 24 22:42:46 2012 +0200

    SwCache: fix non-DBGUTIL memory leak in previous commit

diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index adbcb94..c63afb5 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -70,9 +70,9 @@ void SwCache::Check()
         SAL_WARN_IF( pObj == pRekursive, "sw", "Recursion in SwCache." );
     }
     SAL_WARN_IF( !bFirstFound, "sw", "First not Found." );
-    SAL_WARN_IF( nCnt + aFreePositions.size() != Count(), "sw", "Lost Chain." );
+    SAL_WARN_IF( nCnt + aFreePositions.size() != size(), "sw", "Lost Chain." );
     SAL_WARN_IF(
-        Count() == nCurMax && nCurMax != aFreePositions.size() + nCnt, "sw",
+        size() == nCurMax && nCurMax != aFreePositions.size() + nCnt, "sw",
         "Lost FreePositions." );
 }
 #endif
@@ -119,9 +119,9 @@ SwCache::SwCache( const sal_uInt16 nInitSize
     m_aCacheObjects.reserve( (sal_uInt8)nInitSize );
 }
 
-#ifdef DBG_UTIL
 SwCache::~SwCache()
 {
+#ifdef DBG_UTIL
     {
         rtl::OStringBuffer sOut(m_aName);
 
@@ -182,11 +182,11 @@ SwCache::~SwCache()
         OSL_TRACE(sOut.getStr());
     }
     Check();
+#endif
 
     for(SwCacheObjArr::const_iterator it = m_aCacheObjects.begin(); it != m_aCacheObjects.end(); ++it)
         delete *it;
 }
-#endif
 
 /*************************************************************************
 |*  SwCache::Flush()
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index f4167da..5934c11 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -106,11 +106,11 @@ public:
     //nur sal_uInt8 hineinstecken!!!
 #ifdef DBG_UTIL
     SwCache( const sal_uInt16 nInitSize, const rtl::OString &rNm );
-    // the destructor will free all objects still in the vector
-    ~SwCache();
 #else
     SwCache( const sal_uInt16 nInitSize );
 #endif
+    // the destructor will free all objects still in the vector
+    ~SwCache();
 
     void Flush( const sal_uInt8 nPercent = 100 );
 
commit b55cb6f2bd09ac91fabd5ce1a5bb5766e837e29f
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 16:13:53 2012 +0200

    Inline SV_DECL_PTRARR_DEL(SwCacheObjArr) into a std::vector
    
    ..inside of the SwCache class.
    
    Change-Id: Ie8cf55c28a04d3776b99a8608880ac7a19f748b2

diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 9c0187f..adbcb94 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -30,8 +30,6 @@
 #include <swcache.hxx>
 #include <rtl/strbuf.hxx>
 
-SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*);
-
 #ifdef DBG_UTIL
 #define INCREMENT( nVar )   ++nVar
 #else
@@ -95,7 +93,7 @@ SwCache::SwCache( const sal_uInt16 nInitSize
     , const rtl::OString &rNm
 #endif
     ) :
-    SwCacheObjArr( (sal_uInt8)nInitSize ),
+    m_aCacheObjects(),
     pRealFirst( 0 ),
     pFirst( 0 ),
     pLast( 0 ),
@@ -118,6 +116,7 @@ SwCache::SwCache( const sal_uInt16 nInitSize
     , m_nDecreaseMax( 0 )
 #endif
 {
+    m_aCacheObjects.reserve( (sal_uInt8)nInitSize );
 }
 
 #ifdef DBG_UTIL
@@ -183,6 +182,9 @@ SwCache::~SwCache()
         OSL_TRACE(sOut.getStr());
     }
     Check();
+
+    for(SwCacheObjArr::const_iterator it = m_aCacheObjects.begin(); it != m_aCacheObjects.end(); ++it)
+        delete *it;
 }
 #endif
 
@@ -225,7 +227,7 @@ void SwCache::Flush( const sal_uInt8 )
             pTmp = (SwCacheObj*)pObj;
             pObj = pTmp->GetNext();
             aFreePositions.push_back( pTmp->GetCachePos() );
-            *(pData + pTmp->GetCachePos()) = (void*)0;
+            m_aCacheObjects[pTmp->GetCachePos()] = NULL;
             delete pTmp;
             INCREMENT( m_nFlushedObjects );
         }
@@ -306,7 +308,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const sal_uInt16 nIndex,
                           const sal_Bool bToTop )
 {
     SwCacheObj *pRet;
-    if ( 0 != (pRet = nIndex < Count() ? operator[]( nIndex ) : 0) )
+    if ( 0 != (pRet = nIndex < m_aCacheObjects.size() ? m_aCacheObjects[ nIndex ] : 0) )
     {
         if ( !pRet->IsOwner( pOwner ) )
             pRet = 0;
@@ -377,23 +379,23 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
         pObj->GetNext()->SetPrev( pObj->GetPrev() );
 
     aFreePositions.push_back( pObj->GetCachePos() );
-    *(pData + pObj->GetCachePos()) = (void*)0;
+    m_aCacheObjects[pObj->GetCachePos()] = NULL;
     delete pObj;
 
     CHECK;
-    if ( Count() > nCurMax &&
-         (nCurMax <= (Count() - aFreePositions.size())) )
+    if ( m_aCacheObjects.size() > nCurMax &&
+         (nCurMax <= (m_aCacheObjects.size() - aFreePositions.size())) )
     {
         //Falls moeglich wieder verkleinern, dazu muessen allerdings ausreichend
         //Freie Positionen bereitstehen.
         //Unangenehmer Nebeneffekt ist, das die Positionen verschoben werden
         //muessen, und die Eigentuemer der Objekte diese wahrscheinlich nicht
         //wiederfinden werden.
-        for ( sal_uInt16 i = 0; i < Count(); ++i )
+        for ( sal_uInt16 i = 0; i < m_aCacheObjects.size(); ++i )
         {
-            SwCacheObj *pTmpObj = operator[](i);
+            SwCacheObj *pTmpObj = m_aCacheObjects[i];
             if ( !pTmpObj )
-            {   SwCacheObjArr::Remove( i, 1 );
+            {   m_aCacheObjects.erase( m_aCacheObjects.begin() + i );
                 --i;
             }
             else
@@ -424,12 +426,12 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
     OSL_ENSURE( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." );
 
     sal_uInt16 nPos;//Wird hinter den if's zum setzen am Obj benutzt.
-    if ( Count() < nCurMax )
+    if ( m_aCacheObjects.size() < nCurMax )
     {
         //Es ist noch Platz frei, also einfach einfuegen.
         INCREMENT( m_nAppend );
-        nPos = Count();
-        SwCacheObjArr::C40_INSERT( SwCacheObj, pNew, nPos );
+        nPos = m_aCacheObjects.size();
+        m_aCacheObjects.push_back(pNew);
     }
     else if ( !aFreePositions.empty() )
     {
@@ -437,7 +439,7 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
         INCREMENT( m_nInsertFree );
         const sal_uInt16 nFreePos = aFreePositions.size() - 1;
         nPos = aFreePositions[ nFreePos ];
-        *(pData + nPos) = pNew;
+        m_aCacheObjects[nPos] = pNew;
         aFreePositions.erase( aFreePositions.begin() + nFreePos );
     }
     else
@@ -468,7 +470,7 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
                 pObj->GetNext()->SetPrev( pObj->GetPrev() );
         }
         delete pObj;
-        *(pData + nPos) = pNew;
+        m_aCacheObjects[nPos] = pNew;
     }
     pNew->SetCachePos( nPos );
 
@@ -502,12 +504,12 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
 
 void SwCache::SetLRUOfst( const sal_uInt16 nOfst )
 {
-    if ( !pRealFirst || ((Count() - aFreePositions.size()) < nOfst) )
+    if ( !pRealFirst || ((m_aCacheObjects.size() - aFreePositions.size()) < nOfst) )
         return;
 
     CHECK;
     pFirst = pRealFirst;
-    for ( sal_uInt16 i = 0; i < Count() && i < nOfst; ++i )
+    for ( sal_uInt16 i = 0; i < m_aCacheObjects.size() && i < nOfst; ++i )
     {
         if ( pFirst->GetNext() && pFirst->GetNext()->GetNext() )
             pFirst = pFirst->GetNext();
diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx
index 63995ea..f4167da 100644
--- a/sw/source/core/inc/swcache.hxx
+++ b/sw/source/core/inc/swcache.hxx
@@ -61,10 +61,10 @@
 
 class SwCacheObj;
 
-SV_DECL_PTRARR_DEL(SwCacheObjArr,SwCacheObj*,1)
-
-class SwCache : public SwCacheObjArr
+typedef std::vector<SwCacheObj*> SwCacheObjArr;
+class SwCache
 {
+    SwCacheObjArr m_aCacheObjects;
     std::vector<sal_uInt16> aFreePositions; //Freie Positionen fuer das Insert wenn
                                     //die Maximalgrenze nicht erreicht ist.
                                     //Immer wenn ein Objekt ausgetragen wird,
@@ -106,6 +106,7 @@ public:
     //nur sal_uInt8 hineinstecken!!!
 #ifdef DBG_UTIL
     SwCache( const sal_uInt16 nInitSize, const rtl::OString &rNm );
+    // the destructor will free all objects still in the vector
     ~SwCache();
 #else
     SwCache( const sal_uInt16 nInitSize );
@@ -133,6 +134,8 @@ public:
     inline SwCacheObj *First() { return pRealFirst; }
     inline SwCacheObj *Last()  { return pLast; }
     inline SwCacheObj *Next( SwCacheObj *pCacheObj);
+    inline SwCacheObj* operator[](sal_uInt16 nIndex) { return m_aCacheObjects[nIndex]; }
+    inline sal_uInt16 size() { return m_aCacheObjects.size(); }
 };
 
 //Cache-Manipulation auf die sichere Art.
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 40b4339..2c01b92 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -377,7 +377,7 @@ void _FrmFinit()
 {
 #if OSL_DEBUG_LEVEL > 0
     // The cache may only contain null pointers at this time.
-    for( sal_uInt16 n = SwFrm::GetCachePtr()->Count(); n; )
+    for( sal_uInt16 n = SwFrm::GetCachePtr()->size(); n; )
         if( (*SwFrm::GetCachePtr())[ --n ] )
         {
             SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ];
commit 7d69ffe8c92521537521f3a66a089eb3ed5c2be2
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 15:35:26 2012 +0200

    Convert SV_DECL_PTRARR(SwMovedBoxes) to std::vector
    
    Change-Id: I6df8a2929569ec0a2ee670002833b6a142d42318

diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 5125207..2412d98 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -633,7 +633,7 @@ void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT,
         // and move it
         MoveCell(pDoc, pS, pT, bMoved, pUD);
 
-        rMovedList.Insert(pS, rMovedList.Count() );
+        rMovedList.push_back(pS);
 
         if( pS != pT )
         {
@@ -679,7 +679,7 @@ void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, sal_uInt16 nS, sal_uInt16 nT,
         sal_Bool bMoved = rMovedList.GetPos(pT) != USHRT_MAX;
         MoveCell(pDoc, pS, pT, bMoved, pUD);
 
-        rMovedList.Insert(pS, rMovedList.Count() );
+        rMovedList.push_back(pS);
 
         if( pS != pT )
         {
@@ -977,4 +977,10 @@ const SfxItemSet* FlatFndBox::GetItemSet(sal_uInt16 n_Col, sal_uInt16 n_Row) con
     return ppItemSets ? *(ppItemSets + (n_Row * nCols + n_Col )) : 0;
 }
 
+sal_uInt16 SwMovedBoxes::GetPos(const SwTableBox* pTableBox) const
+{
+    const_iterator it = std::find(begin(), end(), pTableBox);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx
index e3df48b..f91be1f 100644
--- a/sw/source/core/inc/docsort.hxx
+++ b/sw/source/core/inc/docsort.hxx
@@ -31,6 +31,7 @@
 
 #include <svl/svarray.hxx>
 #include <ndindex.hxx>
+#include <vector>
 
 
 class SwDoc;
@@ -54,10 +55,15 @@ namespace com { namespace sun { namespace star { namespace lang {
  --------------------------------------------------------------------*/
 typedef const _FndBox*      _FndBoxPtr;
 typedef SwSortElement*      SwSortElementPtr;
-typedef const SwTableBox*   SwMovedBoxPtr;
 
 SV_DECL_PTRARR_SORT(SwSortElements, SwSortElementPtr, 0)
-SV_DECL_PTRARR(SwMovedBoxes,        SwMovedBoxPtr, 10)
+
+class SwMovedBoxes : public std::vector<const SwTableBox*>
+{
+public:
+    sal_uInt16 GetPos(const SwTableBox* pTableBox) const;
+};
+
 
 /*--------------------------------------------------------------------
     Beschreibung: Funktionen zum Moven von Boxen
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 537c201..3a57a75 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2826,5 +2826,4 @@ void SwTableBox::ForgetFrmFmt()
         GetRegisteredInNonConst()->Remove(this);
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index 8712383..22c9be7 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -121,7 +121,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
                      USHRT_MAX != aMovedList.GetPos(pSource) );
 
             // schon Verschobenen in der Liste merken
-            aMovedList.Insert(pTarget, aMovedList.Count() );
+            aMovedList.push_back(pTarget);
         }
 
         // Restore table frames:
@@ -197,7 +197,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
             MoveCell(&rDoc, pSource, pTarget,
                      USHRT_MAX != aMovedList.GetPos( pTarget ) );
             // schon Verschobenen in der Liste merken
-            aMovedList.Insert( pSource, aMovedList.Count() );
+            aMovedList.push_back( pSource );
         }
 
         if( pUndoTblAttr )
commit 4490eb8c9c701510a3370c900a6c6ec9e4f8a70d
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 15:01:34 2012 +0200

    Convert V_DECL_PTRARR_DEL(SwFlySaveArr) to std::vector
    
    I can't use boost::ptr_vector here because the code moves objects
    around with free'ing them.
    
    Change-Id: I42b8f347e2bac51bd63e2c42d6ebab2e7ad4b61c

diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index 826cb7e..e31d4d3 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -75,8 +75,6 @@ using namespace ::com::sun::star;
 // steht in shellio.hxx
 extern SwCntntNode* GoNextNds( SwNodeIndex * pIdx, sal_Bool bChk );
 
-SV_IMPL_PTRARR( SwFlySaveArr, SwFlySave* )
-
 inline const SwFmtFrmSize GetFrmSize(const SfxItemSet& rSet, sal_Bool bInP=sal_True)
 {
     return (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE,bInP);
@@ -226,7 +224,7 @@ void SwRTFParser::SetFlysInDoc()
     rtfFmtMap aPrevFmts;
 
     SwFrmFmt* pParent = pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME );
-    for( sal_uInt16 n = 0; n < aFlyArr.Count(); ++n )
+    for( sal_uInt16 n = 0; n < aFlyArr.size(); ++n )
     {
         SwFlySave* pFlySave = aFlyArr[ n ];
 
@@ -276,7 +274,7 @@ void SwRTFParser::SetFlysInDoc()
 
         // liegt Ende und Start vom Naechsten im gleichen Node, dann muss
         // gesplittet werden
-        if( n + 1 < aFlyArr.Count() && pFlySave->nEndCnt &&
+        if( n + 1 < (sal_uInt16)aFlyArr.size() && pFlySave->nEndCnt &&
             pFlySave->nEndNd == aFlyArr[ n + 1 ]->nSttNd )
         {
             SwCntntNode *const pCNd = pFlySave->nEndNd.GetNode().GetCntntNode();
@@ -523,7 +521,7 @@ void SwRTFParser::SetFlysInDoc()
         }
     }
 
-    aFlyArr.Remove(0, aFlyArr.Count());
+    aFlyArr.clear();
 }
 
 // clips the text box to the min or max position if it is outside our min or max boundry
@@ -979,7 +977,7 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
     // ein neues FlyFormat anlegen oder das alte benutzen ?
     // (teste ob es die selben Attribute besitzt!)
     SwFlySave* pFlySave = 0;
-    sal_uInt16 nFlyArrCnt = aFlyArr.Count();
+    sal_uInt16 nFlyArrCnt = aFlyArr.size();
     /*
     #i5263#
     There were not enough frame properties found to actually justify creating
@@ -1007,7 +1005,8 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
                      pFlySavePrev->nEndNd=pFlySave->nSttNd;
                 }
             }
-            aFlyArr.Insert(  pFlySave, nFlyArrCnt++ );
+            aFlyArr.push_back( pFlySave );
+            nFlyArrCnt++;
             // #i83368# - reset
             mbReadCellWhileReadSwFly = false;
         }
@@ -1090,7 +1089,8 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
         !pPam->GetPoint()->nContent.GetIndex() )
     {
         // dann zerstoere den FlySave wieder.
-        aFlyArr.DeleteAndDestroy( --nFlyArrCnt );
+        delete aFlyArr[ --nFlyArrCnt ];
+        aFlyArr.erase( aFlyArr.begin() + nFlyArrCnt );
 
         // Remove the properties that have been parsed before in the paragraph
         GetAttrStack().pop_back();
@@ -1237,12 +1237,12 @@ void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf,
         if( pGrfAttrSet )
             pGrfNd->SetAttr( *pGrfAttrSet );
 
-        SwFlySave* pFlySave = aFlyArr[ aFlyArr.Count()-1 ];
+        SwFlySave* pFlySave = aFlyArr[ aFlyArr.size()-1 ];
         pFlySave->nSttNd = rIdx.GetIndex() - 1;
 
-        if( 1 < aFlyArr.Count() )
+        if( 1 < aFlyArr.size() )
         {
-            pFlySave = aFlyArr[ aFlyArr.Count() - 2 ];
+            pFlySave = aFlyArr[ aFlyArr.size() - 2 ];
             if( pFlySave->nEndNd == rIdx )
                 pFlySave->nEndNd = rIdx.GetIndex() - 1;
         }
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 221b512..396de09 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -398,7 +398,7 @@ void SwRTFParser::Continue( int nToken )
         // ein am 1. Absatz verankerter Fly falsch eingefuegt
         if( SVPAR_ACCEPTED == eState )
         {
-            if( aFlyArr.Count() )
+            if( !aFlyArr.empty() )
                 SetFlysInDoc();
             pRelNumRule->SetOultineRelSpaces( *pSttNdIdx, pPam->GetPoint()->nNode );
         }
@@ -475,7 +475,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( sal_False ).nNode.GetIndex() )
         for (rtfSections::myrDummyIter aI = maSegments.maDummyPageNos.rbegin(); aI != aDEnd; ++aI)
             pDoc->DelPageDesc(*aI);
 
-        if( aFlyArr.Count() )
+        if( !aFlyArr.empty() )
             SetFlysInDoc();
 
         // jetzt noch den letzten ueberfluessigen Absatz loeschen
@@ -1145,9 +1145,6 @@ SwRTFParser::~SwRTFParser()
     delete pPam;
     delete pRelNumRule;
 
-    if (aFlyArr.Count())
-        aFlyArr.DeleteAndDestroy( 0, aFlyArr.Count() );
-
     if (pGrfAttrSet)
         DELETEZ( pGrfAttrSet );
 }
@@ -3546,9 +3543,9 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
 
     // save the fly array - after read, all flys may be set into
     // the header/footer
-    SwFlySaveArr aSaveArray( 255 < aFlyArr.Count() ? aFlyArr.Count() : 255 );
-    aSaveArray.Insert( &aFlyArr, 0 );
-    aFlyArr.Remove( 0, aFlyArr.Count() );
+    SwFlySaveArr aSaveArray(aFlyArr);
+    aSaveArray.reserve(255);
+    aFlyArr.clear();
     sal_Bool bSetFlyInDoc = sal_True;
 
     const SwNodeIndex* pSttIdx = 0;
@@ -3665,7 +3662,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
         break;
     }
 
-    sal_uInt16 nOldFlyArrCnt = aFlyArr.Count();
+    sal_uInt16 nOldFlyArrCnt = aFlyArr.size();
     if( !pSttIdx )
         SkipGroup();
     else
@@ -3718,7 +3715,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
         }
 
         SetAllAttrOfStk();
-        if( aFlyArr.Count() && bSetFlyInDoc )
+        if( !aFlyArr.empty() && bSetFlyInDoc )
             SetFlysInDoc();
 
         // sollte der letze Node leer sein, dann loesche ihn
@@ -3730,12 +3727,13 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
     if( pTxtAttr && RES_TXTATR_FLYCNT == pTxtAttr->Which() )
     {
         // is add a new fly ?
-        if( nOldFlyArrCnt < aFlyArr.Count() )
+        if( nOldFlyArrCnt < aFlyArr.size() )
         {
-            SwFlySave* pFlySave = aFlyArr[ aFlyArr.Count()-1 ];
+            SwFlySave* pFlySave = aFlyArr.back();
             pFlySave->aFlySet.ClearItem( RES_ANCHOR );
             pHdFtFmt->SetFmtAttr( pFlySave->aFlySet );
-            aFlyArr.DeleteAndDestroy( aFlyArr.Count() - 1 );
+            delete aFlyArr.back();
+            aFlyArr.pop_back();
         }
         else
         {
@@ -3758,8 +3756,8 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc )
     mbIsFootnote = bOldIsFootnote;
     GetAttrStack() = aSaveStack;
 
-    aFlyArr.Insert( &aSaveArray, 0 );
-    aSaveArray.Remove( 0, aSaveArray.Count() );
+    std::copy(aSaveArray.begin(), aSaveArray.end(), aFlyArr.begin() );
+    aSaveArray.clear();
     bContainsPara = bContainsParaCache;
 }
 
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index feab408..ff9fa97 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -146,8 +146,19 @@ struct SwListEntry
                     bRuleUsed = sal_False; }
 };
 
-typedef SwFlySave* SwFlySavePtr;
-SV_DECL_PTRARR_DEL( SwFlySaveArr, SwFlySavePtr, 0 )
+class SwFlySaveArr : public std::vector<SwFlySave*>
+{
+public:
+    SwFlySaveArr() : vector() {}
+    SwFlySaveArr(const SwFlySaveArr& other) : vector(other) {}
+
+    ~SwFlySaveArr()
+    {
+        for(const_iterator it = begin(); it != end(); ++it)
+            delete *it;
+    }
+};
+
 typedef std::deque< SwListEntry > SwListArr;
 
 struct DocPageInformation
commit 385116041c1ca91d6df2c037a5a95460a1f0fb09
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 24 22:38:52 2012 +0200

    fix previous commit:
    
    erase in SwLabDlg::_ReplaceGroup should go until end()

diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 2c6257c..25ca092 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -84,7 +84,7 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const
 void SwLabDlg::_ReplaceGroup( const String &rMake )
 {
     // Remove old entries
-    pRecs->erase( pRecs->begin() + 1, pRecs->begin() + pRecs->size() - 1 );
+    pRecs->erase(pRecs->begin() + 1, pRecs->end());
     aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
     aLstGroup = rMake;
 }
commit 3694f94b7457614e34d6ce039acdfa082071562b
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 14:15:24 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwLabRecs) to std::vector
    
    I can't use boost::ptr_vector here because the code removes
    entries from the list without free'ing them.
    
    Change-Id: I1640d0bb97443998c02148ed24bbd6ad0d390234

diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 72c2af3..2c6257c 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -52,8 +52,6 @@
 extern SW_DLLPUBLIC String MakeSender();
 
 
-SV_IMPL_PTRARR( SwLabRecs, SwLabRec* );
-
 void SwLabRec::SetFromItem( const SwLabItem& rItem )
 {
     lHDist  = rItem.lHDist;
@@ -86,7 +84,7 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const
 void SwLabDlg::_ReplaceGroup( const String &rMake )
 {
     // Remove old entries
-    pRecs->Remove( 1, pRecs->Count() - 1 );
+    pRecs->erase( pRecs->begin() + 1, pRecs->begin() + pRecs->size() - 1 );
     aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
     aLstGroup = rMake;
 }
@@ -154,10 +152,10 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
 
     sal_Bool bDouble = sal_False;
 
-    for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++)
+    for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->size(); nRecPos++)
     {
-        if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake &&
-            pRec->aType == pRecs->GetObject(nRecPos)->aType)
+        if (pRec->aMake == (*pRecs)[nRecPos]->aMake &&
+            pRec->aType == (*pRecs)[nRecPos]->aType)
         {
             bDouble = sal_True;
             break;
@@ -165,7 +163,7 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
     }
 
     if (!bDouble)
-        pRecs->C40_INSERT( SwLabRec, pRec, 0 );
+        pRecs->insert( pRecs->begin(), pRec );
 
     sal_uInt16 nLstGroup = 0;
     const ::com::sun::star::uno::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers();
@@ -216,7 +214,7 @@ SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont)
     sal_Bool bFound = sal_False;
     String sCustom(SW_RES(STR_CUSTOM));
 
-    const sal_uInt16 nCount = Recs().Count();
+    const sal_uInt16 nCount = Recs().size();
     for (sal_uInt16 i = 0; i < nCount; i++)
     {
         pRec = Recs()[i];
@@ -418,7 +416,7 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl)
     aItem.aLstMake = aMake;
 
     const sal_Bool   bCont    = aContButton.IsChecked();
-    const sal_uInt16 nCount   = GetParent()->Recs().Count();
+    const sal_uInt16 nCount   = GetParent()->Recs().size();
           sal_uInt16 nLstType = 0;
 
     const String sCustom(SW_RES(STR_CUSTOM));
diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx
index 3ee9fe3..78f86a2 100644
--- a/sw/source/ui/envelp/labelcfg.cxx
+++ b/sw/source/ui/envelp/labelcfg.cxx
@@ -177,7 +177,7 @@ void    SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLab
         Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix);
         Sequence<Any>   aValues = GetProperties(aPropNames);
         SwLabRec* pNewRec = lcl_CreateSwLabRec(aValues, rManufacturer);
-        rLabArr.C40_INSERT( SwLabRec, pNewRec, rLabArr.Count() );
+        rLabArr.push_back( pNewRec );
     }
 }
 
diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx
index a20415e..bc004e1 100644
--- a/sw/source/ui/envelp/labimp.hxx
+++ b/sw/source/ui/envelp/labimp.hxx
@@ -83,6 +83,7 @@
 #include <svtools/svtreebx.hxx>
 #include <label.hxx>
 #include <labimg.hxx>
+#include <vector>
 
 #define GETFLDVAL(rField)         (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
 #define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
@@ -113,7 +114,14 @@ public:
 };
 
 
-SV_DECL_PTRARR_DEL( SwLabRecs, SwLabRec*, 110 )
+class SwLabRecs : public std::vector<SwLabRec*> {
+public:
+    ~SwLabRecs()
+    {
+        for(const_iterator it = begin(); it != end(); ++it)
+            delete *it;
+    }
+};
 
 #endif
 
commit 0437791557aa43285a67136f8eae5b9dfd1e363e
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 23 13:49:36 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwDSParamArr) to boost::ptr_vector
    
    Change-Id: I685a79cb14b0bb1d44d2013b3dd74150929cdf4b

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 313c34e..34fc0ae 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
 namespace com{namespace sun{namespace star{
     namespace sdbc{
         class XConnection;
@@ -144,8 +145,7 @@ struct SwDSParam : public SwDBData
                 bAfterSelection = sal_True;
         }
 };
-typedef SwDSParam* SwDSParamPtr;
-SV_DECL_PTRARR_DEL(SwDSParamArr, SwDSParamPtr, 0)
+typedef boost::ptr_vector<SwDSParam> SwDSParamArr;
 
 struct SwMergeDescriptor
 {
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 78f7e87..4d0aa72 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -1759,9 +1759,9 @@ void SwDoc::GetAllDBNames( std::vector<String>& rAllDBNames )
     SwNewDBMgr* pMgr = GetNewDBMgr();
 
     const SwDSParamArr& rArr = pMgr->GetDSParamArray();
-    for(sal_uInt16 i = 0; i < rArr.Count(); i++)
+    for(sal_uInt16 i = 0; i < rArr.size(); i++)
     {
-        SwDSParam* pParam = rArr[i];
+        const SwDSParam* pParam = &rArr[i];
         String* pStr = new String( pParam->sDataSource );
         (*pStr) += DB_DELIM;
         (*pStr) += (String)pParam->sCommand;
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 30d9fa6..eada5cc 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -152,7 +152,6 @@ using namespace ::com::sun::star::ui::dialogs;
 #define DB_SEP_RETURN   2
 #define DB_SEP_NEWLINE  3
 
-SV_IMPL_PTRARR(SwDSParamArr, SwDSParamPtr);
 const sal_Char cCursor[] = "Cursor";
 const sal_Char cCommand[] = "Command";
 const sal_Char cCommandType[] = "CommandType";
@@ -367,7 +366,7 @@ sal_Bool SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
         else
         {
             SwDSParam* pInsert = new SwDSParam(*pImpl->pMergeData);
-            aDataSourceParams.Insert(pInsert, aDataSourceParams.Count());
+            aDataSourceParams.push_back(pInsert);
             try
             {
                 uno::Reference<XComponent> xComponent(pInsert->xConnection, UNO_QUERY);
@@ -730,9 +729,9 @@ SwNewDBMgr::SwNewDBMgr() :
 
 SwNewDBMgr::~SwNewDBMgr()
 {
-    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos];
+        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(pParam->xConnection.is())
         {
             try
@@ -2070,9 +2069,9 @@ void    SwNewDBMgr::CloseAll(sal_Bool bIncludingMerge)
 {
     //the only thing done here is to reset the selection index
     //all connections stay open
-    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos];
+        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(bIncludingMerge || pParam != pImpl->pMergeData)
         {
             pParam->nSelectionIndex = 0;
@@ -2101,9 +2100,9 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate)
     }
 
     SwDSParam* pFound = 0;
-    for(sal_uInt16 nPos = aDataSourceParams.Count(); nPos; nPos--)
+    for(sal_uInt16 nPos = aDataSourceParams.size(); nPos; nPos--)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos - 1];
+        SwDSParam* pParam = &aDataSourceParams[nPos - 1];
         if(rData.sDataSource == pParam->sDataSource &&
             rData.sCommand == pParam->sCommand &&
             (rData.nCommandType == -1 || rData.nCommandType == pParam->nCommandType ||
@@ -2123,7 +2122,7 @@ SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, sal_Bool bCreate)
         if(!pFound)
         {
             pFound = new SwDSParam(rData);
-            aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
+            aDataSourceParams.push_back(pFound);
             try
             {
                 uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
@@ -2146,9 +2145,9 @@ SwDSParam*  SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B
          return pImpl->pMergeData;
     }
     SwDSParam* pFound = 0;
-    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+    for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
     {
-        SwDSParam* pParam = aDataSourceParams[nPos];
+        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(rDataSource == pParam->sDataSource)
         {
             pFound = pParam;
@@ -2160,7 +2159,7 @@ SwDSParam*  SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, sal_B
         SwDBData aData;
         aData.sDataSource = rDataSource;
         pFound = new SwDSParam(aData);
-        aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
+        aDataSourceParams.push_back(pFound);
         try
         {
             uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
@@ -2524,9 +2523,9 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
     }
     if(pFound)
     {
-        for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+        for(sal_uInt16 nPos = 0; nPos < aDataSourceParams.size(); nPos++)
         {
-            SwDSParam* pParam = aDataSourceParams[nPos];
+            SwDSParam* pParam = &aDataSourceParams[nPos];
             if(pParam == pFound)
             {
                 try
@@ -2968,13 +2967,13 @@ void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource )
 {
     ::SolarMutexGuard aGuard;
     uno::Reference<XConnection> xSource(rSource.Source, UNO_QUERY);
-    for(sal_uInt16 nPos = rDBMgr.aDataSourceParams.Count(); nPos; nPos--)
+    for(sal_uInt16 nPos = rDBMgr.aDataSourceParams.size(); nPos; nPos--)
     {
-        SwDSParam* pParam = rDBMgr.aDataSourceParams[nPos - 1];
+        SwDSParam* pParam = &rDBMgr.aDataSourceParams[nPos - 1];
         if(pParam->xConnection.is() &&
                 (xSource == pParam->xConnection))
         {
-            rDBMgr.aDataSourceParams.DeleteAndDestroy(nPos - 1);
+            rDBMgr.aDataSourceParams.erase(rDBMgr.aDataSourceParams.begin() + nPos - 1);
         }
     }
 }
commit da9bf1ee2f712748dd94080fe8fc7fd90348d08f
Author: Noel Grandin <noel at peralex.com>
Date:   Tue May 22 10:54:29 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwPageDescs) to std::vector
    
    Change-Id: I2301c1f237b1b08926c80942f459ba6062ed457d

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 2552022..a8c5c2e 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -240,8 +240,12 @@ namespace sfx2 {
 }
 
 // PageDescriptor-interface, Array because of inlines.
-typedef SwPageDesc* SwPageDescPtr;
-SV_DECL_PTRARR_DEL( SwPageDescs, SwPageDescPtr, 4 )
+class SwPageDescs : public std::vector<SwPageDesc*>
+{
+public:
+    // the destructor will free all objects still in the vector
+    ~SwPageDescs();
+};
 
 // forward declaration
 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
@@ -1332,7 +1336,7 @@ public:
             sal_Int32 nDocPageCount );
 
     // PageDescriptor interface.
-    sal_uInt16 GetPageDescCnt() const { return aPageDescs.Count(); }
+    sal_uInt16 GetPageDescCnt() const { return aPageDescs.size(); }
     const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *aPageDescs[i]; }
     SwPageDesc* FindPageDescByName( const String& rName,
                                     sal_uInt16* pPos = 0 ) const;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index f9b829f..b7414db 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -142,9 +142,6 @@
 using namespace ::com::sun::star;
 using ::rtl::OUString;
 
-// Page descriptors
-SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr);
-
 /* IInterface */
 sal_Int32 SwDoc::acquire()
 {
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 0ca72d7..4d26645 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -187,7 +187,7 @@ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
 
 void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
 {
-    OSL_ENSURE( i < aPageDescs.Count(), "PageDescs is out of range." );
+    OSL_ENSURE( i < aPageDescs.size(), "PageDescs is out of range." );
 
     SwPageDesc *pDesc = aPageDescs[i];
     SwRootFrm* pTmpRoot = GetCurrentLayout();
@@ -452,7 +452,7 @@ void SwDoc::PreDelPageDesc(SwPageDesc * pDel)
         }
     }
 
-    for ( sal_uInt16 j = 0; j < aPageDescs.Count(); ++j )
+    for ( sal_uInt16 j = 0; j < aPageDescs.size(); ++j )
     {
         if ( aPageDescs[j]->GetFollow() == pDel )
         {
@@ -486,7 +486,7 @@ void SwDoc::BroadcastStyleOperation(String rName, SfxStyleFamily eFamily,
 
 void SwDoc::DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast )
 {
-    OSL_ENSURE( i < aPageDescs.Count(), "PageDescs is out of range." );
+    OSL_ENSURE( i < aPageDescs.size(), "PageDescs is out of range." );
     OSL_ENSURE( i != 0, "You cannot delete the default Pagedesc.");
     if ( i == 0 )
         return;
@@ -505,7 +505,7 @@ void SwDoc::DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast )
 
     PreDelPageDesc(pDel); // #i7983#
 
-    aPageDescs.Remove( i );
+    aPageDescs.erase( aPageDescs.begin() + i );
     delete pDel;
     SetModified();
 }
@@ -546,7 +546,7 @@ sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
         pNew->GetMaster().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
         pNew->GetLeft().SetFmtAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
     }
-    aPageDescs.Insert( pNew, aPageDescs.Count() );
+    aPageDescs.push_back( pNew );
 
     if (bBroadcast)
         BroadcastStyleOperation(rName, SFX_STYLE_FAMILY_PAGE,
@@ -558,7 +558,7 @@ sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
     }
 
     SetModified();
-    return (aPageDescs.Count()-1);
+    return (aPageDescs.size()-1);
 }
 
 SwPageDesc* SwDoc::FindPageDescByName( const String& rName, sal_uInt16* pPos ) const
@@ -566,7 +566,7 @@ SwPageDesc* SwDoc::FindPageDescByName( const String& rName, sal_uInt16* pPos ) c
     SwPageDesc* pRet = 0;
     if( pPos ) *pPos = USHRT_MAX;
 
-    for( sal_uInt16 n = 0, nEnd = aPageDescs.Count(); n < nEnd; ++n )
+    for( sal_uInt16 n = 0, nEnd = aPageDescs.size(); n < nEnd; ++n )
         if( aPageDescs[ n ]->GetName() == rName )
         {
             pRet = aPageDescs[ n ];
@@ -781,7 +781,7 @@ sal_Bool SwDoc::FindPageDesc( const String & rName, sal_uInt16 * pFound)
 {
     sal_Bool bResult = sal_False;
     sal_uInt16 nI;
-    for (nI = 0; nI < aPageDescs.Count(); nI++)
+    for (nI = 0; nI < aPageDescs.size(); nI++)
     {
         if (aPageDescs[nI]->GetName() == rName)
         {
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index ab4e43b..751c3ad 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1888,7 +1888,7 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl )
 
 SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const String& rName )
 {
-    for( sal_uInt16 n = rArr.Count(); n; )
+    for( sal_uInt16 n = rArr.size(); n; )
     {
         SwPageDesc* pDesc = rArr[ --n ];
         if( pDesc->GetName() == rName )
@@ -2157,7 +2157,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
     if (bIncludePageStyles)
     {
         // and now the page templates
-        nCnt = rSource.aPageDescs.Count();
+        nCnt = rSource.aPageDescs.size();
         if( nCnt )
         {
             // a different Doc -> Number formatter needs to be merged
@@ -2172,7 +2172,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
             }
 
             // 2nd step: Copy all attributes, set the right parents
-            for( nCnt = rSource.aPageDescs.Count(); nCnt; )
+            for( nCnt = rSource.aPageDescs.size(); nCnt; )
             {
                 SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
                 CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ));
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 52e27b8..3ed8f0a 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -98,6 +98,7 @@
 #include <MarkManager.hxx>
 #include <UndoManager.hxx>
 #include <unochart.hxx>
+#include <fldbas.hxx>
 
 #include <cmdid.h>              // for the default printer in SetJob
 
@@ -385,7 +386,7 @@ SwDoc::SwDoc()
     pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
 
     // Create PageDesc, EmptyPageFmt and ColumnFmt
-    if ( !aPageDescs.Count() )
+    if ( aPageDescs.empty() )
         GetPageDescFromPool( RES_POOLPAGE_STANDARD );
 
     // Set to "Empty Page"
@@ -566,7 +567,9 @@ SwDoc::~SwDoc()
     // there are still Flys registered at that point, we have a problem.
     // (This comment might have been translated incorrectly. Blame the bad
     // German original)
-    aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
+    BOOST_FOREACH(SwPageDesc *pPageDesc, aPageDescs)
+        delete pPageDesc;
+    aPageDescs.clear();
 
     // Delete content selections.
     // Don't wait for the SwNodes dtor to destroy them; so that Formats
@@ -818,8 +821,10 @@ void SwDoc::ClearDoc()
     pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
 
     // remove the dummy pagedec from the array and delete all the old ones
-    aPageDescs.Remove( nDummyPgDsc );
-    aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
+    aPageDescs.erase( aPageDescs.begin() + nDummyPgDsc );
+    BOOST_FOREACH(SwPageDesc *pPageDesc, aPageDescs)
+        delete pPageDesc;
+    aPageDescs.clear();
 
     // Delete for Collections
     // So that we get rid of the dependencies
@@ -856,8 +861,8 @@ void SwDoc::ClearDoc()
 
     GetPageDescFromPool( RES_POOLPAGE_STANDARD );
     pFirstNd->ChgFmtColl( GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
-    nDummyPgDsc = aPageDescs.Count();
-    aPageDescs.Insert( pDummyPgDsc, nDummyPgDsc );
+    nDummyPgDsc = aPageDescs.size();
+    aPageDescs.push_back( pDummyPgDsc );
     // set the layout back to the new standard pagedesc
     pFirstNd->ResetAllAttr();
     // delete now the dummy pagedesc
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 6d7fb9c..467bb38 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1436,7 +1436,7 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
     SwPageDesc *pNewPgDsc;
     sal_uInt16 n;
 
-    for( n = 0; n < aPageDescs.Count(); ++n )
+    for( n = 0; n < aPageDescs.size(); ++n )
         if( nId == ( pNewPgDsc = aPageDescs[ n ] )->GetPoolFmtId() )
         {
             return pNewPgDsc;
@@ -2274,7 +2274,7 @@ bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const
             "Wrong AutoFormat Id" );
     SwPageDesc *pNewPgDsc = 0;
     sal_Bool bFnd = sal_False;
-    for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.Count(); ++n )
+    for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.size(); ++n )
     {
         pNewPgDsc = aPageDescs[ n ];
         if( nId == pNewPgDsc->GetPoolFmtId() )
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 04fd78c..ffe37a8 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -479,4 +479,10 @@ SwPageDescExt::operator SwPageDesc() const
     return aResult;
 }
 
+SwPageDescs::~SwPageDescs()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 74dc44a67c556462185f969f694ef2d3df1f893e
Author: Noel Grandin <noel at peralex.com>
Date:   Mon May 21 17:01:56 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwFldTypes) to std::vector
    
    Change-Id: Ia1f52f25680d3f970aa4f7f60a8e5203326a6796

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 9de2213..2a86422 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -50,8 +50,6 @@ namespace com { namespace sun { namespace star { namespace i18n {
 #include <swtypes.hxx>
 #include <svl/svarray.hxx>
 
-typedef SwFieldType* SwFldTypePtr;
-
 // PageDescriptor-interface
 // typedef SwPageDesc * SwPageDescPtr;
 // SV_DECL_PTRARR_DEL(SwPageDescs, SwPageDescPtr,1);
@@ -65,7 +63,12 @@ SV_DECL_PTRARR_DEL(SwSpzFrmFmts,SwFrmFmtPtr,0)
 typedef SwCharFmt* SwCharFmtPtr;
 SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4)
 
-SV_DECL_PTRARR_DEL( SwFldTypes, SwFldTypePtr, INIT_FLDTYPES )
+class SwFldTypes : public std::vector<SwFieldType*> {
+public:
+    // the destructor will free all objects still in the vector
+    ~SwFldTypes();
+    sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
+};
 
 class SwTOXTypes : public std::vector<SwTOXType*> {
 public:
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 12e8e5f..80a2ba5 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -664,7 +664,7 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
         {
             // es gibt noch versteckte InputFelder in den SetExp. Feldern
             const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
-            const sal_uInt16 nSize = rFldTypes.Count();
+            const sal_uInt16 nSize = rFldTypes.size();
 
             // Alle Typen abklappern
             for( sal_uInt16 i=0; i < nSize; ++i )
@@ -676,7 +676,7 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
     else
     {
         const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
-        const sal_uInt16 nSize = rFldTypes.Count();
+        const sal_uInt16 nSize = rFldTypes.size();
 
         // Alle Typen abklappern
         for( sal_uInt16 i=0; i < nSize; ++i )
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index de9efaf..f9b829f 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -144,8 +144,6 @@ using ::rtl::OUString;
 
 // Page descriptors
 SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr);
-// Field types
-SV_IMPL_PTRARR( SwFldTypes, SwFldTypePtr)
 
 /* IInterface */
 sal_Int32 SwDoc::acquire()
@@ -2380,11 +2378,11 @@ sal_Bool SwDoc::ConvertFieldsToText()
     GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE, NULL );
 
     const SwFldTypes* pMyFldTypes = GetFldTypes();
-    sal_uInt16 nCount = pMyFldTypes->Count();
+    sal_uInt16 nCount = pMyFldTypes->size();
     //go backward, field types are removed
     for(sal_uInt16 nType = nCount;  nType > 0;  --nType)
     {
-        const SwFieldType *pCurType = pMyFldTypes->GetObject(nType - 1);
+        const SwFieldType *pCurType = (*pMyFldTypes)[nType - 1];
 
         if ( RES_POSTITFLD == pCurType->Which() )
             continue;
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 9290e02..78f7e87 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -84,7 +84,7 @@ SV_IMPL_OP_PTRARR_SORT( _SetGetExpFlds, _SetGetExpFldPtr )
  */
 SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp)
 {
-    sal_uInt16 nSize = pFldTypes->Count(),
+    sal_uInt16 nSize = pFldTypes->size(),
             nFldWhich = rFldTyp.Which();
 
     sal_uInt16 i = INIT_FLDTYPES;
@@ -149,7 +149,7 @@ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp)
         break;
     }
 
-    pFldTypes->Insert( pNew, nSize );
+    pFldTypes->insert( pFldTypes->begin() + nSize, pNew );
     SetModified();
 
     return (*pFldTypes)[ nSize ];
@@ -162,7 +162,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp )
     // - If it's not present, it can be re-inserted.
     // - If the same type is found, the deleted one has to be renamed.
 
-    sal_uInt16 nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which();
+    sal_uInt16 nSize = pFldTypes->size(), nFldWhich = rFldTyp.Which();
     sal_uInt16 i = INIT_FLDTYPES;
 
     OSL_ENSURE( RES_SETEXPFLD == nFldWhich ||
@@ -198,7 +198,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp )
         }
 
     // not found, so insert and delete flag
-    pFldTypes->Insert( &rFldTyp, nSize );
+    pFldTypes->insert( pFldTypes->begin() + nSize, &rFldTyp );
     switch( nFldWhich )
     {
     case RES_SETEXPFLD:
@@ -222,7 +222,7 @@ void SwDoc::RemoveFldType(sal_uInt16 nFld)
     /*
      * Dependent fields present -> ErrRaise
      */
-    sal_uInt16 nSize = pFldTypes->Count();
+    sal_uInt16 nSize = pFldTypes->size();
     if(nFld < nSize)
     {
         SwFieldType* pTmp = (*pFldTypes)[nFld];
@@ -255,7 +255,7 @@ void SwDoc::RemoveFldType(sal_uInt16 nFld)
             // delete field type
             delete pTmp;
         }
-        pFldTypes->Remove( nFld );
+        pFldTypes->erase( pFldTypes->begin() + nFld );
         SetModified();
     }
 }
@@ -274,7 +274,7 @@ SwFieldType* SwDoc::GetFldType( sal_uInt16 nResId, const String& rName,
                                    // #i51815#
          ) const
 {
-    sal_uInt16 nSize = pFldTypes->Count(), i = 0;
+    sal_uInt16 nSize = pFldTypes->size(), i = 0;
     const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
 
     switch( nResId )
@@ -326,7 +326,7 @@ void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB )
     // Call Modify() for every field type,
     // dependent SwTxtFld get notified ...
 
-    for( sal_uInt16 i=0; i < pFldTypes->Count(); ++i)
+    for( sal_uInt16 i=0; i < pFldTypes->size(); ++i)
     {
         switch( (*pFldTypes)[i]->Which() )
         {
@@ -385,7 +385,7 @@ void SwDoc::UpdateUsrFlds()
 {
     SwCalc* pCalc = 0;
     const SwFieldType* pFldType;
-    for( sal_uInt16 i = INIT_FLDTYPES; i < pFldTypes->Count(); ++i )
+    for( sal_uInt16 i = INIT_FLDTYPES; i < pFldTypes->size(); ++i )
         if( RES_USERFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
         {
             if( !pCalc )
@@ -406,7 +406,7 @@ void SwDoc::UpdateUsrFlds()
 void SwDoc::UpdateRefFlds( SfxPoolItem* pHt )
 {
     SwFieldType* pFldType;
-    for( sal_uInt16 i = 0; i < pFldTypes->Count(); ++i )
+    for( sal_uInt16 i = 0; i < pFldTypes->size(); ++i )
         if( RES_GETREFFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
             pFldType->ModifyNotification( 0, pHt );
 }
@@ -415,7 +415,7 @@ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt )
 //optimization currently only available when no fields exist.
 bool SwDoc::containsUpdatableFields()
 {
-    for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i)
+    for (sal_uInt16 i = 0; i < pFldTypes->size(); ++i)
     {
         SwFieldType* pFldType = (*pFldTypes)[i];
         SwIterator<SwFmtFld,SwFieldType> aIter(*pFldType);
@@ -432,7 +432,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
 
     SwFieldType* pFldType(0);
 
-    for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i)
+    for (sal_uInt16 i = 0; i < pFldTypes->size(); ++i)
     {
         if( RES_TABLEFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
         {
@@ -702,7 +702,7 @@ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
 // ---- Remove all unreferenced field types of a document --
 void SwDoc::GCFieldTypes()
 {
-    for( sal_uInt16 n = pFldTypes->Count(); n > INIT_FLDTYPES; )
+    for( sal_uInt16 n = pFldTypes->size(); n > INIT_FLDTYPES; )
         if( !(*pFldTypes)[ --n ]->GetDepends() )
             RemoveFldType( n );
 }
@@ -1255,14 +1255,14 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds )
 
     // Hash table for all string replacements is filled on-the-fly.
     // Try to fabricate an uneven number.
-    sal_uInt16 nStrFmtCnt = (( pFldTypes->Count() / 7 ) + 1 ) * 7;
+    sal_uInt16 nStrFmtCnt = (( pFldTypes->size() / 7 ) + 1 ) * 7;
     SwHash** pHashStrTbl = new SwHash*[ nStrFmtCnt ];
     memset( pHashStrTbl, 0, sizeof( _HashStr* ) * nStrFmtCnt );
 
     {
         const SwFieldType* pFldType;
         // process seperately:
-        for( n = pFldTypes->Count(); n; )
+        for( n = pFldTypes->size(); n; )
             switch( ( pFldType = (*pFldTypes)[ --n ] )->Which() )
             {
             case RES_USERFLD:
@@ -1561,50 +1561,49 @@ void SwDoc::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc )
 void SwDoc::_InitFieldTypes()       // is being called by the CTOR
 {
     // Field types
-    sal_uInt16 nFldType = 0;
-    pFldTypes->Insert( new SwDateTimeFieldType(this), nFldType++ );
-    pFldTypes->Insert( new SwChapterFieldType, nFldType++ );
-    pFldTypes->Insert( new SwPageNumberFieldType, nFldType++ );
-    pFldTypes->Insert( new SwAuthorFieldType, nFldType++ );
-    pFldTypes->Insert( new SwFileNameFieldType(this), nFldType++ );
-    pFldTypes->Insert( new SwDBNameFieldType(this), nFldType++);
-    pFldTypes->Insert( new SwGetExpFieldType(this), nFldType++ );
-    pFldTypes->Insert( new SwGetRefFieldType( this ), nFldType++ );
-    pFldTypes->Insert( new SwHiddenTxtFieldType, nFldType++ );
-    pFldTypes->Insert( new SwPostItFieldType(this), nFldType++ );
-    pFldTypes->Insert( new SwDocStatFieldType(this), nFldType++);
-    pFldTypes->Insert( new SwDocInfoFieldType(this), nFldType++);
-    pFldTypes->Insert( new SwInputFieldType( this ), nFldType++ );
-    pFldTypes->Insert( new SwTblFieldType( this ), nFldType++);
-    pFldTypes->Insert( new SwMacroFieldType(this), nFldType++ );
-    pFldTypes->Insert( new SwHiddenParaFieldType, nFldType++ );
-    pFldTypes->Insert( new SwDBNextSetFieldType, nFldType++ );
-    pFldTypes->Insert( new SwDBNumSetFieldType, nFldType++ );
-    pFldTypes->Insert( new SwDBSetNumberFieldType, nFldType++ );
-    pFldTypes->Insert( new SwTemplNameFieldType(this), nFldType++);
-    pFldTypes->Insert( new SwTemplNameFieldType(this),nFldType++);
-    pFldTypes->Insert( new SwExtUserFieldType, nFldType++ );
-    pFldTypes->Insert( new SwRefPageSetFieldType, nFldType++ );
-    pFldTypes->Insert( new SwRefPageGetFieldType( this ), nFldType++ );
-    pFldTypes->Insert( new SwJumpEditFieldType( this ), nFldType++ );
-    pFldTypes->Insert( new SwScriptFieldType( this ), nFldType++ );
-    pFldTypes->Insert( new SwCombinedCharFieldType, nFldType++ );
-    pFldTypes->Insert( new SwDropDownFieldType, nFldType++ );
+    pFldTypes->push_back( new SwDateTimeFieldType(this) );
+    pFldTypes->push_back( new SwChapterFieldType );
+    pFldTypes->push_back( new SwPageNumberFieldType );
+    pFldTypes->push_back( new SwAuthorFieldType );
+    pFldTypes->push_back( new SwFileNameFieldType(this) );
+    pFldTypes->push_back( new SwDBNameFieldType(this) );
+    pFldTypes->push_back( new SwGetExpFieldType(this) );
+    pFldTypes->push_back( new SwGetRefFieldType( this ) );
+    pFldTypes->push_back( new SwHiddenTxtFieldType );
+    pFldTypes->push_back( new SwPostItFieldType(this) );
+    pFldTypes->push_back( new SwDocStatFieldType(this) );
+    pFldTypes->push_back( new SwDocInfoFieldType(this) );
+    pFldTypes->push_back( new SwInputFieldType( this ) );
+    pFldTypes->push_back( new SwTblFieldType( this ) );
+    pFldTypes->push_back( new SwMacroFieldType(this) );
+    pFldTypes->push_back( new SwHiddenParaFieldType );
+    pFldTypes->push_back( new SwDBNextSetFieldType );
+    pFldTypes->push_back( new SwDBNumSetFieldType );
+    pFldTypes->push_back( new SwDBSetNumberFieldType );
+    pFldTypes->push_back( new SwTemplNameFieldType(this) );
+    pFldTypes->push_back( new SwTemplNameFieldType(this) );
+    pFldTypes->push_back( new SwExtUserFieldType );
+    pFldTypes->push_back( new SwRefPageSetFieldType );
+    pFldTypes->push_back( new SwRefPageGetFieldType( this ) );
+    pFldTypes->push_back( new SwJumpEditFieldType( this ) );
+    pFldTypes->push_back( new SwScriptFieldType( this ) );
+    pFldTypes->push_back( new SwCombinedCharFieldType );
+    pFldTypes->push_back( new SwDropDownFieldType );
 
     // Types have to be at the end!
     // We expect this in the InsertFldType!
     // MIB 14.04.95: In Sw3StringPool::Setup (sw3imp.cxx) and
     //               lcl_sw3io_InSetExpField (sw3field.cxx) now also
-    pFldTypes->Insert( new SwSetExpFieldType(this,
-                SW_RESSTR(STR_POOLCOLL_LABEL_ABB), nsSwGetSetExpType::GSE_SEQ), nFldType++);
-    pFldTypes->Insert( new SwSetExpFieldType(this,
-                SW_RESSTR(STR_POOLCOLL_LABEL_TABLE), nsSwGetSetExpType::GSE_SEQ),nFldType++);
-    pFldTypes->Insert( new SwSetExpFieldType(this,
-                SW_RESSTR(STR_POOLCOLL_LABEL_FRAME), nsSwGetSetExpType::GSE_SEQ),nFldType++);
-    pFldTypes->Insert( new SwSetExpFieldType(this,
-                SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), nsSwGetSetExpType::GSE_SEQ),nFldType++);
+    pFldTypes->push_back( new SwSetExpFieldType(this,
+                SW_RESSTR(STR_POOLCOLL_LABEL_ABB), nsSwGetSetExpType::GSE_SEQ) );
+    pFldTypes->push_back( new SwSetExpFieldType(this,
+                SW_RESSTR(STR_POOLCOLL_LABEL_TABLE), nsSwGetSetExpType::GSE_SEQ) );
+    pFldTypes->push_back( new SwSetExpFieldType(this,
+                SW_RESSTR(STR_POOLCOLL_LABEL_FRAME), nsSwGetSetExpType::GSE_SEQ) );
+    pFldTypes->push_back( new SwSetExpFieldType(this,
+                SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), nsSwGetSetExpType::GSE_SEQ) );
 
-    OSL_ENSURE( nFldType == INIT_FLDTYPES, "Bad initsize: SwFldTypes" );
+    OSL_ENSURE( pFldTypes->size() == INIT_FLDTYPES, "Bad initsize: SwFldTypes" );
 }
 
 void SwDoc::InsDelFldInFldLst( bool bIns, const SwTxtFld& rFld )
@@ -1622,7 +1621,7 @@ const SwDBData& SwDoc::GetDBDesc()
 {
     if(aDBData.sDataSource.isEmpty())
     {
-        const sal_uInt16 nSize = pFldTypes->Count();
+        const sal_uInt16 nSize = pFldTypes->size();
         for(sal_uInt16 i = 0; i < nSize && aDBData.sDataSource.isEmpty(); ++i)
         {
             SwFieldType& rFldType = *((*pFldTypes)[i]);
@@ -2143,7 +2142,7 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen )
 
 void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData )
 {
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
 
     for( sal_uInt16 i = INIT_FLDTYPES; i < nSize; ++i )
     {
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index dab617b..1b04015 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1167,7 +1167,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
     sal_Bool bTable = sal_False;    // To save some code.
 
     // Get the field first, beause we retrieve the TxtColl via the field's name
-    OSL_ENSURE( nId == USHRT_MAX  || nId < rDoc.GetFldTypes()->Count(),
+    OSL_ENSURE( nId == USHRT_MAX  || nId < rDoc.GetFldTypes()->size(),
             "FldType index out of bounds." );
     SwFieldType *pType = (nId != USHRT_MAX) ? (*rDoc.GetFldTypes())[nId] : NULL;
     OSL_ENSURE(!pType || pType->Which() == RES_SETEXPFLD, "wrong Id for Label");
@@ -1523,7 +1523,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
     ::sw::DrawUndoGuard const drawUndoGuard(rDoc.GetIDocumentUndoRedo());
 
     // Because we get by the TxtColl's name, we need to create the field first.
-    OSL_ENSURE( nId == USHRT_MAX  || nId < rDoc.GetFldTypes()->Count(),
+    OSL_ENSURE( nId == USHRT_MAX  || nId < rDoc.GetFldTypes()->size(),
             "FldType index out of bounds" );
     SwFieldType *pType = nId != USHRT_MAX ? (*rDoc.GetFldTypes())[nId] : 0;
     OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" );
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 4145b39..52e27b8 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -847,8 +847,10 @@ void SwDoc::ClearDoc()
 
     xForbiddenCharsTable.clear();
 
-    pFldTypes->DeleteAndDestroy( INIT_FLDTYPES,
-                                pFldTypes->Count() - INIT_FLDTYPES );
+    for(SwFldTypes::const_iterator it = pFldTypes->begin() + INIT_FLDTYPES;
+        it != pFldTypes->end(); ++it)
+        delete *it;
+    pFldTypes->erase( pFldTypes->begin() + INIT_FLDTYPES, pFldTypes->end() );
 
     delete pNumberFormatter, pNumberFormatter = 0;
 
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 49967fb..5ed417e 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -55,7 +55,7 @@
 sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) const
 {
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
 
     if(nResId == USHRT_MAX)
     {
@@ -91,7 +91,7 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) cons
 SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Bool bUsed ) const
 {
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
 
     if(nResId == USHRT_MAX && nFld < nSize)
     {
@@ -150,7 +150,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
     }
 
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
     sal_uInt16 nIdx = 0;
     for( sal_uInt16 i = 0; i < nSize; ++i )
         // Gleiche ResId -> Index erhoehen
@@ -168,7 +168,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId)
 void SwEditShell::RemoveFldType(sal_uInt16 nResId, const String& rStr)
 {
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
     const CharClass& rCC = GetAppCharClass();
 
     String aTmp( rCC.lowercase( rStr ));
@@ -509,7 +509,7 @@ void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData)
 sal_Bool SwEditShell::IsAnyDatabaseFieldInDoc()const
 {
     const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
     for(sal_uInt16 i = 0; i < nSize; ++i)
     {
         SwFieldType& rFldType = *((*pFldTypes)[i]);
diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx
index 9b4578c..3577776 100644
--- a/sw/source/core/edit/edfldexp.cxx
+++ b/sw/source/core/edit/edfldexp.cxx
@@ -47,7 +47,7 @@ using ::rtl::OUString;
 sal_Bool SwEditShell::IsFieldDataSourceAvailable(String& rUsedDataSource) const
 {
     const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = pFldTypes->Count();
+    const sal_uInt16 nSize = pFldTypes->size();
     uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
     if( !xMgr.is() )
         return sal_False;
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index e85fca1..3ca892e 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -49,6 +49,7 @@
 #include <shellres.hxx>
 #include <calc.hxx>
 #include <comcore.hrc>
+#include <docary.hxx>
 
 #include <math.h>
 
@@ -763,4 +764,16 @@ String SwField::GetDescription() const
     return SW_RES(STR_FIELD);
 }
 
+sal_uInt16 SwFldTypes::GetPos(const SwFieldType* pFieldType) const
+{
+    const_iterator it = std::find(begin(), end(), pFieldType);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+SwFldTypes::~SwFldTypes()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index cb0b774..cf90dc5 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -51,7 +51,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, sal_Bool bBuildTmpLst )
     pSrtLst = new _SetGetExpFlds();
 
     const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes();
-    const sal_uInt16 nSize = rFldTypes.Count();
+    const sal_uInt16 nSize = rFldTypes.size();
 
     // Alle Typen abklappern
 
@@ -147,7 +147,7 @@ void SwInputFieldList::GotoFieldPos(sal_uInt16 nId)
 sal_uInt16 SwInputFieldList::BuildSortLst()
 {
     const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes();
-    sal_uInt16 nSize = rFldTypes.Count();
+    sal_uInt16 nSize = rFldTypes.size();
 
     // Alle Typen abklappern
 
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 168eb28..07df5b1 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -911,7 +911,7 @@ void SwXFieldMaster::dispose(void)          throw( uno::RuntimeException )
     {
         sal_uInt16 nTypeIdx = USHRT_MAX;
         const SwFldTypes* pTypes = GetDoc()->GetFldTypes();
-        for( sal_uInt16 i = 0; i < pTypes->Count(); i++ )
+        for( sal_uInt16 i = 0; i < pTypes->size(); i++ )
         {
             if((*pTypes)[i] == pFldType)
                 nTypeIdx = i;
@@ -2534,7 +2534,7 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
         throw uno::RuntimeException();
 
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
-    sal_uInt16 nCount = pFldTypes->Count();
+    sal_uInt16 nCount = pFldTypes->size();
 
     std::vector<String*> aFldNames;
     String* pString = new String();
@@ -2714,10 +2714,10 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc* pDc) :
     sal_Int32 nFillPos = 0;
     //
     const SwFldTypes* pFldTypes = pDoc->GetFldTypes();
-    sal_uInt16 nCount = pFldTypes->Count();
+    sal_uInt16 nCount = pFldTypes->size();
     for(sal_uInt16 nType = 0;  nType < nCount;  ++nType)
     {
-        const SwFieldType *pCurType = pFldTypes->GetObject(nType);
+        const SwFieldType *pCurType = (*pFldTypes)[nType];
         SwIterator<SwFmtFld,SwFieldType> aIter( *pCurType );
         const SwFmtFld* pCurFldFmt = aIter.First();
         while (pCurFldFmt)
commit 426389981c6eb4231c8889c65e848b615b290b3a
Author: Noel Grandin <noel at peralex.com>
Date:   Mon May 21 15:49:21 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwTOXTypes) to std::vector
    
    Change-Id: Ibf67e586082132f370659a4c79415d5928758d3a

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index ecc6f39..9de2213 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -67,8 +67,12 @@ SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4)
 
 SV_DECL_PTRARR_DEL( SwFldTypes, SwFldTypePtr, INIT_FLDTYPES )
 
-typedef SwTOXType* SwTOXTypePtr;
-SV_DECL_PTRARR_DEL( SwTOXTypes, SwTOXTypePtr, 0 )
+class SwTOXTypes : public std::vector<SwTOXType*> {
+public:
+    // the destructor will free all objects still in the vector
+    ~SwTOXTypes();
+    sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
+};
 
 // Array of Undo-history.
 typedef SwSectionFmt* SwSectionFmtPtr;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 9359420..de9efaf 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -144,8 +144,6 @@ using ::rtl::OUString;
 
 // Page descriptors
 SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr);
-// Table Of ...
-SV_IMPL_PTRARR( SwTOXTypes, SwTOXTypePtr )
 // Field types
 SV_IMPL_PTRARR( SwFldTypes, SwFldTypePtr)
 
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index ed77b8c..4145b39 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -545,12 +545,12 @@ SwDoc::~SwDoc()
     // Old - deletion without a Flag is expensive, because we send a Modify
     // aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() );
     {
-        for( sal_uInt16 n = pTOXTypes->Count(); n; )
+        for( sal_uInt16 n = pTOXTypes->size(); n; )
         {
             (*pTOXTypes)[ --n ]->SetInDocDTOR();
             delete (*pTOXTypes)[ n ];
         }
-        pTOXTypes->Remove( 0, pTOXTypes->Count() );
+        pTOXTypes->clear();
     }
     delete pDefTOXBases;
 
@@ -1038,19 +1038,19 @@ void SwDoc::InitTOXTypes()
 {
    ShellResource* pShellRes = ViewShell::GetShellRes();
    SwTOXType * pNew = new SwTOXType(TOX_CONTENT,   pShellRes->aTOXContentName        );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
    pNew = new SwTOXType(TOX_INDEX,                 pShellRes->aTOXIndexName  );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
    pNew = new SwTOXType(TOX_USER,                  pShellRes->aTOXUserName  );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
    pNew = new SwTOXType(TOX_ILLUSTRATIONS,         pShellRes->aTOXIllustrationsName );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
    pNew = new SwTOXType(TOX_OBJECTS,               pShellRes->aTOXObjectsName       );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
    pNew = new SwTOXType(TOX_TABLES,                pShellRes->aTOXTablesName        );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
    pNew = new SwTOXType(TOX_AUTHORITIES,           pShellRes->aTOXAuthoritiesName   );
-   pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+   pTOXTypes->push_back( pNew );
 }
 
 void SwDoc::ReplaceDefaults(const SwDoc& rSource)
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 426ecf8..11488d7 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -604,28 +604,26 @@ sal_Bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes )
  --------------------------------------------------------------------*/
 sal_uInt16 SwDoc::GetTOXTypeCount(TOXTypes eTyp) const
 {
-    const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData();
     sal_uInt16 nCnt = 0;
-    for( sal_uInt16 n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes )
-        if( eTyp == (*ppTTypes)->GetType() )
+    for( sal_uInt16 n = 0; n < pTOXTypes->size(); ++n )
+        if( eTyp == (*pTOXTypes)[n]->GetType() )
             ++nCnt;
     return nCnt;
 }
 
 const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, sal_uInt16 nId ) const
 {
-    const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData();
     sal_uInt16 nCnt = 0;
-    for( sal_uInt16 n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes )
-        if( eTyp == (*ppTTypes)->GetType() && nCnt++ == nId )
-            return (*ppTTypes);
+    for( sal_uInt16 n = 0; n < pTOXTypes->size(); ++n )
+        if( eTyp == (*pTOXTypes)[n]->GetType() && nCnt++ == nId )
+            return (*pTOXTypes)[n];
     return 0;
 }
 
 const SwTOXType* SwDoc::InsertTOXType( const SwTOXType& rTyp )
 {
     SwTOXType * pNew = new SwTOXType( rTyp );
-    pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+    pTOXTypes->push_back( pNew );
     return pNew;
 }
 
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index fb47416..06a3ef8 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -551,7 +551,7 @@ SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
         // type not in pDoc, so create it now
         const SwTOXTypes& rTypes = pDoc->GetTOXTypes();
         sal_Bool bFound = sal_False;
-        for( sal_uInt16 n = rTypes.Count(); n; )
+        for( sal_uInt16 n = rTypes.size(); n; )
         {
             const SwTOXType* pCmp = rTypes[ --n ];
             if( pCmp->GetType() == pType->GetType() &&
@@ -931,4 +931,15 @@ const SwFormTokens& SwForm::GetPattern(sal_uInt16 nLevel) const
     return aPattern[nLevel];
 }
 
+sal_uInt16 SwTOXTypes::GetPos(const SwTOXType* pTOXType) const
+{
+    const_iterator it = std::find(begin(), end(), pTOXType);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+SwTOXTypes::~SwTOXTypes()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f9adf2b5b395dd443d1edfea1b23cb75f2152358
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 24 23:03:10 2012 +0200

    fix DBGUTIL code for previous commit

diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 604607c..b14e07d 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -924,7 +924,7 @@ String lcl_dbg_out(const SwNumRuleTbl & rTbl)
 {
     String aResult("[", RTL_TEXTENCODING_ASCII_US);
 
-    for (sal_uInt16 n = 0; n < rTbl.Count(); n++)
+    for (size_t n = 0; n < rTbl.size(); n++)
     {
         if (n > 0)
             aResult += String(", ", RTL_TEXTENCODING_ASCII_US);
commit b620a39936ad2c1fd4067c9e82635c54ce73600b
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 16 15:23:09 2012 +0200

    Convert SV_DECL_PTRARR_DEL(SwNumRuleTbl) to std::vector
    
    Could not use boost::ptr_vector here because the code manually
    moves objects around.
    
    Change-Id: I708270a967ee6663ab1f1ba8d7998c63fa698b8f

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index ef267c7..ecc6f39 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -30,6 +30,7 @@
 
 #include <com/sun/star/i18n/ForbiddenCharacters.hpp>
 #include <vector>
+#include <algorithm>
 
 class SwFieldType;
 class SwFrmFmt;
@@ -73,9 +74,12 @@ SV_DECL_PTRARR_DEL( SwTOXTypes, SwTOXTypePtr, 0 )
 typedef SwSectionFmt* SwSectionFmtPtr;
 SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0)
 
-
-typedef SwNumRule* SwNumRulePtr;
-SV_DECL_PTRARR_DEL_VISIBILITY( SwNumRuleTbl, SwNumRulePtr, 0, SW_DLLPUBLIC )
+class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
+public:
+    // the destructor will free all objects still in the vector
+    ~SwNumRuleTbl();
+    sal_uInt16 GetPos(const SwNumRule* pRule) const;
+};
 
 typedef SwRedline* SwRedlinePtr;
 SV_DECL_PTRARR_SORT_DEL( _SwRedlineTbl, SwRedlinePtr, 0 )
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 1d4121c..9359420 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -254,7 +254,7 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value)
                 mbOldNumbering = value;
 
                 const SwNumRuleTbl& rNmTbl = GetNumRuleTbl();
-                for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n )
+                for( sal_uInt16 n = 0; n < rNmTbl.size(); ++n )
                     rNmTbl[n]->SetInvalidRule(sal_True);
 
                 UpdateNumRule();
@@ -2713,4 +2713,16 @@ void SwDoc::setExternalData(::sw::tExternalDataType eType,
     return m_externalData[eType];
 }
 
+sal_uInt16 SwNumRuleTbl::GetPos(const SwNumRule* pRule) const
+{
+    const_iterator it = std::find(begin(), end(), pRule);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+SwNumRuleTbl::~SwNumRuleTbl()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 01176c9..ab4e43b 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -2181,7 +2181,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
     }
 
     // then there are the numbering templates
-    nCnt = rSource.GetNumRuleTbl().Count();
+    nCnt = rSource.GetNumRuleTbl().size();
     if( nCnt )
     {
         const SwNumRuleTbl& rArr = rSource.GetNumRuleTbl();
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index d3e1ad5..ed77b8c 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -115,6 +115,7 @@
 
 #include <sfx2/Metadatable.hxx>
 #include <fmtmeta.hxx> // MetaFieldManager
+#include <boost/foreach.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::document;
@@ -126,7 +127,6 @@ const sal_Char sCharFmtStr[] = "Zeichenformat";
 const sal_Char sTxtCollStr[] = "Textformatvorlage";
 const sal_Char sGrfCollStr[] = "Graphikformatvorlage";
 
-SV_IMPL_PTRARR( SwNumRuleTbl, SwNumRulePtr)
 SV_IMPL_PTRARR( SwTxtFmtColls, SwTxtFmtCollPtr)
 SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr)
 
@@ -805,7 +805,9 @@ void SwDoc::ClearDoc()
     // destruction of numbering rules and creation of new outline rule
     // *after* the document nodes are deleted.
     pOutlineRule = NULL;
-    pNumRuleTbl->DeleteAndDestroy( 0, pNumRuleTbl->Count() );
+    BOOST_FOREACH( SwNumRule* pNumRule, *pNumRuleTbl )
+        delete pNumRule;
+    pNumRuleTbl->clear();
     // creation of new outline numbering rule
     pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ),
                                   // #i89178#
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 50aecc0..8d5c6d7 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1062,7 +1062,8 @@ sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast )
         // #i34097# DeleteAndDestroy deletes rName if
         // rName is directly taken from the numrule.
         const String aTmpName( rName );
-        pNumRuleTbl->DeleteAndDestroy( nPos );
+        delete (*pNumRuleTbl)[ nPos ];
+        pNumRuleTbl->erase( pNumRuleTbl->begin() + nPos );
         maNumRuleMap.erase(aTmpName);
 
         SetModified();
@@ -1132,7 +1133,7 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName,
 
 void SwDoc::StopNumRuleAnimations( OutputDevice* pOut )
 {
-    for( sal_uInt16 n = GetNumRuleTbl().Count(); n; )
+    for( sal_uInt16 n = GetNumRuleTbl().size(); n; )
     {
         SwNumRule::tTxtNodeList aTxtNodeList;
         GetNumRuleTbl()[ --n ]->GetTxtNodeList( aTxtNodeList );
@@ -1381,7 +1382,7 @@ void SwDoc::DelNumRules( const SwPaM& rPam )
 
 void SwDoc::InvalidateNumRules()
 {
-    for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n)
+    for (sal_uInt16 n = 0; n < pNumRuleTbl->size(); ++n)
         (*pNumRuleTbl)[n]->SetInvalidRule(sal_True);
 }
 
@@ -2132,7 +2133,7 @@ SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const
 
 sal_uInt16 SwDoc::FindNumRule( const String& rName ) const
 {
-    for( sal_uInt16 n = pNumRuleTbl->Count(); n; )
+    for( sal_uInt16 n = pNumRuleTbl->size(); n; )
         if( (*pNumRuleTbl)[ --n ]->GetName() == rName )
             return n;
 
@@ -2147,7 +2148,7 @@ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const
 
     if ( !pResult )
     {
-        for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n)
+        for (sal_uInt16 n = 0; n < pNumRuleTbl->size(); ++n)
         {
             if ((*pNumRuleTbl)[n]->GetName() == rName)
             {
@@ -2163,7 +2164,7 @@ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const
 
 void SwDoc::AddNumRule(SwNumRule * pRule)
 {
-    pNumRuleTbl->Insert(pRule, pNumRuleTbl->Count());
+    pNumRuleTbl->push_back(pRule);
     maNumRuleMap[pRule->GetName()] = pRule;
     pRule->SetNumRuleMap(&maNumRuleMap);
 
@@ -2197,7 +2198,7 @@ sal_uInt16 SwDoc::MakeNumRule( const String &rName,
                               eDefaultNumberFormatPositionAndSpaceMode );
     }
 
-    sal_uInt16 nRet = pNumRuleTbl->Count();
+    sal_uInt16 nRet = pNumRuleTbl->size();
 
     AddNumRule(pNew);
 
@@ -2233,7 +2234,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c
         aName = SW_RESSTR( STR_NUMRULE_DEFNAME );
     }
 
-    sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2;
+    sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->size() / 8 ) +2;
     sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
     memset( pSetFlags, 0, nFlagSize );
 
@@ -2254,7 +2255,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c
     const SwNumRule* pNumRule;
     sal_uInt16 n;
 
-    for( n = 0; n < pNumRuleTbl->Count(); ++n )
+    for( n = 0; n < pNumRuleTbl->size(); ++n )
         if( 0 != ( pNumRule = (*pNumRuleTbl)[ n ] ) )
         {
             const String& rNm = pNumRule->GetName();
@@ -2262,7 +2263,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c
             {
                 // Determine Number and set the Flag
                 nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32();
-                if( nNum-- && nNum < pNumRuleTbl->Count() )
+                if( nNum-- && nNum < pNumRuleTbl->size() )
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
             if( pChkStr && pChkStr->Equals( rNm ) )
@@ -2272,7 +2273,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c
     if( !pChkStr )
     {
         // All Numbers have been flagged accordingly, so identify the right Number
-        nNum = pNumRuleTbl->Count();
+        nNum = pNumRuleTbl->size();
         for( n = 0; n < nFlagSize; ++n )
             if( 0xff != ( nTmp = pSetFlags[ n ] ))
             {
@@ -2293,7 +2294,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c
 void SwDoc::UpdateNumRule()
 {
     const SwNumRuleTbl& rNmTbl = GetNumRuleTbl();
-    for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n )
+    for( sal_uInt16 n = 0; n < rNmTbl.size(); ++n )
         if( rNmTbl[ n ]->IsInvalidRule() )
             rNmTbl[ n ]->Validate();
 }
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index cc0f58a..41fc670 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -357,7 +357,7 @@ void SwNumFmt::UpdateNumNodes( SwDoc* pDoc )
     sal_Bool bDocIsModified = pDoc->IsModified();
     sal_Bool bFnd = sal_False;
     const SwNumRule* pRule;
-    for( sal_uInt16 n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; )
+    for( sal_uInt16 n = pDoc->GetNumRuleTbl().size(); !bFnd && n; )
     {
         pRule = pDoc->GetNumRuleTbl()[ --n ];
         for( sal_uInt8 i = 0; i < MAXLEVEL; ++i )
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 44786d8..6d7fb9c 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1616,7 +1616,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId )
     SwNumRule* pNewRule;
     sal_uInt16 n;
 
-    for( n = 0; n < GetNumRuleTbl().Count(); ++n )
+    for( n = 0; n < GetNumRuleTbl().size(); ++n )
         if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
         {
             return pNewRule;
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index cd341ae..47fa26e 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1740,7 +1740,7 @@ sal_Int32 SwXNumberingRulesCollection::getCount(void) throw( uno::RuntimeExcepti
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    return GetDoc()->GetNumRuleTbl().Count();
+    return GetDoc()->GetNumRuleTbl().size();
 }
 
 uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
@@ -1751,7 +1751,7 @@ uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
     if(IsValid())
     {
         uno::Reference< XIndexReplace >  xRef;
-        if ( nIndex < GetDoc()->GetNumRuleTbl().Count() )
+        if ( nIndex < (sal_Int32)GetDoc()->GetNumRuleTbl().size() )
         {
             xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< sal_uInt16 >(nIndex) ], GetDoc());
             aRet.setValue(&xRef, ::getCppuType((uno::Reference<XIndexReplace>*)0));
@@ -1775,7 +1775,7 @@ sal_Bool SwXNumberingRulesCollection::hasElements(void) throw( uno::RuntimeExcep
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    return GetDoc()->GetNumRuleTbl().Count() > 0;
+    return !GetDoc()->GetNumRuleTbl().empty();
 }
 
 OUString SwXFootnotes::getImplementationName(void) throw( RuntimeException )
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 7a901c5..9c645f3 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -585,7 +585,7 @@ sal_Int32 lcl_GetCountOrName ( const SwDoc &rDoc, SfxStyleFamily eFamily, String
             sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
             nIndex = nIndex - nBaseCount;
             const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
-            for(sal_uInt16 i = 0; i < rNumTbl.Count(); ++i)
+            for(sal_uInt16 i = 0; i < rNumTbl.size(); ++i)
             {
                 const SwNumRule& rRule = *rNumTbl[ i ];
                 if( rRule.IsAutoRule() )
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 35e7d2f..052f359 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -322,16 +322,18 @@ void StgReader::SetFltName( const String& rFltNm )
 SwRelNumRuleSpaces::SwRelNumRuleSpaces( SwDoc& rDoc, sal_Bool bNDoc )
         : bNewDoc( bNDoc )
 {
-        pNumRuleTbl = new SwNumRuleTbl( 8 );
+        pNumRuleTbl = new SwNumRuleTbl();
+        pNumRuleTbl->reserve(8);
         if( !bNDoc )
-                pNumRuleTbl->Insert( &rDoc.GetNumRuleTbl(), 0 );
+                pNumRuleTbl->insert( pNumRuleTbl->begin(),
+                    rDoc.GetNumRuleTbl().begin(), rDoc.GetNumRuleTbl().end() );
 }
 
 SwRelNumRuleSpaces::~SwRelNumRuleSpaces()
 {
         if( pNumRuleTbl )
         {
-                pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() );
+                pNumRuleTbl->clear();
                 delete pNumRuleTbl;
         }
 }
@@ -345,17 +347,17 @@ void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc )
                 // jetzt alle schon vorhanden NumRules aus dem Array entfernen,
                 // damit nur die neuen angepasst werden
                 SwNumRuleTbl aNumRuleTbl;
-                aNumRuleTbl.Insert( pNumRuleTbl, 0 );
-                pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() );
+                aNumRuleTbl.insert( aNumRuleTbl.begin(), pNumRuleTbl->begin(), pNumRuleTbl->end() );
+                pNumRuleTbl->clear();
                 const SwNumRuleTbl& rRuleTbl = rDoc.GetNumRuleTbl();
                 SwNumRule* pRule;
 
-                for( sal_uInt16 n = 0; n < rRuleTbl.Count(); ++n )
-                        if( USHRT_MAX == aNumRuleTbl.GetPos( ( pRule = rRuleTbl[ n ] )))
+                for( sal_uInt16 n = 0; n < rRuleTbl.size(); ++n )
+                        if( USHRT_MAX == aNumRuleTbl.GetPos( pRule = rRuleTbl[ n ] ))
                                 // war noch nicht vorhanden, also neu
-                                pNumRuleTbl->Insert( pRule, pNumRuleTbl->Count() );
+                                pNumRuleTbl->push_back( pRule );
 
-                aNumRuleTbl.Remove( 0, aNumRuleTbl.Count() );
+                aNumRuleTbl.clear();
 
         pRuleTbl = pNumRuleTbl;
         }
@@ -366,7 +368,7 @@ void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc )
 
         if( pRuleTbl )
         {
-                for( sal_uInt16 n = pRuleTbl->Count(); n; )
+                for( sal_uInt16 n = pRuleTbl->size(); n; )
                 {
                         SwNumRule* pRule = (*pRuleTbl)[ --n ];
                         // Rule noch gueltig und am Doc vorhanden?
@@ -386,7 +388,7 @@ void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc )
 
         if( pNumRuleTbl )
         {
-                pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() );
+                pNumRuleTbl->clear();
                 delete pNumRuleTbl, pNumRuleTbl = 0;
         }
 
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 5942209..9702d17 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -372,7 +372,7 @@ void Writer::PutNumFmtFontsInAttrPool()
     const Font* pDefFont = &numfunc::GetDefBulletFont();
     sal_Bool bCheck = sal_False;
 
-    for( sal_uInt16 nGet = rListTbl.Count(); nGet; )
+    for( sal_uInt16 nGet = rListTbl.size(); nGet; )
         if( pDoc->IsUsed( *(pRule = rListTbl[ --nGet ] )))
             for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
                 if( SVX_NUM_CHAR_SPECIAL == (pFmt = &pRule->Get( nLvl ))->GetNumberingType() ||
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 95f8350..efcea5b 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -213,11 +213,11 @@ void RtfExport::BuildNumbering()
 {
     const SwNumRuleTbl& rListTbl = pDoc->GetNumRuleTbl();
 
-    for( sal_uInt16 n = rListTbl.Count()+1; n; )
+    for( sal_uInt16 n = rListTbl.size()+1; n; )
     {
         SwNumRule* pRule;
         --n;
-        if( n == rListTbl.Count() )
+        if( n == rListTbl.size() )
             pRule = (SwNumRule*)pDoc->GetOutlineNumRule();
         else
         {
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 068a27d..d656b69 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -59,7 +59,7 @@ sal_uInt16 MSWordExportBase::DuplicateNumRule( const SwNumRule *pRule, sal_uInt8
     SwNumRule* pMyNumRule =
             new SwNumRule( pDoc->GetUniqueNumRuleName( &sPrefix ),
                            SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
-    pUsedNumTbl->Insert( pMyNumRule, pUsedNumTbl->Count() );
+    pUsedNumTbl->push_back( pMyNumRule );
 
     for ( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
     {
@@ -84,16 +84,16 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule )
     if ( !pUsedNumTbl )
     {
         pUsedNumTbl = new SwNumRuleTbl;
-        pUsedNumTbl->Insert( &pDoc->GetNumRuleTbl(), 0 );
+        pUsedNumTbl->insert( pUsedNumTbl->begin(), pDoc->GetNumRuleTbl().begin(), pDoc->GetNumRuleTbl().end() );
         // Check, if the outline rule is already inserted into <pUsedNumTbl>.
         // If yes, do not insert it again.
         bool bOutlineRuleAdded( false );
-        for ( sal_uInt16 n = pUsedNumTbl->Count(); n; )
+        for ( sal_uInt16 n = pUsedNumTbl->size(); n; )
         {
-            const SwNumRule& rRule = *pUsedNumTbl->GetObject( --n );
+            const SwNumRule& rRule = *(*pUsedNumTbl)[ --n ];
             if ( !pDoc->IsUsed( rRule ) )
             {
-                pUsedNumTbl->Remove( n );
+                pUsedNumTbl->erase( pUsedNumTbl->begin() + n );
             }
             else if ( &rRule == pDoc->GetOutlineNumRule() )
             {
@@ -105,7 +105,7 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule )
         {
             // jetzt noch die OutlineRule einfuegen
             SwNumRule* pR = (SwNumRule*)pDoc->GetOutlineNumRule();
-            pUsedNumTbl->Insert( pR, pUsedNumTbl->Count() );
+            pUsedNumTbl->push_back( pR );
         }
     }
     SwNumRule* p = (SwNumRule*)&rNumRule;
@@ -147,7 +147,7 @@ void WW8Export::WriteNumbering()
 
     // list formats - LSTF
     pFib->fcPlcfLst = pTableStrm->Tell();
-    SwWW8Writer::WriteShort( *pTableStrm, pUsedNumTbl->Count() );
+    SwWW8Writer::WriteShort( *pTableStrm, pUsedNumTbl->size() );
     NumberingDefinitions();
     // set len to FIB
     pFib->lcbPlcfLst = pTableStrm->Tell() - pFib->fcPlcfLst;
@@ -183,12 +183,12 @@ void MSWordExportBase::NumberingDefinitions()
     if ( !pUsedNumTbl )
         return; // no numbering is used
 
-    sal_uInt16 nCount = pUsedNumTbl->Count();
+    sal_uInt16 nCount = pUsedNumTbl->size();
 
     // Write static data of SwNumRule - LSTF
     for ( sal_uInt16 n = 0; n < nCount; ++n )
     {
-        const SwNumRule& rRule = *pUsedNumTbl->GetObject( n );
+        const SwNumRule& rRule = *(*pUsedNumTbl)[ n ];
 
         AttrOutput().NumberingDefinition( n + 1, rRule );
     }
@@ -300,7 +300,7 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/,
 
 void MSWordExportBase::AbstractNumberingDefinitions()
 {
-    sal_uInt16 nCount = pUsedNumTbl->Count();
+    sal_uInt16 nCount = pUsedNumTbl->size();
     sal_uInt16 n;
 
     // prepare the NodeNum to generate the NumString
@@ -313,7 +313,7 @@ void MSWordExportBase::AbstractNumberingDefinitions()
     {
         AttrOutput().StartAbstractNumbering( n + 1 );
 
-        const SwNumRule& rRule = *pUsedNumTbl->GetObject( n );
+        const SwNumRule& rRule = *(*pUsedNumTbl)[ n ];
         sal_uInt8 nLvl;
         sal_uInt8 nLevels = static_cast< sal_uInt8 >(rRule.IsContinusNum() ?
             WW8ListManager::nMinLevel : WW8ListManager::nMaxLevel);
@@ -503,7 +503,7 @@ void WW8Export::OutOverrideListTab()
         return ;            // no numbering is used
 
     // write the "list format override" - LFO
-    sal_uInt16 nCount = pUsedNumTbl->Count();
+    sal_uInt16 nCount = pUsedNumTbl->size();
     sal_uInt16 n;
 
     pFib->fcPlfLfo = pTableStrm->Tell();
@@ -527,7 +527,7 @@ void WW8Export::OutListNamesTab()
         return ;            // no numbering is used
 
     // write the "list format override" - LFO
-    sal_uInt16 nNms = 0, nCount = pUsedNumTbl->Count();
+    sal_uInt16 nNms = 0, nCount = pUsedNumTbl->size();
 
     pFib->fcSttbListNames = pTableStrm->Tell();
     SwWW8Writer::WriteShort( *pTableStrm, -1 );
@@ -535,7 +535,7 @@ void WW8Export::OutListNamesTab()
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list