summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-06-05 09:18:31 -0430
committerPetr Mladek <pmladek@suse.cz>2011-06-10 18:46:42 +0200
commit06c54a8d8e17eefc9644ba44542c71bc72f72068 (patch)
treee489abf3e6fa4fab28d6142db909da71db355ac0 /sd
parent418e1c560a9c6c68a1918e8a9b95ef276ce78ab1 (diff)
Replace List for std::vector<String>.
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/ppt/pptin.cxx54
-rw-r--r--sd/source/filter/ppt/pptin.hxx2
2 files changed, 25 insertions, 31 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 20a02db6a50d..7652ed5a6e40 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -239,8 +239,6 @@ ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage
ImplSdPPTImport::~ImplSdPPTImport()
{
- for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
- delete (String*)pPtr;
delete pStData;
}
@@ -344,22 +342,19 @@ sal_Bool ImplSdPPTImport::Import()
{
if ( !aPropItem.Read( aUString, nType, sal_False ) )
break;
- String* pString = new String( aUString );
- if ( pString->EqualsAscii( "No Slide Title" ))
- *pString = String();
+
+ String aString( aUString );
+ if ( aString.EqualsAscii( "No Slide Title" ))
+ aString = String();
else
{
- void* pPtr;
- for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
- {
- if ( *((String*)pPtr ) == *pString )
- {
- *pString = String();
- break;
- }
- }
+ std::vector<String>::const_iterator pIter =
+ std::find(maSlideNameList.begin(),maSlideNameList.end(),aString);
+
+ if (pIter != maSlideNameList.end())
+ aString = String();
}
- maSlideNameList.Insert( pString, LIST_APPEND );
+ maSlideNameList.push_back( aString );
}
}
}
@@ -469,14 +464,13 @@ sal_Bool ImplSdPPTImport::Import()
for ( nToken = 0; nToken < nTokenCount; nToken++ )
{
String aToken( aString.GetToken( nToken, (sal_Unicode)',' ) );
- for ( void* pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
+ std::vector<String>::const_iterator pIter =
+ std::find(maSlideNameList.begin(),maSlideNameList.end(),aToken);
+
+ if (pIter != maSlideNameList.end())
{
- if ( *(String*)pPtr == aToken )
- {
- nPageNumber = maSlideNameList.GetCurPos();
- bSucceeded = sal_True;
- break;
- }
+ nPageNumber = pIter - maSlideNameList.begin();
+ bSucceeded = sal_True;
}
}
}
@@ -498,8 +492,8 @@ sal_Bool ImplSdPPTImport::Import()
}
if ( bSucceeded )
{
- if ( nPageNumber < maSlideNameList.Count() )
- pHyperlink->aConvSubString = *(String*)maSlideNameList.GetObject( nPageNumber );
+ if ( nPageNumber < maSlideNameList.size() )
+ pHyperlink->aConvSubString = maSlideNameList[ nPageNumber ];
if ( !pHyperlink->aConvSubString.Len() )
{
pHyperlink->aConvSubString = String( SdResId( STR_PAGE ) );
@@ -1191,16 +1185,16 @@ sal_Bool ImplSdPPTImport::Import()
}
sal_uInt32 nSlideCount = GetPageCount();
- for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.Count() ); i++ )
+ for ( i = 0; ( i < nSlideCount) && ( i < maSlideNameList.size() ); i++ )
{
SdPage* pPage = mpDoc->GetSdPage( i, PK_STANDARD );
- String* pName = (String*)maSlideNameList.GetObject( i );
- if ( pPage && pName )
+ String &aName = maSlideNameList[ i ];
+ if ( pPage )
{
- if ( pName->Len() )
- pPage->SetName( *pName );
+ if ( aName.Len() )
+ pPage->SetName( aName );
else
- *pName = pPage->GetName();
+ aName = pPage->GetName();
}
}
if ( mbDocumentFound )
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
index 2f38ff74d444..78f09d7bf89d 100644
--- a/sd/source/filter/ppt/pptin.hxx
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -61,7 +61,7 @@ class ImplSdPPTImport : public SdrPowerPointImport
SvStorage& mrStorage;
// SvStream* mpPicStream;
DffRecordHeader maDocHd;
- List maSlideNameList;
+ std::vector<String> maSlideNameList;
sal_Bool mbDocumentFound;
sal_uInt32 mnFilterOptions;
SdDrawDocument* mpDoc;