sw/inc/SwXMLSectionList.hxx | 6 +- sw/inc/shellio.hxx | 6 +- sw/inc/swunohelper.hxx | 6 +- sw/source/core/swg/SwXMLSectionList.cxx | 9 +-- sw/source/core/unocore/swunohelper.cxx | 8 +- sw/source/core/unocore/unofield.cxx | 18 ++---- sw/source/filter/basflt/shellio.cxx | 2 sw/source/filter/inc/fltini.hxx | 4 - sw/source/filter/xml/swxml.cxx | 12 +--- sw/source/ui/dialog/uiregionsw.cxx | 10 +-- sw/source/ui/inc/glosdoc.hxx | 11 +-- sw/source/ui/misc/glosdoc.cxx | 89 ++++++++++++-------------------- sw/source/ui/utlui/gloslst.cxx | 10 +-- 13 files changed, 80 insertions(+), 111 deletions(-)
New commits: commit 3fb612cb206a989c0749ac509b173ec01eb3f49e Author: Brad Sowden <c...@sowden.org> Date: Thu Dec 29 22:26:57 2011 +1300 Easyhack fdo#38831 remove SvStrings diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 6b0ddc7..2e4785f 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -85,7 +85,6 @@ #include <tools/datetime.hxx> #include <tools/urlobj.hxx> #include <svx/dataaccessdescriptor.hxx> -#define _SVSTDARR_STRINGS #include <svl/svstdarr.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -95,6 +94,7 @@ #include <fmtmeta.hxx> // MetaFieldManager #include <switerator.hxx> #include <rtl/strbuf.hxx> +#include <vector> using ::rtl::OUString; using namespace ::com::sun::star; @@ -2539,32 +2539,30 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void) const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); sal_uInt16 nCount = pFldTypes->Count(); - SvStrings aFldNames; + std::vector<String*> aFldNames; String* pString = new String(); - sal_uInt16 i; - for( i = 0; i < nCount; i++) + for( sal_uInt16 i = 0; i < nCount; i++) { SwFieldType& rFldType = *((*pFldTypes)[i]); if (SwXTextFieldMasters::getInstanceName(rFldType, *pString)) { - aFldNames.Insert(pString, aFldNames.Count()); + aFldNames.push_back(pString); pString = new String(); } } delete pString; - uno::Sequence< OUString > aSeq(aFldNames.Count()); + uno::Sequence< OUString > aSeq( static_cast<sal_uInt16>(aFldNames.size()) ); OUString* pArray = aSeq.getArray(); - for(i = 0; i < aFldNames.Count();i++) + for(sal_uInt16 i = 0; i < aFldNames.size();i++) { - pArray[i] = *aFldNames.GetObject(i); + pArray[i] = *aFldNames[i]; + delete aFldNames[i]; } - aFldNames.DeleteAndDestroy(0, aFldNames.Count()); return aSeq; - } sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( uno::RuntimeException ) commit 9e192c9fd1c0ddc0cd9b926a46f4144f1bf71526 Author: Brad Sowden <c...@sowden.org> Date: Thu Dec 29 22:26:06 2011 +1300 Easyhack fdo#38831 remove SvStrings diff --git a/sw/inc/SwXMLSectionList.hxx b/sw/inc/SwXMLSectionList.hxx index 0467864..c59fda7 100644 --- a/sw/inc/SwXMLSectionList.hxx +++ b/sw/inc/SwXMLSectionList.hxx @@ -31,7 +31,7 @@ #include <xmloff/xmlictxt.hxx> #include <xmloff/xmlimp.hxx> -class SvStrings; +class vector; class SwXMLSectionList : public SvXMLImport { @@ -43,11 +43,11 @@ protected: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); public: - SvStrings & rSectionList; + std::vector<String*> &rSectionList; SwXMLSectionList( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - SvStrings & rNewSectionList ); + std::vector<String*> &rNewSectionList ); virtual ~SwXMLSectionList ( ) throw(); diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index 56cd063..0b91804 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -56,7 +56,6 @@ class SfxItemSet; class SfxMedium; class SvPtrarr; class SvStream; -class SvStrings; class SvxFontItem; class SvxMacroTableDtor; class SwCntntNode; @@ -64,6 +63,7 @@ class SwCrsrShell; class SwDoc; class SwPaM; class SwTextBlocks; +class vector; struct SwPosition; struct Writer_Impl; @@ -272,8 +272,8 @@ public: // Read the sections of the document, which is equal to the medium. // Returns the count of it - virtual sal_uInt16 GetSectionList( SfxMedium& rMedium, - SvStrings& rStrings ) const; + virtual size_t GetSectionList( SfxMedium& rMedium, + std::vector<String*>& rStrings ) const; SotStorageRef getSotStorageRef() { return pStg; }; void setSotStorageRef(SotStorageRef pStgRef) { pStg = pStgRef; }; diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx index 1d00774..3a1adfd 100644 --- a/sw/source/core/swg/SwXMLSectionList.cxx +++ b/sw/source/core/swg/SwXMLSectionList.cxx @@ -26,12 +26,11 @@ * ************************************************************************/ -#define _SVSTDARR_STRINGSDTOR -#define _SVSTDARR_STRINGS -#include <svl/svstdarr.hxx> #include <SwXMLSectionList.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> +#include <tools/string.hxx> +#include <vector> using namespace ::com::sun::star; using ::rtl::OUString; @@ -43,7 +42,7 @@ sal_Char const sXML_np__text[] = "_otext"; // #110680# SwXMLSectionList::SwXMLSectionList( const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, - SvStrings & rNewSectionList) + std::vector<String*> &rNewSectionList) : SvXMLImport( xServiceFactory ), rSectionList ( rNewSectionList ) { @@ -121,7 +120,7 @@ SvXMLImportContext *SvXMLSectionListContext::CreateChildContext( sName = rAttrValue; } if ( sName.Len() ) - rLocalRef.rSectionList.Insert ( new String(sName), rLocalRef.rSectionList.Count() ); + rLocalRef.rSectionList.push_back( new String(sName) ); } pContext = new SvXMLSectionListContext (rLocalRef, nPrefix, rLocalName, xAttrList); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 3999f47..35f8409 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -682,7 +682,7 @@ void Reader::ResetFrmFmts( SwDoc& rDoc ) // read the sections of the document, which is equal to the medium. // returns the count of it -sal_uInt16 Reader::GetSectionList( SfxMedium&, SvStrings& ) const +size_t Reader::GetSectionList( SfxMedium&, std::vector<String*>& ) const { return 0; } diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 5b546c0..47e6cc1 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -64,8 +64,8 @@ public: // read the sections of the document, which is equal to the medium. // returns the count of it - virtual sal_uInt16 GetSectionList( SfxMedium& rMedium, - SvStrings& rStrings ) const; + virtual size_t GetSectionList( SfxMedium& rMedium, + std::vector<String*>& rStrings ) const; }; // die speziellen Writer diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index b6684bd..3f29d8c 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -27,10 +27,6 @@ ************************************************************************/ - - - -#define _SVSTDARR_STRINGS #include <rsc/rscsfx.hxx> #include <tools/urlobj.hxx> #include <com/sun/star/embed/XStorage.hpp> @@ -51,7 +47,6 @@ #include <com/sun/star/packages/zip/ZipIOException.hpp> #include <com/sun/star/packages/WrongPasswordException.hpp> #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> -#include <svl/svstdarr.hxx> #include <sfx2/docfile.hxx> #include <svtools/sfxecode.hxx> #include <svl/stritem.hxx> @@ -1067,8 +1062,8 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con // read the sections of the document, which is equal to the medium. // returns the count of it -sal_uInt16 XMLReader::GetSectionList( SfxMedium& rMedium, - SvStrings& rStrings ) const +size_t XMLReader::GetSectionList( SfxMedium& rMedium, + std::vector<String*>& rStrings ) const { uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); @@ -1095,7 +1090,6 @@ sal_uInt16 XMLReader::GetSectionList( SfxMedium& rMedium, if( xXMLParser.is() ) { // get filter - // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( rStrings ); uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xServiceFactory, rStrings ); // connect parser and filter @@ -1123,7 +1117,7 @@ sal_uInt16 XMLReader::GetSectionList( SfxMedium& rMedium, // re throw ? } } - return rStrings.Count(); + return rStrings.size(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 9f262d4..8c28df4 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1494,16 +1494,16 @@ static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox ) uno::Reference < embed::XStorage > xStg; if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() ) { - SvStrings aArr( 10, 10 ); + std::vector<String*> aArr; sal_uInt32 nFormat = SotStorage::GetFormatID( xStg ); if ( nFormat == SOT_FORMATSTR_ID_STARWRITER_60 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_60 || nFormat == SOT_FORMATSTR_ID_STARWRITER_8 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_8) SwGetReaderXML()->GetSectionList( rMedium, aArr ); - for( sal_uInt16 n = 0; n < aArr.Count(); ++n ) - rBox.InsertEntry( *aArr[ n ] ); - - aArr.DeleteAndDestroy(0, aArr.Count()); + for(std::vector<String*>::const_iterator it(aArr.begin()); it != aArr.end(); ++it) { + rBox.InsertEntry( **it ); + delete *it; + } } } commit 8172646815db38744d8ba0dfd959b1afc089fb40 Author: Brad Sowden <c...@sowden.org> Date: Thu Dec 29 22:25:11 2011 +1300 Easyhack fdo#38831 remove SvStrings diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx index 9f7b05b..6d61d2e 100644 --- a/sw/inc/swunohelper.hxx +++ b/sw/inc/swunohelper.hxx @@ -32,6 +32,8 @@ #include <sal/types.h> #include "swdllapi.h" +#include <vector> + namespace com { namespace sun { namespace star { namespace uno { class Any; @@ -39,7 +41,6 @@ namespace com { namespace sun { namespace star { }}} class String; -class SvStrings; class SvPtrarr; namespace SWUnoHelper { @@ -68,7 +69,8 @@ SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL ); // pDateTime != 0 -> returns also the modified date/time of // the files in a SvPtrarr --> // !! objects must be deleted from the caller!! -sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList, +sal_Bool UCB_GetFileListOfFolder( const String& rURL, + std::vector<String*>& rList, const String* pExtension = 0, SvPtrarr* pDateTimeList = 0 ); diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 9946c2c..c3896fa 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -26,8 +26,6 @@ * ************************************************************************/ - -#define _SVSTDARR_STRINGS #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/ucb/XContentIdentifier.hpp> @@ -204,7 +202,8 @@ sal_Bool UCB_IsDirectory( const String& rURL ) // pDateTime != 0 -> returns also the modified date/time of // the files in a SvPtrarr --> // !! objects must be deleted from the caller!! -sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList, +sal_Bool UCB_GetFileListOfFolder( const String& rURL, + std::vector<String*>& rList, const String* pExtension, SvPtrarr* pDateTimeList ) { @@ -245,8 +244,7 @@ sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList, sTitle.Equals( *pExtension, sTitle.Len() - nExtLen, nExtLen )) ) { - String* pStr = new String( sTitle ); - rList.Insert( pStr, rList.Count() ); + rList.push_back( new String(sTitle) ); if( pDateTimeList ) { diff --git a/sw/source/ui/inc/glosdoc.hxx b/sw/source/ui/inc/glosdoc.hxx index a0db0b8..114c9bc 100644 --- a/sw/source/ui/inc/glosdoc.hxx +++ b/sw/source/ui/inc/glosdoc.hxx @@ -29,11 +29,9 @@ #define _GLOSDOC_HXX #include <tools/string.hxx> -#include <svl/svarray.hxx> #include <com/sun/star/text/XAutoTextGroup.hpp> class SwTextBlocks; -class SvStrings; class SwDocShell; #ifndef SW_DECL_SWDOCSHELL_DEFINED @@ -43,10 +41,7 @@ SV_DECL_REF( SwDocShell ) #endif #include <cppuhelper/weakref.hxx> -#ifndef INCLUDED_VECTOR #include <vector> -#define INCLUDED_VECTOR -#endif #include "swdllapi.h" typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef; @@ -67,11 +62,11 @@ class SW_DLLPUBLIC SwGlossaries String m_sOldErrPath; String m_sErrPath; std::vector<String*> m_aPathArr; - SvStrings *m_pGlosArr; - sal_Bool m_bError; + std::vector<String*> *m_pGlosArr; + sal_Bool m_bError; SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const; - SW_DLLPRIVATE SvStrings *GetNameList(); + SW_DLLPRIVATE std::vector<String*>* GetNameList(); // implementation in unoatxt.cxx SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup ); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index 3f02b01..c012152 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -31,7 +31,6 @@ #include <com/sun/star/container/XNamed.hpp> -#define _SVSTDARR_STRINGS #include <unotools/transliterationwrapper.hxx> #include <svl/svstdarr.hxx> @@ -115,7 +114,7 @@ String SwGlossaries::GetDefName() ------------------------------------------------------------------------*/ sal_uInt16 SwGlossaries::GetGroupCnt() { - return GetNameList()->Count(); + return static_cast<sal_uInt16>(GetNameList()->size()); } /*------------------------------------------------------------------------ @@ -156,7 +155,7 @@ sal_Bool SwGlossaries::FindGroupName(String & rGroup) String SwGlossaries::GetGroupName(sal_uInt16 nGroupId) { - OSL_ENSURE(nGroupId < m_pGlosArr->Count(), "Textbausteinarray ueberindiziert"); + OSL_ENSURE(static_cast<size_t>(nGroupId) < m_pGlosArr->size(), "Textbausteinarray ueberindiziert"); return *(*m_pGlosArr)[nGroupId]; } @@ -181,23 +180,18 @@ String SwGlossaries::GetGroupTitle( const String& rGroupName ) SwTextBlocks* SwGlossaries::GetGroupDoc(const String &rName, sal_Bool bCreate) const { - // insert to the list of text blocks if applicable + // insert to the list of text blocks if applicable if(bCreate && m_pGlosArr) { - const String aName(rName); - const sal_uInt16 nCount = m_pGlosArr->Count(); - sal_uInt16 i; - - for( i = 0; i < nCount; ++i) + std::vector<String*>::const_iterator it(m_pGlosArr->begin()); + for(; it != m_pGlosArr->end(); ++it) { - const String *pName = (*m_pGlosArr)[i]; - if(*pName == aName) + if(**it == rName) break; } - if(i == nCount) + if( it == m_pGlosArr->end() ) { // block not in the list - String *pTmp = new String(aName); - m_pGlosArr->Insert(pTmp, m_pGlosArr->Count()); + m_pGlosArr->push_back(new String(rName)); } } return GetGlosDoc( rName, bCreate ); @@ -227,10 +221,7 @@ sal_Bool SwGlossaries::NewGroupDoc(String& rGroupName, const String& rTitle) SwTextBlocks *pBlock = GetGlosDoc( sNewGroup ); if(pBlock) { - String *pTmp = - new String(sNewGroup); - SvStrings* pList = GetNameList(); - pList->Insert(pTmp, pList->Count()); + GetNameList()->push_back(new String(sNewGroup)); pBlock->SetName(rTitle); PutGroupDoc(pBlock); rGroupName = sNewGroup; @@ -279,11 +270,10 @@ sal_Bool SwGlossaries::RenameGroupDoc( rNewGroup = sNewFileName.Copy(0, nFileNameLen); rNewGroup += GLOS_DELIM; rNewGroup += String::CreateFromInt32(nNewPath); - String *pTmp = new String(rNewGroup); if(!m_pGlosArr) GetNameList(); else - m_pGlosArr->Insert(pTmp, m_pGlosArr->Count()); + m_pGlosArr->push_back(new String(rNewGroup)); sNewFilePath += INET_PATH_TOKEN; sNewFilePath += sNewFileName ; @@ -326,20 +316,16 @@ sal_Bool SwGlossaries::DelGroupDoc(const String &rName) SwGlossaries::~SwGlossaries() { - sal_uInt16 nCount = m_pGlosArr? m_pGlosArr->Count() : 0; - sal_uInt16 i; - - for( i = 0; i < nCount; ++i) + if( m_pGlosArr ) { - String *pTmp = (*m_pGlosArr)[i]; - delete pTmp; + for(std::vector<String*>::const_iterator it(m_pGlosArr->begin()); it != m_pGlosArr->end(); ++it) + delete *it; + delete m_pGlosArr; } for(std::vector<String*>::const_iterator it(m_aPathArr.begin()); it != m_aPathArr.end(); ++it) delete *it; - delete m_pGlosArr; - InvalidateUNOOjects(); } @@ -383,37 +369,37 @@ SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate ) /*------------------------------------------------------------------------ Description: access to the list of names; read in if applicable ------------------------------------------------------------------------*/ -SvStrings* SwGlossaries::GetNameList() +std::vector<String*>* SwGlossaries::GetNameList() { if( !m_pGlosArr ) { - m_pGlosArr = new SvStrings; + m_pGlosArr = new std::vector<String*>; String sExt( SwGlossaries::GetExtension() ); for( size_t i = 0; i < m_aPathArr.size(); ++i ) { - SvStrings aFiles( 16, 16 ); + std::vector<String*> aFiles; SWUnoHelper::UCB_GetFileListOfFolder( *m_aPathArr[i], aFiles, &sExt ); - for( sal_uInt16 nFiles = 0, nFEnd = aFiles.Count(); - nFiles < nFEnd; ++nFiles ) + for( std::vector<String*>::const_iterator filesIt(aFiles.begin()); + filesIt != aFiles.end(); ++filesIt) { - String* pTitle = aFiles[ nFiles ]; + String *pTitle = *filesIt; String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() )); sName += GLOS_DELIM; sName += String::CreateFromInt32( static_cast<sal_Int16>(i) ); - m_pGlosArr->Insert( new String(sName), m_pGlosArr->Count() ); + m_pGlosArr->push_back( new String(sName) ); // don't need any more these pointers delete pTitle; } } - if(!m_pGlosArr->Count()) + if( m_pGlosArr->empty() ) { // the standard block is inside of the path's first part String *pTmp = new String( SwGlossaries::GetDefName() ); (*pTmp) += GLOS_DELIM; (*pTmp) += '0'; - m_pGlosArr->Insert(pTmp, m_pGlosArr->Count()); + m_pGlosArr->push_back( pTmp ); } } return m_pGlosArr; @@ -432,10 +418,10 @@ SwGlossaries::SwGlossaries() : /* -------------------------------------------------- * #61050# double paths cause irritation - get rid of it * --------------------------------------------------*/ -sal_Bool lcl_FindSameEntry(const SvStrings& rDirArr, const String& rEntryURL) +sal_Bool lcl_FindSameEntry(const std::vector<String*>& rDirArr, const String& rEntryURL) { - for(sal_uInt16 i = 0; i < rDirArr.Count(); i++) - if(rEntryURL == (*rDirArr.GetObject(i))) + for(std::vector<String*>::const_iterator it(rDirArr.begin()); it != rDirArr.end(); ++it) + if( **it == rEntryURL ) return sal_True; return sal_False; } @@ -454,7 +440,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) m_aPathArr.clear(); sal_uInt16 nTokenCount = m_aPath.GetTokenCount(SVT_SEARCHPATH_DELIMITER); - SvStrings aDirArr; + std::vector<String*> aDirArr; for( sal_uInt16 i = 0; i < nTokenCount; i++ ) { String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER)); @@ -465,7 +451,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) { continue; } - aDirArr.Insert(new String(sPth), aDirArr.Count()); + aDirArr.push_back(new String(sPth)); if( !FStatHelper::IsFolder( sPth ) ) { if( m_sErrPath.Len() ) @@ -476,7 +462,8 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) else m_aPathArr.push_back(new String(sPth)); } - aDirArr.DeleteAndDestroy(0, aDirArr.Count()); + for(std::vector<String*>::const_iterator it(aDirArr.begin()); it != aDirArr.end(); ++it) + delete *it; if(!nTokenCount || (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) ) @@ -494,10 +481,8 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) if(m_pGlosArr) { - for(sal_uInt16 i = 0; i < m_pGlosArr->Count(); ++i) - { - delete (String *)(*m_pGlosArr)[i]; - } + for(std::vector<String*>::const_iterator it(m_pGlosArr->begin()); it != m_pGlosArr->end(); ++it) + delete *it; DELETEZ(m_pGlosArr); GetNameList(); } @@ -520,11 +505,9 @@ void SwGlossaries::RemoveFileFromList( const String& rGroup ) { if(m_pGlosArr) { - const sal_uInt16 nCount = m_pGlosArr->Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) + for(std::vector<String*>::iterator it(m_pGlosArr->begin()); it != m_pGlosArr->end(); ++it) { - String *pTmp = (*m_pGlosArr)[i]; - if(*pTmp == rGroup) + if(**it == rGroup) { rtl::OUString aUName = rGroup; { @@ -569,8 +552,8 @@ void SwGlossaries::RemoveFileFromList( const String& rGroup ) } } - m_pGlosArr->Remove(i); - delete pTmp; + delete *it; + m_pGlosArr->erase(it); break; } } diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx index 860b5d1..b19f92d 100644 --- a/sw/source/ui/utlui/gloslst.cxx +++ b/sw/source/ui/utlui/gloslst.cxx @@ -31,7 +31,6 @@ #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGSISORTDTOR -#define _SVSTDARR_STRINGS #include <svl/svstdarr.hxx> #include <tools/urlobj.hxx> #include <vcl/dialog.hxx> @@ -50,6 +49,8 @@ #include <gloslst.hxx> #include <swunohelper.hxx> +#include <vector> + #include <utlui.hrc> #include <gloslst.hrc> @@ -325,16 +326,15 @@ void SwGlossaryList::Update() for( size_t nPath = 0; nPath < pPathArr->size(); nPath++ ) { SvStringsDtor aFoundGroupNames; - SvStrings aFiles( 16, 16 ); + std::vector<String*> aFiles; SvPtrarr aDateTimeArr( 16, 16 ); SWUnoHelper::UCB_GetFileListOfFolder( *(*pPathArr)[nPath], aFiles, &sExt, &aDateTimeArr ); - for( sal_uInt16 nFiles = 0, nFEnd = aFiles.Count(); - nFiles < nFEnd; ++nFiles ) + for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles ) { String* pTitle = aFiles[ nFiles ]; - ::DateTime* pDT = (::DateTime*) aDateTimeArr[ nFiles ]; + ::DateTime* pDT = (::DateTime*) aDateTimeArr[ static_cast<sal_uInt16>(nFiles) ]; String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() )); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits