From eaea49187f4ea29bba32042ef8aeced45304773b Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Sun, 15 May 2011 19:48:38 -0700 Subject: Change SvStorageInfoList from an OwnList to vector< The main work is in: storinfo.hxx storinfo.cxx The rest is just simple cleanup. --- sot/inc/sot/stg.hxx | 3 ++- sot/inc/sot/storage.hxx | 2 +- sot/inc/sot/storinfo.hxx | 12 ++++-------- sot/source/sdstor/stg.cxx | 6 +++--- sot/source/sdstor/storinfo.cxx | 15 --------------- sot/source/sdstor/ucbstorage.cxx | 2 +- sot/source/sdstor/unostorageholder.cxx | 4 ++-- sot/source/unoolestorage/xolesimplestorage.cxx | 6 +++--- 8 files changed, 16 insertions(+), 34 deletions(-) diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx index 30ffbf06d2a7..2d17974d0a2d 100644 --- a/sot/inc/sot/stg.hxx +++ b/sot/inc/sot/stg.hxx @@ -42,9 +42,11 @@ #include #include #include +#include "sot/storinfo.hxx" #include "sot/sotdllapi.h" #include + class UNOStorageHolder; typedef ::std::list< UNOStorageHolder* > UNOStorageHolderList; @@ -99,7 +101,6 @@ public: virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0; }; -class SvStorageInfoList; class BaseStorage : public StorageBase { public: diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx index 1e78865a3ef0..e1ce95158b12 100644 --- a/sot/inc/sot/storage.hxx +++ b/sot/inc/sot/storage.hxx @@ -38,6 +38,7 @@ #include #include #include +#include "sot/storinfo.hxx" #include "sot/sotdllapi.h" #define STORAGE_FAILIFTHERE 0x02 @@ -108,7 +109,6 @@ namespace ucbhelper class Content; } -class SvStorageInfoList; class BaseStorage; class UNOStorageHolder; class SOT_DLLPUBLIC SotStorage : virtual public SotObject diff --git a/sot/inc/sot/storinfo.hxx b/sot/inc/sot/storinfo.hxx index 0d7c73d3717c..90062330adac 100644 --- a/sot/inc/sot/storinfo.hxx +++ b/sot/inc/sot/storinfo.hxx @@ -31,7 +31,7 @@ #include #include -#include +#include #include "sot/sotdllapi.h" class StgDirEntry; @@ -40,8 +40,8 @@ class SvStorageInfo friend class SvStorage; String aName; SvGlobalName aClassName; - sal_uLong nSize; - sal_Bool bStream:1, + sal_uLong nSize; + sal_Bool bStream:1, bStorage:1; SvStorageInfo(){}; // Fuer SvStorage @@ -61,11 +61,7 @@ public: sal_uLong GetSize() const { return nSize; } }; -class SOT_DLLPUBLIC SvStorageInfoList -{ - PRV_SV_DECL_OWNER_LIST(SvStorageInfoList,SvStorageInfo) - const SvStorageInfo * Get( const String & rName ); -}; +typedef ::std::vector< SvStorageInfo > SvStorageInfoList; SOT_DLLPUBLIC sal_uLong ReadClipboardFormat( SvStream & rStm ); SOT_DLLPUBLIC void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat ); diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index c73028833790..9229fcf81534 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -549,7 +549,7 @@ void Storage::FillInfoList( SvStorageInfoList* pList ) const if( !p->bInvalid ) { SvStorageInfo aInfo( *p ); - pList->Append( aInfo ); + pList->push_back( aInfo ); } p = aIter.Next(); } @@ -806,9 +806,9 @@ sal_Bool Storage::CopyTo( BaseStorage* pDest ) const SvStorageInfoList aList; FillInfoList( &aList ); sal_Bool bRes = sal_True; - for( sal_uInt16 i = 0; i < aList.Count() && bRes; i++ ) + for( size_t i = 0; i < aList.size() && bRes; i++ ) { - SvStorageInfo& rInfo = aList.GetObject( i ); + SvStorageInfo& rInfo = aList[ i ]; bRes = pThis->CopyTo( rInfo.GetName(), pDest, rInfo.GetName() ); } if( !bRes ) diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx index 1cdde1a45104..5f1768b8e7ef 100644 --- a/sot/source/sdstor/storinfo.cxx +++ b/sot/source/sdstor/storinfo.cxx @@ -34,21 +34,6 @@ #include -/************** class SvStorageInfoList ********************************** -*************************************************************************/ -PRV_SV_IMPL_OWNER_LIST(SvStorageInfoList,SvStorageInfo) - -const SvStorageInfo * SvStorageInfoList::Get( const String & rEleName ) -{ - for( sal_uLong i = 0; i < Count(); i++ ) - { - const SvStorageInfo & rType = GetObject( i ); - if( rType.GetName() == rEleName ) - return &rType; - } - return NULL; -} - /************** class SvStorageInfo ************************************** *************************************************************************/ sal_uLong ReadClipboardFormat( SvStream & rStm ) diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 8199a5e3423d..198a6572dec3 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -2674,7 +2674,7 @@ void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const if ( pElement->m_xStream.Is() ) nSize = pElement->m_xStream->GetSize(); SvStorageInfo aInfo( pElement->m_aName, nSize, pElement->m_bIsStorage ); - pList->Append( aInfo ); + pList->push_back( aInfo ); } } } diff --git a/sot/source/sdstor/unostorageholder.cxx b/sot/source/sdstor/unostorageholder.cxx index dcfdfa134480..dbb54e08cd4d 100644 --- a/sot/source/sdstor/unostorageholder.cxx +++ b/sot/source/sdstor/unostorageholder.cxx @@ -37,7 +37,7 @@ #include #include "unostorageholder.hxx" -#include +#include "sot/storinfo.hxx" using namespace ::com::sun::star; @@ -140,7 +140,7 @@ void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ ) SvStorageInfoList aSubStorInfoList; m_rSotStorage->FillInfoList( &aSubStorInfoList ); - for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.Count(); nInd++ ) + for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.size(); nInd++ ) { m_rSotStorage->Remove( aSubStorInfoList[nInd].GetName() ); if ( m_rSotStorage->GetError() ) diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index a50bfb9ae227..0e765a7285c9 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -566,8 +566,8 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::getElementNames() throw uno::RuntimeException(); // TODO: } - uno::Sequence< ::rtl::OUString > aSeq( aList.Count() ); - for ( sal_uInt32 nInd = 0; nInd < aList.Count(); nInd++ ) + uno::Sequence< ::rtl::OUString > aSeq( aList.size() ); + for ( sal_uInt32 nInd = 0; nInd < aList.size(); nInd++ ) aSeq[nInd] = aList[nInd].GetName(); return aSeq; @@ -629,7 +629,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasElements() throw uno::RuntimeException(); // TODO: } - return ( aList.Count() != 0 ); + return ( aList.size() != 0 ); } //____________________________________________________________________________________________________ -- cgit v1.2.3