diff options
-rw-r--r-- | sot/source/base/exchange.cxx | 1 | ||||
-rw-r--r-- | tools/inc/tools/globname.hxx | 7 | ||||
-rw-r--r-- | tools/source/ref/globname.cxx | 25 |
3 files changed, 20 insertions, 13 deletions
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 065d54aa9d6c..2524e0c9b30a 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -33,6 +33,7 @@ #define _SOT_FORMATS_INCLUDE_SYSTEMFORMATS #include <tools/debug.hxx> #include <tools/solar.h> +#include <tools/list.hxx> #include <tools/globname.hxx> #include <tools/string.hxx> #include <sot/sotdata.hxx> diff --git a/tools/inc/tools/globname.hxx b/tools/inc/tools/globname.hxx index 97fbce56b7d0..cbca2169b518 100644 --- a/tools/inc/tools/globname.hxx +++ b/tools/inc/tools/globname.hxx @@ -28,10 +28,11 @@ #ifndef _GLOBNAME_HXX #define _GLOBNAME_HXX +#include <vector> + #include "tools/toolsdllapi.h" #include <com/sun/star/uno/Sequence.hxx> #include <tools/string.hxx> -#include <tools/list.hxx> /************************************************************************* *************************************************************************/ @@ -120,7 +121,7 @@ public: class SvGlobalNameList { - List aList; + std::vector<ImpSvGlobalName*> aList; public: SvGlobalNameList(); ~SvGlobalNameList(); @@ -128,7 +129,7 @@ public: void Append( const SvGlobalName & ); SvGlobalName GetObject( ULONG ); BOOL IsEntry( const SvGlobalName & rName ); - ULONG Count() const { return aList.Count(); } + ULONG Count() const { return aList.size(); } private: // nicht erlaubt SvGlobalNameList( const SvGlobalNameList & ); diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 82db356dc130..c220fbe1af92 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -409,7 +409,6 @@ String SvGlobalName::GetHexName() const |* SvGlobalNameList::SvGlobalNameList() *************************************************************************/ SvGlobalNameList::SvGlobalNameList() - : aList( 1, 1 ) { } @@ -418,10 +417,14 @@ SvGlobalNameList::SvGlobalNameList() *************************************************************************/ SvGlobalNameList::~SvGlobalNameList() { - for( ULONG i = Count(); i > 0; i-- ) + ImpSvGlobalName *pImp = 0; + std::vector<ImpSvGlobalName*>::iterator piter; + + for (piter = aList.begin(); piter != aList.end(); ++piter) { - ImpSvGlobalName * pImp = (ImpSvGlobalName *)aList.GetObject( i -1 ); - pImp->nRefCount--; + pImp = *piter; + + --pImp->nRefCount; if( !pImp->nRefCount ) delete pImp; } @@ -433,7 +436,7 @@ SvGlobalNameList::~SvGlobalNameList() void SvGlobalNameList::Append( const SvGlobalName & rName ) { rName.pImp->nRefCount++; - aList.Insert( rName.pImp, LIST_APPEND ); + aList.push_back(rName.pImp); } /************************************************************************* @@ -441,7 +444,7 @@ void SvGlobalNameList::Append( const SvGlobalName & rName ) *************************************************************************/ SvGlobalName SvGlobalNameList::GetObject( ULONG nPos ) { - return SvGlobalName( (ImpSvGlobalName *)aList.GetObject( nPos ) ); + return SvGlobalName(nPos < aList.size() ? aList[nPos] : NULL); } /************************************************************************* @@ -449,12 +452,14 @@ SvGlobalName SvGlobalNameList::GetObject( ULONG nPos ) *************************************************************************/ BOOL SvGlobalNameList::IsEntry( const SvGlobalName & rName ) { - for( ULONG i = Count(); i > 0; i-- ) + std::vector<ImpSvGlobalName*>::iterator piter; + for (piter = aList.begin(); piter != aList.end(); ++piter) { - if( *rName.pImp == *(ImpSvGlobalName *)aList.GetObject( i -1 ) ) - return TRUE; + if (*rName.pImp == *(*piter)) + return true; } - return FALSE; + + return false; } com::sun::star::uno::Sequence < sal_Int8 > SvGlobalName::GetByteSequence() const |