summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-27 01:42:46 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-27 01:53:06 +0200
commitc96c6d52cf382cfbc3e2e16619a6e3370fb1a40b (patch)
tree5962ac65cf9362d5fe06975d5dfd8129c023c40c
parentf98083890c55318dd4f10c666b749d6092eb4617 (diff)
remove chart listener when chart is deleted, fdo#64639
Change-Id: I7ebf75f49c89edcb0bba3a597ba24ac1c0a655ef
-rw-r--r--sc/inc/chartlis.hxx2
-rw-r--r--sc/source/core/tool/chartlis.cxx5
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx1
3 files changed, 8 insertions, 0 deletions
diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index df3c02231422..ded1f3cb79ac 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -171,6 +171,8 @@ public:
const ScChartListener* findByName(const OUString& rName) const;
bool hasListeners() const;
+ void removeByName(const OUString& rName);
+
const ListenersType& getListeners() const;
ListenersType& getListeners();
StringSetType& getNonOleObjectNames();
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index ed0796073726..df584d485d1d 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -469,6 +469,11 @@ void ScChartListenerCollection::insert(ScChartListener* pListener)
maListeners.insert(aName, pListener);
}
+void ScChartListenerCollection::removeByName(const OUString& rName)
+{
+ maListeners.erase(rName);
+}
+
ScChartListener* ScChartListenerCollection::findByName(const OUString& rName)
{
ListenersType::iterator it = maListeners.find(rName);
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index b31200bad87d..c259aaa94805 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -298,6 +298,7 @@ void SAL_CALL ScChartsObj::removeByName( const OUString& aName )
if (pObj)
{
ScDocument* pDoc = pDocShell->GetDocument();
+ pDoc->GetChartListenerCollection()->removeByName(aName);
ScDrawLayer* pModel = pDoc->GetDrawLayer(); // ist nicht 0
SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(nTab)); // ist nicht 0