From ebde6c7e3e816980dfe32086783a165f3d0019b1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 28 Jun 2012 11:02:42 +0200 Subject: Convert aItems field of SvLBoxEntry class from SvPtrarr to std::vector Change-Id: I96d676ded52ebdf0f68b051b06cecf717d56e813 --- svtools/inc/svtools/svlbox.hxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'svtools/inc') diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx index 92aa9460e692..ea18d052dbfd 100644 --- a/svtools/inc/svtools/svlbox.hxx +++ b/svtools/inc/svtools/svlbox.hxx @@ -183,24 +183,28 @@ class SVT_DLLPUBLIC SvLBoxEntry : public SvListEntry { friend class SvLBox; - SvPtrarr aItems; - void* pUserData; - sal_uInt16 nEntryFlags; + std::vector aItems; + void* pUserData; + sal_uInt16 nEntryFlags; SVT_DLLPRIVATE void DeleteItems_Impl(); public: SvLBoxEntry(); virtual ~SvLBoxEntry(); - sal_uInt16 ItemCount() const { return (sal_uInt16)aItems.Count(); } + sal_uInt16 ItemCount() const { return (sal_uInt16)aItems.size(); } // DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL // EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN // DATEN ALLOZIERT WERDEN! void AddItem( SvLBoxItem* pItem ); void ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos ); - SvLBoxItem* GetItem( sal_uInt16 nPos ) const { return (SvLBoxItem*)aItems.GetObject(nPos ); } + SvLBoxItem* GetItem( sal_uInt16 nPos ) const { return aItems[nPos]; } SvLBoxItem* GetFirstItem( sal_uInt16 nId ); - sal_uInt16 GetPos( SvLBoxItem* pItem ) const { return aItems.GetPos( pItem ); } + sal_uInt16 GetPos( SvLBoxItem* pItem ) const + { + std::vector::const_iterator it = std::find( aItems.begin(), aItems.end(), pItem ); + return it == aItems.end() ? USHRT_MAX : it - aItems.begin(); + } void* GetUserData() const { return pUserData; } void SetUserData( void* pPtr ) { pUserData = pPtr; } virtual void Clone( SvListEntry* pSource ); -- cgit