Kaydet (Commit) 445fc29e authored tarafından August Sodora's avatar August Sodora

SvStringsDtor->std::vector

üst 91d3c111
...@@ -46,7 +46,7 @@ class SwNumRule; ...@@ -46,7 +46,7 @@ class SwNumRule;
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
Local helper class. Local helper class.
--------------------------------------------------------------------*/ --------------------------------------------------------------------*/
class SwPoolFmtList : public SvStringsDtor class SwPoolFmtList : public std::vector<String>
{ {
public: public:
SwPoolFmtList() {} SwPoolFmtList() {}
...@@ -54,7 +54,6 @@ public: ...@@ -54,7 +54,6 @@ public:
void Erase(); void Erase();
}; };
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
Temporary StyleSheet. Temporary StyleSheet.
--------------------------------------------------------------------*/ --------------------------------------------------------------------*/
......
...@@ -314,7 +314,7 @@ const SwNumRule* lcl_FindNumRule( SwDoc& rDoc, ...@@ -314,7 +314,7 @@ const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam, sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
const String& rName ) const String& rName )
{ {
if( rLst.Count() ) if(!rLst.empty())
{ {
String sSrch( ' ' ); String sSrch( ' ' );
switch( eFam ) switch( eFam )
...@@ -327,8 +327,8 @@ sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam, ...@@ -327,8 +327,8 @@ sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
default:; //prevent warning default:; //prevent warning
} }
sSrch += rName; sSrch += rName;
for( sal_uInt16 i=0; i < rLst.Count(); ++i ) for(size_t i = 0; i < rLst.size(); ++i)
if( *rLst[i] == sSrch ) if(rLst[i] == sSrch)
return i; return i;
} }
return USHRT_MAX; return USHRT_MAX;
...@@ -361,17 +361,12 @@ sal_Bool FindPhyStyle( SwDoc& rDoc, const String& rName, SfxStyleFamily eFam ) ...@@ -361,17 +361,12 @@ sal_Bool FindPhyStyle( SwDoc& rDoc, const String& rName, SfxStyleFamily eFam )
void SwPoolFmtList::Append( char cChar, const String& rStr ) void SwPoolFmtList::Append( char cChar, const String& rStr )
{ {
String* pStr = new String( cChar ); String aStr(cChar);
*pStr += rStr; aStr += rStr;
for ( sal_uInt16 i=0; i < Count(); ++i ) for(std::vector<String>::const_iterator i = begin(); i != end(); ++i)
{ if(*i == aStr)
if( *operator[](i) == *pStr )
{
delete pStr;
return; return;
} push_back(aStr);
}
Insert( pStr, Count() );
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
...@@ -381,7 +376,7 @@ void SwPoolFmtList::Append( char cChar, const String& rStr ) ...@@ -381,7 +376,7 @@ void SwPoolFmtList::Append( char cChar, const String& rStr )
void SwPoolFmtList::Erase() void SwPoolFmtList::Erase()
{ {
DeleteAndDestroy( 0, Count() ); clear();
} }
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
...@@ -2401,7 +2396,7 @@ sal_uInt16 SwStyleSheetIterator::Count() ...@@ -2401,7 +2396,7 @@ sal_uInt16 SwStyleSheetIterator::Count()
// let the list fill correctly!! // let the list fill correctly!!
if( !bFirstCalled ) if( !bFirstCalled )
First(); First();
return aLst.Count(); return aLst.size();
} }
SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_uInt16 nIdx ) SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_uInt16 nIdx )
...@@ -2409,7 +2404,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_uInt16 nIdx ) ...@@ -2409,7 +2404,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::operator[]( sal_uInt16 nIdx )
// found // found
if( !bFirstCalled ) if( !bFirstCalled )
First(); First();
mxStyleSheet->PresetNameAndFamily( *aLst[ nIdx ] ); mxStyleSheet->PresetNameAndFamily( aLst[ nIdx ] );
mxStyleSheet->SetPhysical( sal_False ); mxStyleSheet->SetPhysical( sal_False );
mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName ); mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
...@@ -2740,7 +2735,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() ...@@ -2740,7 +2735,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE); bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
} }
if(aLst.Count() > 0) if(!aLst.empty())
{ {
nLastPos = USHRT_MAX; nLastPos = USHRT_MAX;
return Next(); return Next();
...@@ -2750,10 +2745,10 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() ...@@ -2750,10 +2745,10 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
SfxStyleSheetBase* SwStyleSheetIterator::Next() SfxStyleSheetBase* SwStyleSheetIterator::Next()
{ {
nLastPos++; ++nLastPos;
if(aLst.Count() > 0 && nLastPos < aLst.Count()) if(!aLst.empty() && nLastPos < aLst.size())
{ {
mxIterSheet->PresetNameAndFamily(*aLst[nLastPos]); mxIterSheet->PresetNameAndFamily(aLst[nLastPos]);
mxIterSheet->SetPhysical( sal_False ); mxIterSheet->SetPhysical( sal_False );
mxIterSheet->SetMask( nMask ); mxIterSheet->SetMask( nMask );
if(mxIterSheet->pSet) if(mxIterSheet->pSet)
...@@ -2776,7 +2771,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::Find( const UniString& rName ) ...@@ -2776,7 +2771,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::Find( const UniString& rName )
if( USHRT_MAX != nLastPos ) if( USHRT_MAX != nLastPos )
{ {
// found // found
mxStyleSheet->PresetNameAndFamily(*aLst[nLastPos]); mxStyleSheet->PresetNameAndFamily(aLst[nLastPos]);
// new name is set, so determine its Data // new name is set, so determine its Data
mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName ); mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
if( !mxStyleSheet->IsPhysical() ) if( !mxStyleSheet->IsPhysical() )
...@@ -2835,8 +2830,8 @@ void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -2835,8 +2830,8 @@ void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
{ {
sal_uInt16 nTmpPos = lcl_FindName( aLst, pStyle->GetFamily(), sal_uInt16 nTmpPos = lcl_FindName( aLst, pStyle->GetFamily(),
pStyle->GetName() ); pStyle->GetName() );
if( nTmpPos < aLst.Count() ) if( nTmpPos < aLst.size() )
aLst.DeleteAndDestroy( nTmpPos ); aLst.erase(aLst.begin() + nTmpPos);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment