diff options
author | Joseph Powers <jpowers27@cox.net> | 2011-05-17 22:22:12 -0700 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-05-17 22:23:57 -0700 |
commit | 22e299f25e6b9b27b097aa95a75bc0fb39c18752 (patch) | |
tree | 9a1baa40e7ec36383e54ad6979073c9f2ef6cf07 | |
parent | 834fc570c2f2d66aacd2a0315a2fb38ffc474c0f (diff) |
Convert OwnList SvObjectServer into a vector<>
-rw-r--r-- | svtools/inc/svtools/insdlg.hxx | 18 | ||||
-rw-r--r-- | svtools/source/dialogs/insdlg.cxx | 30 |
2 files changed, 31 insertions, 17 deletions
diff --git a/svtools/inc/svtools/insdlg.hxx b/svtools/inc/svtools/insdlg.hxx index e7d894122243..4bb9cd893828 100644 --- a/svtools/inc/svtools/insdlg.hxx +++ b/svtools/inc/svtools/insdlg.hxx @@ -35,7 +35,7 @@ #include <tools/globname.hxx> #include <sot/formats.hxx> -#include <svl/ownlist.hxx> +#include <vector> #include <svtools/transfer.hxx> class SvObjectServer @@ -53,13 +53,27 @@ public: const String & GetHumanName() const { return aHumanName; } }; +typedef ::std::vector< SvObjectServer > SvObjectServerList_impl; + class SVT_DLLPUBLIC SvObjectServerList { - PRV_SV_DECL_OWNER_LIST(SvObjectServerList,SvObjectServer) +private: + SvObjectServerList_impl aObjectServerList; + +public: const SvObjectServer * Get( const String & rHumanName ) const; const SvObjectServer * Get( const SvGlobalName & ) const; void Remove( const SvGlobalName & ); void FillInsertObjects(); + size_t Count() const + { + return aObjectServerList.size(); + } + + const SvObjectServer operator[]( size_t n ) const + { + return aObjectServerList[ n ]; + } }; class SVT_DLLPUBLIC SvPasteObjectHelper diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index ee950a4e7cc2..b102f3845f4b 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -70,7 +70,6 @@ struct OleObjectDescriptor /********************** SvObjectServerList ******************************** **************************************************************************/ -PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) /************************************************************************* |* SvObjectServerList::SvObjectServerList() @@ -79,10 +78,10 @@ PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) *************************************************************************/ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) const { - for( sal_uLong i = 0; i < Count(); i++ ) + for( size_t i = 0; i < aObjectServerList.size(); i++ ) { - if( rHumanName == GetObject( i ).GetHumanName() ) - return &GetObject( i ); + if( rHumanName == aObjectServerList[ i ].GetHumanName() ) + return &aObjectServerList[ i ]; } return NULL; } @@ -94,26 +93,27 @@ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) cons *************************************************************************/ const SvObjectServer * SvObjectServerList::Get( const SvGlobalName & rName ) const { - for( sal_uLong i = 0; i < Count(); i++ ) + for( size_t i = 0; i < aObjectServerList.size(); i++ ) { - if( rName == GetObject( i ).GetClassName() ) - return &GetObject( i ); + if( rName == aObjectServerList[ i ].GetClassName() ) + return &aObjectServerList[ i ]; } return NULL; } void SvObjectServerList::Remove( const SvGlobalName & rName ) { - SvObjectServer * pS = (SvObjectServer *)aTypes.First(); - while( pS ) + for( size_t i = 0; i < aObjectServerList.size(); ) { - if( rName == pS->GetClassName() ) + if( aObjectServerList[ i ].GetClassName() == rName ) { - Remove(); - pS = (SvObjectServer *)aTypes.GetCurObject(); + SvObjectServerList_impl::iterator it = aObjectServerList.begin() + i; + aObjectServerList.erase( it ); } else - pS = (SvObjectServer *)aTypes.Next(); + { + ++i; + } } } @@ -208,7 +208,7 @@ void SvObjectServerList::FillInsertObjects() { if( !Get( aClassName ) ) // noch nicht eingetragen - Append( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); + aObjectServerList.push_back( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); } } } @@ -220,7 +220,7 @@ void SvObjectServerList::FillInsertObjects() #ifdef WNT SvGlobalName aOleFact( SO3_OUT_CLASSID ); String aOleObj( SvtResId( STR_FURTHER_OBJECT ) ); - Append( SvObjectServer( aOleFact, aOleObj ) ); + aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) ); #endif }catch( container::NoSuchElementException) |