diff options
author | Joseph Powers <jpowers27@cox.net> | 2011-05-01 06:37:57 -0700 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-05-01 06:39:41 -0700 |
commit | 8157dce1b00e2fe619efe1edf1e8b85d49996788 (patch) | |
tree | f93e3927e21c7ee9aef069f537c4d337c8701f2a /sot | |
parent | lacking endif re added (diff) | |
download | core-8157dce1b00e2fe619efe1edf1e8b85d49996788.tar.gz core-8157dce1b00e2fe619efe1edf1e8b85d49996788.zip |
Convert List* to vector<>
Diffstat (limited to 'sot')
-rw-r--r-- | sot/inc/sot/sotdata.hxx | 7 | ||||
-rw-r--r-- | sot/source/base/exchange.cxx | 52 | ||||
-rw-r--r-- | sot/source/base/factory.cxx | 5 |
3 files changed, 31 insertions, 33 deletions
diff --git a/sot/inc/sot/sotdata.hxx b/sot/inc/sot/sotdata.hxx index 0e2564ee0ae9..489d50dbb0b7 100644 --- a/sot/inc/sot/sotdata.hxx +++ b/sot/inc/sot/sotdata.hxx @@ -34,25 +34,26 @@ #include <tools/solar.h> #include "sot/sotdllapi.h" +#include <com/sun/star/datatransfer/DataFlavor.hpp> #include <vector> //==================class SotData_Impl==================================== -class List; class SotFactory; class SotObjectList; typedef ::std::vector< SotFactory* > SotFactoryList; +typedef ::std::vector< com::sun::star::datatransfer::DataFlavor* > tDataFlavorList; struct SotData_Impl { - sal_uInt32 nSvObjCount; + sal_uInt32 nSvObjCount; SotObjectList * pObjectList; SotFactoryList * pFactoryList; SotFactory * pSotObjectFactory; SotFactory * pSotStorageStreamFactory; SotFactory * pSotStorageFactory; - List* pDataFlavorList; + tDataFlavorList* pDataFlavorList; SotData_Impl(); }; diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index f27df19eceb1..20b8efddbfff 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -33,7 +33,6 @@ #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> @@ -42,7 +41,6 @@ #include <sot/clsids.hxx> #include <rtl/instance.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/datatransfer/DataFlavor.hpp> #include <comphelper/documentconstants.hxx> #ifdef GetObject @@ -229,11 +227,11 @@ namespace //----------------------------------------------------------------------- -static List& InitFormats_Impl() +static tDataFlavorList& InitFormats_Impl() { SotData_Impl * pSotData = SOTDATA(); if( !pSotData->pDataFlavorList ) - pSotData->pDataFlavorList = new List(); + pSotData->pDataFlavorList = new tDataFlavorList(); return *pSotData->pDataFlavorList; } @@ -263,10 +261,10 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName ) : i ); // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + tDataFlavorList& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && rName == String( pFlavor->HumanPresentableName ) ) return i + SOT_FORMATSTR_ID_USER_END + 1; } @@ -278,7 +276,7 @@ sal_uLong SotExchange::RegisterFormatName( const String& rName ) pNewFlavor->HumanPresentableName = rName; pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 ); - rL.Insert( pNewFlavor, LIST_APPEND ); + rL.push_back( pNewFlavor ); return nMax + SOT_FORMATSTR_ID_USER_END + 1; } @@ -298,10 +296,10 @@ sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType ) return i; // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + tDataFlavorList& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && rMimeType == String( pFlavor->MimeType ) ) return i + SOT_FORMATSTR_ID_USER_END + 1; } @@ -313,7 +311,7 @@ sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType ) pNewFlavor->HumanPresentableName = rMimeType; pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 ); - rL.Insert( pNewFlavor, LIST_APPEND ); + rL.push_back( pNewFlavor ); return nMax + SOT_FORMATSTR_ID_USER_END + 1; } @@ -330,9 +328,9 @@ sal_uLong SotExchange::RegisterFormat( const DataFlavor& rFlavor ) if( !nRet ) { - List& rL = InitFormats_Impl(); - nRet = rL.Count() + SOT_FORMATSTR_ID_USER_END + 1; - rL.Insert( new DataFlavor( rFlavor ), LIST_APPEND ); + tDataFlavorList& rL = InitFormats_Impl(); + nRet = rL.size() + SOT_FORMATSTR_ID_USER_END + 1; + rL.push_back( new DataFlavor( rFlavor ) ); } return nRet; @@ -359,13 +357,13 @@ sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavo } else { - List& rL = InitFormats_Impl(); + tDataFlavorList& rL = InitFormats_Impl(); nFormat -= SOT_FORMATSTR_ID_USER_END + 1; - if( rL.Count() > nFormat ) + if( rL.size() > nFormat ) { - rFlavor = *(DataFlavor*) rL.GetObject( nFormat ); + rFlavor = *rL[ nFormat ]; bRet = sal_True; } else @@ -393,12 +391,12 @@ String SotExchange::GetFormatMimeType( sal_uLong nFormat ) sMimeType.AssignAscii( FormatArray_Impl::get()[nFormat].pMimeType ); else { - List& rL = InitFormats_Impl(); + tDataFlavorList& rL = InitFormats_Impl(); nFormat -= SOT_FORMATSTR_ID_USER_END + 1; - if( rL.Count() > nFormat ) - sMimeType = ((DataFlavor*) rL.GetObject( nFormat ))->MimeType; + if( rL.size() > nFormat ) + sMimeType = rL[ nFormat ]->MimeType; } DBG_ASSERT( sMimeType.Len(), "SotExchange::GetFormatMimeType(): DataFlavor not initialized" ); @@ -431,11 +429,11 @@ sal_uLong SotExchange::GetFormatIdFromMimeType( const String& rMimeType ) : i ); // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); + tDataFlavorList& rL = InitFormats_Impl(); ::rtl::OUString aMimeType( rMimeType ); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && aMimeType == pFlavor->MimeType ) return i + SOT_FORMATSTR_ID_USER_END + 1; } @@ -471,10 +469,10 @@ sal_uLong SotExchange::GetFormat( const DataFlavor& rFlavor ) : i ); // dann in der dynamischen Liste - List& rL = InitFormats_Impl(); - for( i = 0, nMax = rL.Count(); i < nMax; i++ ) + tDataFlavorList& rL = InitFormats_Impl(); + for( i = 0, nMax = rL.size(); i < nMax; i++ ) { - DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i ); + DataFlavor* pFlavor = rL[ i ]; if( pFlavor && rMimeType == pFlavor->MimeType ) return i + SOT_FORMATSTR_ID_USER_END + 1; } diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 904c6a7f90f8..cecd511d0e5b 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -39,7 +39,6 @@ #include <sot/sotdata.hxx> #include <sot/clsids.hxx> #include <rtl/instance.hxx> -#include <com/sun/star/datatransfer/DataFlavor.hpp> /************** class SotData_Impl *********************************************/ /************************************************************************* @@ -104,8 +103,8 @@ void SotFactory::DeInit() if( pSotData->pDataFlavorList ) { - for( sal_uLong i = 0, nMax = pSotData->pDataFlavorList->Count(); i < nMax; i++ ) - delete (::com::sun::star::datatransfer::DataFlavor*) pSotData->pDataFlavorList->GetObject( i ); + for( size_t i = 0, nMax = pSotData->pDataFlavorList->size(); i < nMax; i++ ) + delete (*pSotData->pDataFlavorList)[ i ]; delete pSotData->pDataFlavorList; pSotData->pDataFlavorList = NULL; } |