[Libreoffice-commits] .: sw/CppunitTest_sw_swdoc_test.mk sw/inc sw/source

Fridrich Strba fridrich at kemper.freedesktop.org
Wed Jun 20 07:49:01 PDT 2012


 sw/CppunitTest_sw_swdoc_test.mk                 |    1 
 sw/inc/doc.hxx                                  |   22 +--
 sw/inc/docary.hxx                               |   75 +++++++++++--
 sw/inc/fmtcol.hxx                               |    6 -
 sw/source/core/crsr/crstrvl.cxx                 |   10 -
 sw/source/core/crsr/pam.cxx                     |    2 
 sw/source/core/crsr/swcrsr.cxx                  |    2 
 sw/source/core/crsr/trvlreg.cxx                 |    2 
 sw/source/core/doc/dbgoutsw.cxx                 |    2 
 sw/source/core/doc/doc.cxx                      |   17 +--
 sw/source/core/doc/docbasic.cxx                 |   12 --
 sw/source/core/doc/docbm.cxx                    |    8 -
 sw/source/core/doc/docchart.cxx                 |    4 
 sw/source/core/doc/docdde.cxx                   |   90 +++++++++------
 sw/source/core/doc/docedt.cxx                   |   31 ++---
 sw/source/core/doc/docfld.cxx                   |    6 -
 sw/source/core/doc/docfly.cxx                   |   10 -
 sw/source/core/doc/docfmt.cxx                   |  136 ++++++++++++++----------
 sw/source/core/doc/docglbl.cxx                  |   10 -
 sw/source/core/doc/doclay.cxx                   |   43 +++----
 sw/source/core/doc/docnew.cxx                   |  125 ++++++++++++++++------
 sw/source/core/doc/docnum.cxx                   |    4 
 sw/source/core/doc/docsort.cxx                  |    2 
 sw/source/core/doc/doctxm.cxx                   |   10 -
 sw/source/core/doc/number.cxx                   |    2 
 sw/source/core/doc/poolfmt.cxx                  |   18 +--
 sw/source/core/doc/tblcpy.cxx                   |    2 
 sw/source/core/docnode/ndcopy.cxx               |    8 -
 sw/source/core/docnode/ndsect.cxx               |   18 +--
 sw/source/core/docnode/ndtbl.cxx                |   18 +--
 sw/source/core/docnode/node.cxx                 |   12 +-
 sw/source/core/docnode/section.cxx              |   32 +++--
 sw/source/core/draw/dcontact.cxx                |    6 -
 sw/source/core/edit/autofmt.cxx                 |    4 
 sw/source/core/edit/edfcol.cxx                  |    3 
 sw/source/core/edit/edfmt.cxx                   |    2 
 sw/source/core/edit/edglbldc.cxx                |    2 
 sw/source/core/edit/edglss.cxx                  |    2 
 sw/source/core/edit/editsh.cxx                  |    2 
 sw/source/core/edit/edsect.cxx                  |    4 
 sw/source/core/edit/edtox.cxx                   |    4 
 sw/source/core/edit/edws.cxx                    |    2 
 sw/source/core/fields/cellfml.cxx               |    2 
 sw/source/core/frmedt/fecopy.cxx                |   24 ++--
 sw/source/core/frmedt/fefly1.cxx                |    8 -
 sw/source/core/frmedt/tblsel.cxx                |    4 
 sw/source/core/inc/flyfrm.hxx                   |    4 
 sw/source/core/layout/atrfrm.cxx                |   10 -
 sw/source/core/layout/flypos.cxx                |    2 
 sw/source/core/layout/frmtool.cxx               |   37 +++---
 sw/source/core/layout/laycache.cxx              |    6 -
 sw/source/core/layout/pagechg.cxx               |    8 -
 sw/source/core/layout/tabfrm.cxx                |    6 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx |    4 
 sw/source/core/text/itratr.cxx                  |   66 +++++------
 sw/source/core/txtnode/ndtxt.cxx                |    2 
 sw/source/core/undo/rolbck.cxx                  |    3 
 sw/source/core/undo/unattr.cxx                  |   16 +-
 sw/source/core/undo/undel.cxx                   |   12 +-
 sw/source/core/undo/undobj.cxx                  |   18 +--
 sw/source/core/undo/undobj1.cxx                 |   12 +-
 sw/source/core/undo/undraw.cxx                  |   44 +++----
 sw/source/core/undo/unfmco.cxx                  |    1 
 sw/source/core/undo/untbl.cxx                   |   22 +--
 sw/source/core/undo/untblk.cxx                  |    4 
 sw/source/core/unocore/unochart.cxx             |    2 
 sw/source/core/unocore/unocoll.cxx              |   20 +--
 sw/source/core/unocore/unocrsrhelper.cxx        |    2 
 sw/source/core/unocore/unoidx.cxx               |   14 +-
 sw/source/core/unocore/unoobj2.cxx              |    4 
 sw/source/core/unocore/unosect.cxx              |    4 
 sw/source/core/unocore/unosett.cxx              |   10 -
 sw/source/core/unocore/unostyle.cxx             |    8 -
 sw/source/core/unocore/unotbl.cxx               |    2 
 sw/source/core/unocore/unotext.cxx              |    2 
 sw/source/filter/ascii/wrtasc.cxx               |    2 
 sw/source/filter/basflt/shellio.cxx             |   10 -
 sw/source/filter/html/css1atr.cxx               |    4 
 sw/source/filter/html/htmlcss1.cxx              |   12 +-
 sw/source/filter/html/htmlforw.cxx              |    4 
 sw/source/filter/html/htmlgrin.cxx              |    4 
 sw/source/filter/html/swhtml.cxx                |    8 -
 sw/source/filter/html/wrthtml.cxx               |   12 +-
 sw/source/filter/rtf/swparrtf.cxx               |    8 -
 sw/source/filter/ww8/writerhelper.cxx           |    2 
 sw/source/filter/ww8/wrtw8sty.cxx               |   18 +--
 sw/source/filter/ww8/wrtww8.cxx                 |    2 
 sw/source/filter/ww8/ww8atr.cxx                 |    5 
 sw/source/filter/ww8/ww8glsy.cxx                |    2 
 sw/source/filter/xml/swxml.cxx                  |    3 
 sw/source/filter/xml/xmlexp.cxx                 |    6 -
 sw/source/filter/xml/xmlfmt.cxx                 |    2 
 sw/source/ui/app/docsh2.cxx                     |    6 -
 sw/source/ui/app/docstyle.cxx                   |   18 +--
 sw/source/ui/dialog/uiregionsw.cxx              |   13 --
 sw/source/ui/shells/langhelper.cxx              |    8 -
 sw/source/ui/uiview/view2.cxx                   |    2 
 sw/source/ui/uno/unotxdoc.cxx                   |    4 
 sw/source/ui/utlui/uitool.cxx                   |    2 
 99 files changed, 734 insertions(+), 577 deletions(-)

New commits:
commit 1015cd4ff73ee25e55b4da8c8bc55a41e652da87
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jun 20 16:36:51 2012 +0200

    Convert SV_DECL_PTRARR_DEL of Sw*Fmts to std::vector
    
    - I had to convert SwFrmFmts, SwSpzFrmFmts, SwCharFmts, SwSectionsFmts,
      SwTextFormatColl, SwGrfFmtColl all together because of the code that wants
      to work with any of them.
    - Introduce a pure virtual base class SwFmtsBase, since there are a handful
      of methods that want to work with any of the std::vector<Sw*Fmt> types.
    - the class SwSpzFrmFmts was dropped, and the code changed to use SwFrmFmts
      instead, since the 2 types are identical.
    
    Change-Id: I8c4056b5aedd574a33666e2d649a8b849958441c
    
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/sw/CppunitTest_sw_swdoc_test.mk b/sw/CppunitTest_sw_swdoc_test.mk
index 94ebab3..dc4490b 100644
--- a/sw/CppunitTest_sw_swdoc_test.mk
+++ b/sw/CppunitTest_sw_swdoc_test.mk
@@ -58,6 +58,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_swdoc_test, \
     svt \
     svx \
     svxcore \
+    sw \
     swd \
 	test \
     tk \
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ab09943..c658633 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -131,6 +131,7 @@ class SwField;
 class SwTxtFld;
 class SwFldTypes;
 class SwFlyFrmFmt;
+class SwFmtsBase;
 class SwFmt;
 class SwFmtINetFmt;
 class SwFmtRefMark;
@@ -162,7 +163,6 @@ class SwSectionFmt;
 class SwSectionFmts;
 class SwSectionData;
 class SwSelBoxes;
-class SwSpzFrmFmts;
 class SwTOXBase;
 class SwTOXBaseSection;
 class SwTOXMark;
@@ -315,7 +315,7 @@ class SW_DLLPUBLIC SwDoc :
 
     SwFrmFmts       *pFrmFmtTbl;        // Format table
     SwCharFmts      *pCharFmtTbl;
-    SwSpzFrmFmts    *pSpzFrmFmtTbl;
+    SwFrmFmts       *pSpzFrmFmtTbl;
     SwSectionFmts   *pSectionFmtTbl;
     SwFrmFmts       *pTblFrmFmtTbl;     // For tables
     SwTxtFmtColls   *pTxtFmtCollTbl;    // FormatCollections
@@ -634,13 +634,13 @@ private:
     sal_Int8 SetFlyFrmAnchor( SwFrmFmt& rFlyFmt, SfxItemSet& rSet, sal_Bool bNewFrms );
 
     typedef SwFmt* (SwDoc:: *FNCopyFmt)( const String&, SwFmt*, sal_Bool, sal_Bool );
-    SwFmt* CopyFmt( const SwFmt& rFmt, const SvPtrarr& rFmtArr,
+    SwFmt* CopyFmt( const SwFmt& rFmt, const SwFmtsBase& rFmtArr,
                         FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt );
-    void CopyFmtArr( const SvPtrarr& rSourceArr, SvPtrarr& rDestArr,
+    void CopyFmtArr( const SwFmtsBase& rSourceArr, SwFmtsBase& rDestArr,
                         FNCopyFmt fnCopyFmt, SwFmt& rDfltFmt );
     void CopyPageDescHeaderFooterImpl( bool bCpyHeader,
                                 const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt );
-    SwFmt* FindFmtByName( const SvPtrarr& rFmtArr,
+    SwFmt* FindFmtByName( const SwFmtsBase& rFmtArr,
                                     const String& rName ) const;
 
     VirtualDevice& CreateVirtualDevice_() const;
@@ -1202,8 +1202,8 @@ public:
     const SwCharFmts* GetCharFmts() const   { return pCharFmtTbl;}
 
     /* LayoutFormats (frames, DrawObjects), sometimes const sometimes not  */
-    const SwSpzFrmFmts* GetSpzFrmFmts() const   { return pSpzFrmFmtTbl; }
-          SwSpzFrmFmts* GetSpzFrmFmts()         { return pSpzFrmFmtTbl; }
+    const SwFrmFmts* GetSpzFrmFmts() const   { return pSpzFrmFmtTbl; }
+          SwFrmFmts* GetSpzFrmFmts()         { return pSpzFrmFmtTbl; }
 
     const SwFrmFmt *GetDfltFrmFmt() const   { return pDfltFrmFmt; }
           SwFrmFmt *GetDfltFrmFmt()         { return pDfltFrmFmt; }
@@ -1224,7 +1224,7 @@ public:
                           sal_Bool bBroadcast = sal_False, sal_Bool bAuto = sal_True);
     void       DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast = sal_False );
     SwFrmFmt* FindFrmFmtByName( const String& rName ) const
-        {   return (SwFrmFmt*)FindFmtByName( (SvPtrarr&)*pFrmFmtTbl, rName ); }
+        {   return (SwFrmFmt*)FindFmtByName( (SwFmtsBase&)*pFrmFmtTbl, rName ); }
 
     SwCharFmt *MakeCharFmt(const String &rFmtName, SwCharFmt *pDerivedFrom,
                            sal_Bool bBroadcast = sal_False,
@@ -1232,7 +1232,7 @@ public:
     void       DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False);
     void       DelCharFmt(SwCharFmt* pFmt, sal_Bool bBroadcast = sal_False);
     SwCharFmt* FindCharFmtByName( const String& rName ) const
-        {   return (SwCharFmt*)FindFmtByName( (SvPtrarr&)*pCharFmtTbl, rName ); }
+        {   return (SwCharFmt*)FindFmtByName( (SwFmtsBase&)*pCharFmtTbl, rName ); }
 
     /* Formatcollections (styles) */
     // TXT
@@ -1258,7 +1258,7 @@ public:
                             bool bReset = true,
                             bool bResetListAttrs = false );
     SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const
-        {   return (SwTxtFmtColl*)FindFmtByName( (SvPtrarr&)*pTxtFmtCollTbl, rName ); }
+        {   return (SwTxtFmtColl*)FindFmtByName( (SwFmtsBase&)*pTxtFmtCollTbl, rName ); }
 
     void ChkCondColls();
 
@@ -1268,7 +1268,7 @@ public:
     SwGrfFmtColl *MakeGrfFmtColl(const String &rFmtName,
                                     SwGrfFmtColl *pDerivedFrom);
     SwGrfFmtColl* FindGrfFmtCollByName( const String& rName ) const
-        {   return (SwGrfFmtColl*)FindFmtByName( (SvPtrarr&)*pGrfFmtCollTbl, rName ); }
+        {   return (SwGrfFmtColl*)FindFmtByName( (SwFmtsBase&)*pGrfFmtCollTbl, rName ); }
 
     // Table formating
     const SwFrmFmts* GetTblFrmFmts() const  { return pTblFrmFmtTbl; }
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 2a86422..6c7f994 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -33,6 +33,7 @@
 #include <algorithm>
 
 class SwFieldType;
+class SwFmt;
 class SwFrmFmt;
 class SwCharFmt;
 class SwTOXType;
@@ -42,6 +43,8 @@ class SwNumRule;
 class SwRedline;
 class SwUnoCrsr;
 class SwOLENode;
+class SwTxtFmtColl;
+class SwGrfFmtColl;
 
 namespace com { namespace sun { namespace star { namespace i18n {
     struct ForbiddenCharacters;    // comes from the I18N UNO interface
@@ -50,18 +53,70 @@ namespace com { namespace sun { namespace star { namespace i18n {
 #include <swtypes.hxx>
 #include <svl/svarray.hxx>
 
-// PageDescriptor-interface
-// typedef SwPageDesc * SwPageDescPtr;
-// SV_DECL_PTRARR_DEL(SwPageDescs, SwPageDescPtr,1);
+// provides some methods for generic operations on lists that contain
+// SwFmt* subclasses.
+class SwFmtsBase
+{
+public:
+    virtual size_t GetFmtCount() const = 0;
+    virtual SwFmt* GetFmt(size_t idx) const = 0;
+    virtual ~SwFmtsBase() = 0;
+};
 
-typedef SwFrmFmt* SwFrmFmtPtr;
-SV_DECL_PTRARR_DEL(SwFrmFmts,SwFrmFmtPtr,4)
+class SwGrfFmtColls : public std::vector<SwGrfFmtColl*>, public SwFmtsBase
+{
+public:
+    virtual size_t GetFmtCount() const { return size(); }
+    virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+    sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
+    // free's any remaining child objects
+    virtual ~SwGrfFmtColls() {}
+};
 
 // Specific frame formats (frames, DrawObjects).
-SV_DECL_PTRARR_DEL(SwSpzFrmFmts,SwFrmFmtPtr,0)
+class SW_DLLPUBLIC SwFrmFmts : public std::vector<SwFrmFmt*>, public SwFmtsBase
+{
+public:
+    virtual size_t GetFmtCount() const { return size(); }
+    virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+    sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
+    bool Contains(const SwFrmFmt* pFmt) const;
+    // free's any remaining child objects
+    virtual ~SwFrmFmts();
+};
 
-typedef SwCharFmt* SwCharFmtPtr;
-SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4)
+class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
+{
+public:
+    virtual size_t GetFmtCount() const { return size(); }
+    virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+    sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
+    bool Contains(const SwCharFmt* pFmt) const;
+    // free's any remaining child objects
+    virtual ~SwCharFmts();
+};
+
+class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
+{
+public:
+    virtual size_t GetFmtCount() const { return size(); }
+    virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+    sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
+    bool Contains(const SwTxtFmtColl* pFmt) const;
+    virtual ~SwTxtFmtColls() {}
+};
+
+// Array of Undo-history.
+class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
+{
+public:
+    virtual size_t GetFmtCount() const { return size(); }
+    virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+    sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
+    bool Contains(const SwSectionFmt* pFmt) const;
+    // free's any remaining child objects
+    virtual ~SwSectionFmts();
+};
 
 class SwFldTypes : public std::vector<SwFieldType*> {
 public:
@@ -77,10 +132,6 @@ public:
     sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
 };
 
-// Array of Undo-history.
-typedef SwSectionFmt* SwSectionFmtPtr;
-SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0)
-
 class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
 public:
     // the destructor will free all objects still in the vector
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 3451a4b..80bfbf8 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -154,9 +154,6 @@ public:
 */
 };
 
-typedef SwTxtFmtColl* SwTxtFmtCollPtr;
-SV_DECL_PTRARR(SwTxtFmtColls,SwTxtFmtCollPtr,2)
-
 class SwGrfFmtColl: public SwFmtColl
 {
     friend class SwDoc;
@@ -177,9 +174,6 @@ public:
     TYPEINFO(); // Already in base class Client.
 };
 
-typedef SwGrfFmtColl* SwGrfFmtCollPtr;
-SV_DECL_PTRARR(SwGrfFmtColls,SwGrfFmtCollPtr,2)
-
 // FEATURE::CONDCOLL
 // Conditional styles.
 enum Master_CollConditions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index ec77f94..976b769 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -305,7 +305,7 @@ sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName )
 
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     SwCntntNode* pFnd = 0;
-    for( sal_uInt16 n = rFmts.Count(); n; )
+    for( sal_uInt16 n = rFmts.size(); n; )
     {
         const SwSection* pSect = rFmts[ --n ]->GetSection();
         const SwSectionNode* pSectNd;
@@ -352,7 +352,7 @@ sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName )
 
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     SwCntntNode* pFnd = 0;
-    for( sal_uInt16 n = rFmts.Count(); n; )
+    for( sal_uInt16 n = rFmts.size(); n; )
     {
         const SwSection* pSect = rFmts[ --n ]->GetSection();
         const SwSectionNode* pSectNd;
@@ -2083,7 +2083,7 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext )
     {
         const SwTxtNode* pTxtNd;
         const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
-        for( sal_uInt16 n = pFmts->Count(); 1 < n; )
+        for( sal_uInt16 n = pFmts->size(); 1 < n; )
         {
             SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
 
@@ -2117,8 +2117,8 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperlink( sal_Bool bNext )
     }
     // then check all the Flys with a URL or imapge map
     {
-        const SwSpzFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts();
-        for( sal_uInt16 n = 0, nEnd = pFmts->Count(); n < nEnd; ++n )
+        const SwFrmFmts* pFmts = GetDoc()->GetSpzFrmFmts();
+        for( sal_uInt16 n = 0, nEnd = pFmts->size(); n < nEnd; ++n )
         {
             SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)(*pFmts)[ n ];
             const SwFmtURL& rURLItem = pFmt->GetURL();
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index e40f43a..c3b3a32 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -700,7 +700,7 @@ sal_Bool SwPaM::HasReadonlySel( bool bFormView ) const
             if( nSttIdx + 3 < nEndIdx )
             {
                 const SwSectionFmts& rFmts = GetDoc()->GetSections();
-                for( sal_uInt16 n = rFmts.Count(); n;  )
+                for( sal_uInt16 n = rFmts.size(); n;  )
                 {
                     const SwSectionFmt* pFmt = rFmts[ --n ];
                     if( pFmt->GetProtect().IsCntntProtected() )
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 0bca531..a700610 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -311,7 +311,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
             }
 
             const SwSectionFmts& rFmts = pDoc->GetSections();
-            for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+            for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
             {
                 const SwSectionFmt* pFmt = rFmts[n];
                 const SvxProtectItem& rProtect = pFmt->GetProtect();
diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx
index 6001220..5f61e69 100644
--- a/sw/source/core/crsr/trvlreg.cxx
+++ b/sw/source/core/crsr/trvlreg.cxx
@@ -253,7 +253,7 @@ sal_Bool SwCursor::GotoRegion( const String& rName )
 {
     sal_Bool bRet = sal_False;
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    for( sal_uInt16 n = rFmts.Count(); n; )
+    for( sal_uInt16 n = rFmts.size(); n; )
     {
         const SwSectionFmt* pFmt = rFmts[ --n ];
         const SwNodeIndex* pIdx;
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index b14e07d..03fdce5 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -468,7 +468,7 @@ const String lcl_AnchoredFrames(const SwNode & rNode)
     const SwDoc * pDoc = rNode.GetDoc();
     if (pDoc)
     {
-        const SwSpzFrmFmts * pFrmFmts = pDoc->GetSpzFrmFmts();
+        const SwFrmFmts * pFrmFmts = pDoc->GetSpzFrmFmts();
 
         if (pFrmFmts)
         {
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 54e6e42..cd2804d 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2098,7 +2098,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool
             GetNodes()._Copy( aRange, aEndOfDoc );
         }
         const SwTxtFmtColls *pColl = pExtDoc->GetTxtFmtColls();
-        for( i = 0; i < pColl->Count(); ++i )
+        for( i = 0; i < pColl->size(); ++i )
             (*pColl)[ i ]->ResetFmtAttr( RES_PAGEDESC, RES_BREAK );
         SwNodeIndex aIndx( pExtDoc->GetNodes().GetEndOfExtras() );
         ++aEndOfDoc;
@@ -2228,7 +2228,7 @@ bool SwDoc::RemoveInvisibleContent()
         SwSectionFmts& rSectFmts = GetSections();
         sal_uInt16 n;
 
-        for( n = rSectFmts.Count(); n; )
+        for( n = rSectFmts.size(); n; )
         {
             SwSectionFmt* pSectFmt = rSectFmts[ --n ];
             // don't add sections in Undo/Redo
@@ -2245,8 +2245,9 @@ bool SwDoc::RemoveInvisibleContent()
                     pParent = pTmp;
                 }
 
-                if( USHRT_MAX == aSectFmts.GetPos( pSect->GetFmt() ) )
-                    aSectFmts.Insert( pSect->GetFmt(), 0 );
+                SwSectionFmts::iterator it = std::find( aSectFmts.begin(), aSectFmts.end(), pSect->GetFmt() );
+                if ( it != aSectFmts.end() )
+                    aSectFmts.insert( aSectFmts.begin(), pSect->GetFmt() );
             }
             if( pSect->GetCondition().Len() )
             {
@@ -2257,7 +2258,7 @@ bool SwDoc::RemoveInvisibleContent()
             }
         }
 
-        if( 0 != ( n = aSectFmts.Count() ))
+        if( 0 != ( n = aSectFmts.size() ))
         {
             while( n )
             {
@@ -2295,7 +2296,7 @@ bool SwDoc::RemoveInvisibleContent()
 
                 }
             }
-            aSectFmts.Remove( 0, aSectFmts.Count() );
+            aSectFmts.clear();
         }
     }
 
@@ -2339,7 +2340,7 @@ bool SwDoc::HasInvisibleContent() const
         const SwSectionFmts& rSectFmts = GetSections();
         sal_uInt16 n;
 
-        for( n = rSectFmts.Count(); !bRet && (n > 0); )
+        for( n = rSectFmts.size(); !bRet && (n > 0); )
         {
             SwSectionFmt* pSectFmt = rSectFmts[ --n ];
             // don't add sections in Undo/Redo
@@ -2666,7 +2667,7 @@ SwUnoCrsr* SwDoc::CreateUnoCrsr( const SwPosition& rPos, sal_Bool bTblCrsr )
 
 void SwDoc::ChkCondColls()
 {
-     for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++)
+     for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->size(); n++)
      {
         SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n];
         if (RES_CONDTXTFMTCOLL == pColl->Which())
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index 1275c79..8c502cc 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -170,11 +170,10 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
     case EVENT_OBJECT_URLITEM:
     case EVENT_OBJECT_IMAGE:
         {
-            const SwFrmFmtPtr pFmt = (SwFrmFmtPtr)rCallEvent.PTR.pFmt;
+            const SwFrmFmt* pFmt = (SwFrmFmt*)rCallEvent.PTR.pFmt;
             if( bCheckPtr )
             {
-                sal_uInt16 nPos = GetSpzFrmFmts()->GetPos( pFmt );
-                if( USHRT_MAX != nPos )
+                if ( GetSpzFrmFmts()->Contains( pFmt ) )
                     bCheckPtr = sal_False;      // misuse as a flag
             }
             if( !bCheckPtr )
@@ -187,13 +186,12 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
             const IMapObject* pIMapObj = rCallEvent.PTR.IMAP.pIMapObj;
             if( bCheckPtr )
             {
-                const SwFrmFmtPtr pFmt = (SwFrmFmtPtr)rCallEvent.PTR.IMAP.pFmt;
-                sal_uInt16 nPos = GetSpzFrmFmts()->GetPos( pFmt );
+                const SwFrmFmt* pFmt = (SwFrmFmt*)rCallEvent.PTR.IMAP.pFmt;
                 const ImageMap* pIMap;
-                if( USHRT_MAX != nPos &&
+                if( GetSpzFrmFmts()->Contains( pFmt ) &&
                     0 != (pIMap = pFmt->GetURL().GetMap()) )
                 {
-                    for( nPos = pIMap->GetIMapObjectCount(); nPos; )
+                    for( sal_uInt16 nPos = pIMap->GetIMapObjectCount(); nPos; )
                         if( pIMapObj == pIMap->GetIMapObject( --nPos ))
                         {
                             bCheckPtr = sal_False;      // misuse as a flag
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 327babe..1937bc9 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1341,7 +1341,7 @@ void _SaveCntntIdx(SwDoc* pDoc,
                                         continue;
                                 }
                             }
-                            aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() );
+                            aSave.SetCount( pDoc->GetSpzFrmFmts()->size() );
                             while( aSave.GetCount() &&
                                     &rFmt != (*pDoc->GetSpzFrmFmts())[
                                     aSave.DecCount() ] )
@@ -1356,7 +1356,7 @@ void _SaveCntntIdx(SwDoc* pDoc,
             }
             else // No layout, so it's a bit more expensive ...
             {
-                for( aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() );
+                for( aSave.SetCount( pDoc->GetSpzFrmFmts()->size() );
                         aSave.GetCount() ; )
                 {
                     SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
@@ -1447,7 +1447,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
 {
     SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
     const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
-    SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
+    SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     sal_uInt16 n = 0;
     while( n < rSaveArr.size() )
@@ -1608,7 +1608,7 @@ void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
 {
     const SwDoc* pDoc = rNd.GetDoc();
     const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
-    const SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
+    const SwFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
     const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
 
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index a481045..f48fab4 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -108,7 +108,7 @@ void SwDoc::DoUpdateAllCharts()
     if( pVSh )
     {
         const SwFrmFmts& rTblFmts = *GetTblFrmFmts();
-        for( sal_uInt16 n = 0; n < rTblFmts.Count(); ++n )
+        for( sal_uInt16 n = 0; n < rTblFmts.size(); ++n )
         {
             SwTable* pTmpTbl;
             const SwTableNode* pTblNd;
@@ -171,7 +171,7 @@ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName )
     {
         SwFrmFmt* pFmt;
         const SwFrmFmts& rTbl = *GetTblFrmFmts();
-        for( sal_uInt16 i = rTbl.Count(); i; )
+        for( sal_uInt16 i = rTbl.size(); i; )
             if( !( pFmt = rTbl[ --i ] )->IsDefault() &&
                 pFmt->GetName() == rNewName && IsUsed( *pFmt ) )
             {
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index dc87ce0..edc6c87 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -45,6 +45,7 @@
 #include <pam.hxx>
 #include <docary.hxx>
 #include <MarkManager.hxx>
+#include <boost/foreach.hpp>
 
 using namespace ::com::sun::star;
 
@@ -85,10 +86,9 @@ struct _FindItem
     {}
 };
 
-sal_Bool lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bCaseSensitive )
+static bool lcl_FindSection( const SwSectionFmt* pSectFmt, _FindItem * const pItem, bool bCaseSensitive )
 {
-    _FindItem * const pItem( static_cast<_FindItem*>(pArgs) );
-    SwSection* pSect = rpSectFmt->GetSection();
+    SwSection* pSect = pSectFmt->GetSection();
     if( pSect )
     {
         String sNm( (bCaseSensitive)
@@ -101,52 +101,43 @@ sal_Bool lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs, bool bC
         {
             // found, so get the data
             const SwNodeIndex* pIdx;
-            if( 0 != (pIdx = rpSectFmt->GetCntnt().GetCntntIdx() ) &&
-                &rpSectFmt->GetDoc()->GetNodes() == &pIdx->GetNodes() )
+            if( 0 != (pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) &&
+                &pSectFmt->GetDoc()->GetNodes() == &pIdx->GetNodes() )
             {
                 // a table in the normal NodesArr
                 pItem->pSectNd = pIdx->GetNode().GetSectionNode();
-                return sal_False;
+                return false;
             }
             // If the name is already correct, but not the rest then we don't have them.
             // The names are always unique.
         }
     }
-    return sal_True;
-}
-sal_Bool lcl_FindSectionCaseSensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
-{
-    return lcl_FindSection( rpSectFmt, pArgs, true );
-}
-sal_Bool lcl_FindSectionCaseInsensitive( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
-{
-    return lcl_FindSection( rpSectFmt, pArgs, false );
+    return true;
 }
 
 
 
-sal_Bool lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs )
+static bool lcl_FindTable( const SwFrmFmt* pTableFmt, _FindItem * const pItem )
 {
-    _FindItem * const pItem( static_cast<_FindItem*>(pArgs) );
-    String sNm( GetAppCharClass().lowercase( rpTableFmt->GetName() ));
+    String sNm( GetAppCharClass().lowercase( pTableFmt->GetName() ));
     if (sNm.Equals( pItem->m_Item ))
     {
         SwTable* pTmpTbl;
         SwTableBox* pFBox;
-        if( 0 != ( pTmpTbl = SwTable::FindTable( rpTableFmt ) ) &&
+        if( 0 != ( pTmpTbl = SwTable::FindTable( pTableFmt ) ) &&
             0 != ( pFBox = pTmpTbl->GetTabSortBoxes()[0] ) &&
             pFBox->GetSttNd() &&
-            &rpTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
+            &pTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
         {
             // a table in the normal NodesArr
             pItem->pTblNd = (SwTableNode*)
                                         pFBox->GetSttNd()->FindTableNode();
-            return sal_False;
+            return false;
         }
         // If the name is already correct, but not the rest then we don't have them.
         // The names are always unique.
     }
-    return sal_True;
+    return true;
 }
 
 
@@ -165,8 +156,11 @@ bool SwDoc::GetData( const rtl::OUString& rItem, const String& rMimeType,
         // Do we already have the Item?
         String sItem( bCaseSensitive ? rItem : GetAppCharClass().lowercase(rItem));
         _FindItem aPara( sItem );
-        ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
-                                                    bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+        BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
+        {
+            if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
+                break;
+        }
         if( aPara.pSectNd )
         {
             // found, so get the data
@@ -178,8 +172,11 @@ bool SwDoc::GetData( const rtl::OUString& rItem, const String& rMimeType,
     }
 
     _FindItem aPara( GetAppCharClass().lowercase( rItem ));
-    ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(),
-                                            lcl_FindTable, &aPara );
+    BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
+    {
+        if (!(lcl_FindTable(pFmt, &aPara)))
+            break;
+    }
     if( aPara.pTblNd )
     {
         return SwServerObject( *aPara.pTblNd ).GetData( rValue, rMimeType );
@@ -204,7 +201,11 @@ bool SwDoc::SetData( const rtl::OUString& rItem, const String& rMimeType,
         // Do we already have the Item?
         String sItem( bCaseSensitive ? rItem : GetAppCharClass().lowercase(rItem));
         _FindItem aPara( sItem );
-        pSectionFmtTbl->ForEach( 0, pSectionFmtTbl->Count(), bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+        BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
+        {
+            if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
+                break;
+        }
         if( aPara.pSectNd )
         {
             // found, so get the data
@@ -217,7 +218,11 @@ bool SwDoc::SetData( const rtl::OUString& rItem, const String& rMimeType,
 
     String sItem(GetAppCharClass().lowercase(rItem));
     _FindItem aPara( sItem );
-    pTblFrmFmtTbl->ForEach( 0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara );
+    BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
+    {
+        if (!(lcl_FindTable(pFmt, &aPara)))
+            break;
+    }
     if( aPara.pTblNd )
     {
         return SwServerObject( *aPara.pTblNd ).SetData( rMimeType, rValue );
@@ -251,7 +256,12 @@ bool SwDoc::SetData( const rtl::OUString& rItem, const String& rMimeType,
 
         _FindItem aPara(bCaseSensitive ? rItem : GetAppCharClass().lowercase(rItem));
         // sections
-        ((SwSectionFmts&)*pSectionFmtTbl).ForEach(0, pSectionFmtTbl->Count(), bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara);
+        BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
+        {
+            if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
+                break;
+        }
+
         if(aPara.pSectNd
             && (0 == (pObj = aPara.pSectNd->GetSection().GetObject())))
         {
@@ -269,7 +279,11 @@ bool SwDoc::SetData( const rtl::OUString& rItem, const String& rMimeType,
 
     _FindItem aPara( GetAppCharClass().lowercase(rItem) );
     // tables
-    ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach(0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara);
+    BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
+    {
+        if (!(lcl_FindTable(pFmt, &aPara)))
+            break;
+    }
     if(aPara.pTblNd
         && (0 == (pObj = aPara.pTblNd->GetTable().GetObject())))
     {
@@ -310,8 +324,11 @@ sal_Bool SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
         if( sCmp.EqualsAscii( pMarkToTable ) )
         {
             sName = rCC.lowercase( sName );
-            ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(),
-                                                    lcl_FindTable, &aPara );
+            BOOST_FOREACH( const SwFrmFmt* pFmt, *pTblFrmFmtTbl )
+            {
+                if (!(lcl_FindTable(pFmt, &aPara)))
+                    break;
+            }
             if( aPara.pTblNd )
             {
                 rpRange = new SwNodeRange( *aPara.pTblNd, 0,
@@ -389,10 +406,13 @@ sal_Bool SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
         //
         _FindItem aPara( bCaseSensitive ? sItem : String(rCC.lowercase( sItem )) );
 
-        if( pSectionFmtTbl->Count() )
+        if( !pSectionFmtTbl->empty() )
         {
-            ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
-                                                    bCaseSensitive ? lcl_FindSectionCaseSensitive : lcl_FindSectionCaseInsensitive, &aPara );
+            BOOST_FOREACH( const SwSectionFmt* pFmt, *pSectionFmtTbl )
+            {
+                if (!(lcl_FindSection(pFmt, &aPara, bCaseSensitive)))
+                    break;
+            }
             if( aPara.pSectNd )
             {
                 rpRange = new SwNodeRange( *aPara.pSectNd, 1,
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index c805779..e721966 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -207,8 +207,7 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx,
         aPos.nContent.Assign( 0, 0 );
         SwFmtAnchor aAnchor( pFmt->GetAnchor() );
         aAnchor.SetAnchor( &aPos );
-        pFmt->GetDoc()->GetSpzFrmFmts()->Insert(
-                pFmt, pFmt->GetDoc()->GetSpzFrmFmts()->Count() );
+        pFmt->GetDoc()->GetSpzFrmFmts()->push_back( pFmt );
         pFmt->SetFmtAttr( aAnchor );
         SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
         if( pCNd && pCNd->getLayoutFrm( pFmt->GetDoc()->GetCurrentLayout(), 0, 0, sal_False ) )
@@ -218,8 +217,8 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx,
 
 void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr )
 {
-    SwSpzFrmFmts& rFmts = *rRg.aStart.GetNode().GetDoc()->GetSpzFrmFmts();
-    for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+    SwFrmFmts& rFmts = *rRg.aStart.GetNode().GetDoc()->GetSpzFrmFmts();
+    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
     {
         SwFrmFmt *const pFmt = static_cast<SwFrmFmt*>(rFmts[n]);
         SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
@@ -233,7 +232,7 @@ void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr )
                             pFmt, sal_False );
             rArr.push_back( aSave );
             pFmt->DelFrms();
-            rFmts.Remove( n--, 1 );
+            rFmts.erase( rFmts.begin() + n-- );
         }
     }
 }
@@ -241,7 +240,7 @@ void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr )
 void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
                        _SaveFlyArr& rArr, bool bMoveAllFlys )
 {
-    SwSpzFrmFmts& rFmts = *rPam.GetPoint()->nNode.GetNode().GetDoc()->GetSpzFrmFmts();
+    SwFrmFmts& rFmts = *rPam.GetPoint()->nNode.GetNode().GetDoc()->GetSpzFrmFmts();
     SwFrmFmt* pFmt;
     const SwFmtAnchor* pAnchor;
 
@@ -258,7 +257,7 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
 
     const SwNodeIndex* pCntntIdx;
 
-    for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
     {
         sal_Bool bInsPos = sal_False;
         pFmt = (SwFrmFmt*)rFmts[n];
@@ -294,7 +293,7 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
                                 pFmt, bInsPos );
                 rArr.push_back( aSave );
                 pFmt->DelFrms();
-                rFmts.Remove( n--, 1 );
+                rFmts.erase( rFmts.begin() + n-- );
             }
         }
     }
@@ -308,8 +307,8 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
     const sal_Bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
 
     SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
-    SwSpzFrmFmts& rTbl = *pDoc->GetSpzFrmFmts();
-    for ( sal_uInt16 i = rTbl.Count(); i; )
+    SwFrmFmts& rTbl = *pDoc->GetSpzFrmFmts();
+    for ( sal_uInt16 i = rTbl.size(); i; )
     {
         SwFrmFmt *pFmt = rTbl[--i];
         const SwFmtAnchor &rAnch = pFmt->GetAnchor();
@@ -339,8 +338,8 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
                                     SwNodeIndex( *rCntnt.GetCntntIdx()->
                                             GetNode().EndOfSectionNode() ));
                     // Position could have been moved!
-                    if( i > rTbl.Count() )
-                        i = rTbl.Count();
+                    if( i > rTbl.size() )
+                        i = rTbl.size();
                     else if( pFmt != rTbl[i] )
                         i = rTbl.GetPos( pFmt );
                 }
@@ -348,8 +347,8 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
                 pDoc->DelLayoutFmt( pFmt );
 
                 // DelLayoutFmt can also trigger the deletion of objects.
-                if( i > rTbl.Count() )
-                    i = rTbl.Count();
+                if( i > rTbl.size() )
+                    i = rTbl.size();
             }
         }
     }
@@ -1158,7 +1157,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
 
     // Save the paragraph-bound Flys, so that they can be moved.
     _SaveFlyArr aSaveFlyArr;
-    if( GetSpzFrmFmts()->Count() )
+    if( !GetSpzFrmFmts()->empty() )
         _SaveFlyInRange( rRange, aSaveFlyArr );
 
     // Set it to before the Position, so that it cannot be moved further.
@@ -2596,7 +2595,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
             // What's with Flys?
         {
             // If there are FlyFrames left, delete these too
-            for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+            for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->size(); ++n )
             {
                 SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
                 const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 44b47a7..559bac2 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -1691,7 +1691,7 @@ void SwDoc::GetAllUsedDB( std::vector<String>& rDBNameList,
     }
 
     SwSectionFmts& rArr = GetSections();
-    for (sal_uInt16 n = rArr.Count(); n; )
+    for (sal_uInt16 n = rArr.size(); n; )
     {
         SwSection* pSect = rArr[ --n ]->GetSection();
 
@@ -1844,7 +1844,7 @@ void SwDoc::ChangeDBFields( const std::vector<String>& rOldNames,
     String sFormel;
 
     SwSectionFmts& rArr = GetSections();
-    for (sal_uInt16 n = rArr.Count(); n; )
+    for (sal_uInt16 n = rArr.size(); n; )
     {
         SwSection* pSect = rArr[ --n ]->GetSection();
 
@@ -2234,7 +2234,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
         sal_uInt16 nArrStt = 0;
         sal_uLong nSttCntnt = rDoc.GetNodes().GetEndOfExtras().GetIndex();
 
-        for (sal_uInt16 n = rArr.Count(); n; )
+        for (sal_uInt16 n = rArr.size(); n; )
         {
             SwSection* pSect = rArr[ --n ]->GetSection();
             if( pSect && pSect->IsHidden() && pSect->GetCondition().Len() &&
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 388f11d..f57fcec 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -73,8 +73,8 @@ using namespace ::com::sun::star;
 
 sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const
 {
-    const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
-    sal_uInt16 nSize = rFmts.Count();
+    const SwFrmFmts& rFmts = *GetSpzFrmFmts();
+    sal_uInt16 nSize = rFmts.size();
     sal_uInt16 nCount = 0;
     const SwNodeIndex* pIdx;
     for ( sal_uInt16 i = 0; i < nSize; i++)
@@ -115,9 +115,9 @@ sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const
 // If you change this, also update SwXFrameEnumeration in unocoll.
 SwFrmFmt* SwDoc::GetFlyNum( sal_uInt16 nIdx, FlyCntType eType )
 {
-    SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+    SwFrmFmts& rFmts = *GetSpzFrmFmts();
     SwFrmFmt* pRetFmt = 0;
-    sal_uInt16 nSize = rFmts.Count();
+    sal_uInt16 nSize = rFmts.size();
     const SwNodeIndex* pIdx;
     sal_uInt16 nCount = 0;
     for( sal_uInt16 i = 0; !pRetFmt && i < nSize; ++i )
@@ -886,7 +886,7 @@ int SwDoc::Chainable( const SwFrmFmt &rSource, const SwFrmFmt &rDest )
         pTxtNd->GetTxt().Len() )
         return SW_CHAIN_NOT_EMPTY;
 
-    sal_uInt16 nArrLen = GetSpzFrmFmts()->Count();
+    sal_uInt16 nArrLen = GetSpzFrmFmts()->size();
     for( sal_uInt16 n = 0; n < nArrLen; ++n )
     {
         const SwFmtAnchor& rAnchor = (*GetSpzFrmFmts())[ n ]->GetAnchor();
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index eeefa15..73df01b 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -80,24 +80,16 @@ using namespace ::com::sun::star::i18n;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 
-SV_IMPL_PTRARR(SwFrmFmts,SwFrmFmtPtr)
-SV_IMPL_PTRARR(SwCharFmts,SwCharFmtPtr)
-
-// Specific frame formats (frames)
-SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr)
-
 /*
  * Internal functions
  */
 
-sal_Bool SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs )
+static void SetTxtFmtCollNext( SwTxtFmtColl* pTxtColl, const SwTxtFmtColl* pDel )
 {
-    SwTxtFmtColl *pDel = (SwTxtFmtColl*) pArgs;
-    if ( &rpTxtColl->GetNextTxtFmtColl() == pDel )
+    if ( &pTxtColl->GetNextTxtFmtColl() == pDel )
     {
-        rpTxtColl->SetNextTxtFmtColl( *rpTxtColl );
+        pTxtColl->SetNextTxtFmtColl( *pTxtColl );
     }
-    return sal_True;
 }
 
 /*
@@ -1313,7 +1305,8 @@ void SwDoc::DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast)
         GetIDocumentUndoRedo().AppendUndo(pUndo);
     }
 
-    pCharFmtTbl->DeleteAndDestroy(nFmt);
+    delete (*pCharFmtTbl)[nFmt];
+    pCharFmtTbl->erase(pCharFmtTbl->begin() + nFmt);
 
     SetModified();
 }
@@ -1322,7 +1315,6 @@ void SwDoc::DelCharFmt( SwCharFmt *pFmt, sal_Bool bBroadcast )
 {
     sal_uInt16 nFmt = pCharFmtTbl->GetPos( pFmt );
     OSL_ENSURE( USHRT_MAX != nFmt, "Fmt not found," );
-
     DelCharFmt( nFmt, bBroadcast );
 }
 
@@ -1338,8 +1330,8 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast )
     {
 
         // The format has to be in the one or the other, we'll see in which one.
-        sal_uInt16 nPos;
-        if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) )
+        SwFrmFmts::iterator it = std::find( pFrmFmtTbl->begin(), pFrmFmtTbl->end(), pFmt );
+        if ( it != pFrmFmtTbl->end() )
         {
             if (bBroadcast)
                 BroadcastStyleOperation(pFmt->GetName(),
@@ -1353,23 +1345,28 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast )
                 GetIDocumentUndoRedo().AppendUndo(pUndo);
             }
 
-            pFrmFmtTbl->DeleteAndDestroy( nPos );
+            delete *it;
+            pFrmFmtTbl->erase(it);
         }
         else
         {
-            nPos = GetSpzFrmFmts()->GetPos( pFmt );
-            OSL_ENSURE( nPos != USHRT_MAX, "FrmFmt not found." );
-            if( USHRT_MAX != nPos )
-                GetSpzFrmFmts()->DeleteAndDestroy( nPos );
+            SwFrmFmts::iterator it2 = std::find( GetSpzFrmFmts()->begin(), GetSpzFrmFmts()->end(), pFmt );
+            OSL_ENSURE( it2 != GetSpzFrmFmts()->end(), "FrmFmt not found." );
+            if( it2 != GetSpzFrmFmts()->end() )
+            {
+                delete *it2;
+                GetSpzFrmFmts()->erase( it2 );
+            }
         }
     }
 }
 
 void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt )
 {
-    sal_uInt16 nPos = pTblFrmFmtTbl->GetPos( pFmt );
-    OSL_ENSURE( USHRT_MAX != nPos, "Fmt not found," );
-    pTblFrmFmtTbl->DeleteAndDestroy( nPos );
+    SwFrmFmts::iterator it = std::find( pTblFrmFmtTbl->begin(), pTblFrmFmtTbl->end(), pFmt );
+    OSL_ENSURE( it != pTblFrmFmtTbl->end(), "Fmt not found," );
+    delete *it;
+    pTblFrmFmtTbl->erase(it);
 }
 
 /*
@@ -1379,7 +1376,7 @@ SwFlyFrmFmt *SwDoc::MakeFlyFrmFmt( const String &rFmtName,
                                     SwFrmFmt *pDerivedFrom )
 {
     SwFlyFrmFmt *pFmt = new SwFlyFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
-    GetSpzFrmFmts()->Insert(pFmt, GetSpzFrmFmts()->Count());
+    GetSpzFrmFmts()->push_back(pFmt);
     SetModified();
     return pFmt;
 }
@@ -1388,7 +1385,7 @@ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName,
                                      SwFrmFmt *pDerivedFrom )
 {
     SwDrawFrmFmt *pFmt = new SwDrawFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom);
-    GetSpzFrmFmts()->Insert(pFmt,GetSpzFrmFmts()->Count());
+    GetSpzFrmFmts()->push_back(pFmt);
     SetModified();
     return pFmt;
 }
@@ -1396,14 +1393,13 @@ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName,
 
 sal_uInt16 SwDoc::GetTblFrmFmtCount(sal_Bool bUsed) const
 {
-    sal_uInt16 nCount = pTblFrmFmtTbl->Count();
+    sal_uInt16 nCount = pTblFrmFmtTbl->size();
     if(bUsed)
     {
         SwAutoFmtGetDocNode aGetHt( &GetNodes() );
         for ( sal_uInt16 i = nCount; i; )
         {
             if((*pTblFrmFmtTbl)[--i]->GetInfo( aGetHt ))
-
                 --nCount;
         }
     }
@@ -1433,7 +1429,7 @@ SwTableFmt* SwDoc::MakeTblFrmFmt( const String &rFmtName,
                                     SwFrmFmt *pDerivedFrom )
 {
     SwTableFmt* pFmt = new SwTableFmt( GetAttrPool(), rFmtName, pDerivedFrom );
-    pTblFrmFmtTbl->Insert( pFmt, pTblFrmFmtTbl->Count() );
+    pTblFrmFmtTbl->push_back( pFmt );
     SetModified();
 
     return pFmt;
@@ -1447,7 +1443,7 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName,
     SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
 
     pFmt->SetAuto(bAuto);
-    pFrmFmtTbl->Insert( pFmt, pFrmFmtTbl->Count());
+    pFrmFmtTbl->push_back( pFmt );
     SetModified();
 
     if (bBroadcast)
@@ -1483,7 +1479,7 @@ SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName,
                                sal_Bool )
 {
     SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom );
-    pCharFmtTbl->Insert( pFmt, pCharFmtTbl->Count() );
+    pCharFmtTbl->push_back( pFmt );
     pFmt->SetAuto( sal_False );
     SetModified();
 
@@ -1525,7 +1521,7 @@ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName,
 {
     SwTxtFmtColl *pFmtColl = new SwTxtFmtColl( GetAttrPool(), rFmtName,
                                                 pDerivedFrom );
-    pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
+    pTxtFmtCollTbl->push_back(pFmtColl);
     pFmtColl->SetAuto( sal_False );
     SetModified();
 
@@ -1560,7 +1556,7 @@ SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const String &rFmtName,
 {
     SwConditionTxtFmtColl*pFmtColl = new SwConditionTxtFmtColl( GetAttrPool(),
                                                     rFmtName, pDerivedFrom );
-    pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
+    pTxtFmtCollTbl->push_back(pFmtColl);
     pFmtColl->SetAuto( sal_False );
     SetModified();
 
@@ -1579,7 +1575,7 @@ SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const String &rFmtName,
 {
     SwGrfFmtColl *pFmtColl = new SwGrfFmtColl( GetAttrPool(), rFmtName,
                                                 pDerivedFrom );
-    pGrfFmtCollTbl->Insert( pFmtColl, pGrfFmtCollTbl->Count() );
+    pGrfFmtCollTbl->push_back( pFmtColl );
     pFmtColl->SetAuto( sal_False );
     SetModified();
     return pFmtColl;
@@ -1607,10 +1603,10 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast)
     }
 
     // Remove the FmtColl
-    pTxtFmtCollTbl->Remove(nFmtColl);
+    pTxtFmtCollTbl->erase(pTxtFmtCollTbl->begin() + nFmtColl);
     // Correct next
-    pTxtFmtCollTbl->ForEach( 1, pTxtFmtCollTbl->Count(),
-                            &SetTxtFmtCollNext, pDel );
+    for( SwTxtFmtColls::const_iterator it = pTxtFmtCollTbl->begin() + 1; it != pTxtFmtCollTbl->end(); ++it )
+        SetTxtFmtCollNext( *it, pDel );
     delete pDel;
     SetModified();
 }
@@ -1734,17 +1730,17 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
 // ---- Copy the formats to itself (SwDoc) ----------------------
 
 SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt,
-                        const SvPtrarr& rFmtArr,
+                        const SwFmtsBase& rFmtArr,
                         FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt )
 {
     // It's no autoformat, default format or collection format,
     // then search for it.
     if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() )
-        for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ )
+        for( sal_uInt16 n = 0; n < rFmtArr.GetFmtCount(); n++ )
         {
             // Does the Doc already contain the template?
-            if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() ))
-                return (SwFmt*)rFmtArr[n];
+            if( rFmtArr.GetFmt(n)->GetName().Equals( rFmt.GetName() ))
+                return (SwFmt*)rFmtArr.GetFmt(n);
         }
 
     // Search for the "parent" first
@@ -1805,7 +1801,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl )
     {
         pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), rColl.GetName(),
                                                 pParent);
-        pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
+        pTxtFmtCollTbl->push_back( pNewColl );
         pNewColl->SetAuto( sal_False );
         SetModified();
 
@@ -1895,8 +1891,8 @@ SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const String& rName )
     return 0;
 }
 
-void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
-                        SvPtrarr& rDestArr,
+void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr,
+                        SwFmtsBase& rDestArr,
                         FNCopyFmt fnCopyFmt,
                         SwFmt& rDfltFmt )
 {
@@ -1904,9 +1900,9 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
     SwFmt* pSrc, *pDest;
 
     // 1st step: Create all formats (skip the 0th - it's the default one)
-    for( nSrc = rSourceArr.Count(); nSrc > 1; )
+    for( nSrc = rSourceArr.GetFmtCount(); nSrc > 1; )
     {
-        pSrc = (SwFmt*)rSourceArr[ --nSrc ];
+        pSrc = (SwFmt*)rSourceArr.GetFmt( --nSrc );
         if( pSrc->IsDefault() || pSrc->IsAuto() )
             continue;
 
@@ -1921,9 +1917,9 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
     }
 
     // 2nd step: Copy all attributes, set the right parents
-    for( nSrc = rSourceArr.Count(); nSrc > 1; )
+    for( nSrc = rSourceArr.GetFmtCount(); nSrc > 1; )
     {
-        pSrc = (SwFmt*)rSourceArr[ --nSrc ];
+        pSrc = (SwFmt*)rSourceArr.GetFmt( --nSrc );
         if( pSrc->IsDefault() || pSrc->IsAuto() )
             continue;
 
@@ -2206,16 +2202,16 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
     SetModified();
 }
 
-SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr,
+SwFmt* SwDoc::FindFmtByName( const SwFmtsBase& rFmtArr,
                                     const String& rName ) const
 {
     SwFmt* pFnd = 0;
-    for( sal_uInt16 n = 0; n < rFmtArr.Count(); n++ )
+    for( sal_uInt16 n = 0; n < rFmtArr.GetFmtCount(); n++ )
     {
         // Does the Doc already contain the template?
-        if( ((SwFmt*)rFmtArr[n])->GetName() == rName )
+        if( rFmtArr.GetFmt(n)->GetName() == rName )
         {
-            pFnd = (SwFmt*)rFmtArr[n];
+            pFnd = (SwFmt*)rFmtArr.GetFmt(n);
             break;
         }
     }
@@ -2514,7 +2510,7 @@ namespace docfunc
         const SwTxtFmtColls* pTxtFmtColls( rDoc.GetTxtFmtColls() );
         if ( pTxtFmtColls )
         {
-            const sal_uInt16 nCount = pTxtFmtColls->Count();
+            const sal_uInt16 nCount = pTxtFmtColls->size();
             for ( sal_uInt16 i = 0; i < nCount; ++i )
             {
                 SwTxtFmtColl* pTxtFmtColl = (*pTxtFmtColls)[i];
@@ -2547,4 +2543,40 @@ namespace docfunc
     }
 }
 
+SwFmtsBase::~SwFmtsBase() {}
+
+sal_uInt16 SwFrmFmts::GetPos(const SwFrmFmt* p) const
+{
+    const_iterator it = std::find(begin(), end(), p);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+bool SwFrmFmts::Contains(const SwFrmFmt* p) const
+{
+    return std::find(begin(), end(), p) != end();
+}
+
+SwFrmFmts::~SwFrmFmts()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
+sal_uInt16 SwCharFmts::GetPos(const SwCharFmt* p) const
+{
+    const_iterator it = std::find(begin(), end(), p);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+bool SwCharFmts::Contains(const SwCharFmt* p) const
+{
+    return std::find(begin(), end(), p) != end();
+}
+
+SwCharFmts::~SwCharFmts()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index d499082..d3a4cf5 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -191,7 +191,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
     {
         // Look for the 1st level OutlineTemplate
         const SwTxtFmtColls& rFmtColls =*GetTxtFmtColls();
-        for( sal_uInt16 n = rFmtColls.Count(); n; )
+        for( sal_uInt16 n = rFmtColls.size(); n; )
             if ( rFmtColls[ --n ]->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
             {
                 pSplitColl = rFmtColls[ n ];
@@ -330,7 +330,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
                     // We need to have a Layout for the HTMLFilter, so that
                     // TextFrames/Controls/OLE objects can be exported correctly as graphics.
                     if( SPLITDOC_TO_HTML == eDocType &&
-                        pDoc->GetSpzFrmFmts()->Count() )
+                        !pDoc->GetSpzFrmFmts()->empty() )
                     {
                             SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
                     }
@@ -377,7 +377,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
                             CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), sal_True);
 
                             // If FlyFrames are still around, delete these too
-                            for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+                            for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->size(); ++n )
                             {
                                 SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
                                 const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
@@ -496,8 +496,8 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
         if( get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
         {
             // save all remaining sections
-            while( GetSections().Count() )
-                DelSectionFmt( GetSections()[ 0 ] );
+            while( !GetSections().empty() )
+                DelSectionFmt( GetSections().front() );
 
             SfxFilterContainer* pFCntnr = pDocShell->GetFactory().GetFilterContainer();
             pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SFX_FILTER_EXPORT );
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 1b04015..5dbff90 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -282,13 +282,13 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
             const SwNodeIndex* pCntntIdx = pFmt->GetCntnt().GetCntntIdx();
             if ( pCntntIdx )
             {
-                const SwSpzFrmFmts* pTbl = pFmt->GetDoc()->GetSpzFrmFmts();
+                const SwFrmFmts* pTbl = pFmt->GetDoc()->GetSpzFrmFmts();
                 if ( pTbl )
                 {
                     std::vector<SwFrmFmt*> aToDeleteFrmFmts;
                     const sal_uLong nNodeIdxOfFlyFmt( pCntntIdx->GetIndex() );
 
-                    for ( sal_uInt16 i = 0; i < pTbl->Count(); ++i )
+                    for ( sal_uInt16 i = 0; i < pTbl->size(); ++i )
                     {
                         SwFrmFmt* pTmpFmt = (*pTbl)[i];
                         const SwFmtAnchor &rAnch = pTmpFmt->GetAnchor();
@@ -1026,7 +1026,7 @@ void SwDoc::GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts,
     SwFrmFmt *pFly;
 
     // collect all anchored somehow to paragraphs
-    for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+    for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->size(); ++n )
     {
         pFly = (*GetSpzFrmFmts())[ n ];
         bool bDrawFmt = bDrawAlso ? RES_DRAWFRMFMT == pFly->Which() : false;
@@ -1175,7 +1175,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
     SwTxtFmtColl * pColl = NULL;
     if( pType )
     {
-        for( sal_uInt16 i = pTxtFmtCollTbl->Count(); i; )
+        for( sal_uInt16 i = pTxtFmtCollTbl->size(); i; )
         {
             if( (*pTxtFmtCollTbl)[ --i ]->GetName().Equals(pType->GetName()) )
             {
@@ -1531,7 +1531,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
     SwTxtFmtColl *pColl = NULL;
     if( pType )
     {
-        for( sal_uInt16 i = pTxtFmtCollTbl->Count(); i; )
+        for( sal_uInt16 i = pTxtFmtCollTbl->size(); i; )
         {
             if( (*pTxtFmtCollTbl)[ --i ]->GetName().Equals(pType->GetName()) )
             {
@@ -1941,15 +1941,15 @@ static String lcl_GetUniqueFlyName( const SwDoc* pDoc, sal_uInt16 nDefStrId )
     String aName( aId );
     xub_StrLen nNmLen = aName.Len();
 
-    const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+    const SwFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
 
-    sal_uInt16 nNum, nTmp, nFlagSize = ( rFmts.Count() / 8 ) +2;
+    sal_uInt16 nNum, nTmp, nFlagSize = ( rFmts.size() / 8 ) +2;
     sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
     sal_uInt16 n;
 
     memset( pSetFlags, 0, nFlagSize );
 
-    for( n = 0; n < rFmts.Count(); ++n )
+    for( n = 0; n < rFmts.size(); ++n )
     {
         const SwFrmFmt* pFlyFmt = rFmts[ n ];
         if( RES_FLYFRMFMT == pFlyFmt->Which() &&
@@ -1957,13 +1957,13 @@ static String lcl_GetUniqueFlyName( const SwDoc* pDoc, sal_uInt16 nDefStrId )
         {
             // Only get and set the Flag
             nNum = static_cast< sal_uInt16 >( pFlyFmt->GetName().Copy( nNmLen ).ToInt32() );
-            if( nNum-- && nNum < rFmts.Count() )
+            if( nNum-- && nNum < rFmts.size() )
                 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
         }
     }
 
     // All numbers are flagged accordingly, so determine the right one
-    nNum = rFmts.Count();
+    nNum = rFmts.size();
     for( n = 0; n < nFlagSize; ++n )
         if( 0xff != ( nTmp = pSetFlags[ n ] ))
         {
@@ -1995,8 +1995,8 @@ String SwDoc::GetUniqueFrameName() const
 
 const SwFlyFrmFmt* SwDoc::FindFlyByName( const String& rName, sal_Int8 nNdTyp ) const
 {
-    const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
-    for( sal_uInt16 n = rFmts.Count(); n; )
+    const SwFrmFmts& rFmts = *GetSpzFrmFmts();
+    for( sal_uInt16 n = rFmts.size(); n; )
     {
         const SwFrmFmt* pFlyFmt = rFmts[ --n ];
         const SwNodeIndex* pIdx;
@@ -2050,13 +2050,14 @@ void SwDoc::SetAllUniqueFlyNames()
     String sGrfNm( nGrfId );
     String sOLENm( nOLEId );
 
-    if( 255 < ( n = GetSpzFrmFmts()->Count() ))
+    if( 255 < ( n = GetSpzFrmFmts()->size() ))
         n = 255;
-    SwSpzFrmFmts aArr( (sal_Int8)n );
-    SwFrmFmtPtr pFlyFmt;
+    SwFrmFmts aArr;
+    aArr.reserve( (sal_Int8)n );
+    SwFrmFmt* pFlyFmt;
     sal_Bool bLoadedFlag = sal_True;            // something for the Layout
 
-    for( n = GetSpzFrmFmts()->Count(); n; )
+    for( n = GetSpzFrmFmts()->size(); n; )
     {
         if( RES_FLYFRMFMT == (pFlyFmt = (*GetSpzFrmFmts())[ --n ])->Which() )
         {
@@ -2077,7 +2078,7 @@ void SwDoc::SetAllUniqueFlyNames()
             }
             else
                 // we want to set that afterwards
-                aArr.Insert( pFlyFmt, aArr.Count() );
+                aArr.push_back( pFlyFmt );
 
         }
         if( bLoadedFlag )
@@ -2099,7 +2100,7 @@ void SwDoc::SetAllUniqueFlyNames()
 
     const SwNodeIndex* pIdx;
 
-    for( n = aArr.Count(); n; )
+    for( n = aArr.size(); n; )
         if( 0 != ( pIdx = ( pFlyFmt = aArr[ --n ])->GetCntnt().GetCntntIdx() )
             && pIdx->GetNode().GetNodes().IsDocNodes() )
         {
@@ -2122,7 +2123,7 @@ void SwDoc::SetAllUniqueFlyNames()
             }
             pFlyFmt->SetName( sNm += String::CreateFromInt32( nNum ));
         }
-    aArr.Remove( 0, aArr.Count() );
+    aArr.clear();
 
     if( GetFtnIdxs().Count() )
     {
@@ -2181,7 +2182,7 @@ sal_Bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const
     {
         // get up by using the Anchor
         sal_uInt16 n;
-        for( n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+        for( n = 0; n < GetSpzFrmFmts()->size(); ++n )
         {
             const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[ n ];
             const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
@@ -2199,7 +2200,7 @@ sal_Bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const
                 break;
             }
         }
-        if( n >= GetSpzFrmFmts()->Count() )
+        if( n >= GetSpzFrmFmts()->size() )
         {
             OSL_ENSURE( mbInReading, "Found a FlySection but not a Format!" );
             return sal_False;
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 270d6af..e8b60c3 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -128,9 +128,6 @@ const sal_Char sCharFmtStr[] = "Zeichenformat";
 const sal_Char sTxtCollStr[] = "Textformatvorlage";
 const sal_Char sGrfCollStr[] = "Graphikformatvorlage";
 
-SV_IMPL_PTRARR( SwTxtFmtColls, SwTxtFmtCollPtr)
-SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr)
-
 /*
  * global functions...
  */
@@ -192,15 +189,14 @@ void StartGrammarChecking( SwDoc &rDoc )
 /*
  * internal functions
  */
-sal_Bool lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* )
+static void lcl_DelFmtIndizes( SwFmt* pFmt )
 {
-    SwFmtCntnt &rFmtCntnt = (SwFmtCntnt&)rpFmt->GetCntnt();
+    SwFmtCntnt &rFmtCntnt = (SwFmtCntnt&)pFmt->GetCntnt();
     if ( rFmtCntnt.GetCntntIdx() )
         rFmtCntnt.SetNewCntntIdx( 0 );
-    SwFmtAnchor &rFmtAnchor = (SwFmtAnchor&)rpFmt->GetAnchor();
+    SwFmtAnchor &rFmtAnchor = (SwFmtAnchor&)pFmt->GetAnchor();
     if ( rFmtAnchor.GetCntntAnchor() )
         rFmtAnchor.SetAnchor( 0 );
-    return sal_True;
 }
 
 /*
@@ -222,7 +218,7 @@ SwDoc::SwDoc()
     pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ),
     pFrmFmtTbl( new SwFrmFmts() ),
     pCharFmtTbl( new SwCharFmts() ),
-    pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
+    pSpzFrmFmtTbl( new SwFrmFmts() ),
     pSectionFmtTbl( new SwSectionFmts() ),
     pTblFrmFmtTbl( new SwFrmFmts() ),
     pTxtFmtCollTbl( new SwTxtFmtColls() ),
@@ -376,14 +372,14 @@ SwDoc::SwDoc()
      * DefaultFormats and are also in the list.
      */
     /* Formats */
-    pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
-    pCharFmtTbl->Insert(pDfltCharFmt, 0 );
+    pFrmFmtTbl->push_back(pDfltFrmFmt);
+    pCharFmtTbl->push_back(pDfltCharFmt);
 
     /* FmtColls */
     // TXT
-    pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
+    pTxtFmtCollTbl->push_back(pDfltTxtFmtColl);
     // GRF
-    pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
+    pGrfFmtCollTbl->push_back(pDfltGrfFmtColl);
 
     // Create PageDesc, EmptyPageFmt and ColumnFmt
     if ( aPageDescs.empty() )
@@ -444,6 +440,46 @@ SwDoc::SwDoc()
     ResetModified();
 }
 
+static void DeleteAndDestroy(SwFrmFmts& rFmts, int aStartIdx, int aEndIdx)
+{
+    if (aEndIdx < aStartIdx)
+        return;
+    for( SwFrmFmts::const_iterator it = rFmts.begin() + aStartIdx;
+         it != rFmts.begin() + aEndIdx; ++it )
+             delete *it;
+    rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
+}
+
+static void DeleteAndDestroy(SwTxtFmtColls& rFmts, int aStartIdx, int aEndIdx)
+{
+    if (aEndIdx < aStartIdx)
+        return;
+    for( SwTxtFmtColls::const_iterator it = rFmts.begin() + aStartIdx;
+         it != rFmts.begin() + aEndIdx; ++it )
+             delete *it;
+    rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
+}
+
+static void DeleteAndDestroy(SwCharFmts& rFmts, int aStartIdx, int aEndIdx)
+{
+    if (aEndIdx < aStartIdx)
+        return;
+    for( SwCharFmts::const_iterator it = rFmts.begin() + aStartIdx;
+         it != rFmts.begin() + aEndIdx; ++it )
+             delete *it;
+    rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
+}
+
+static void DeleteAndDestroy(SwGrfFmtColls& rFmts, int aStartIdx, int aEndIdx)
+{
+    if (aEndIdx < aStartIdx)
+        return;
+    for( SwGrfFmtColls::const_iterator it = rFmts.begin() + aStartIdx;
+         it != rFmts.begin() + aEndIdx; ++it )
+             delete *it;
+    rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
+}
+
 /*
  * Speciality: a member of the class SwDoc is located at
  * position 0 in the array of the Format and GDI objects.
@@ -559,9 +595,12 @@ SwDoc::~SwDoc()
 
     // Any of the FrmFormats can still have indices registered.
     // These need to be destroyed now at the latest.
-    pFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
-    pSpzFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
-    ((SwFrmFmts&)*pSectionFmtTbl).ForEach( &lcl_DelFmtIndizes, this );
+    BOOST_FOREACH( SwFrmFmt* pFmt, *pFrmFmtTbl )
+        lcl_DelFmtIndizes( pFmt );
+    BOOST_FOREACH( SwFrmFmt* pFmt, *pSpzFrmFmtTbl )
+        lcl_DelFmtIndizes( pFmt );
+    BOOST_FOREACH( SwSectionFmt* pFmt, *pSectionFmtTbl )
+        lcl_DelFmtIndizes( pFmt );
 
     // The formattings that come hereafter depend on the default formattings.
     // [Destroy] these only after destroying the FmtIndices, because the content
@@ -592,15 +631,15 @@ SwDoc::~SwDoc()
     // Optimization: Based on the fact that Standard is always 2nd in the
     // array, we should delete it as the last. With this we avoid
     // remangling the Formats all the time!
-    if( 2 < pTxtFmtCollTbl->Count() )
-        pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
-    pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
+    if( 2 < pTxtFmtCollTbl->size() )
+        DeleteAndDestroy( *pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size()-2 );
+    DeleteAndDestroy( *pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size()-1 );
     delete pTxtFmtCollTbl;
 
     OSL_ENSURE( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0],
             "DefaultGrfCollection must always be at the start" );
 
-    pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
+    DeleteAndDestroy( *pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size()-1 );
     // Is the result anyway - no _DEL array!
     //  pGrfFmtCollTbl->Remove( 0, n );
     delete pGrfFmtCollTbl;
@@ -611,8 +650,8 @@ SwDoc::~SwDoc()
      * In order to not be deleted by the array's dtor, we remove them
      * now.
      */
-    pFrmFmtTbl->Remove( 0 );
-    pCharFmtTbl->Remove( 0 );
+    pFrmFmtTbl->erase( pFrmFmtTbl->begin() );
+    pCharFmtTbl->erase( pCharFmtTbl->begin() );
 
     // Delete for pPrt
     DELETEZ( pPrt );
@@ -621,7 +660,7 @@ SwDoc::~SwDoc()
     // All Flys need to be destroyed before the Drawing Model,
     // because Flys can still contain DrawContacts, when no
     // Layout could be constructed due to a read error.
-    pSpzFrmFmtTbl->DeleteAndDestroy( 0, pSpzFrmFmtTbl->Count() );
+    DeleteAndDestroy( *pSpzFrmFmtTbl, 0, pSpzFrmFmtTbl->size() );
 
     // Only now destroy the Model, the drawing objects - which are also
     // contained in the Undo - need to remove their attributes from the
@@ -771,7 +810,7 @@ void SwDoc::ClearDoc()
 
     // if there are still FlyFrames dangling around, delete them too
     sal_uInt16 n;
-    while ( 0 != (n = GetSpzFrmFmts()->Count()) )
+    while ( 0 != (n = GetSpzFrmFmts()->size()) )
         DelLayoutFmt((*pSpzFrmFmtTbl)[n-1]);
     OSL_ENSURE( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(),
                 "not all DrawObjects removed from the page" );
@@ -836,21 +875,21 @@ void SwDoc::ClearDoc()
     // Optimization: Based on the fact that Standard is always 2nd in the
     // array, we should delete it as the last. With this we avoid
     // remangling the Formats all the time!
-    if( 2 < pTxtFmtCollTbl->Count() )
-        pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
-    pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
-    pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
-    pCharFmtTbl->DeleteAndDestroy( 1, pCharFmtTbl->Count()-1 );
+    if( 2 < pTxtFmtCollTbl->size() )
+        DeleteAndDestroy( *pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size()-2 );
+    DeleteAndDestroy( *pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size()-1 );
+    DeleteAndDestroy( *pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size()-1 );
+    DeleteAndDestroy( *pCharFmtTbl, 1, pCharFmtTbl->size()-1 );
 
     if( pCurrentView )
     {
         // search the FrameFormat of the root frm. This is not allowed to delete
-        pFrmFmtTbl->Remove( pFrmFmtTbl->GetPos( pCurrentView->GetLayout()->GetFmt() ) );
-        pFrmFmtTbl->DeleteAndDestroy( 1, pFrmFmtTbl->Count()-1 );
-        pFrmFmtTbl->Insert( pCurrentView->GetLayout()->GetFmt(), pFrmFmtTbl->Count() );
+        pFrmFmtTbl->erase( std::find( pFrmFmtTbl->begin(), pFrmFmtTbl->end(), pCurrentView->GetLayout()->GetFmt() ) );
+        DeleteAndDestroy( *pFrmFmtTbl, 1, pFrmFmtTbl->size()-1 );
+        pFrmFmtTbl->push_back( pCurrentView->GetLayout()->GetFmt() );
     }
     else    //swmod 071029//swmod 071225
-        pFrmFmtTbl->DeleteAndDestroy( 1, pFrmFmtTbl->Count()-1 );
+        DeleteAndDestroy( *pFrmFmtTbl, 1, pFrmFmtTbl->size()-1 );
 
     xForbiddenCharsTable.clear();
 
@@ -1208,9 +1247,9 @@ void SwDoc::Paste( const SwDoc& rSource )
             this->DelFullPara(aPara);
         }
         //additionally copy page bound frames
-        if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->Count() )
+        if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->size() )
         {
-            for ( sal_uInt16 i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i )
+            for ( sal_uInt16 i = 0; i < rSource.GetSpzFrmFmts()->size(); ++i )
             {
                 sal_Bool bInsWithFmt = sal_True;
                 const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i];
@@ -1235,4 +1274,22 @@ void SwDoc::Paste( const SwDoc& rSource )
     UpdateFlds(NULL, false);
 }
 
+sal_uInt16 SwTxtFmtColls::GetPos(const SwTxtFmtColl* p) const
+{
+    const_iterator it = std::find(begin(), end(), p);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+bool SwTxtFmtColls::Contains(const SwTxtFmtColl* p) const
+{
+    return std::find(begin(), end(), p) != end();
+}
+
+sal_uInt16 SwGrfFmtColls::GetPos(const SwGrfFmtColl* p) const
+{
+    const_iterator it = std::find(begin(), end(), p);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 7caae4d..5ba43b4 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -156,7 +156,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
 
 void SwDoc::PropagateOutlineRule()
 {
-    for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); n++)
+    for (sal_uInt16 n = 0; n < pTxtFmtCollTbl->size(); n++)
     {
         SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n];
 
@@ -211,7 +211,7 @@ sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
     SwTxtFmtColl* aCollArr[ MAXLEVEL ];
     memset( aCollArr, 0, sizeof( SwTxtFmtColl* ) * MAXLEVEL );
 
-    for( n = 0; n < pTxtFmtCollTbl->Count(); ++n )
+    for( n = 0; n < pTxtFmtCollTbl->size(); ++n )
     {
         if((*pTxtFmtCollTbl)[ n ]->IsAssignedToListLevelOfOutlineStyle())
         {
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 7f31f84..29284de 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -312,7 +312,7 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
     const SwPosition *pStart = rPaM.Start(), *pEnd = rPaM.End();
 
     // Set index to the Selection's start
-    for ( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+    for ( sal_uInt16 n = 0; n < GetSpzFrmFmts()->size(); ++n )
     {
         SwFrmFmt *const pFmt = static_cast<SwFrmFmt*>((*GetSpzFrmFmts())[n]);
         SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 11488d7..ffeb89c 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -641,11 +641,11 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
 
     sal_uInt16 nNum = 0;
     sal_uInt16 nTmp = 0;
-    sal_uInt16 nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2;
+    sal_uInt16 nFlagSize = ( pSectionFmtTbl->size() / 8 ) +2;
     sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
     memset( pSetFlags, 0, nFlagSize );
 
-    for( n = 0; n < pSectionFmtTbl->Count(); ++n )
+    for( n = 0; n < pSectionFmtTbl->size(); ++n )
         if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) )&&
              TOX_CONTENT_SECTION == (pSect = &pSectNd->GetSection())->GetType())
         {
@@ -654,7 +654,7 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
             {
                 // Calculate number and set the Flag
                 nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32();
-                if( nNum-- && nNum < pSectionFmtTbl->Count() )
+                if( nNum-- && nNum < pSectionFmtTbl->size() )
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
             if( pChkStr && pChkStr->Equals( rNm ) )
@@ -664,7 +664,7 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
     if( !pChkStr )
     {
         // All Numbers have been flagged accordingly, so get the right Number
-        nNum = pSectionFmtTbl->Count();
+        nNum = pSectionFmtTbl->size();
         for( n = 0; n < nFlagSize; ++n )
             if( 0xff != ( nTmp = pSetFlags[ n ] ))
             {
@@ -1513,7 +1513,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode )
     SwNodes& rNds = pDoc->GetNodes();
     const SwFrmFmts& rArr = *pDoc->GetTblFrmFmts();
 
-    for( sal_uInt16 n = 0; n < rArr.Count(); ++n )
+    for( sal_uInt16 n = 0; n < rArr.size(); ++n )
     {
         ::SetProgressState( 0, pDoc->GetDocShell() );
 
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 484b977..e781cc8 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -842,7 +842,7 @@ SwNumRule& SwNumRule::CopyNumRule( SwDoc* pDoc, const SwNumRule& rNumRule )
     {
         Set( n, rNumRule.aFmts[ n ] );
         if( aFmts[ n ] && aFmts[ n ]->GetCharFmt() &&
-            USHRT_MAX == pDoc->GetCharFmts()->GetPos( aFmts[n]->GetCharFmt() ))
+            !pDoc->GetCharFmts()->Contains( aFmts[n]->GetCharFmt() ))
             // If we copy across different Documents, then copy the
             // corresponding CharFormat into the new Document.
             aFmts[n]->SetCharFmt( pDoc->CopyCharFmt( *aFmts[n]->
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 467bb38..c0f2caf 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -325,7 +325,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
 
     SwTxtFmtColl* pNewColl;
     sal_uInt16 nOutLvlBits = 0;
-    for( sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); ++n )
+    for( sal_uInt16 n = 0; n < pTxtFmtCollTbl->size(); ++n )
     {
         if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() )
         {
@@ -375,7 +375,7 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
                                             ? pDfltTxtFmtColl
                                             : GetTxtCollFromPool( nParent ));
         pNewColl->SetPoolFmtId( nId );
-        pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
+        pTxtFmtCollTbl->push_back( pNewColl );
     }
 
     switch( nId )
@@ -1060,7 +1060,7 @@ bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const
 
     SwTxtFmtColl* pNewColl = 0;
     sal_Bool bFnd = sal_False;
-    for( sal_uInt16 n = 0; !bFnd && n < pTxtFmtCollTbl->Count(); ++n )
+    for( sal_uInt16 n = 0; !bFnd && n < pTxtFmtCollTbl->size(); ++n )
     {
         pNewColl = (*pTxtFmtCollTbl)[ n ];
         if( nId == pNewColl->GetPoolFmtId() )
@@ -1081,7 +1081,7 @@ SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
     SwFmt *pNewFmt = 0;
     SwFmt *pDeriveFmt = 0;
 
-    SvPtrarr* pArray[ 2 ];
+    SwFmtsBase* pArray[ 2 ];
     sal_uInt16 nArrCnt = 1, nRCId = 0;
     sal_uInt16* pWhichRange = 0;
 
@@ -1134,8 +1134,8 @@ SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
     OSL_ENSURE( nRCId, "invalid Id" );
 
     while( nArrCnt-- )
-        for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).Count(); ++n )
-            if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
+        for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).GetFmtCount(); ++n )
+            if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )->
                     GetPoolFmtId() )
             {
                 return pNewFmt;
@@ -1369,7 +1369,7 @@ SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId )
 bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
 {
     SwFmt *pNewFmt = 0;
-    const SvPtrarr* pArray[ 2 ];
+    const SwFmtsBase* pArray[ 2 ];
     sal_uInt16 nArrCnt = 1;
     sal_Bool bFnd = sal_True;
 
@@ -1393,8 +1393,8 @@ bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
     {
         bFnd = sal_False;
         while( nArrCnt-- && !bFnd )
-            for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n )
-                if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
+            for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).GetFmtCount(); ++n )
+                if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )->
                         GetPoolFmtId() )
                     bFnd = sal_True;
     }
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 7f6cbf0..582370d 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -570,7 +570,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
         }
 
         // If we still have FlyFrames hanging around, delete them too
-        for( sal_uInt16 n = 0; n < pDoc->GetSpzFrmFmts()->Count(); ++n )
+        for( sal_uInt16 n = 0; n < pDoc->GetSpzFrmFmts()->size(); ++n )
         {
             SwFrmFmt *const pFly = (*pDoc->GetSpzFrmFmts())[n];
             SwFmtAnchor const*const pAnchor = &pFly->GetAnchor();
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index a698cd6..c94534c 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -434,7 +434,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
     if( !pDoc->IsCopyIsMove() )
     {
         const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
-        for( sal_uInt16 n = rTblFmts.Count(); n; )
+        for( sal_uInt16 n = rTblFmts.size(); n; )
             if( rTblFmts[ --n ]->GetName() == sTblName )
             {
                 sTblName = pDoc->GetUniqueTblName();
@@ -543,9 +543,9 @@ void SwTxtNode::CopyCollFmt( SwTxtNode& rDestNd )
 sal_Bool lcl_ChkFlyFly( SwDoc* pDoc, sal_uLong nSttNd, sal_uLong nEndNd,
                         sal_uLong nInsNd )
 {
-    const SwSpzFrmFmts& rFrmFmtTbl = *pDoc->GetSpzFrmFmts();
+    const SwFrmFmts& rFrmFmtTbl = *pDoc->GetSpzFrmFmts();
 
-    for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n )
+    for( sal_uInt16 n = 0; n < rFrmFmtTbl.size(); ++n )
     {
         SwFrmFmt const*const  pFmt = rFrmFmtTbl[n];
         SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
@@ -1402,7 +1402,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg,
     //            beibehalten.
     SwDoc *const pDest = rStartIdx.GetNode().GetDoc();
     ::std::set< _ZSortFly > aSet;
-    sal_uInt16 nArrLen = GetSpzFrmFmts()->Count();
+    sal_uInt16 nArrLen = GetSpzFrmFmts()->size();
 
     for ( sal_uInt16 n = 0; n < nArrLen; ++n )
     {
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 4666c05..12c59d7 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -516,17 +516,17 @@ SwSectionFmt* SwDoc::MakeSectionFmt( SwSectionFmt *pDerivedFrom )
     if( !pDerivedFrom )
         pDerivedFrom = (SwSectionFmt*)pDfltFrmFmt;
     SwSectionFmt* pNew = new SwSectionFmt( pDerivedFrom, this );
-    pSectionFmtTbl->Insert( pNew, pSectionFmtTbl->Count() );
+    pSectionFmtTbl->push_back( pNew );
     return pNew;
 }
 
 void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
 {
-    sal_uInt16 nPos = pSectionFmtTbl->GetPos( pFmt );
+    SwSectionFmts::iterator itFmtPos = std::find( pSectionFmtTbl->begin(), pSectionFmtTbl->end(), pFmt );
 
     GetIDocumentUndoRedo().StartUndo(UNDO_DELSECTION, NULL);
 
-    if( USHRT_MAX != nPos )
+    if( pSectionFmtTbl->end() != itFmtPos )
     {
         const SwNodeIndex* pIdx = pFmt->GetCntnt( sal_False ).GetCntntIdx();
         const SfxPoolItem* pFtnEndAtTxtEnd;
@@ -575,12 +575,12 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
 
         // A ClearRedo could result in a rekursive call of this function and delete some section
         // formats => the position iside the SectionFmtTbl could have changed
-        nPos = pSectionFmtTbl->GetPos( pFmt );
+        itFmtPos = std::find( pSectionFmtTbl->begin(), pSectionFmtTbl->end(), pFmt );
 
         // ACHTUNG: erst aus dem Array entfernen und dann loeschen.
         //          Der Section-DTOR versucht selbst noch sein Format
         //          zu loeschen!
-        pSectionFmtTbl->Remove( nPos );
+        pSectionFmtTbl->erase( itFmtPos );
 //FEATURE::CONDCOLL
         sal_uLong nCnt = 0, nSttNd = 0;
         if( pIdx && &GetNodes() == &pIdx->GetNodes() &&
@@ -1426,14 +1426,14 @@ String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
     xub_StrLen nNmLen = aName.Len();
 
     sal_uInt16 nNum = 0;
-    sal_uInt16 nTmp, nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2;
+    sal_uInt16 nTmp, nFlagSize = ( pSectionFmtTbl->size() / 8 ) +2;
     sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
     memset( pSetFlags, 0, nFlagSize );
 
     const SwSectionNode* pSectNd;
     sal_uInt16 n;
 
-    for( n = 0; n < pSectionFmtTbl->Count(); ++n )
+    for( n = 0; n < pSectionFmtTbl->size(); ++n )
         if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( sal_False ) ))
         {
             const String& rNm = pSectNd->GetSection().GetSectionName();
@@ -1441,7 +1441,7 @@ String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
             {
                 // Nummer bestimmen und das Flag setzen
                 nNum = static_cast<sal_uInt16>(rNm.Copy( nNmLen ).ToInt32());
-                if( nNum-- && nNum < pSectionFmtTbl->Count() )
+                if( nNum-- && nNum < pSectionFmtTbl->size() )
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
             if( pChkStr && pChkStr->Equals( rNm ) )
@@ -1451,7 +1451,7 @@ String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
     if( !pChkStr )
     {
         // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
-        nNum = pSectionFmtTbl->Count();
+        nNum = pSectionFmtTbl->size();
         for( n = 0; n < nFlagSize; ++n )
             if( 0xff != ( nTmp = pSetFlags[ n ] ))
             {
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a6efdba..5822c63 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1640,8 +1640,8 @@ sal_Bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh,
 
     // #i28006# Fly frames have to be restored even if the table was
     // #alone in the section
-    const SwSpzFrmFmts& rFlyArr = *GetDoc()->GetSpzFrmFmts();
-    for( sal_uInt16 n = 0; n < rFlyArr.Count(); ++n )
+    const SwFrmFmts& rFlyArr = *GetDoc()->GetSpzFrmFmts();
+    for( sal_uInt16 n = 0; n < rFlyArr.size(); ++n )
     {
         SwFrmFmt *const pFmt = (SwFrmFmt*)rFlyArr[n];
         const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
@@ -3886,13 +3886,13 @@ String SwDoc::GetUniqueTblName() const
     String aName( aId );
     xub_StrLen nNmLen = aName.Len();
 
-    sal_uInt16 nNum, nTmp, nFlagSize = ( pTblFrmFmtTbl->Count() / 8 ) +2;
+    sal_uInt16 nNum, nTmp, nFlagSize = ( pTblFrmFmtTbl->size() / 8 ) +2;
     sal_uInt16 n;
 
     sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
     memset( pSetFlags, 0, nFlagSize );
 
-    for( n = 0; n < pTblFrmFmtTbl->Count(); ++n )
+    for( n = 0; n < pTblFrmFmtTbl->size(); ++n )
     {
         const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ];
         if( !pFmt->IsDefault() && IsUsed( *pFmt )  &&
@@ -3900,13 +3900,13 @@ String SwDoc::GetUniqueTblName() const
         {
             // Nummer bestimmen und das Flag setzen
             nNum = static_cast<sal_uInt16>(pFmt->GetName().Copy( nNmLen ).ToInt32());
-            if( nNum-- && nNum < pTblFrmFmtTbl->Count() )
+            if( nNum-- && nNum < pTblFrmFmtTbl->size() )
                 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
         }
     }
 
     // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
-    nNum = pTblFrmFmtTbl->Count();
+    nNum = pTblFrmFmtTbl->size();
     for( n = 0; n < nFlagSize; ++n )
         if( 0xff != ( nTmp = pSetFlags[ n ] ))
         {
@@ -3925,11 +3925,11 @@ SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, sal_Bool bAll ) const
 {
     const SwFmt* pRet = 0;
     if( bAll )
-        pRet = FindFmtByName( (SvPtrarr&)*pTblFrmFmtTbl, rName );
+        pRet = FindFmtByName( *pTblFrmFmtTbl, rName );
     else
     {
         // dann nur die, die im Doc gesetzt sind
-        for( sal_uInt16 n = 0; n < pTblFrmFmtTbl->Count(); ++n )
+        for( sal_uInt16 n = 0; n < pTblFrmFmtTbl->size(); ++n )
         {
             const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ];
             if( !pFmt->IsDefault() && IsUsed( *pFmt ) &&
@@ -4507,7 +4507,7 @@ sal_Bool SwDoc::UnProtectTbls( const SwPaM& rPam )
     SwFrmFmts& rFmts = *GetTblFrmFmts();
     SwTable* pTbl;
     const SwTableNode* pTblNd;
-    for( sal_uInt16 n = rFmts.Count(); n ; )
+    for( sal_uInt16 n = rFmts.size(); n ; )
         if( 0 != (pTbl = SwTable::FindTable( rFmts[ --n ] )) &&
             0 != (pTblNd = pTbl->GetTableNode() ) &&
             pTblNd->GetNodes().IsDocNodes() )
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index f795732..86200b8 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -558,10 +558,10 @@ const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay,
         {
             // dann erstmal den richtigen Anker finden
             const SwFrmFmt* pFmt = 0;
-            const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+            const SwFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
             sal_uInt16 n;
 
-            for( n = 0; n < rFmts.Count(); ++n )
+            for( n = 0; n < rFmts.size(); ++n )
             {
                 SwFrmFmt* pFrmFmt = rFmts[ n ];
                 const SwFmtCntnt& rCntnt = pFrmFmt->GetCntnt();
@@ -584,7 +584,7 @@ const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay,
                     while( pFlyNd )
                     {
                         // dann ueber den Anker nach oben "hangeln"
-                        for( n = 0; n < rFmts.Count(); ++n )
+                        for( n = 0; n < rFmts.size(); ++n )
                         {
                             const SwFrmFmt* pFrmFmt = rFmts[ n ];
                             const SwNodeIndex* pIdx = pFrmFmt->GetCntnt().
@@ -610,7 +610,7 @@ const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay,
                                 break;
                             }
                         }
-                        if( n >= rFmts.Count() )
+                        if( n >= rFmts.size() )
                         {
                             OSL_ENSURE( !this, "Fly-Section aber kein Format gefunden" );
                             return sal_False;
@@ -765,8 +765,8 @@ SwFrmFmt* SwNode::GetFlyFmt() const
         if( !pRet )
         {
             // dann gibts noch harten steinigen Weg uebers Dokument:
-            const SwSpzFrmFmts& rFrmFmtTbl = *GetDoc()->GetSpzFrmFmts();
-            for( sal_uInt16 n = 0; n < rFrmFmtTbl.Count(); ++n )
+            const SwFrmFmts& rFrmFmtTbl = *GetDoc()->GetSpzFrmFmts();
+            for( sal_uInt16 n = 0; n < rFrmFmtTbl.size(); ++n )
             {
                 SwFrmFmt* pFmt = rFrmFmtTbl[n];
                 const SwFmtCntnt& rCntnt = pFmt->GetCntnt();
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 7ee67d7..d94e417 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -103,10 +103,6 @@ public:
 TYPEINIT1(SwSectionFmt,SwFrmFmt );
 TYPEINIT1(SwSection,SwClient );
 
-typedef SwSection* SwSectionPtr;
-
-SV_IMPL_PTRARR(SwSectionFmts,SwSectionFmt*)
-
 
 SwSectionData::SwSectionData(SectionType const eType, String const& rName)
     : m_eType(eType)
@@ -675,7 +671,7 @@ SwSectionFmt::~SwSectionFmt()
             // noch anzeigen muessen!
             if( rSect.IsHiddenFlag() )
             {
-                SwSectionPtr pParentSect = rSect.GetParent();
+                SwSection* pParentSect = rSect.GetParent();
                 if( !pParentSect || !pParentSect->IsHiddenFlag() )
                 {
                     // Nodes wieder anzeigen
@@ -973,7 +969,7 @@ void SwSectionFmt::UpdateParent()       // Parent wurde veraendert
     if( !GetDepends() )
         return;
 
-    SwSectionPtr pSection = 0;
+    SwSection* pSection = 0;
     const SvxProtectItem* pProtect(0);
     // edit in readonly sections
     const SwFmtEditInReadonly* pEditInReadonly = 0;
@@ -990,7 +986,7 @@ void SwSectionFmt::UpdateParent()       // Parent wurde veraendert
                     pSection = GetSection();
                     if( GetRegisteredIn() )
                     {
-                        const SwSectionPtr pPS = GetParentSection();
+                        const SwSection* pPS = GetParentSection();
                         pProtect = &pPS->GetFmt()->GetProtect();
                         // edit in readonly sections
                         pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
@@ -1030,10 +1026,10 @@ void SwSectionFmt::UpdateParent()       // Parent wurde veraendert
             else if( !pSection &&
                     pLast->IsA( TYPE(SwSection) ) )
             {
-                pSection = (SwSectionPtr)pLast;
+                pSection = (SwSection*)pLast;
                 if( GetRegisteredIn() )
                 {
-                    const SwSectionPtr pPS = GetParentSection();
+                    const SwSection* pPS = GetParentSection();
                     pProtect = &pPS->GetFmt()->GetProtect();
                     // edit in readonly sections
                     pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
@@ -1596,7 +1592,7 @@ void SwIntrnlSectRefLink::Closed()
         // kennzeichnen und das Flag umsetzen
 
         const SwSectionFmts& rFmts = pDoc->GetSections();
-        for( sal_uInt16 n = rFmts.Count(); n; )
+        for( sal_uInt16 n = rFmts.size(); n; )
             if( rFmts[ --n ] == &rSectFmt )
             {
                 ViewShell* pSh;
@@ -1744,6 +1740,22 @@ sal_Bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
             pSttNd->EndOfSectionIndex() < nEndNd;
 }
 
+sal_uInt16 SwSectionFmts::GetPos(const SwSectionFmt* p) const
+{
+    const_iterator it = std::find(begin(), end(), p);
+    return it == end() ? USHRT_MAX : it - begin();
+}
+
+bool SwSectionFmts::Contains(const SwSectionFmt* p) const
+{
+    return std::find(begin(), end(), p) != end();
+}
+
+SwSectionFmts::~SwSectionFmts()
+{
+    for(const_iterator it = begin(); it != end(); ++it)
+        delete *it;
+}
 
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index a2e8e04..1ecaa7b 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -690,7 +690,7 @@ SwDrawContact::~SwDrawContact()
 
 void SwDrawContact::GetTextObjectsFromFmt( std::list<SdrTextObj*>& rTextObjects, SwDoc* pDoc )
 {
-    for( sal_Int32 n=0; n<pDoc->GetSpzFrmFmts()->Count(); n++ )
+    for( sal_Int32 n=0; n<(sal_Int32)pDoc->GetSpzFrmFmts()->size(); n++ )
     {
         SwFrmFmt* pFly = (*pDoc->GetSpzFrmFmts())[n];
         if( pFly->IsA( TYPE(SwDrawFrmFmt) ) )
@@ -1853,8 +1853,8 @@ void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch )
                         else
                         {
                             const SwNodeIndex& rIdx = pAnch->GetCntntAnchor()->nNode;
-                            SwSpzFrmFmts& rFmts = *(pDrawFrmFmt->GetDoc()->GetSpzFrmFmts());
-                            for( sal_uInt16 i = 0; i < rFmts.Count(); ++i )
+                            SwFrmFmts& rFmts = *(pDrawFrmFmt->GetDoc()->GetSpzFrmFmts());
+                            for( sal_uInt16 i = 0; i < rFmts.size(); ++i )
                             {
                                 SwFrmFmt* pFlyFmt = rFmts[i];
                                 if( pFlyFmt->GetCntnt().GetCntntIdx() &&
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index e2c57c3..4004727 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -373,8 +373,8 @@ sal_Bool SwAutoFormat::HasObjects( const SwNode& rNd )
     // Is there something bound to the paragraph in the paragraph
     // like borders, DrawObjects, ...
     sal_Bool bRet = sal_False;
-    const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
-    for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+    const SwFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
     {
         const SwFmtAnchor& rAnchor = rFmts[ n ]->GetAnchor();
         if ((FLY_AT_PAGE != rAnchor.GetAnchorId()) &&
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 8d9afd0..9727467 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -39,6 +39,7 @@
 #include <SwRewriter.hxx>
 #include <numrule.hxx>
 #include <swundo.hxx>
+#include <docary.hxx>
 
 /*************************************
  * FormatColl
@@ -54,7 +55,7 @@ SwTxtFmtColl& SwEditShell::GetDfltTxtFmtColl() const
 
 sal_uInt16 SwEditShell::GetTxtFmtCollCount() const
 {
-    return GetDoc()->GetTxtFmtColls()->Count();
+    return GetDoc()->GetTxtFmtColls()->size();
 }
 
 
diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx
index 3917006..38ba4be 100644
--- a/sw/source/core/edit/edfmt.cxx
+++ b/sw/source/core/edit/edfmt.cxx
@@ -46,7 +46,7 @@
 
 sal_uInt16 SwEditShell::GetCharFmtCount() const
 {
-    return GetDoc()->GetCharFmts()->Count();
+    return GetDoc()->GetCharFmts()->size();
 }
 
 
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index 8938625..8ebd932 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -75,7 +75,7 @@ sal_uInt16 SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
     const SwSectionFmts& rSectFmts = pMyDoc->GetSections();
     sal_uInt16 n;
 
-    for( n = rSectFmts.Count(); n; )
+    for( n = rSectFmts.size(); n; )
     {
         const SwSection* pSect = rSectFmts[ --n ]->GetGlobalDocSection();
         if( pSect )
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 8a9d5eb..91d32a8 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -217,7 +217,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
             {
                 const String& rTblName = pTblNd->GetTable().GetFrmFmt()->GetName();
                 const SwFrmFmts& rTblFmts = *pInsDoc->GetTblFrmFmts();
-                for( sal_uInt16 n = rTblFmts.Count(); n; )
+                for( sal_uInt16 n = rTblFmts.size(); n; )
                     if( rTblFmts[ --n ]->GetName() == rTblName )
                     {
                         bCpyTblNm = sal_False;
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 0c154d9..7889328 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -773,7 +773,7 @@ sal_uInt16 SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
 
     const SwTxtNode* pTxtNd;
     const SwCharFmts* pFmts = GetDoc()->GetCharFmts();
-    for( sal_uInt16 n = pFmts->Count(); 1 < n; )
+    for( sal_uInt16 n = pFmts->size(); 1 < n; )
     {
         SwIterator<SwTxtINetFmt,SwCharFmt> aIter(*(*pFmts)[--n]);
         for( SwTxtINetFmt* pFnd = aIter.First(); pFnd; pFnd = aIter.Next() )
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 598ebcd..86ce8b4 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -125,14 +125,14 @@ const SwSection* SwEditShell::GetAnySection( sal_Bool bOutOfTab, const Point* pP
 
 sal_uInt16 SwEditShell::GetSectionFmtCount() const
 {
-    return GetDoc()->GetSections().Count();
+    return GetDoc()->GetSections().size();
 }
 
 
 sal_Bool SwEditShell::IsAnySectionInDoc( sal_Bool bChkReadOnly, sal_Bool bChkHidden, sal_Bool bChkTOX ) const
 {
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    sal_uInt16 nCnt = rFmts.Count();
+    sal_uInt16 nCnt = rFmts.size();
     sal_uInt16 n;
 
     for( n = 0; n < nCnt; ++n )
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index bbe4460..0e5edc1 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -259,7 +259,7 @@ sal_uInt16 SwEditShell::GetTOXCount() const
 {
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     sal_uInt16 nRet = 0;
-    for( sal_uInt16 n = rFmts.Count(); n; )
+    for( sal_uInt16 n = rFmts.size(); n; )
     {
         const SwSection* pSect = rFmts[ --n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -273,7 +273,7 @@ sal_uInt16 SwEditShell::GetTOXCount() const
 const SwTOXBase* SwEditShell::GetTOX( sal_uInt16 nPos ) const
 {
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+    for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.size(); ++n )
     {
         const SwSection* pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 0ebd62c..4f267fe 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -184,7 +184,7 @@ sal_uInt16 SwEditShell::GetCntType() const
 sal_Bool SwEditShell::HasOtherCnt() const
 
 {
-    if ( GetDoc()->GetSpzFrmFmts()->Count() )
+    if ( !GetDoc()->GetSpzFrmFmts()->empty() )
         return sal_True;
 
     const SwNodes &rNds = GetDoc()->GetNodes();
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 2187fed..0109071 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -692,7 +692,7 @@ const SwTable* SwTableFormula::FindTable( SwDoc& rDoc, const String& rNm ) const
 {
     const SwFrmFmts& rTblFmts = *rDoc.GetTblFrmFmts();
     const SwTable* pTmpTbl, *pRet = 0;
-    for( sal_uInt16 nFmtCnt = rTblFmts.Count(); nFmtCnt; )
+    for( sal_uInt16 nFmtCnt = rTblFmts.size(); nFmtCnt; )
     {
         SwFrmFmt* pFmt = rTblFmts[ --nFmtCnt ];
         // falls wir von Sw3Writer gerufen werden, dann ist dem
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index b3f88fb..540d201 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -111,7 +111,7 @@ sal_Bool SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt )
     }
 
     // also delete surrounding FlyFrames if any
-    for( sal_uInt16 n = 0; n < pClpDoc->GetSpzFrmFmts()->Count(); ++n )
+    for( sal_uInt16 n = 0; n < pClpDoc->GetSpzFrmFmts()->size(); ++n )
     {
         SwFlyFrmFmt* pFly = (SwFlyFrmFmt*)(*pClpDoc->GetSpzFrmFmts())[n];
         pClpDoc->DelLayoutFmt( pFly );
@@ -155,14 +155,14 @@ sal_Bool SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt )
 
        // assure the "RootFmt" is the first element in Spz-Array
         // (if necessary Flys were copied in Flys)
-        SwSpzFrmFmts& rSpzFrmFmts = *(SwSpzFrmFmts*)pClpDoc->GetSpzFrmFmts();
+        SwFrmFmts& rSpzFrmFmts = *(SwFrmFmts*)pClpDoc->GetSpzFrmFmts();
         if( rSpzFrmFmts[ 0 ] != pFlyFmt )
         {
-            sal_uInt16 nPos = rSpzFrmFmts.GetPos( pFlyFmt );
-            OSL_ENSURE( nPos != USHRT_MAX, "Fly not contained in Spz-Array" );
+            SwFrmFmts::iterator it = std::find( rSpzFrmFmts.begin(), rSpzFrmFmts.end(), pFlyFmt );
+            OSL_ENSURE( it != rSpzFrmFmts.end(), "Fly not contained in Spz-Array" );
 
-            rSpzFrmFmts.Remove( nPos );
-            rSpzFrmFmts.Insert( pFlyFmt, 0 );
+            rSpzFrmFmts.erase( it );
+            rSpzFrmFmts.insert( rSpzFrmFmts.begin(), pFlyFmt );
         }
 
         if ( FLY_AS_CHAR == aAnchor.GetAnchorId() )
@@ -894,13 +894,13 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
             break;      // exit the "while-loop"
         }
         else if( *aCpyPam.GetPoint() == *aCpyPam.GetMark() &&
-                 pClpDoc->GetSpzFrmFmts()->Count() )
+                 pClpDoc->GetSpzFrmFmts()->size() )
         {
             // we need a DrawView
             if( !Imp()->GetDrawView() )
                 MakeDrawView();
 
-            for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->Count(); ++i )
+            for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
             {
                 sal_Bool bInsWithFmt = sal_True;
                 const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
@@ -1082,13 +1082,13 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
                 GetDoc()->DelFullPara(aPara);
             }
             //additionally copy page bound frames
-            if( bIncludingPageFrames && pClpDoc->GetSpzFrmFmts()->Count() )
+            if( bIncludingPageFrames && pClpDoc->GetSpzFrmFmts()->size() )
             {
                 // create a draw view if necessary
                 if( !Imp()->GetDrawView() )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list