diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2011-06-05 10:42:37 -0430 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-06-10 18:54:02 +0200 |
commit | 093898ba3b532cb2d56b1275a2e0e2c102c6a15f (patch) | |
tree | 7bdfde8e9f55cd7ab9fd28b9d08272cbfc21c932 /sd | |
parent | 06c54a8d8e17eefc9644ba44542c71bc72f72068 (diff) |
Replace List for std::vector<rtl::OUString>.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/eppt.cxx | 45 | ||||
-rw-r--r-- | sd/source/filter/eppt/eppt.hxx | 2 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 28 |
3 files changed, 33 insertions, 42 deletions
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 4973b25301ab..b996d205cf1d 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -456,8 +456,6 @@ PPTWriter::~PPTWriter() while( aStyleSheetIter < maStyleSheetList.end() ) delete *aStyleSheetIter++; - for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() ) - delete (::rtl::OUString*)pPtr; for ( pPtr = maHyperlink.First(); pPtr; pPtr = maHyperlink.Next() ) delete (EPPTHyperlink*)pPtr; for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() ) @@ -751,13 +749,9 @@ sal_Bool PPTWriter::ImplCreateDocument() aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); if ( aXName.is() ) - { - ::rtl::OUString aStr = aXName->getName(); - ::rtl::OUString *pUStr = new ::rtl::OUString( aStr ); - maSlideNameList.Insert( pUStr, LIST_APPEND ); - } + maSlideNameList.push_back( aXName->getName() ); else - maSlideNameList.Insert( new ::rtl::OUString(), LIST_APPEND ); + maSlideNameList.push_back( ::rtl::OUString() ); } mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText @@ -814,20 +808,16 @@ sal_Bool PPTWriter::ImplCreateDocument() if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) ) { ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() ); - ::rtl::OUString* pStr; - for ( pStr = (::rtl::OUString*)maSlideNameList.First(); pStr; - pStr = (::rtl::OUString*)maSlideNameList.Next(), nStartSlide++ ) + + std::vector<rtl::OUString>::const_iterator pIter = std::find( + maSlideNameList.begin(),maSlideNameList.end(),aSlideName); + + if (pIter != maSlideNameList.end()) { - if ( *pStr == aSlideName ) - { - nStartSlide++; - nFlags |= 4; - nEndSlide = (sal_uInt16)mnPages; - break; - } + nStartSlide = pIter - maSlideNameList.begin() + 1; + nFlags |= 4; + nEndSlide = (sal_uInt16)mnPages; } - if ( !pStr ) - nStartSlide = 0; } } @@ -923,16 +913,13 @@ sal_Bool PPTWriter::ImplCreateDocument() if ( aXName.is() ) { ::rtl::OUString aSlideName( aXName->getName() ); - sal_uInt32 nPageNumber = 0; - for ( ::rtl::OUString* pSlideName = (::rtl::OUString*)maSlideNameList.First(); - pSlideName; - pSlideName = (::rtl::OUString*)maSlideNameList.Next(), nPageNumber++ ) + std::vector<rtl::OUString>::const_iterator pIter = std::find( + maSlideNameList.begin(),maSlideNameList.end(),aSlideName); + + if (pIter != maSlideNameList.end()) { - if ( *pSlideName == aSlideName ) - { - *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id - break; - } + sal_uInt32 nPageNumber = pIter - maSlideNameList.begin(); + *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id } } } diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx index 8ff33e63e9dc..a3284bd9f810 100644 --- a/sd/source/filter/eppt/eppt.hxx +++ b/sd/source/filter/eppt/eppt.hxx @@ -179,7 +179,7 @@ class PPTWriter : public PPTWriterBase, public PPTExBulletProvider sal_uInt32 mnLatestStatValue; EscherGraphicProvider* mpGraphicProvider; - List maSlideNameList; + std::vector<rtl::OUString> maSlideNameList; ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index bd558aedddae..606756d1cce3 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1216,16 +1216,19 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u { String aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', INetURLObject::DECODE_WITH_CHARSET ) ); aPage.Erase( 0, 1 ); - for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = (String*)maSlideNameList.Next(), nPageIndex++ ) + + rtl::OUString aUPage(aPage); + std::vector<rtl::OUString>::const_iterator pIter = std::find( + maSlideNameList.begin(),maSlideNameList.end(),aUPage); + + if ( pIter != maSlideNameList.end() ) { - if ( *pStr == aPage ) - { - aPageUrl = UniString::CreateFromInt32( 256 + nPageIndex ); - aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) ); - aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) ); - aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide " ) ) ); - aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) ); - } + nPageIndex = pIter - maSlideNameList.begin(); + aPageUrl = UniString::CreateFromInt32( 256 + nPageIndex ); + aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) ); + aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) ); + aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide " ) ) ); + aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) ); } } sal_uInt32 nHyperId; @@ -2034,11 +2037,12 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentat { if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) ) { - String aBookmark( *(::rtl::OUString*)mAny.getValue() ); + rtl::OUString aBookmark( *(::rtl::OUString*)mAny.getValue() ); sal_uInt32 nIndex = 0; - for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = (String*)maSlideNameList.Next(), nIndex++ ) + std::vector<rtl::OUString>::const_iterator pIter; + for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, nIndex++ ) { - if ( *pStr == aBookmark ) + if ( *pIter == aBookmark ) { // Bookmark ist ein link zu einer Dokumentseite nAction = 4; |