diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-16 15:23:09 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-25 00:17:05 +0200 |
commit | b620a39936ad2c1fd4067c9e82635c54ce73600b (patch) | |
tree | abcbec5d23faa9bedd7f347dc014755441180401 /sw | |
parent | Convert SV_DECL_PTRARR(SwOLENodes) to std::vector (diff) | |
download | core-b620a39936ad2c1fd4067c9e82635c54ce73600b.tar.gz core-b620a39936ad2c1fd4067c9e82635c54ce73600b.zip |
Convert SV_DECL_PTRARR_DEL(SwNumRuleTbl) to std::vector
Could not use boost::ptr_vector here because the code manually
moves objects around.
Change-Id: I708270a967ee6663ab1f1ba8d7998c63fa698b8f
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/docary.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 25 | ||||
-rw-r--r-- | sw/source/core/doc/number.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/poolfmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/basflt/fltini.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/writer/writer.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 28 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/app/docstyle.cxx | 6 |
15 files changed, 78 insertions, 57 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index ef267c7f46e3..ecc6f39614bd 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/i18n/ForbiddenCharacters.hpp> #include <vector> +#include <algorithm> class SwFieldType; class SwFrmFmt; @@ -73,9 +74,12 @@ SV_DECL_PTRARR_DEL( SwTOXTypes, SwTOXTypePtr, 0 ) typedef SwSectionFmt* SwSectionFmtPtr; SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0) - -typedef SwNumRule* SwNumRulePtr; -SV_DECL_PTRARR_DEL_VISIBILITY( SwNumRuleTbl, SwNumRulePtr, 0, SW_DLLPUBLIC ) +class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> { +public: + // the destructor will free all objects still in the vector + ~SwNumRuleTbl(); + sal_uInt16 GetPos(const SwNumRule* pRule) const; +}; typedef SwRedline* SwRedlinePtr; SV_DECL_PTRARR_SORT_DEL( _SwRedlineTbl, SwRedlinePtr, 0 ) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 1d4121c19203..9359420a6188 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -254,7 +254,7 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) mbOldNumbering = value; const SwNumRuleTbl& rNmTbl = GetNumRuleTbl(); - for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rNmTbl.size(); ++n ) rNmTbl[n]->SetInvalidRule(sal_True); UpdateNumRule(); @@ -2713,4 +2713,16 @@ void SwDoc::setExternalData(::sw::tExternalDataType eType, return m_externalData[eType]; } +sal_uInt16 SwNumRuleTbl::GetPos(const SwNumRule* pRule) const +{ + const_iterator it = std::find(begin(), end(), pRule); + return it == end() ? USHRT_MAX : it - begin(); +} + +SwNumRuleTbl::~SwNumRuleTbl() +{ + for(const_iterator it = begin(); it != end(); ++it) + delete *it; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 01176c9bf212..ab4e43b9e22e 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -2181,7 +2181,7 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles ) } // then there are the numbering templates - nCnt = rSource.GetNumRuleTbl().Count(); + nCnt = rSource.GetNumRuleTbl().size(); if( nCnt ) { const SwNumRuleTbl& rArr = rSource.GetNumRuleTbl(); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index d3e1ad526c61..ed77b8c5d2db 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -115,6 +115,7 @@ #include <sfx2/Metadatable.hxx> #include <fmtmeta.hxx> // MetaFieldManager +#include <boost/foreach.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::document; @@ -126,7 +127,6 @@ const sal_Char sCharFmtStr[] = "Zeichenformat"; const sal_Char sTxtCollStr[] = "Textformatvorlage"; const sal_Char sGrfCollStr[] = "Graphikformatvorlage"; -SV_IMPL_PTRARR( SwNumRuleTbl, SwNumRulePtr) SV_IMPL_PTRARR( SwTxtFmtColls, SwTxtFmtCollPtr) SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr) @@ -805,7 +805,9 @@ void SwDoc::ClearDoc() // destruction of numbering rules and creation of new outline rule // *after* the document nodes are deleted. pOutlineRule = NULL; - pNumRuleTbl->DeleteAndDestroy( 0, pNumRuleTbl->Count() ); + BOOST_FOREACH( SwNumRule* pNumRule, *pNumRuleTbl ) + delete pNumRule; + pNumRuleTbl->clear(); // creation of new outline numbering rule pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ), // #i89178# diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 50aecc016d5c..8d5c6d78e0e5 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1062,7 +1062,8 @@ sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast ) // #i34097# DeleteAndDestroy deletes rName if // rName is directly taken from the numrule. const String aTmpName( rName ); - pNumRuleTbl->DeleteAndDestroy( nPos ); + delete (*pNumRuleTbl)[ nPos ]; + pNumRuleTbl->erase( pNumRuleTbl->begin() + nPos ); maNumRuleMap.erase(aTmpName); SetModified(); @@ -1132,7 +1133,7 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, void SwDoc::StopNumRuleAnimations( OutputDevice* pOut ) { - for( sal_uInt16 n = GetNumRuleTbl().Count(); n; ) + for( sal_uInt16 n = GetNumRuleTbl().size(); n; ) { SwNumRule::tTxtNodeList aTxtNodeList; GetNumRuleTbl()[ --n ]->GetTxtNodeList( aTxtNodeList ); @@ -1381,7 +1382,7 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) void SwDoc::InvalidateNumRules() { - for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n) + for (sal_uInt16 n = 0; n < pNumRuleTbl->size(); ++n) (*pNumRuleTbl)[n]->SetInvalidRule(sal_True); } @@ -2132,7 +2133,7 @@ SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const sal_uInt16 SwDoc::FindNumRule( const String& rName ) const { - for( sal_uInt16 n = pNumRuleTbl->Count(); n; ) + for( sal_uInt16 n = pNumRuleTbl->size(); n; ) if( (*pNumRuleTbl)[ --n ]->GetName() == rName ) return n; @@ -2147,7 +2148,7 @@ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const if ( !pResult ) { - for (sal_uInt16 n = 0; n < pNumRuleTbl->Count(); ++n) + for (sal_uInt16 n = 0; n < pNumRuleTbl->size(); ++n) { if ((*pNumRuleTbl)[n]->GetName() == rName) { @@ -2163,7 +2164,7 @@ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const void SwDoc::AddNumRule(SwNumRule * pRule) { - pNumRuleTbl->Insert(pRule, pNumRuleTbl->Count()); + pNumRuleTbl->push_back(pRule); maNumRuleMap[pRule->GetName()] = pRule; pRule->SetNumRuleMap(&maNumRuleMap); @@ -2197,7 +2198,7 @@ sal_uInt16 SwDoc::MakeNumRule( const String &rName, eDefaultNumberFormatPositionAndSpaceMode ); } - sal_uInt16 nRet = pNumRuleTbl->Count(); + sal_uInt16 nRet = pNumRuleTbl->size(); AddNumRule(pNew); @@ -2233,7 +2234,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c aName = SW_RESSTR( STR_NUMRULE_DEFNAME ); } - sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2; + sal_uInt16 nNum(0), nTmp, nFlagSize = ( pNumRuleTbl->size() / 8 ) +2; sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); @@ -2254,7 +2255,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c const SwNumRule* pNumRule; sal_uInt16 n; - for( n = 0; n < pNumRuleTbl->Count(); ++n ) + for( n = 0; n < pNumRuleTbl->size(); ++n ) if( 0 != ( pNumRule = (*pNumRuleTbl)[ n ] ) ) { const String& rNm = pNumRule->GetName(); @@ -2262,7 +2263,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c { // Determine Number and set the Flag nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32(); - if( nNum-- && nNum < pNumRuleTbl->Count() ) + if( nNum-- && nNum < pNumRuleTbl->size() ) pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 )); } if( pChkStr && pChkStr->Equals( rNm ) ) @@ -2272,7 +2273,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c if( !pChkStr ) { // All Numbers have been flagged accordingly, so identify the right Number - nNum = pNumRuleTbl->Count(); + nNum = pNumRuleTbl->size(); for( n = 0; n < nFlagSize; ++n ) if( 0xff != ( nTmp = pSetFlags[ n ] )) { @@ -2293,7 +2294,7 @@ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) c void SwDoc::UpdateNumRule() { const SwNumRuleTbl& rNmTbl = GetNumRuleTbl(); - for( sal_uInt16 n = 0; n < rNmTbl.Count(); ++n ) + for( sal_uInt16 n = 0; n < rNmTbl.size(); ++n ) if( rNmTbl[ n ]->IsInvalidRule() ) rNmTbl[ n ]->Validate(); } diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index cc0f58a39d8a..41fc6709fe21 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -357,7 +357,7 @@ void SwNumFmt::UpdateNumNodes( SwDoc* pDoc ) sal_Bool bDocIsModified = pDoc->IsModified(); sal_Bool bFnd = sal_False; const SwNumRule* pRule; - for( sal_uInt16 n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; ) + for( sal_uInt16 n = pDoc->GetNumRuleTbl().size(); !bFnd && n; ) { pRule = pDoc->GetNumRuleTbl()[ --n ]; for( sal_uInt8 i = 0; i < MAXLEVEL; ++i ) diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index 44786d8e1e0c..6d7fb9c6bc1b 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -1616,7 +1616,7 @@ SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId ) SwNumRule* pNewRule; sal_uInt16 n; - for( n = 0; n < GetNumRuleTbl().Count(); ++n ) + for( n = 0; n < GetNumRuleTbl().size(); ++n ) if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() ) { return pNewRule; diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index cd341aeaa37c..47fa26eb72ad 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1740,7 +1740,7 @@ sal_Int32 SwXNumberingRulesCollection::getCount(void) throw( uno::RuntimeExcepti SolarMutexGuard aGuard; if(!IsValid()) throw uno::RuntimeException(); - return GetDoc()->GetNumRuleTbl().Count(); + return GetDoc()->GetNumRuleTbl().size(); } uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex) @@ -1751,7 +1751,7 @@ uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex) if(IsValid()) { uno::Reference< XIndexReplace > xRef; - if ( nIndex < GetDoc()->GetNumRuleTbl().Count() ) + if ( nIndex < (sal_Int32)GetDoc()->GetNumRuleTbl().size() ) { xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< sal_uInt16 >(nIndex) ], GetDoc()); aRet.setValue(&xRef, ::getCppuType((uno::Reference<XIndexReplace>*)0)); @@ -1775,7 +1775,7 @@ sal_Bool SwXNumberingRulesCollection::hasElements(void) throw( uno::RuntimeExcep SolarMutexGuard aGuard; if(!IsValid()) throw uno::RuntimeException(); - return GetDoc()->GetNumRuleTbl().Count() > 0; + return !GetDoc()->GetNumRuleTbl().empty(); } OUString SwXFootnotes::getImplementationName(void) throw( RuntimeException ) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 7a901c503d26..9c645f3c2c8b 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -585,7 +585,7 @@ sal_Int32 lcl_GetCountOrName ( const SwDoc &rDoc, SfxStyleFamily eFamily, String sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN; nIndex = nIndex - nBaseCount; const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl(); - for(sal_uInt16 i = 0; i < rNumTbl.Count(); ++i) + for(sal_uInt16 i = 0; i < rNumTbl.size(); ++i) { const SwNumRule& rRule = *rNumTbl[ i ]; if( rRule.IsAutoRule() ) diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 35e7d2fefeca..052f359db375 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -322,16 +322,18 @@ void StgReader::SetFltName( const String& rFltNm ) SwRelNumRuleSpaces::SwRelNumRuleSpaces( SwDoc& rDoc, sal_Bool bNDoc ) : bNewDoc( bNDoc ) { - pNumRuleTbl = new SwNumRuleTbl( 8 ); + pNumRuleTbl = new SwNumRuleTbl(); + pNumRuleTbl->reserve(8); if( !bNDoc ) - pNumRuleTbl->Insert( &rDoc.GetNumRuleTbl(), 0 ); + pNumRuleTbl->insert( pNumRuleTbl->begin(), + rDoc.GetNumRuleTbl().begin(), rDoc.GetNumRuleTbl().end() ); } SwRelNumRuleSpaces::~SwRelNumRuleSpaces() { if( pNumRuleTbl ) { - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); + pNumRuleTbl->clear(); delete pNumRuleTbl; } } @@ -345,17 +347,17 @@ void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc ) // jetzt alle schon vorhanden NumRules aus dem Array entfernen, // damit nur die neuen angepasst werden SwNumRuleTbl aNumRuleTbl; - aNumRuleTbl.Insert( pNumRuleTbl, 0 ); - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); + aNumRuleTbl.insert( aNumRuleTbl.begin(), pNumRuleTbl->begin(), pNumRuleTbl->end() ); + pNumRuleTbl->clear(); const SwNumRuleTbl& rRuleTbl = rDoc.GetNumRuleTbl(); SwNumRule* pRule; - for( sal_uInt16 n = 0; n < rRuleTbl.Count(); ++n ) - if( USHRT_MAX == aNumRuleTbl.GetPos( ( pRule = rRuleTbl[ n ] ))) + for( sal_uInt16 n = 0; n < rRuleTbl.size(); ++n ) + if( USHRT_MAX == aNumRuleTbl.GetPos( pRule = rRuleTbl[ n ] )) // war noch nicht vorhanden, also neu - pNumRuleTbl->Insert( pRule, pNumRuleTbl->Count() ); + pNumRuleTbl->push_back( pRule ); - aNumRuleTbl.Remove( 0, aNumRuleTbl.Count() ); + aNumRuleTbl.clear(); pRuleTbl = pNumRuleTbl; } @@ -366,7 +368,7 @@ void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc ) if( pRuleTbl ) { - for( sal_uInt16 n = pRuleTbl->Count(); n; ) + for( sal_uInt16 n = pRuleTbl->size(); n; ) { SwNumRule* pRule = (*pRuleTbl)[ --n ]; // Rule noch gueltig und am Doc vorhanden? @@ -386,7 +388,7 @@ void SwRelNumRuleSpaces::SetNumRelSpaces( SwDoc& rDoc ) if( pNumRuleTbl ) { - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); + pNumRuleTbl->clear(); delete pNumRuleTbl, pNumRuleTbl = 0; } diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 5942209fc9bf..9702d17badc5 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -372,7 +372,7 @@ void Writer::PutNumFmtFontsInAttrPool() const Font* pDefFont = &numfunc::GetDefBulletFont(); sal_Bool bCheck = sal_False; - for( sal_uInt16 nGet = rListTbl.Count(); nGet; ) + for( sal_uInt16 nGet = rListTbl.size(); nGet; ) if( pDoc->IsUsed( *(pRule = rListTbl[ --nGet ] ))) for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl ) if( SVX_NUM_CHAR_SPECIAL == (pFmt = &pRule->Get( nLvl ))->GetNumberingType() || diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 95f83509f0cf..efcea5b458ce 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -213,11 +213,11 @@ void RtfExport::BuildNumbering() { const SwNumRuleTbl& rListTbl = pDoc->GetNumRuleTbl(); - for( sal_uInt16 n = rListTbl.Count()+1; n; ) + for( sal_uInt16 n = rListTbl.size()+1; n; ) { SwNumRule* pRule; --n; - if( n == rListTbl.Count() ) + if( n == rListTbl.size() ) pRule = (SwNumRule*)pDoc->GetOutlineNumRule(); else { diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 068a27db92c7..d656b695debb 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -59,7 +59,7 @@ sal_uInt16 MSWordExportBase::DuplicateNumRule( const SwNumRule *pRule, sal_uInt8 SwNumRule* pMyNumRule = new SwNumRule( pDoc->GetUniqueNumRuleName( &sPrefix ), SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); - pUsedNumTbl->Insert( pMyNumRule, pUsedNumTbl->Count() ); + pUsedNumTbl->push_back( pMyNumRule ); for ( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) { @@ -84,16 +84,16 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule ) if ( !pUsedNumTbl ) { pUsedNumTbl = new SwNumRuleTbl; - pUsedNumTbl->Insert( &pDoc->GetNumRuleTbl(), 0 ); + pUsedNumTbl->insert( pUsedNumTbl->begin(), pDoc->GetNumRuleTbl().begin(), pDoc->GetNumRuleTbl().end() ); // Check, if the outline rule is already inserted into <pUsedNumTbl>. // If yes, do not insert it again. bool bOutlineRuleAdded( false ); - for ( sal_uInt16 n = pUsedNumTbl->Count(); n; ) + for ( sal_uInt16 n = pUsedNumTbl->size(); n; ) { - const SwNumRule& rRule = *pUsedNumTbl->GetObject( --n ); + const SwNumRule& rRule = *(*pUsedNumTbl)[ --n ]; if ( !pDoc->IsUsed( rRule ) ) { - pUsedNumTbl->Remove( n ); + pUsedNumTbl->erase( pUsedNumTbl->begin() + n ); } else if ( &rRule == pDoc->GetOutlineNumRule() ) { @@ -105,7 +105,7 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule ) { // jetzt noch die OutlineRule einfuegen SwNumRule* pR = (SwNumRule*)pDoc->GetOutlineNumRule(); - pUsedNumTbl->Insert( pR, pUsedNumTbl->Count() ); + pUsedNumTbl->push_back( pR ); } } SwNumRule* p = (SwNumRule*)&rNumRule; @@ -147,7 +147,7 @@ void WW8Export::WriteNumbering() // list formats - LSTF pFib->fcPlcfLst = pTableStrm->Tell(); - SwWW8Writer::WriteShort( *pTableStrm, pUsedNumTbl->Count() ); + SwWW8Writer::WriteShort( *pTableStrm, pUsedNumTbl->size() ); NumberingDefinitions(); // set len to FIB pFib->lcbPlcfLst = pTableStrm->Tell() - pFib->fcPlcfLst; @@ -183,12 +183,12 @@ void MSWordExportBase::NumberingDefinitions() if ( !pUsedNumTbl ) return; // no numbering is used - sal_uInt16 nCount = pUsedNumTbl->Count(); + sal_uInt16 nCount = pUsedNumTbl->size(); // Write static data of SwNumRule - LSTF for ( sal_uInt16 n = 0; n < nCount; ++n ) { - const SwNumRule& rRule = *pUsedNumTbl->GetObject( n ); + const SwNumRule& rRule = *(*pUsedNumTbl)[ n ]; AttrOutput().NumberingDefinition( n + 1, rRule ); } @@ -300,7 +300,7 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/, void MSWordExportBase::AbstractNumberingDefinitions() { - sal_uInt16 nCount = pUsedNumTbl->Count(); + sal_uInt16 nCount = pUsedNumTbl->size(); sal_uInt16 n; // prepare the NodeNum to generate the NumString @@ -313,7 +313,7 @@ void MSWordExportBase::AbstractNumberingDefinitions() { AttrOutput().StartAbstractNumbering( n + 1 ); - const SwNumRule& rRule = *pUsedNumTbl->GetObject( n ); + const SwNumRule& rRule = *(*pUsedNumTbl)[ n ]; sal_uInt8 nLvl; sal_uInt8 nLevels = static_cast< sal_uInt8 >(rRule.IsContinusNum() ? WW8ListManager::nMinLevel : WW8ListManager::nMaxLevel); @@ -503,7 +503,7 @@ void WW8Export::OutOverrideListTab() return ; // no numbering is used // write the "list format override" - LFO - sal_uInt16 nCount = pUsedNumTbl->Count(); + sal_uInt16 nCount = pUsedNumTbl->size(); sal_uInt16 n; pFib->fcPlfLfo = pTableStrm->Tell(); @@ -527,7 +527,7 @@ void WW8Export::OutListNamesTab() return ; // no numbering is used // write the "list format override" - LFO - sal_uInt16 nNms = 0, nCount = pUsedNumTbl->Count(); + sal_uInt16 nNms = 0, nCount = pUsedNumTbl->size(); pFib->fcSttbListNames = pTableStrm->Tell(); SwWW8Writer::WriteShort( *pTableStrm, -1 ); @@ -535,7 +535,7 @@ void WW8Export::OutListNamesTab() for( ; nNms < nCount; ++nNms ) { - const SwNumRule& rRule = *pUsedNumTbl->GetObject( nNms ); + const SwNumRule& rRule = *(*pUsedNumTbl)[ nNms ]; String sNm; if( !rRule.IsAutoRule() ) sNm = rRule.GetName(); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 73d432f47939..28e8c29e80da 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3067,7 +3067,7 @@ void WW8Export::ExportDocument_Impl() // clear the part of the list array that was copied from the document // - it's an auto delete array, so the rest of the array which are // duplicated lists that were added during the export will be deleted. - pUsedNumTbl->Remove(0, pUsedNumTbl->Count()-nUniqueList); + pUsedNumTbl->erase(pUsedNumTbl->begin(), pUsedNumTbl->begin() + pUsedNumTbl->size() - nUniqueList); delete pUsedNumTbl; } diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index e7aea6ce0023..2b5d8e1cee53 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -1420,7 +1420,7 @@ void lcl_SaveStyles( sal_uInt16 nFamily, SvPtrarr& rArr, SwDoc& rDoc ) case SFX_STYLE_FAMILY_PSEUDO: { const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl(); - for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n ) + for( sal_uInt16 n = 0, nCnt = rTbl.size(); n < nCnt; ++n ) { void* p = (void*)rTbl[ n ]; rArr.Insert( p, n ); @@ -1500,7 +1500,7 @@ void lcl_DeleteInfoStyles( sal_uInt16 nFamily, SvPtrarr& rArr, SwDoc& rDoc ) { SvPtrarr aDelArr; const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl(); - for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n ) + for( n = 0, nCnt = rTbl.size(); n < nCnt; ++n ) { void* p = (void*)rTbl[ n ]; if( USHRT_MAX == rArr.GetPos( p )) @@ -2713,7 +2713,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() nSearchFamily == SFX_STYLE_FAMILY_ALL ) { const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl(); - for(sal_uInt16 i = 0; i < rNumTbl.Count(); ++i) + for(sal_uInt16 i = 0; i < rNumTbl.size(); ++i) { const SwNumRule& rRule = *rNumTbl[ i ]; if( !rRule.IsAutoRule() ) |