[PATCH] Get rid of SvULongs in writer

Maciej Rumianowski maciej.rumianowski at gmail.com
Tue Aug 2 08:27:34 PDT 2011


Replace SvULongs with std::vector. In SwHTMLWriter simultaneously replace aOutlineMarks with boost::ptr_vector.
---
 sw/source/filter/html/htmlfly.cxx |   10 ++--
 sw/source/filter/html/wrthtml.cxx |   20 ++++----
 sw/source/filter/html/wrthtml.hxx |    7 ++-
 sw/source/filter/ww8/wrtw8esh.cxx |    4 +-
 sw/source/filter/ww8/wrtw8sty.cxx |   84 +++++++++++++++++--------------------
 sw/source/filter/ww8/wrtww8.cxx   |   24 +++++------
 sw/source/filter/ww8/wrtww8.hxx   |   24 ++++-------
 7 files changed, 80 insertions(+), 93 deletions(-)

diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index a6bd6c3..873afd5 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -1804,20 +1804,20 @@ void SwHTMLWriter::AddLinkTarget( const String& rURL )
         SwPosition aPos( *pCurPam->GetPoint() );
         if( pDoc->GotoOutline( aPos, aOutline ) )
         {
-            sal_uLong nIdx = aPos.nNode.GetIndex();
+            sal_uInt32 nIdx = aPos.nNode.GetIndex();
 
-            sal_uInt16 nIns=0;
-            while( nIns < aOutlineMarkPoss.Count() &&
+            sal_uInt32 nIns=0;
+            while( nIns < aOutlineMarkPoss.size() &&
                    aOutlineMarkPoss[nIns] < nIdx )
                 nIns++;
 
-            aOutlineMarkPoss.Insert( nIdx, nIns );
+            aOutlineMarkPoss.insert( aOutlineMarkPoss.begin()+nIns, nIdx );
             if( bEncoded )
             {
                 aURL.Erase( nPos, 2 );
                 aURL.SetChar( nPos-1, cMarkSeperator );
             }
-            aOutlineMarks.Insert( new String( aURL ), nIns );
+            aOutlineMarks.insert( aOutlineMarks.begin()+nIns, new String( aURL ) );
         }
     }
     else if( sCmp.EqualsAscii( pMarkToText ) )
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 0e78fae..e6baa5a 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -402,11 +402,11 @@ sal_uLong SwHTMLWriter::WriteStream()
     if( aImplicitMarks.Count() )
         aImplicitMarks.DeleteAndDestroy( sal_uInt16(0), aImplicitMarks.Count() );
 
-    if( aOutlineMarks.Count() )
-        aOutlineMarks.DeleteAndDestroy( sal_uInt16(0), aOutlineMarks.Count() );
+    if( !aOutlineMarks.empty() )
+        aOutlineMarks.clear();
 
-    if( aOutlineMarkPoss.Count() )
-        aOutlineMarkPoss.Remove( sal_uInt16(0), aOutlineMarkPoss.Count() );
+    if( !aOutlineMarkPoss.empty() )
+        aOutlineMarkPoss.clear();
 
     if( aNumRuleNames.Count() )
         aNumRuleNames.DeleteAndDestroy( sal_uInt16(0), aNumRuleNames.Count() );
@@ -1065,18 +1065,18 @@ void SwHTMLWriter::OutBookmarks()
             pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get();
     }
 
-    sal_uInt16 nPos;
-    for( nPos = 0; nPos < aOutlineMarkPoss.Count() &&
+    sal_uInt32 nPos;
+    for( nPos = 0; nPos < aOutlineMarkPoss.size() &&
                    aOutlineMarkPoss[nPos] < nNode; nPos++ )
         ; 
 
-    while( nPos < aOutlineMarkPoss.Count() && aOutlineMarkPoss[nPos] == nNode )
+    while( nPos < aOutlineMarkPoss.size() && aOutlineMarkPoss[nPos] == nNode )
     {
-        String sMark( *aOutlineMarks[nPos] );
+        String sMark( aOutlineMarks[nPos] );
         sMark.SearchAndReplaceAll( '?', '_' );  // '?' causes problems in IE/Netscape 5
         OutAnchor( sMark );
-        aOutlineMarkPoss.Remove( nPos, 1 );
-        aOutlineMarks.DeleteAndDestroy( nPos, 1 );
+        aOutlineMarkPoss.erase( aOutlineMarkPoss.begin()+nPos );
+        aOutlineMarks.erase( aOutlineMarks.begin() + nPos );
     }
 }
 
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 4e040f1..83f93f4 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -28,13 +28,14 @@
 #ifndef _WRTHTML_HXX
 #define _WRTHTML_HXX
 
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
 
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/form/XForm.hpp>
 #include <vcl/field.hxx>
 #define _SVSTDARR_STRINGSDTOR
 #define _SVSTDARR_STRINGSSORTDTOR
-#define _SVSTDARR_ULONGS
 #include <svl/svstdarr.hxx>
 #include <i18npool/lang.h>
 #include <tools/stream.hxx>
@@ -227,11 +228,11 @@ public:
 
     SvStringsDtor aImgMapNames;		// geschriebene Image Maps
     SvStringsSortDtor aImplicitMarks;// implizite Stprungmarken
-    SvStringsDtor aOutlineMarks;		// geschriebene Image Maps
     SvStringsSortDtor aNumRuleNames;// Names of exported num rules
     SvStringsSortDtor aScriptParaStyles;// script dependent para styles
     SvStringsSortDtor aScriptTextStyles;// script dependent text styles
-    SvULongs aOutlineMarkPoss;
+    boost::ptr_vector<String> aOutlineMarks;
+    std::vector<sal_uInt32> aOutlineMarkPoss;
     HTMLControls aHTMLControls;		// die zu schreibenden ::com::sun::star::form::Forms
     SwHTMLFmtInfos aChrFmtInfos;
     SwHTMLFmtInfos aTxtCollInfos;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index d0e85d8..2995c85 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -782,10 +782,10 @@ void WW8_WrPlcTxtBoxes::Append( const SdrObject& rObj, sal_uInt32 nShapeId )
 {
     void* p = (void*)&rObj;
     aCntnt.Insert( p, aCntnt.Count() );
-    aShapeIds.Insert( nShapeId, aShapeIds.Count() );
+    aShapeIds.push_back( nShapeId );
 }
 
-const SvULongs* WW8_WrPlcTxtBoxes::GetShapeIdArr() const
+const std::vector<sal_uInt32>* WW8_WrPlcTxtBoxes::GetShapeIdArr() const
 {
     return &aShapeIds;
 }
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index d297a9c..b663d3c 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -93,14 +93,12 @@ struct WW8_SED
                         //  cbSED is 12 (decimal)), C (hex).
 };
 
-SV_IMPL_VARARR( WW8_WrSepInfoPtrs, WW8_SepInfo )
-
 // class WW8_WrPlc0 ist erstmal nur fuer Header / Footer-Positionen, d.h. es
 // gibt keine inhaltstragende Struktur.
 class WW8_WrPlc0
 {
 private:
-    SvULongs aPos;      // PTRARR von CPs / FCs
+    std::vector<sal_uLong> aPos;      // PTRARR von CPs / FCs
     sal_uLong nOfs;
 
     //No copying
@@ -108,7 +106,7 @@ private:
     WW8_WrPlc0 &operator=(const WW8_WrPlc0&);
 public:
     WW8_WrPlc0( sal_uLong nOffset );
-    sal_uInt16 Count() const                { return aPos.Count(); }
+    sal_uInt16 Count() const                { return aPos.size(); }
     void Append( sal_uLong nStartCpOrFc );
     void Write( SvStream& rStrm );
 };
@@ -903,22 +901,22 @@ void wwFontHelper::WriteFontTable( const RtfAttributeOutput& rAttrOutput )
 
 
 WW8_WrPlc0::WW8_WrPlc0( sal_uLong nOffset )
-    : aPos( 4, 4 ), nOfs( nOffset )
+    : nOfs( nOffset )
 {
 }
 
 void WW8_WrPlc0::Append( sal_uLong nStartCpOrFc )
 {
-    aPos.Insert( nStartCpOrFc - nOfs, aPos.Count() );
+    aPos.push_back( nStartCpOrFc - nOfs );
 }
 
 void WW8_WrPlc0::Write( SvStream& rStrm )
 {
-    sal_uInt16 nLen = aPos.Count();
-    for( sal_uInt16 i = 0; i < nLen; ++i )
+    std::vector<sal_uLong>::const_iterator iter;
+    for( iter = aPos.begin(); iter != aPos.end(); ++iter )
     {
         SVBT32 nP;
-        UInt32ToSVBT32( aPos[i], nP );
+        UInt32ToSVBT32( *iter, nP );
         rStrm.Write( nP, 4 );
     }
 }
@@ -931,8 +929,7 @@ void WW8_WrPlc0::Write( SvStream& rStrm )
 //------------------------------------------------------------------------------
 
 MSWordSections::MSWordSections( MSWordExportBase& rExport )
-    : mbDocumentIsProtected( false ),
-      aSects( 4, 4 )
+    : mbDocumentIsProtected( false )
 {
     const SwSectionFmt *pFmt = 0;
     rExport.pAktPageDesc = &const_cast<const SwDoc *>(rExport.pDoc)->GetPageDesc( 0 );
@@ -981,14 +978,13 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport )
 
 WW8_WrPlcSepx::WW8_WrPlcSepx( MSWordExportBase& rExport )
     : MSWordSections( rExport ),
-      aCps( 4, 4 ),
       pAttrs( 0 ),
       pTxtPos( 0 ),
       bNoMoreSections( false )
 {
     // to be in sync with the AppendSection() call in the MSWordSections
     // constructor
-    aCps.Insert( sal_uLong( 0 ), aCps.Count() );
+    aCps.push_back( 0 );
 }
 
 MSWordSections::~MSWordSections()
@@ -997,7 +993,7 @@ MSWordSections::~MSWordSections()
 
 WW8_WrPlcSepx::~WW8_WrPlcSepx()
 {
-    sal_uInt16 nLen = aSects.Count();
+    sal_uInt16 nLen = aSects.size();
     if( pAttrs )
     {
         while( nLen )
@@ -1009,11 +1005,11 @@ WW8_WrPlcSepx::~WW8_WrPlcSepx()
 
 sal_uInt16 MSWordSections::CurrentNumberOfColumns( const SwDoc &rDoc ) const
 {
-    OSL_ENSURE( aSects.Count(), "no segement inserted yet" );
-    if ( !aSects.Count() )
+    OSL_ENSURE( !aSects.empty(), "no segement inserted yet" );
+    if ( aSects.empty() )
         return 1;
 
-    return NumberOfColumns( rDoc, aSects[aSects.Count() - 1] );
+    return NumberOfColumns( rDoc, aSects.back() );
 }
 
 sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo& rInfo ) const
@@ -1043,8 +1039,8 @@ sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo
 
 const WW8_SepInfo* MSWordSections::CurrentSectionInfo()
 {
-    if ( aSects.Count() > 0 )
-        return &aSects[aSects.Count() - 1];
+    if ( !aSects.empty() )
+        return &aSects.back();
 
     return NULL;
 }
@@ -1052,9 +1048,8 @@ const WW8_SepInfo* MSWordSections::CurrentSectionInfo()
 void MSWordSections::AppendSection( const SwPageDesc* pPd,
     const SwSectionFmt* pSectionFmt, sal_uLong nLnNumRestartNo )
 {
-    aSects.Insert( WW8_SepInfo( pPd, pSectionFmt, nLnNumRestartNo ),
-            aSects.Count() );
-    NeedsDocumentProtected( aSects[aSects.Count()-1] );
+    aSects.push_back( WW8_SepInfo( pPd, pSectionFmt, nLnNumRestartNo ) );
+    NeedsDocumentProtected( aSects.back() );
 }
 
 void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwPageDesc* pPd,
@@ -1062,7 +1057,7 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwPageDesc* pPd,
 {
     if ( !bNoMoreSections )
     {
-        aCps.Insert( nStartCp, aCps.Count() );
+        aCps.push_back( nStartCp );
 
         AppendSection( pPd, pSectionFmt, nLnNumRestartNo );
     }
@@ -1073,7 +1068,7 @@ void MSWordSections::AppendSection( const SwFmtPageDesc& rPD,
 {
     WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo,
             rPD.GetNumOffset(), &rNd );
-    aSects.Insert( aI, aSects.Count() );
+    aSects.push_back( aI );
     NeedsDocumentProtected( aI );
 }
 
@@ -1082,7 +1077,7 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPD,
 {
     if ( !bNoMoreSections )
     {
-        aCps.Insert(nStartCp, aCps.Count());
+        aCps.push_back( nStartCp );
 
         AppendSection( rPD, rNd, pSectionFmt, nLnNumRestartNo );
     }
@@ -1094,7 +1089,7 @@ void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPD,
 
 void MSWordSections::SetNum( const SwTxtNode* pNumNd )
 {
-    WW8_SepInfo& rInfo = aSects[ aSects.Count() - 1 ];
+    WW8_SepInfo& rInfo = aSects.back();
     if ( !rInfo.pNumNd ) // noch nicht belegt
         rInfo.pNumNd = pNumNd;
 }
@@ -1234,9 +1229,10 @@ void MSWordSections::CheckForFacinPg( WW8Export& rWrt ) const
     // 2 Werte werden gesetzt
     //      Dop.fFacingPages            == Kopf-/Fusszeilen unterschiedlich
     //      Dop.fSwapBordersFacingPgs   == gespiegelte Raender
-    for( sal_uInt16 i = 0, nEnde = 0; i < aSects.Count(); ++i )
+    std::vector<WW8_SepInfo>::const_iterator iter = aSects.begin();
+    for( sal_uInt16 nEnde = 0; iter != aSects.end(); ++iter )
     {
-        WW8_SepInfo& rSepInfo = aSects[i];
+        const WW8_SepInfo& rSepInfo = *iter;
         if( !rSepInfo.pSectionFmt )
         {
             const SwPageDesc* pPd = rSepInfo.pPageDesc;
@@ -1764,7 +1760,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
 
 bool WW8_WrPlcSepx::WriteKFTxt( WW8Export& rWrt )
 {
-    pAttrs = new WW8_PdAttrDesc[ aSects.Count() ];
+    pAttrs = new WW8_PdAttrDesc[ aSects.size() ];
     sal_uLong nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
 
     OSL_ENSURE( !pTxtPos, "wer hat den Pointer gesetzt?" );
@@ -1775,7 +1771,7 @@ bool WW8_WrPlcSepx::WriteKFTxt( WW8Export& rWrt )
 
     unsigned int nOldIndex = rWrt.GetHdFtIndex();
     rWrt.SetHdFtIndex( 0 );
-    for ( sal_uInt16 i = 0; i < aSects.Count(); ++i )
+    for ( sal_uInt16 i = 0; i < aSects.size(); ++i )
     {
         WW8_PdAttrDesc* pA = pAttrs + i;
         pA->pData = 0;
@@ -1814,7 +1810,7 @@ bool WW8_WrPlcSepx::WriteKFTxt( WW8Export& rWrt )
 void WW8_WrPlcSepx::WriteSepx( SvStream& rStrm ) const
 {
     sal_uInt16 i;
-    for( i = 0; i < aSects.Count(); i++ ) // ueber alle Sections
+    for( i = 0; i < aSects.size(); i++ )
     {
         WW8_PdAttrDesc* pA = pAttrs + i;
         if( pA->nLen && pA->pData != NULL)
@@ -1830,12 +1826,11 @@ void WW8_WrPlcSepx::WriteSepx( SvStream& rStrm ) const
 
 void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const
 {
-    OSL_ENSURE( aCps.Count() == aSects.Count() + 1, "WrPlcSepx: DeSync" );
+    OSL_ENSURE( aCps.size() == aSects.size() + 1, "WrPlcSepx: DeSync" );
     sal_uLong nFcStart = rWrt.pTableStrm->Tell();
 
     sal_uInt16 i;
-    // ( ueber alle Sections )
-    for( i = 0; i <= aSects.Count(); i++ )
+    for( i = 0; i <= aSects.size(); i++ )
     {
         sal_uInt32 nP = aCps[i];
         SVBT32 nPos;
@@ -1845,8 +1840,7 @@ void WW8_WrPlcSepx::WritePlcSed( WW8Export& rWrt ) const
 
     static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}};
 
-    // ( ueber alle Sections )
-    for( i = 0; i < aSects.Count(); i++ )
+    for( i = 0; i < aSects.size(); i++ )
     {
         WW8_PdAttrDesc* pA = pAttrs + i;
         UInt32ToSVBT32( pA->nSepxFcPos, aSed.fcSepx );    // Sepx-Pos
@@ -1921,7 +1915,7 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader )
 // WW8_WrPlcFtnEdn ist die Klasse fuer Fuss- und Endnoten
 //------------------------------------------------------------------------------
 WW8_WrPlcSubDoc::WW8_WrPlcSubDoc()
-    : aCps( 0, 16 ), aCntnt( 0, 16 ), pTxtPos( 0 )
+    : aCntnt( 0, 16 ), pTxtPos( 0 )
 {
 }
 
@@ -1932,7 +1926,7 @@ WW8_WrPlcSubDoc::~WW8_WrPlcSubDoc()
 
 void WW8_WrPlcFtnEdn::Append( WW8_CP nCp, const SwFmtFtn& rFtn )
 {
-    aCps.Insert( nCp, aCps.Count() );
+    aCps.push_back( nCp );
     void* p = (void*)&rFtn;
     aCntnt.Insert( p, aCntnt.Count() );
 }
@@ -1955,7 +1949,7 @@ WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline) : mpRichText(0)
 
 void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt )
 {
-    aCps.Insert( nCp, aCps.Count() );
+    aCps.push_back( nCp );
     WW8_Annotation* p = new WW8_Annotation(pPostIt);
     aCntnt.Insert( p, aCntnt.Count() );
 }
@@ -1963,7 +1957,7 @@ void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt )
 void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwRedlineData *pRedline )
 {
     maProcessedRedlines.insert(pRedline);
-    aCps.Insert( nCp, aCps.Count() );
+    aCps.push_back( nCp );
     WW8_Annotation* p = new WW8_Annotation(pRedline);
     aCntnt.Insert( p, aCntnt.Count() );
 }
@@ -2017,7 +2011,7 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp,
             {
                 // textbox - content
                 WW8_CP nCP = rWrt.Fc2Cp( rWrt.Strm().Tell() );
-                aCps.Insert( nCP, i );
+                aCps.push_back( nCP );
                 pTxtPos->Append( nCP );
 
                 // is it an writer or sdr - textbox?
@@ -2111,11 +2105,11 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
     typedef ::std::vector<String>::iterator myiter;
 
     sal_uLong nFcStart = rWrt.pTableStrm->Tell();
-    sal_uInt16 nLen = aCps.Count();
+    sal_uInt16 nLen = aCps.size();
     if ( !nLen )
         return;
 
-    OSL_ENSURE( aCps.Count() + 2 == pTxtPos->Count(), "WritePlc: DeSync" );
+    OSL_ENSURE( aCps.size() + 2 == pTxtPos->Count(), "WritePlc: DeSync" );
 
     ::std::vector<String> aStrArr;
     WW8Fib& rFib = *rWrt.pFib;              // n+1-te CP-Pos nach Handbuch
@@ -2191,7 +2185,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
         case TXT_HFTXTBOX:
             {
                 pTxtPos->Write( *rWrt.pTableStrm );
-                const SvULongs* pShapeIds = GetShapeIdArr();
+                const std::vector<sal_uInt32>* pShapeIds = GetShapeIdArr();
                 OSL_ENSURE( pShapeIds, "wo sind die ShapeIds?" );
 
                 for ( i = 0; i < nLen; ++i )
@@ -2330,7 +2324,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
     rTxtCount = rWrt.pTableStrm->Tell() - nFcStart;
 }
 
-const SvULongs* WW8_WrPlcSubDoc::GetShapeIdArr() const
+const std::vector<sal_uInt32>* WW8_WrPlcSubDoc::GetShapeIdArr() const
 {
     return 0;
 }
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index edad4b1..c614eef 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -42,8 +42,6 @@
 #include <osl/endian.h>
 #include <docsh.hxx>
 
-#include <svl/svstdarr.hxx>
-
 #include <unotools/fltrcfg.hxx>
 #include <vcl/salbtype.hxx>
 #include <sot/storage.hxx>
@@ -602,7 +600,7 @@ const SfxPoolItem& MSWordExportBase::GetItem(sal_uInt16 nWhich) const
 //------------------------------------------------------------------------------
 
 WW8_WrPlc1::WW8_WrPlc1( sal_uInt16 nStructSz )
-    : aPos( 16, 16 ), nStructSiz( nStructSz )
+    : nStructSiz( nStructSz )
 {
     nDataLen = 16 * nStructSz;
     pData = new sal_uInt8[ nDataLen ];
@@ -615,15 +613,15 @@ WW8_WrPlc1::~WW8_WrPlc1()
 
 WW8_CP WW8_WrPlc1::Prev() const
 {
-    sal_uInt16 nLen = aPos.Count();
-    OSL_ENSURE(nLen,"Prev called on empty list");
-    return nLen ? aPos[nLen-1] : 0;
+    bool b = !aPos.empty();
+    OSL_ENSURE(b,"Prev called on empty list");
+    return b ? aPos.back() : 0;
 }
 
 void WW8_WrPlc1::Append( WW8_CP nCp, const void* pNewData )
 {
-    sal_uLong nInsPos = aPos.Count() * nStructSiz;
-    aPos.Insert( nCp, aPos.Count() );
+    sal_uLong nInsPos = aPos.size() * nStructSiz;
+    aPos.push_back( nCp );
     if( nDataLen < nInsPos + nStructSiz )
     {
         sal_uInt8* pNew = new sal_uInt8[ 2 * nDataLen ];
@@ -637,11 +635,11 @@ void WW8_WrPlc1::Append( WW8_CP nCp, const void* pNewData )
 
 void WW8_WrPlc1::Finish( sal_uLong nLastCp, sal_uLong nSttCp )
 {
-    if( aPos.Count() )
+    if( !aPos.empty() )
     {
-        aPos.Insert( nLastCp, aPos.Count() );
+        aPos.push_back( nLastCp );
         if( nSttCp )
-            for( sal_uInt16 n = 0; n < aPos.Count(); ++n )
+            for( sal_uInt32 n = 0; n < aPos.size(); ++n )
                 aPos[ n ] -= nSttCp;
     }
 }
@@ -649,8 +647,8 @@ void WW8_WrPlc1::Finish( sal_uLong nLastCp, sal_uLong nSttCp )
 
 void WW8_WrPlc1::Write( SvStream& rStrm )
 {
-    sal_uInt16 i;
-    for( i = 0; i < aPos.Count(); ++i )
+    sal_uInt32 i;
+    for( i = 0; i < aPos.size(); ++i )
         SwWW8Writer::WriteLong( rStrm, aPos[i] );
     if( i )
         rStrm.Write( pData, (i-1) * nStructSiz );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index c3cbd09..2d606c9 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -31,10 +31,6 @@
 
 #include <tools/solar.h>        // UINTXX
 #include <tools/gen.hxx>
-#ifndef _SVSTDARR_HXX
-#define _SVSTDARR_ULONGS
-#include <svl/svstdarr.hxx>
-#endif
 #include <editeng/editdata.hxx>
 
 #include <map>
@@ -179,15 +175,13 @@ struct WW8_SepInfo
     bool IsProtected() const;
 };
 
-SV_DECL_VARARR( WW8_WrSepInfoPtrs, WW8_SepInfo, 4, 4 )
-
 /// Class to collect and output the sections/headers/footers.
 // Plc fuer PageDescs -> Sepx ( Section Extensions )
 class MSWordSections
 {
 protected:
     bool mbDocumentIsProtected;
-    WW8_WrSepInfoPtrs aSects;   // PTRARR von SwPageDesc und SwSectionFmt
+    std::vector<WW8_SepInfo> aSects;
 
     void CheckForFacinPg( WW8Export& rWrt ) const;
     void WriteOlst( WW8Export& rWrt, const WW8_SepInfo& rSectionInfo );
@@ -231,7 +225,7 @@ public:
 
 class WW8_WrPlcSepx : public MSWordSections
 {
-    SvULongs aCps;              // PTRARR von CPs
+    std::vector<WW8_CP> aCps;
     WW8_PdAttrDesc* pAttrs;
     WW8_WrPlc0* pTxtPos;        // Pos der einzelnen Header / Footer
     bool bNoMoreSections;
@@ -252,7 +246,7 @@ public:
                     const SwNode& rNd,
                     const SwSectionFmt* pSectionFmt,
                     sal_uLong nLnNumRestartNo );
-    void Finish( WW8_CP nEndCp ) { aCps.Insert( nEndCp, aCps.Count() ); }
+    void Finish( WW8_CP nEndCp ) { aCps.push_back( nEndCp ); }
 
     bool WriteKFTxt( WW8Export& rWrt );
     void WriteSepx( SvStream& rStrm ) const;
@@ -1157,7 +1151,7 @@ private:
     WW8_WrPlcSubDoc(const WW8_WrPlcSubDoc&);
     WW8_WrPlcSubDoc& operator=(const WW8_WrPlcSubDoc&);
 protected:
-    SvULongs aCps;                  // PTRARR CP-Pos der Verweise
+    std::vector<WW8_CP> aCps;
     SvPtrarr aCntnt;                // PTRARR von SwFmtFtn/PostIts/..
     WW8_WrPlc0* pTxtPos;            // Pos der einzelnen Texte
 
@@ -1168,7 +1162,7 @@ protected:
     void WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, WW8_FC& rTxtStt,
         sal_Int32& rTxtCnt, WW8_FC& rRefStt, sal_Int32& rRefCnt ) const;
 
-    virtual const SvULongs* GetShapeIdArr() const;
+    virtual const std::vector<sal_uInt32>* GetShapeIdArr() const;
 };
 
 // Doppel-Plc fuer Footnotes/Endnotes
@@ -1221,8 +1215,8 @@ class WW8_WrPlcTxtBoxes : public WW8_WrPlcSubDoc // Doppel-Plc fuer Textboxen
 {                        // Rahmen/DrawTextboxes!
 private:
     sal_uInt8 nTyp;
-    SvULongs aShapeIds;        // VARARR of ShapeIds for the SwFrmFmts
-    virtual const SvULongs* GetShapeIdArr() const;
+    std::vector<sal_uInt32> aShapeIds;        // VARARR of ShapeIds for the SwFrmFmts
+    virtual const std::vector<sal_uInt32>* GetShapeIdArr() const;
 
     //No copying
     WW8_WrPlcTxtBoxes(const WW8_WrPlcTxtBoxes&);
@@ -1266,7 +1260,7 @@ public:
 class WW8_WrPlc1
 {
 private:
-    SvULongs aPos;              // PTRARR von CPs
+    std::vector<WW8_CP> aPos;
     sal_uInt8* pData;                // Inhalte ( Strukturen )
     sal_uLong nDataLen;
     sal_uInt16 nStructSiz;
@@ -1275,7 +1269,7 @@ private:
     WW8_WrPlc1(const WW8_WrPlc1&);
     WW8_WrPlc1& operator=(const WW8_WrPlc1&);
 protected:
-    sal_uInt16 Count() const { return aPos.Count(); }
+    sal_uInt16 Count() const { return aPos.size(); }
     void Write( SvStream& rStrm );
     WW8_CP Prev() const;
 public:
-- 
1.7.4.1


--=-yjRBUPjUgg6jqovcGQz6--



More information about the LibreOffice mailing list