diff options
author | Joseph Powers <jpowers27@cox.net> | 2011-06-22 18:19:57 -0700 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-06-22 18:21:00 -0700 |
commit | d3c77f63b4823f7a4d68043de50a62dfd5ed5e1f (patch) | |
tree | 1eadae6601ab3a27cef30fa2c6e8eb670fd2025f /svx | |
parent | 4ffe2461c158226fc587f8b741c1ff8f2adbbb8d (diff) |
Replace List with std::vector< Bitmap* >
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/xtable.hxx | 3 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabdash.cxx | 14 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabgrdt.cxx | 14 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabhtch.cxx | 14 | ||||
-rw-r--r-- | svx/source/xoutdev/xtable.cxx | 48 | ||||
-rw-r--r-- | svx/source/xoutdev/xtablend.cxx | 14 |
6 files changed, 72 insertions, 35 deletions
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx index 913a7665e195..f828b15cc293 100644 --- a/svx/inc/svx/xtable.hxx +++ b/svx/inc/svx/xtable.hxx @@ -244,6 +244,7 @@ public: // -------------------- typedef ::std::vector< XPropertyEntry* > XPropertyEntryList_impl; +typedef ::std::vector< Bitmap* > BitmapList_impl; class SVX_DLLPUBLIC XPropertyList { protected: @@ -252,7 +253,7 @@ protected: XOutdevItemPool* pXPool; XPropertyEntryList_impl aList; - List* pBmpList; + BitmapList_impl* pBmpList; sal_Bool bListDirty; sal_Bool bBitmapsDirty; diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index f6d76b62062b..f5ce99d55242 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -243,12 +243,12 @@ void XDashList::impDestroy() XDashList::XDashList( const String& rPath, XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, - sal_uInt16 nReSize + sal_uInt16 /* nInitSize */, + sal_uInt16 /* nReSize */ ) : XPropertyList( rPath, pInPool ), mpData(0) { - pBmpList = new List(nInitSize, nReSize); + pBmpList = new BitmapList_impl(); } XDashList::~XDashList() @@ -341,7 +341,13 @@ sal_Bool XDashList::CreateBitmapsForUI() DBG_ASSERT( pBmp, "XDashList: Bitmap(UI) konnte nicht erzeugt werden!" ); if( pBmp ) - pBmpList->Insert( pBmp, i ); + { + if ( (size_t)i < pBmpList->size() ) { + pBmpList->insert( pBmpList->begin() + i, pBmp ); + } else { + pBmpList->push_back( pBmp ); + } + } } impDestroy(); diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index ced902ead484..3da02661c5c0 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -225,12 +225,12 @@ void XGradientList::impDestroy() XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, - sal_uInt16 nReSize + sal_uInt16 /* nInitSize */, + sal_uInt16 /* nReSize */ ) : XPropertyList( rPath, pInPool ), mpData(0) { - pBmpList = new List(nInitSize, nReSize); + pBmpList = new BitmapList_impl(); } XGradientList::~XGradientList() @@ -334,7 +334,13 @@ sal_Bool XGradientList::CreateBitmapsForUI() DBG_ASSERT( pBmp, "XGradientList: Bitmap(UI) konnte nicht erzeugt werden!" ); if( pBmp ) - pBmpList->Insert( pBmp, i ); + { + if ( (size_t)i < pBmpList->size() ) { + pBmpList->insert( pBmpList->begin() + i, pBmp ); + } else { + pBmpList->push_back( pBmp ); + } + } } impDestroy(); diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index c7df40e196fd..22b236ce85c2 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -233,12 +233,12 @@ void XHatchList::impDestroy() XHatchList::XHatchList( const String& rPath, XOutdevItemPool* pInPool, - sal_uInt16 nInitSize, - sal_uInt16 nReSize + sal_uInt16 /* nInitSize */, + sal_uInt16 /* nReSize */ ) : XPropertyList( rPath, pInPool ), mpData(0) { - pBmpList = new List(nInitSize, nReSize); + pBmpList = new BitmapList_impl(); } XHatchList::~XHatchList() @@ -335,7 +335,13 @@ sal_Bool XHatchList::CreateBitmapsForUI() DBG_ASSERT( pBmp, "XHatchList: Bitmap(UI) konnte nicht erzeugt werden!" ); if( pBmp ) - pBmpList->Insert( pBmp, i ); + { + if ( (size_t)i < pBmpList->size() ) { + pBmpList->insert( pBmpList->begin() + i, pBmp ); + } else { + pBmpList->push_back( pBmp ); + } + } } impDestroy(); diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 6279116690e5..6f9b3d64cfaf 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -331,16 +331,12 @@ XPropertyList::~XPropertyList() } aList.clear(); - Bitmap* pBitmap = NULL; if( pBmpList ) { - pBitmap = (Bitmap*) pBmpList->First(); - - for( sal_uIntPtr nIndex = 0; nIndex < pBmpList->Count(); nIndex++ ) - { - delete pBitmap; - pBitmap = (Bitmap*) pBmpList->Next(); + for ( size_t i = 0, n = pBmpList->size(); i < n; ++i ) { + delete (*pBmpList)[ i ]; } + pBmpList->clear(); delete pBmpList; pBmpList = NULL; } @@ -364,7 +360,12 @@ void XPropertyList::Clear() } aList.clear(); if( pBmpList ) - pBmpList->Clear(); + { + for ( size_t i = 0, n = pBmpList->size(); i < n; ++i ) { + delete (*pBmpList)[ i ]; + } + pBmpList->clear(); + } } /************************************************************************/ @@ -435,10 +436,10 @@ Bitmap* XPropertyList::GetBitmap( long nIndex ) const ( (XPropertyList*) this )->bBitmapsDirty = sal_False; ( (XPropertyList*) this )->CreateBitmapsForUI(); } - if( pBmpList->Count() >= (sal_uIntPtr) nIndex ) - return (Bitmap*) pBmpList->GetObject( (sal_uIntPtr) nIndex ); + if( (size_t)nIndex < pBmpList->size() ) + return (*pBmpList)[ nIndex ]; } - return( NULL ); + return NULL; } /************************************************************************* @@ -460,7 +461,11 @@ void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex ) Bitmap* pBmp = CreateBitmapForUI( (size_t)nIndex < aList.size() ? nIndex : aList.size() - 1 ); - pBmpList->Insert( pBmp, (sal_uIntPtr) nIndex ); + if ( (size_t)nIndex < pBmpList->size() ) { + pBmpList->insert( pBmpList->begin() + nIndex, pBmp ); + } else { + pBmpList->push_back( pBmp ); + } } } @@ -480,9 +485,14 @@ XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex ) if( pBmpList && !bBitmapsDirty ) { Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex ); - Bitmap* pOldBmp = (Bitmap*) pBmpList->Replace( pBmp, (sal_uIntPtr) nIndex ); - if( pOldBmp ) - delete pOldBmp; + if ( (size_t)nIndex < pBmpList->size() ) + { + delete (*pBmpList)[ nIndex ]; + (*pBmpList)[ nIndex ] = pBmp; + } + else { + pBmpList->push_back( pBmp ); + } } return pOldEntry; } @@ -497,9 +507,11 @@ XPropertyEntry* XPropertyList::Remove( long nIndex ) { if( pBmpList && !bBitmapsDirty ) { - Bitmap* pOldBmp = (Bitmap*) pBmpList->Remove( (sal_uIntPtr) nIndex ); - if( pOldBmp ) - delete pOldBmp; + if ( (size_t)nIndex < pBmpList->size() ) + { + delete (*pBmpList)[ nIndex ]; + pBmpList->erase( pBmpList->begin() + nIndex ); + } } XPropertyEntry* pEntry = NULL; diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index 31f2a60ac01a..cfffda9b82cd 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -250,12 +250,12 @@ void XLineEndList::impDestroy() XLineEndList::XLineEndList( const String& rPath, XOutdevItemPool* _pXPool, - sal_uInt16 nInitSize, - sal_uInt16 nReSize + sal_uInt16 /* nInitSize */, + sal_uInt16 /* nReSize */ ) : XPropertyList( rPath, _pXPool ), mpData(0) { - pBmpList = new List(nInitSize, nReSize); + pBmpList = new BitmapList_impl(); } XLineEndList::~XLineEndList() @@ -355,7 +355,13 @@ sal_Bool XLineEndList::CreateBitmapsForUI() OSL_ENSURE(0 != pBmp, "XLineEndList: Bitmap(UI) could not be created!" ); if( pBmp ) - pBmpList->Insert( pBmp, i ); + { + if ( (size_t)i < pBmpList->size() ) { + pBmpList->insert( pBmpList->begin() + i, pBmp ); + } else { + pBmpList->push_back( pBmp ); + } + } } impDestroy(); |