diff options
Diffstat (limited to 'svx/source/svdraw/svdetc.cxx')
-rw-r--r-- | svx/source/svdraw/svdetc.cxx | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index 7ea0e0b686ba..89c17590984c 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -112,8 +112,6 @@ OLEObjCache::OLEObjCache() pTimer = new AutoTimer( "svx OLEObjCache pTimer UnloadCheck" ); pTimer->SetInvokeHandler( LINK(this, OLEObjCache, UnloadCheckHdl) ); pTimer->SetTimeout(20000); - pTimer->Invoke(); - pTimer->Start(); } OLEObjCache::~OLEObjCache() @@ -122,7 +120,7 @@ OLEObjCache::~OLEObjCache() delete pTimer; } -void OLEObjCache::UnloadOnDemand() +IMPL_LINK_NOARG(OLEObjCache, UnloadCheckHdl, Timer*, void) { if (nSize >= maObjs.size()) return; @@ -190,11 +188,12 @@ void OLEObjCache::InsertObj(SdrOle2Obj* pObj) // insert object into first position maObjs.insert(maObjs.begin(), pObj); - if ( !bFound ) - { - // a new object was inserted, recalculate the cache - UnloadOnDemand(); - } + // if a new object was inserted, recalculate the cache + if (!bFound) + pTimer->Invoke(); + + if (!bFound || !pTimer->IsActive()) + pTimer->Start(); } void OLEObjCache::RemoveObj(SdrOle2Obj* pObj) @@ -202,6 +201,8 @@ void OLEObjCache::RemoveObj(SdrOle2Obj* pObj) std::vector<SdrOle2Obj*>::iterator it = std::find(maObjs.begin(), maObjs.end(), pObj); if (it != maObjs.end()) maObjs.erase(it); + if (maObjs.empty()) + pTimer->Stop(); } size_t OLEObjCache::size() const @@ -243,12 +244,6 @@ bool OLEObjCache::UnloadObj(SdrOle2Obj* pObj) return bUnloaded; } -IMPL_LINK_NOARG(OLEObjCache, UnloadCheckHdl, Timer*, void) -{ - UnloadOnDemand(); -} - - bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol) { drawing::FillStyle eFill=static_cast<const XFillStyleItem&>(rSet.Get(XATTR_FILLSTYLE)).GetValue(); |