Replace List with std::vector< GraphicObject* >

This commit is contained in:
Joseph Powers
2011-07-13 19:59:10 -07:00
parent ecf04369ec
commit 3e7cc99273
2 changed files with 15 additions and 7 deletions

View File

@@ -548,6 +548,8 @@ public:
// - GraphicManager -
// ------------------
typedef ::std::vector< GraphicObject* > GraphicObjectList_impl;
class SVT_DLLPUBLIC GraphicManager
{
friend class GraphicObject;
@@ -555,8 +557,8 @@ class SVT_DLLPUBLIC GraphicManager
private:
List maObjList;
GraphicCache* mpCache;
GraphicObjectList_impl maObjList;
GraphicCache* mpCache;
GraphicManager( const GraphicManager& ) {}
GraphicManager& operator=( const GraphicManager& ) { return *this; }
@@ -652,7 +654,7 @@ private:
const GraphicObject* pCopyObj = NULL
);
void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj );
inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return( maObjList.Count() > 0UL ); }
inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); }
// Only used in swap case by GraphicObject
void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj );

View File

@@ -122,8 +122,8 @@ GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize
GraphicManager::~GraphicManager()
{
for( void* pObj = maObjList.First(); pObj; pObj = maObjList.Next() )
( (GraphicObject*) pObj )->GraphicManagerDestroyed();
for( size_t i = 0, n = maObjList.size(); i < n; ++i )
maObjList[ i ]->GraphicManagerDestroyed();
delete mpCache;
}
@@ -271,7 +271,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si
void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute,
const ByteString* pID, const GraphicObject* pCopyObj )
{
maObjList.Insert( (void*) &rObj, LIST_APPEND );
maObjList.push_back( (GraphicObject*)&rObj );
mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj );
}
@@ -280,7 +280,13 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst
void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
{
mpCache->ReleaseGraphicObject( rObj );
maObjList.Remove( (void*) &rObj );
for( GraphicObjectList_impl::iterator it = maObjList.begin(); it < maObjList.end(); ++it )
{
if ( *it == &rObj ) {
maObjList.erase( it );
break;
}
}
}
// -----------------------------------------------------------------------------