summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/tabpages/autocdlg.cxx64
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectExport.cxx2
-rw-r--r--editeng/source/misc/SvXMLAutoCorrectImport.cxx2
-rw-r--r--editeng/source/misc/svxacorr.cxx42
-rw-r--r--svl/inc/svl/svstdarr.hxx14
-rw-r--r--svl/source/memtools/svarray.cxx47
-rw-r--r--sw/inc/ftnidx.hxx1
-rw-r--r--sw/source/core/bastyp/swcache.cxx1
-rw-r--r--sw/source/core/doc/acmplwrd.cxx42
-rw-r--r--sw/source/core/doc/docfld.cxx2
-rw-r--r--sw/source/core/fields/fldlst.cxx2
-rw-r--r--sw/source/filter/html/htmlfly.cxx2
-rw-r--r--sw/source/ui/app/docsh2.cxx5
13 files changed, 103 insertions, 123 deletions
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 94a5c7f5c4d5..2808cf2c791b 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -1532,20 +1532,23 @@ sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& )
if(pWrdList)
{
- sal_uInt16 nCount = pWrdList->Count();
+ sal_uInt16 nCount = pWrdList->size();
sal_uInt16 i;
for( i = nCount; i; )
{
- String* pString = pWrdList->GetObject( --i );
+ String* pString = (*pWrdList)[ --i ];
if( !lcl_FindInArray(rArrays.aDoubleCapsStrings, *pString))
- pWrdList->DeleteAndDestroy( i );
+ {
+ delete (*pWrdList)[ i ];
+ pWrdList->erase( pWrdList->begin() + i );
+ }
}
for(std::vector<rtl::OUString>::iterator it = rArrays.aDoubleCapsStrings.begin(); it != rArrays.aDoubleCapsStrings.end(); ++i)
{
String* s = new String(*it);
- if(!pWrdList->Insert(s))
+ if(!pWrdList->insert(s).second)
delete s;
}
pAutoCorrect->SaveWrdSttExceptList(eCurLang);
@@ -1555,19 +1558,22 @@ sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& )
if(pCplList)
{
- sal_uInt16 nCount = pCplList->Count();
+ sal_uInt16 nCount = pCplList->size();
sal_uInt16 i;
for( i = nCount; i; )
{
- String* pString = pCplList->GetObject( --i );
+ String* pString = (*pCplList)[ --i ];
if( !lcl_FindInArray(rArrays.aAbbrevStrings, *pString))
- pCplList->DeleteAndDestroy( i );
+ {
+ delete (*pCplList)[ i ];
+ pCplList->erase( pCplList->begin() + i );
+ }
}
for(std::vector<rtl::OUString>::iterator it = rArrays.aAbbrevStrings.begin(); it != rArrays.aAbbrevStrings.end(); ++it)
{
String* s = new String(*it);
- if(!pCplList->Insert(s))
+ if(!pCplList->insert(s).second)
delete s;
}
@@ -1581,19 +1587,22 @@ sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& )
if(pWrdList)
{
- sal_uInt16 nCount = pWrdList->Count();
+ sal_uInt16 nCount = pWrdList->size();
sal_uInt16 i;
for( i = nCount; i; )
{
- String* pString = pWrdList->GetObject( --i );
+ String* pString = (*pWrdList)[ --i ];
if( USHRT_MAX == aDoubleCapsLB.GetEntryPos(*pString) )
- pWrdList->DeleteAndDestroy( i );
+ {
+ delete (*pWrdList)[ i ];
+ pWrdList->erase( pWrdList->begin() + i );
+ }
}
nCount = aDoubleCapsLB.GetEntryCount();
for( i = 0; i < nCount; ++i )
{
String* pEntry = new String( aDoubleCapsLB.GetEntry( i ) );
- if( !pWrdList->Insert( pEntry ))
+ if( !pWrdList->insert( pEntry ).second)
delete pEntry;
}
pAutoCorrect->SaveWrdSttExceptList(eLang);
@@ -1603,19 +1612,22 @@ sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& )
if(pCplList)
{
- sal_uInt16 nCount = pCplList->Count();
+ sal_uInt16 nCount = pCplList->size();
sal_uInt16 i;
for( i = nCount; i; )
{
- String* pString = pCplList->GetObject( --i );
+ String* pString = (*pCplList)[ --i ];
if( USHRT_MAX == aAbbrevLB.GetEntryPos(*pString) )
- pCplList->DeleteAndDestroy( i );
+ {
+ delete (*pCplList)[ i ];
+ pCplList->erase( pCplList->begin() + i );
+ }
}
nCount = aAbbrevLB.GetEntryCount();
for( i = 0; i < nCount; ++i )
{
String* pEntry = new String( aAbbrevLB.GetEntry( i ) );
- if( !pCplList->Insert( pEntry ))
+ if( !pCplList->insert( pEntry ).second)
delete pEntry;
}
pAutoCorrect->SaveCplSttExceptList(eLang);
@@ -1693,13 +1705,13 @@ void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset,
const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang);
const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang);
sal_uInt16 i;
- for( i = 0; i < pCplList->Count(); i++ )
+ for( i = 0; i < pCplList->size(); i++ )
{
- aAbbrevLB.InsertEntry(*pCplList->GetObject(i));
+ aAbbrevLB.InsertEntry(*(*pCplList)[i]);
}
- for( i = 0; i < pWrdList->Count(); i++ )
+ for( i = 0; i < pWrdList->size(); i++ )
{
- aDoubleCapsLB.InsertEntry(*pWrdList->GetObject(i));
+ aDoubleCapsLB.InsertEntry(*(*pWrdList)[i]);
}
}
}
@@ -2330,14 +2342,14 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet& )
}
}
- if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->Count() )
+ if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->size() )
{
pAutoCmpltList = (SvStringsISortDtor*)pOpt->pAutoCmpltList;
pOpt->pAutoCmpltList = 0;
- nAutoCmpltListCnt = pAutoCmpltList->Count();
+ nAutoCmpltListCnt = pAutoCmpltList->size();
for( sal_uInt16 n = 0; n < nAutoCmpltListCnt; ++n )
{
- const StringPtr pStr = pAutoCmpltList->GetObject( n );
+ const StringPtr pStr = (*pAutoCmpltList)[ n ];
sal_uInt16 nPos = aLBEntries.InsertEntry( *pStr );
aLBEntries.SetEntryData( nPos, (void*)pStr );
}
@@ -2363,11 +2375,9 @@ IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl)
while( nSelCnt )
{
sal_uInt16 nPos = aLBEntries.GetSelectEntryPos( --nSelCnt );
- const StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos );
+ StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos );
aLBEntries.RemoveEntry( nPos );
- nPos = pAutoCmpltList->GetPos( pStr );
- if( USHRT_MAX != nPos )
- pAutoCmpltList->Remove( nPos );
+ pAutoCmpltList->erase( pStr );
}
return 0;
}
diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.cxx b/editeng/source/misc/SvXMLAutoCorrectExport.cxx
index 2552f2f4805f..df1ba5d73eff 100644
--- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx
+++ b/editeng/source/misc/SvXMLAutoCorrectExport.cxx
@@ -103,7 +103,7 @@ sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/)
_GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
{
SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, sal_True, sal_True);
- sal_uInt16 nBlocks= rList.Count();
+ sal_uInt16 nBlocks= rList.size();
for ( sal_uInt16 i = 0; i < nBlocks; i++)
{
AddAttribute( XML_NAMESPACE_BLOCKLIST,
diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.cxx b/editeng/source/misc/SvXMLAutoCorrectImport.cxx
index 0f520b48688a..54243386aee6 100644
--- a/editeng/source/misc/SvXMLAutoCorrectImport.cxx
+++ b/editeng/source/misc/SvXMLAutoCorrectImport.cxx
@@ -246,7 +246,7 @@ SvXMLExceptionContext::SvXMLExceptionContext(
String * pNew = new String( sWord );
- if( !rLocalRef.rList.Insert( pNew ) )
+ if( !rLocalRef.rList.insert( pNew ).second )
delete pNew;
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 68473fd5c694..7007a50e02a8 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1762,7 +1762,7 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
//the language is available - so bring it on
SvxAutoCorrectLanguageLists* pList = pLangTable->find(eLang)->second;
String _sTemp(sWord);
- if(pList->GetWrdSttExceptList()->Seek_Entry(&_sTemp))
+ if(pList->GetWrdSttExceptList()->find(&_sTemp) != pList->GetWrdSttExceptList()->end() )
return sal_True;
}
@@ -1771,7 +1771,7 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
{
//the language is available - so bring it on
SvxAutoCorrectLanguageLists* pList = pLangTable->find(nTmpKey1)->second;
- if(pList->GetWrdSttExceptList()->Seek_Entry(&sTemp))
+ if(pList->GetWrdSttExceptList()->find(&sTemp) != pList->GetWrdSttExceptList()->end() )
return sal_True;
}
@@ -1779,7 +1779,7 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
{
//the language is available - so bring it on
SvxAutoCorrectLanguageLists* pList = pLangTable->find(nTmpKey2)->second;
- if(pList->GetWrdSttExceptList()->Seek_Entry(&sTemp))
+ if(pList->GetWrdSttExceptList()->find(&sTemp) != pList->GetWrdSttExceptList()->end() )
return sal_True;
}
@@ -1787,7 +1787,7 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
{
//the language is available - so bring it on
SvxAutoCorrectLanguageLists* pList = pLangTable->find(LANGUAGE_DONTKNOW)->second;
- if(pList->GetWrdSttExceptList()->Seek_Entry(&sTemp))
+ if(pList->GetWrdSttExceptList()->find(&sTemp) != pList->GetWrdSttExceptList()->end() )
return sal_True;
}
return sal_False;
@@ -1796,14 +1796,14 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
static sal_Bool lcl_FindAbbreviation( const SvStringsISortDtor* pList, const String& sWord)
{
String sAbk(rtl::OUString('~'));
- sal_uInt16 nPos;
- pList->Seek_Entry( &sAbk, &nPos );
- if( nPos < pList->Count() )
+ SvStringsISortDtor::const_iterator it = pList->find( &sAbk );
+ sal_uInt16 nPos = it - pList->begin();
+ if( nPos < pList->size() )
{
String sLowerWord( sWord ); sLowerWord.ToLowerAscii();
const String* pAbk;
for( sal_uInt16 n = nPos;
- n < pList->Count() &&
+ n < pList->size() &&
'~' == ( pAbk = (*pList)[ n ])->GetChar( 0 );
++n )
{
@@ -1840,7 +1840,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = pLangTable->find(eLang)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->Seek_Entry(&sTemp))
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(&sTemp) != pList->end() )
return sal_True;
}
@@ -1848,7 +1848,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
if(nTmpKey1 != eLang && (pLangTable->find(nTmpKey1) != pLangTable->end() || CreateLanguageFile(nTmpKey1, sal_False)))
{
const SvStringsISortDtor* pList = pLangTable->find(nTmpKey1)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->Seek_Entry(&sTemp))
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(&sTemp) != pList->end() )
return sal_True;
}
@@ -1856,7 +1856,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = pLangTable->find(nTmpKey2)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->Seek_Entry(&sTemp))
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(&sTemp) != pList->end() )
return sal_True;
}
@@ -1864,7 +1864,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = pLangTable->find(LANGUAGE_DONTKNOW)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->Seek_Entry(&sTemp))
+ if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(&sTemp) != pList->end() )
return sal_True;
}
return sal_False;
@@ -1952,9 +1952,9 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
SotStorageRef& rStg)
{
if( rpLst )
- rpLst->DeleteAndDestroy( 0, rpLst->Count() );
+ rpLst->DeleteAndDestroyAll();
else
- rpLst = new SvStringsISortDtor( 16 );
+ rpLst = new SvStringsISortDtor;
{
String sStrmName( pStrmName, RTL_TEXTENCODING_MS_1252 );
@@ -2042,7 +2042,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
if( rStg.Is() )
{
String sStrmName( pStrmName, RTL_TEXTENCODING_MS_1252 );
- if( !rLst.Count() )
+ if( rLst.empty() )
{
rStg->Remove( sStrmName );
rStg->Commit();
@@ -2178,7 +2178,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::GetCplSttExceptList()
sal_Bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const String& rNew)
{
String* pNew = new String( rNew );
- if( rNew.Len() && GetCplSttExceptList()->Insert( pNew ) )
+ if( rNew.Len() && GetCplSttExceptList()->insert( pNew ).second )
{
MakeUserStorage_Impl();
SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
@@ -2200,7 +2200,7 @@ sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const String& rNew)
{
String* pNew = new String( rNew );
SvStringsISortDtor* pExceptList = LoadWrdSttExceptList();
- if( rNew.Len() && pExceptList && pExceptList->Insert( pNew ) )
+ if( rNew.Len() && pExceptList && pExceptList->insert( pNew ).second )
{
MakeUserStorage_Impl();
SotStorageRef xStg = new SotStorage( sUserAutoCorrFile, STREAM_READWRITE, sal_True );
@@ -2252,7 +2252,7 @@ void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList
if( !pCplStt_ExcptLst )
{
OSL_ENSURE( !this, "No valid list" );
- pCplStt_ExcptLst = new SvStringsISortDtor( 16 );
+ pCplStt_ExcptLst = new SvStringsISortDtor;
}
nFlags |= CplSttLstLoad;
}
@@ -2288,7 +2288,7 @@ void SvxAutoCorrectLanguageLists::SetWrdSttExceptList( SvStringsISortDtor* pList
if( !pWrdStt_ExcptLst )
{
OSL_ENSURE( !this, "No valid list" );
- pWrdStt_ExcptLst = new SvStringsISortDtor( 16 );
+ pWrdStt_ExcptLst = new SvStringsISortDtor;
}
nFlags |= WrdSttLstLoad;
}
@@ -2386,7 +2386,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
if (pTmpWordList)
{
SaveExceptList_Imp( *pTmpWordList, pXMLImplWrdStt_ExcptLstStr, xDstStg, sal_True );
- pTmpWordList->DeleteAndDestroy( 0, pTmpWordList->Count() );
+ pTmpWordList->DeleteAndDestroyAll();
pTmpWordList = NULL;
}
@@ -2397,7 +2397,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
if (pTmpWordList)
{
SaveExceptList_Imp( *pTmpWordList, pXMLImplCplStt_ExcptLstStr, xDstStg, sal_True );
- pTmpWordList->DeleteAndDestroy( 0, pTmpWordList->Count() );
+ pTmpWordList->DeleteAndDestroyAll();
}
GetAutocorrWordList();
diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx
index 302ba85bd491..66fc0fd7a24b 100644
--- a/svl/inc/svl/svstdarr.hxx
+++ b/svl/inc/svl/svstdarr.hxx
@@ -28,15 +28,25 @@
***********************************************************************/
#include "svl/svldllapi.h"
-#include <svl/svarray.hxx>
#include <deque>
#include <tools/string.hxx>
+#include <o3tl/sorted_vector.hxx>
typedef String* StringPtr;
#ifndef _SVSTDARR_STRINGSISORTDTOR_DECL
-SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsISortDtor, StringPtr, 1, SVL_DLLPUBLIC )
+
+struct SVL_DLLPUBLIC CompareSvStringsISortDtor
+{
+ bool operator()( String* const& lhs, String* const& rhs ) const;
+};
+class SVL_DLLPUBLIC SvStringsISortDtor : public o3tl::sorted_vector<String*, CompareSvStringsISortDtor >
+{
+public:
+ ~SvStringsISortDtor() { DeleteAndDestroyAll(); }
+};
+
#define _SVSTDARR_STRINGSISORTDTOR_DECL
#endif
diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx
index f99e0bd8ad38..98e7f2a93495 100644
--- a/svl/source/memtools/svarray.cxx
+++ b/svl/source/memtools/svarray.cxx
@@ -18,7 +18,7 @@
*/
#include <svl/svstdarr.hxx>
-#include <tools/debug.hxx>
+#include <svl/svarray.hxx>
SV_IMPL_VARARR(SvPtrarr,VoidPtr)
@@ -28,51 +28,10 @@ sal_uInt16 SvPtrarr::GetPos( const VoidPtr& aElement ) const
return ( n >= nA ? USHRT_MAX : n );
}
-// ---------------- strings -------------------------------------
-// Array with different Seek method
-_SV_IMPL_SORTAR_ALG( SvStringsISortDtor, StringPtr )
-void SvStringsISortDtor::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
+bool CompareSvStringsISortDtor::operator()( String* const& lhs, String* const& rhs ) const
{
- if( nL )
- {
- DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );
- for( sal_uInt16 n=nP; n < nP + nL; n++ )
- delete *((StringPtr*)pData+n);
- SvPtrarr::Remove( nP, nL );
- }
-}
-sal_Bool SvStringsISortDtor::Seek_Entry( const StringPtr aE, sal_uInt16* pP ) const
-{
- register sal_uInt16 nO = SvStringsISortDtor_SAR::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- StringCompare eCmp = (*((StringPtr*)pData + nM))->
- CompareIgnoreCaseToAscii( *(aE) );
- if( COMPARE_EQUAL == eCmp )
- {
- if( pP ) *pP = nM;
- return sal_True;
- }
- else if( COMPARE_LESS == eCmp )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return sal_False;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return sal_False;
+ return lhs->CompareIgnoreCaseToAscii( *rhs ) == COMPARE_LESS;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx
index 40b969fb4c55..446a3db4917f 100644
--- a/sw/inc/ftnidx.hxx
+++ b/sw/inc/ftnidx.hxx
@@ -29,6 +29,7 @@
#define _FTNIDX_HXX
#include <svl/svstdarr.hxx>
+#include <svl/svarray.hxx>
#include <vector>
class SwTxtFtn;
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index b94892d56da6..63320c0e955f 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -28,6 +28,7 @@
#include <rtl/strbuf.hxx>
#include <swcache.hxx>
+#include <limits.h> // USHRT_MAX
#ifdef DBG_UTIL
void SwCache::Check()
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index c1600efe197b..138dcd115f7e 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -223,7 +223,7 @@ bool SwAutoCompleteString::RemoveDocument(const SwDoc& rDoc)
}
SwAutoCompleteWord::SwAutoCompleteWord( sal_uInt16 nWords, sal_uInt16 nMWrdLen )
- : aWordLst( 0 ),
+ : aWordLst(),
pImpl(new SwAutoCompleteWord_Impl(*this)),
nMaxCount( nWords ),
nMinWrdLen( nMWrdLen ),
@@ -233,10 +233,10 @@ SwAutoCompleteWord::SwAutoCompleteWord( sal_uInt16 nWords, sal_uInt16 nMWrdLen )
SwAutoCompleteWord::~SwAutoCompleteWord()
{
- for(sal_uInt16 nPos = aWordLst.Count(); nPos; nPos--)
+ for(sal_uInt16 nPos = aWordLst.size(); nPos; nPos--)
{
SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)aWordLst[ nPos - 1 ];
- aWordLst.Remove( nPos - 1 );
+ aWordLst.erase( aWordLst.begin() + nPos - 1 );
delete pCurrent;
}
delete pImpl;
@@ -273,8 +273,8 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
{
SwAutoCompleteString* pNew = new SwAutoCompleteString( aNewWord, 0, nWrdLen );
pNew->AddDocument(rDoc);
- sal_uInt16 nInsPos;
- if( aWordLst.Insert( pNew, nInsPos ) )
+ std::pair<SvStringsISortDtor::const_iterator, bool> aInsPair;
+ if( (aInsPair = aWordLst.insert( pNew )).second )
{
bRet = sal_True;
if (aLRULst.size() >= nMaxCount)
@@ -283,7 +283,7 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
// so that there is space for the first one
SwAutoCompleteString* pDel = aLRULst.back();
aLRULst.pop_back();
- aWordLst.Remove( pDel );
+ aWordLst.erase( pDel );
delete pDel;
}
aLRULst.push_front(pNew);
@@ -292,7 +292,7 @@ sal_Bool SwAutoCompleteWord::InsertWord( const String& rWord, SwDoc& rDoc )
{
delete pNew;
// then move "up"
- pNew = (SwAutoCompleteString*)aWordLst[ nInsPos ];
+ pNew = (SwAutoCompleteString*)(*aInsPair.first);
// add the document to the already inserted string
pNew->AddDocument(rDoc);
@@ -316,12 +316,12 @@ void SwAutoCompleteWord::SetMaxCount( sal_uInt16 nNewMax )
{
// remove the trailing ones
sal_uInt16 nLRUIndex = nNewMax-1;
- while( nNewMax < aWordLst.Count() && nLRUIndex < aLRULst.size())
+ while( nNewMax < aWordLst.size() && nLRUIndex < aLRULst.size())
{
- sal_uInt16 nPos = aWordLst.GetPos( aLRULst[ nLRUIndex++ ] );
- OSL_ENSURE( USHRT_MAX != nPos, "String not found" );
- SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[nPos];
- aWordLst.Remove( nPos );
+ SvStringsISortDtor::iterator it = aWordLst.find( aLRULst[ nLRUIndex++ ] );
+ OSL_ENSURE( aWordLst.end() != it, "String not found" );
+ SwAutoCompleteString* pDel = (SwAutoCompleteString*) *it;
+ aWordLst.erase( it );
delete pDel;
}
aLRULst.erase( aLRULst.begin() + nNewMax - 1, aLRULst.end() );
@@ -334,11 +334,11 @@ void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
// Do you really want to remove all words that are less than the minWrdLen?
if( n < nMinWrdLen )
{
- for( sal_uInt16 nPos = 0; nPos < aWordLst.Count(); ++nPos )
+ for( sal_uInt16 nPos = 0; nPos < aWordLst.size(); ++nPos )
if( aWordLst[ nPos ]->Len() < n )
{
SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[ nPos ];
- aWordLst.Remove(nPos);
+ aWordLst.erase(aWordLst.begin() + nPos);
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
OSL_ENSURE( aLRULst.end() != it, "String not found" );
@@ -355,11 +355,11 @@ sal_Bool SwAutoCompleteWord::GetRange( const String& rWord, sal_uInt16& rStt,
sal_uInt16& rEnd ) const
{
const StringPtr pStr = (StringPtr)&rWord;
- aWordLst.Seek_Entry( pStr, &rStt );
+ rStt = aWordLst.find( pStr ) - aWordLst.begin();
rEnd = rStt;
const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
- while( rEnd < aWordLst.Count() && rSCmp.isMatch( rWord, *aWordLst[ rEnd ]))
+ while( rEnd < aWordLst.size() && rSCmp.isMatch( rWord, *aWordLst[ rEnd ]))
++rEnd;
return rStt < rEnd;
@@ -367,7 +367,7 @@ sal_Bool SwAutoCompleteWord::GetRange( const String& rWord, sal_uInt16& rStt,
void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst )
{
- sal_uInt16 nMyLen = aWordLst.Count(), nNewLen = rNewLst.Count();
+ sal_uInt16 nMyLen = aWordLst.size(), nNewLen = rNewLst.size();
sal_uInt16 nMyPos = 0, nNewPos = 0;
for( ; nMyPos < nMyLen && nNewPos < nNewLen; ++nMyPos, ++nNewPos )
@@ -376,7 +376,7 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst )
while( aWordLst[ nMyPos ] != pStr )
{
SwAutoCompleteString* pDel = (SwAutoCompleteString*) aWordLst[ nMyPos ];
- aWordLst.Remove(nMyPos);
+ aWordLst.erase(aWordLst.begin() + nMyPos);
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pDel );
OSL_ENSURE( aLRULst.end() != it, "String not found" );
@@ -399,7 +399,7 @@ void SwAutoCompleteWord::CheckChangedList( const SvStringsISortDtor& rNewLst )
delete pDel;
}
// remove from array
- aWordLst.Remove( nMyPos, nMyLen - nMyPos );
+ aWordLst.erase( aWordLst.begin() + nMyPos, aWordLst.begin() + nMyLen);
}
}
@@ -409,12 +409,12 @@ void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc)
SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get().GetAutoCorrect();
const sal_Bool bDelete = !pACorr->GetSwFlags().bAutoCmpltKeepList;
- for(sal_uInt16 nPos = aWordLst.Count(); nPos; nPos--)
+ for(sal_uInt16 nPos = aWordLst.size(); nPos; nPos--)
{
SwAutoCompleteString* pCurrent = (SwAutoCompleteString*)aWordLst[ nPos - 1 ];
if(pCurrent->RemoveDocument(rDoc) && bDelete)
{
- aWordLst.Remove( nPos - 1 );
+ aWordLst.erase( aWordLst.begin() + nPos - 1 );
SwAutoCompleteStringPtrDeque::iterator it = std::find( aLRULst.begin(), aLRULst.end(), pCurrent );
OSL_ENSURE( aLRULst.end() != it, "word not found in LRU list" );
aLRULst.erase( it );
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 4e4710cb7a09..a8ae938a7f1a 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -2191,7 +2191,7 @@ void SwDocUpdtFld::InsDelFldInFldLst( sal_Bool bIns, const SwTxtFld& rFld )
if( &rFld == (*pFldSortLst)[ n ]->GetPointer() )
{
delete (*pFldSortLst)[n];
- pFldSortLst->erase( n );
+ pFldSortLst->erase( pFldSortLst->begin() + n );
n--; // one field can occur multiple times
}
}
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index 59c70948e912..5485b1165be1 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -212,7 +212,7 @@ void SwInputFieldList::RemoveUnselectedFlds()
{
// Feld innerhalb der Selektion
pNewLst->insert( (*pSrtLst)[i] );
- pSrtLst->erase( i );
+ pSrtLst->erase( pSrtLst->begin() + i );
}
else
i++;
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index bc3d069b57ac..066f7321bd52 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -401,7 +401,7 @@ sal_Bool SwHTMLWriter::OutFlyFrm( sal_uLong nNdIdx, xub_StrLen nCntntIdx, sal_uI
// Erst entfernen ist wichtig, weil in tieferen
// Rekursionen evtl. weitere Eintraege oder das
// ganze Array geloscht werden koennte.
- pHTMLPosFlyFrms->erase( i );
+ pHTMLPosFlyFrms->erase( pHTMLPosFlyFrms->begin() + i );
i--;
if( pHTMLPosFlyFrms->empty() )
{
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 0c4bec127673..d2d6013a2928 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -642,8 +642,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
rACW.SetLockWordLstLocked( true );
- SvStringsISortDtor aTmpLst;
- aTmpLst.Insert( &rACW.GetWordList() );
+ SvStringsISortDtor aTmpLst( rACW.GetWordList() );
pAFlags->pAutoCmpltList = &aTmpLst;
SfxApplication* pApp = SFX_APP();
@@ -678,7 +677,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
pAFlags->pAutoCmpltList = 0;
}
// remove all pointer we never delete the strings
- aTmpLst.Remove( (sal_uInt16)0, aTmpLst.Count() );
+ aTmpLst.clear();
if( !bOldAutoCmpltCollectWords && bOldAutoCmpltCollectWords !=
pAFlags->bAutoCmpltCollectWords )