SvStringsDtor->std::vector

This commit is contained in:
August Sodora 2012-01-11 23:54:28 -05:00
parent 17964c4f5a
commit 5c445208a1

View file

@ -1320,7 +1320,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
SfxStyleSheetBase *pStyle = pStyleSheetPool->First(); SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
SvLBoxEntry* pEntry = aFmtLb.First(); SvLBoxEntry* pEntry = aFmtLb.First();
SvStringsDtor aStrings; std::vector<rtl::OUString> aStrings;
comphelper::string::NaturalStringSorter aSorter( comphelper::string::NaturalStringSorter aSorter(
::comphelper::getProcessComponentContext(), ::comphelper::getProcessComponentContext(),
@ -1329,21 +1329,19 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
while( pStyle ) while( pStyle )
{ {
//Bubblesort //Bubblesort
sal_uInt16 nPos; size_t nPos;
for( nPos = aStrings.Count() ; nPos && for(nPos = aStrings.size(); nPos && aSorter.compare(aStrings[nPos-1], pStyle->GetName()) > 0; --nPos)
aSorter.compare(*(aStrings[nPos-1]), pStyle->GetName()) > 0 ; nPos--)
{}; {};
aStrings.Insert( new String( pStyle->GetName() ), nPos ); aStrings.insert(aStrings.begin() + nPos, pStyle->GetName());
pStyle = pStyleSheetPool->Next(); pStyle = pStyleSheetPool->Next();
} }
size_t nCount = aStrings.size();
sal_uInt16 nCount = aStrings.Count(); size_t nPos = 0;
sal_uInt16 nPos = 0; while(nPos < nCount && pEntry &&
while( nPos < nCount && pEntry && aStrings[nPos] == rtl::OUString(aFmtLb.GetEntryText(pEntry)))
*aStrings[ nPos ] == aFmtLb.GetEntryText( pEntry ) )
{ {
nPos++; ++nPos;
pEntry = aFmtLb.Next( pEntry ); pEntry = aFmtLb.Next( pEntry );
} }
@ -1353,8 +1351,8 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
aFmtLb.SetUpdateMode(sal_False); aFmtLb.SetUpdateMode(sal_False);
aFmtLb.Clear(); aFmtLb.Clear();
for(nPos = 0 ; nPos < nCount ; ++nPos ) for(nPos = 0; nPos < nCount; ++nPos)
aFmtLb.InsertEntry( *aStrings.GetObject( nPos ), 0, sal_False, nPos); aFmtLb.InsertEntry(aStrings[nPos], 0, sal_False, nPos);
aFmtLb.SetUpdateMode(true); aFmtLb.SetUpdateMode(true);
} }