[Libreoffice-commits] .: 7 commits - sc/inc sc/source sd/source svx/inc svx/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Feb 1 17:20:56 PST 2012


 sc/inc/chartlis.hxx                           |   75 ++++---
 sc/inc/document.hxx                           |    3 
 sc/source/core/data/documen3.cxx              |    5 
 sc/source/core/data/documen5.cxx              |   27 +-
 sc/source/core/data/documen8.cxx              |    2 
 sc/source/core/data/document.cxx              |   25 +-
 sc/source/core/data/drwlayer.cxx              |    4 
 sc/source/core/tool/charthelper.cxx           |   18 -
 sc/source/core/tool/chartlis.cxx              |  266 +++++++++++++++++---------
 sc/source/filter/excel/xichart.cxx            |    2 
 sc/source/filter/xml/XMLTableShapeResizer.cxx |    2 
 sc/source/filter/xml/xmlexprt.cxx             |    9 
 sc/source/ui/docshell/docsh4.cxx              |    2 
 sc/source/ui/unoobj/cellsuno.cxx              |   58 +----
 sc/source/ui/unoobj/chartuno.cxx              |   63 ++----
 sc/source/ui/unoobj/shapeuno.cxx              |    2 
 sc/source/ui/view/tabvwsh9.cxx                |    2 
 sd/source/core/drawdoc2.cxx                   |    2 
 sd/source/ui/unoidl/unoobj.cxx                |    2 
 sd/source/ui/view/drviewsg.cxx                |    2 
 sd/source/ui/view/sdview3.cxx                 |    4 
 sd/source/ui/view/sdview4.cxx                 |    6 
 svx/inc/svx/svdobj.hxx                        |    4 
 svx/source/dialog/imapwnd.cxx                 |    8 
 svx/source/gallery2/galtheme.cxx              |    2 
 svx/source/svdraw/svdobj.cxx                  |   24 --
 svx/source/svdraw/svdotxln.cxx                |    2 
 27 files changed, 352 insertions(+), 269 deletions(-)

New commits:
commit 67748256612046759bf4141c6c08f023585d11d5
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 16:20:03 2012 -0500

    Method description.

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index 8e8f739..e710d1f 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -187,6 +187,10 @@ public:
     const ListenersType& getListeners() const;
     ListenersType& getListeners();
 
+    /**
+     * Create a unique name that's not taken by any existing chart listener
+     * objects.  The name consists of a prefix given followed by a number.
+     */
     rtl::OUString getUniqueName(const rtl::OUString& rPrefix) const;
 
     void            ChangeListening( const String& rName,
commit e0917855f80eb64b3eacce13152810d8b8932517
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 16:13:39 2012 -0500

    Always look up chart objects by name, change method names' casing.
    
    The old container always perform lookups by name only.

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index b08af31..8e8f739 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -179,15 +179,15 @@ public:
                     // only needed after copy-ctor, if newly added to doc
     void            StartAllListeners();
 
-    SC_DLLPUBLIC void Insert(ScChartListener* pListener);
-    ScChartListener* Find(const ScChartListener& rListener);
-    const ScChartListener* Find(const ScChartListener& rListener) const;
-    bool HasListeners() const;
+    SC_DLLPUBLIC void insert(ScChartListener* pListener);
+    ScChartListener* findByName(const rtl::OUString& rName);
+    const ScChartListener* findByName(const rtl::OUString& rName) const;
+    bool hasListeners() const;
 
-    const ListenersType& GetListeners() const;
-    ListenersType& GetListeners();
+    const ListenersType& getListeners() const;
+    ListenersType& getListeners();
 
-    rtl::OUString GetUniqueName(const rtl::OUString& rPrefix) const;
+    rtl::OUString getUniqueName(const rtl::OUString& rPrefix) const;
 
     void            ChangeListening( const String& rName,
                                     const ScRangeListRef& rRangeListRef,
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index e5101d8..d09b87b 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -188,7 +188,7 @@ void ScDocument::UpdateAllCharts()
 
                                 ScChartListener* pCL = new ScChartListener(
                                     aIPName, this, pChartObj->GetRangeList() );
-                                pChartListenerCollection->Insert( pCL );
+                                pChartListenerCollection->insert( pCL );
                                 pCL->StartListeningTo();
                             }
                         }
@@ -503,7 +503,7 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
     if (!pDrawLayer)
         return;
 
-    ScChartListenerCollection::ListenersType& rListeners = pChartListenerCollection->GetListeners();
+    ScChartListenerCollection::ListenersType& rListeners = pChartListenerCollection->getListeners();
     ScChartListenerCollection::ListenersType::iterator it = rListeners.begin(), itEnd = rListeners.end();
     for (; it != itEnd; ++it)
     {
@@ -696,9 +696,6 @@ void ScDocument::UpdateChartListenerCollection()
     if (!pDrawLayer)
         return;
 
-    ScRange aRange;
-    // Range for searching is not important
-    ScChartListener aCLSearcher( EMPTY_STRING, this, aRange );
     for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()); nTab++)
     {
         if (!maTabs[nTab])
@@ -717,8 +714,7 @@ void ScDocument::UpdateChartListenerCollection()
                 continue;
 
             rtl::OUString aObjName = ((SdrOle2Obj*)pObject)->GetPersistName();
-            aCLSearcher.SetName(aObjName);
-            ScChartListener* pListener = pChartListenerCollection->Find(aCLSearcher);
+            ScChartListener* pListener = pChartListenerCollection->findByName(aObjName);
             if (pListener)
                 pListener->SetUsed(true);
             else if ( lcl_StringInCollection( pOtherObjects, aObjName ) )
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 08db4fc..0212745 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1464,7 +1464,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
 // TimerDelays etc.
 void ScDocument::KeyInput( const KeyEvent& )
 {
-    if ( pChartListenerCollection->HasListeners() )
+    if ( pChartListenerCollection->hasListeners() )
         pChartListenerCollection->StartTimer();
     if( apTemporaryChartLock.get() )
         apTemporaryChartLock->StartOrContinueLocking();
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 6d23825..22ec123 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3485,7 +3485,7 @@ void ScDocument::CalcAfterLoad()
     // similar to ScMyShapeResizer::CreateChartListener for loading own files (i104899).
     if (pChartListenerCollection)
     {
-        const ScChartListenerCollection::ListenersType& rListeners = pChartListenerCollection->GetListeners();
+        const ScChartListenerCollection::ListenersType& rListeners = pChartListenerCollection->getListeners();
         ScChartListenerCollection::ListenersType::const_iterator it = rListeners.begin(), itEnd = rListeners.end();
         for (; it != itEnd; ++it)
         {
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 180c001..a5522f3 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -305,9 +305,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
                     if (pCollection)
                     {
                         ::rtl::OUString aChartName = pSdrOle2Obj->GetPersistName();
-                        ScRange aEmptyRange;
-                        ScChartListener aSearcher( aChartName, pDocument, aEmptyRange );
-                        const ScChartListener* pListener = pCollection->Find(aSearcher);
+                        const ScChartListener* pListener = pCollection->findByName(aChartName);
                         if (pListener)
                         {
                             const ScRangeListRef& rRangeList = pListener->GetRangeList();
@@ -395,15 +393,13 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, Sd
                             {
                                 if ( bSameDoc )
                                 {
-                                    ScRange aEmptyRange;
-                                    ScChartListener aSearcher( aChartName, pDoc, aEmptyRange );
                                     ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
-                                    if (pCollection && !pCollection->Find(aSearcher))
+                                    if (pCollection && !pCollection->findByName(aChartName))
                                     {
                                         ScRangeList aRangeList( rRangesVector[ nRangeList++ ] );
                                         ScRangeListRef rRangeList( new ScRangeList( aRangeList ) );
                                         ScChartListener* pChartListener = new ScChartListener( aChartName, pDoc, rRangeList );
-                                        pCollection->Insert( pChartListener );
+                                        pCollection->insert( pChartListener );
                                         pChartListener->StartListeningTo();
                                     }
                                 }
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index f8afb81..49d67a4 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -502,54 +502,40 @@ void ScChartListenerCollection::StartAllListeners()
         it->second->StartListeningTo();
 }
 
-void ScChartListenerCollection::Insert(ScChartListener* pListener)
+void ScChartListenerCollection::insert(ScChartListener* pListener)
 {
     rtl::OUString aName = pListener->GetName();
     maListeners.insert(aName, pListener);
 }
 
-ScChartListener* ScChartListenerCollection::Find(const ScChartListener& rListener)
+ScChartListener* ScChartListenerCollection::findByName(const rtl::OUString& rName)
 {
-    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
-    for (; it != itEnd; ++it)
-    {
-        ScChartListener* p = it->second;
-        OSL_ASSERT(p);
-        if (*p == rListener)
-            return p;
-    }
-    return NULL;
+    ListenersType::iterator it = maListeners.find(rName);
+    return it == maListeners.end() ? NULL : it->second;
 }
 
-const ScChartListener* ScChartListenerCollection::Find(const ScChartListener& rListener) const
+const ScChartListener* ScChartListenerCollection::findByName(const rtl::OUString& rName) const
 {
-    ListenersType::const_iterator it = maListeners.begin(), itEnd = maListeners.end();
-    for (; it != itEnd; ++it)
-    {
-        const ScChartListener* p = it->second;
-        OSL_ASSERT(p);
-        if (*p == rListener)
-            return p;
-    }
-    return NULL;
+    ListenersType::const_iterator it = maListeners.find(rName);
+    return it == maListeners.end() ? NULL : it->second;
 }
 
-bool ScChartListenerCollection::HasListeners() const
+bool ScChartListenerCollection::hasListeners() const
 {
     return !maListeners.empty();
 }
 
-const ScChartListenerCollection::ListenersType& ScChartListenerCollection::GetListeners() const
+const ScChartListenerCollection::ListenersType& ScChartListenerCollection::getListeners() const
 {
     return maListeners;
 }
 
-ScChartListenerCollection::ListenersType& ScChartListenerCollection::GetListeners()
+ScChartListenerCollection::ListenersType& ScChartListenerCollection::getListeners()
 {
     return maListeners;
 }
 
-rtl::OUString ScChartListenerCollection::GetUniqueName(const rtl::OUString& rPrefix) const
+rtl::OUString ScChartListenerCollection::getUniqueName(const rtl::OUString& rPrefix) const
 {
     for (sal_Int32 nNum = 1; nNum < 10000; ++nNum) // arbitrary limit to prevent infinite loop.
     {
@@ -565,8 +551,7 @@ rtl::OUString ScChartListenerCollection::GetUniqueName(const rtl::OUString& rPre
 void ScChartListenerCollection::ChangeListening( const String& rName,
         const ScRangeListRef& rRangeListRef, bool bDirty )
 {
-    ScChartListener aCLSearcher( rName, pDoc, rRangeListRef );
-    ScChartListener* pCL = Find(aCLSearcher);
+    ScChartListener* pCL = findByName(rName);
     if (pCL)
     {
         pCL->EndListeningTo();
@@ -574,8 +559,8 @@ void ScChartListenerCollection::ChangeListening( const String& rName,
     }
     else
     {
-        pCL = new ScChartListener( aCLSearcher );
-        Insert( pCL );
+        pCL = new ScChartListener(rName, pDoc, rRangeListRef);
+        insert(pCL);
     }
     pCL->StartListeningTo();
     if ( bDirty )
@@ -716,7 +701,7 @@ void ScChartListenerCollection::SetDiffDirty(
     {
         ScChartListener* pCL = it->second;
         OSL_ASSERT(pCL);
-        const ScChartListener* pCLCmp = rCmp.Find(*pCL);
+        const ScChartListener* pCLCmp = rCmp.findByName(pCL->GetName());
         if (!pCLCmp || *pCL != *pCLCmp)
         {
             if ( bSetChartRangeLists )
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index d02cecf..6caf627 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -4013,7 +4013,7 @@ void XclImpChChart::Convert( const Reference<XChartDocument>& xChartDoc,
             SAL_WNODEPRECATED_DECLARATIONS_POP
             xListener->SetUsed( true );
             xListener->StartListeningTo();
-            pChartCollection->Insert( xListener.release() );
+            pChartCollection->insert( xListener.release() );
         }
     }
 }
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index 8bbc6b8..61b686a 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -114,7 +114,7 @@ void ScMyOLEFixer::CreateChartListener(ScDocument* pDoc,
             pDoc->InterpretDirtyCells( *pCL->GetRangeList() );
         }
 
-        pCollection->Insert( pCL );
+        pCollection->insert( pCL );
         pCL->StartListeningTo();
     }
 }
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 2d6dbad..5e92182 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3060,12 +3060,10 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
                     {
                         ::rtl::OUString aChartName;
                         xShapeProps->getPropertyValue( sPersistName ) >>= aChartName;
-                        ScRange aEmptyRange;
-                        ScChartListener aSearcher( aChartName, pDoc, aEmptyRange );
                         ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
                         if (pCollection)
                         {
-                            ScChartListener* pListener = pCollection->Find(aSearcher);
+                            ScChartListener* pListener = pCollection->findByName(aChartName);
                             if (pListener)
                             {
                                 const ScRangeListRef& rRangeList = pListener->GetRangeList();
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 40c35f9..7e5f395 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1223,7 +1223,7 @@ void ScDocShell::DoRecalc( bool bApi )
         //  doppelt gepainted werden.
 
         ScChartListenerCollection* pCharts = aDocument.GetChartListenerCollection();
-        if ( pCharts && pCharts->HasListeners() )
+        if ( pCharts && pCharts->hasListeners() )
             PostPaintGridAll();
         else
             PostDataChanged();
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index a19091e..1bddc21 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1113,7 +1113,7 @@ sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
         using XCellRangeData::setDataArray() significantly. */
     bool bDoubleAlloc = ScColumn::bDoubleAlloc;
     ScColumn::bDoubleAlloc = true;
-    
+
     sal_Bool bError = false;
     SCROW nDocRow = nStartRow;
     for (long nRow=0; nRow<nRows; nRow++)
@@ -3253,7 +3253,7 @@ void ScCellRangesBase::ForceChartListener_Impl()
     if (!pColl)
         return;
 
-    ScChartListenerCollection::ListenersType& rListeners = pColl->GetListeners();
+    ScChartListenerCollection::ListenersType& rListeners = pColl->getListeners();
     ScChartListenerCollection::ListenersType::iterator it = rListeners.begin(), itEnd = rListeners.end();
     for (; it != itEnd; ++it)
     {
@@ -3276,14 +3276,14 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe
         ScDocument* pDoc = pDocShell->GetDocument();
         ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
         ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
-        rtl::OUString aName = pColl->GetUniqueName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("__Uno")));
+        rtl::OUString aName = pColl->getUniqueName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("__Uno")));
         if (aName.isEmpty())
             // failed to create unique name.
             return;
 
         ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef );
         pListener->SetUno( aListener, this );
-        pColl->Insert( pListener );
+        pColl->insert( pListener );
         pListener->StartListeningTo();
     }
 }
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index f2218b9..8eac240 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -287,7 +287,7 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName,
 
             ScChartListener* pChartListener =
                 new ScChartListener( aObjName, pDoc, xNewRanges );
-            pDoc->GetChartListenerCollection()->Insert( pChartListener );
+            pDoc->GetChartListenerCollection()->insert( pChartListener );
             pChartListener->StartListeningTo();
 
             SdrOle2Obj* pObj = new SdrOle2Obj( ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), aObjName, aInsRect );
@@ -607,13 +607,11 @@ void ScChartObj::getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) con
             if (!pDoc)
                 break;
 
-            ScRange aEmptyRange;
             ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
             if (!pCollection)
                 break;
 
-            ScChartListener aSearcher(aChartName, pDoc, aEmptyRange);
-            ScChartListener* pListener = pCollection->Find(aSearcher);
+            ScChartListener* pListener = pCollection->findByName(aChartName);
             if (!pListener)
                 break;
 
commit 9ad6925552b6c6a366bd8a349a3bd78eb2d4bb92
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 15:54:08 2012 -0500

    We don't really need GetCount().

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index d6bff1b..b08af31 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -186,7 +186,6 @@ public:
 
     const ListenersType& GetListeners() const;
     ListenersType& GetListeners();
-    size_t GetCount() const;
 
     rtl::OUString GetUniqueName(const rtl::OUString& rPrefix) const;
 
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 48974e2..f8afb81 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -549,11 +549,6 @@ ScChartListenerCollection::ListenersType& ScChartListenerCollection::GetListener
     return maListeners;
 }
 
-size_t ScChartListenerCollection::GetCount() const
-{
-    return maListeners.size();
-}
-
 rtl::OUString ScChartListenerCollection::GetUniqueName(const rtl::OUString& rPrefix) const
 {
     for (sal_Int32 nNum = 1; nNum < 10000; ++nNum) // arbitrary limit to prevent infinite loop.
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 2760a39..40c35f9 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1223,7 +1223,7 @@ void ScDocShell::DoRecalc( bool bApi )
         //  doppelt gepainted werden.
 
         ScChartListenerCollection* pCharts = aDocument.GetChartListenerCollection();
-        if ( pCharts && pCharts->GetCount() )
+        if ( pCharts && pCharts->HasListeners() )
             PostPaintGridAll();
         else
             PostDataChanged();
commit 1f290abba0bb70c1ecf9d168c0d6c8c564d302ec
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 15:13:50 2012 -0500

    ScChartListenerCollection is no longer a child of ScStrCollection.

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index 970f796..d6bff1b 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -43,13 +43,14 @@
 
 #include <boost/unordered_set.hpp>
 #include <boost/scoped_ptr.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
 
 class ScDocument;
 class ScChartUnoData;
 #include <com/sun/star/chart/XChartData.hpp>
 #include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
 
-class SC_DLLPUBLIC ScChartListener : public StrData, public SvtListener
+class SC_DLLPUBLIC ScChartListener : public SvtListener
 {
 public:
     class ExternalRefListener : public ScExternalRefManager::LinkListener
@@ -76,6 +77,7 @@ private:
     boost::scoped_ptr<ExternalRefListener> mpExtRefListener;
     boost::scoped_ptr<std::vector<ScTokenRef> > mpTokens;
 
+    rtl::OUString maName;
     ScChartUnoData* pUnoData;
     ScDocument*     pDoc;
     bool            bUsed:1;  // for ScChartListenerCollection::FreeUnused
@@ -86,15 +88,17 @@ private:
     ScChartListener& operator=( const ScChartListener& );
 
 public:
-                    ScChartListener( const String& rName, ScDocument* pDoc,
-                                     const ScRange& rRange );
-                    ScChartListener( const String& rName, ScDocument* pDoc,
-                                     const ScRangeListRef& rRangeListRef );
-                    ScChartListener( const String& rName, ScDocument* pDoc,
-                                     ::std::vector<ScTokenRef>* pTokens );
-                    ScChartListener( const ScChartListener& );
-    virtual         ~ScChartListener();
-    virtual ScDataObject*   Clone() const;
+    ScChartListener( const rtl::OUString& rName, ScDocument* pDoc,
+                     const ScRange& rRange );
+    ScChartListener( const rtl::OUString& rName, ScDocument* pDoc,
+                     const ScRangeListRef& rRangeListRef );
+    ScChartListener( const rtl::OUString& rName, ScDocument* pDoc,
+                     ::std::vector<ScTokenRef>* pTokens );
+    ScChartListener( const ScChartListener& );
+    ~ScChartListener();
+
+    const rtl::OUString& GetName() const;
+    void SetName(const rtl::OUString& rName);
 
     void            SetUno( const com::sun::star::uno::Reference< com::sun::star::chart::XChartDataChangeEventListener >& rListener,
                             const com::sun::star::uno::Reference< com::sun::star::chart::XChartData >& rSource );
@@ -127,9 +131,8 @@ public:
     ExternalRefListener* GetExtRefListener();
     void            SetUpdateQueue();
 
-    bool            operator==( const ScChartListener& );
-    bool            operator!=( const ScChartListener& r )
-                        { return !operator==( r ); }
+    bool operator==( const ScChartListener& ) const;
+    bool operator!=( const ScChartListener& r ) const;
 };
 
 // ============================================================================
@@ -144,7 +147,7 @@ public:
 
 // ============================================================================
 
-class ScChartListenerCollection : public ScStrCollection
+class ScChartListenerCollection
 {
 public:
     struct RangeListenerItem
@@ -154,7 +157,10 @@ public:
         explicit RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p);
     };
 
+    typedef boost::ptr_map<rtl::OUString, ScChartListener> ListenersType;
+
 private:
+    ListenersType maListeners;
     ::std::list<RangeListenerItem> maHiddenListeners;
 
     Timer           aTimer;
@@ -165,18 +171,25 @@ private:
                     // not implemented
     ScChartListenerCollection& operator=( const ScChartListenerCollection& );
 
-    using ScStrCollection::operator==;
-
 public:
-                    ScChartListenerCollection( ScDocument* pDoc );
-                    ScChartListenerCollection( const ScChartListenerCollection& );
-    virtual ScDataObject*   Clone() const;
-
-    virtual         ~ScChartListenerCollection();
+    ScChartListenerCollection( ScDocument* pDoc );
+    ScChartListenerCollection( const ScChartListenerCollection& );
+    ~ScChartListenerCollection();
 
                     // only needed after copy-ctor, if newly added to doc
     void            StartAllListeners();
 
+    SC_DLLPUBLIC void Insert(ScChartListener* pListener);
+    ScChartListener* Find(const ScChartListener& rListener);
+    const ScChartListener* Find(const ScChartListener& rListener) const;
+    bool HasListeners() const;
+
+    const ListenersType& GetListeners() const;
+    ListenersType& GetListeners();
+    size_t GetCount() const;
+
+    rtl::OUString GetUniqueName(const rtl::OUString& rPrefix) const;
+
     void            ChangeListening( const String& rName,
                                     const ScRangeListRef& rRangeListRef,
                                     bool bDirty = false );
@@ -186,7 +199,7 @@ public:
                              const com::sun::star::uno::Reference< com::sun::star::chart::XChartData >& rSource );
     void            StartTimer();
     void            UpdateDirtyCharts();
-    void SC_DLLPUBLIC SetDirty();
+    SC_DLLPUBLIC void SetDirty();
     void            SetDiffDirty( const ScChartListenerCollection&,
                         bool bSetChartRangeLists = false );
 
@@ -195,7 +208,8 @@ public:
     void            UpdateScheduledSeriesRanges();
     void            UpdateChartsContainingTab( SCTAB nTab );
 
-    bool            operator==( const ScChartListenerCollection& );
+    bool operator==( const ScChartListenerCollection& r ) const;
+    bool operator!=( const ScChartListenerCollection& r ) const;
 
     /**
      * Start listening on hide/show change within specified cell range.  A
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index f19a067..e5101d8 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -503,11 +503,11 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
     if (!pDrawLayer)
         return;
 
-    sal_uInt16 nChartCount = pChartListenerCollection->GetCount();
-    for ( sal_uInt16 nIndex = 0; nIndex < nChartCount; nIndex++ )
+    ScChartListenerCollection::ListenersType& rListeners = pChartListenerCollection->GetListeners();
+    ScChartListenerCollection::ListenersType::iterator it = rListeners.begin(), itEnd = rListeners.end();
+    for (; it != itEnd; ++it)
     {
-        ScChartListener* pChartListener =
-            (ScChartListener*) (pChartListenerCollection->At(nIndex));
+        ScChartListener* pChartListener = it->second;
         ScRangeListRef aRLR( pChartListener->GetRangeList() );
         ScRangeListRef aNewRLR( new ScRangeList );
         bool bChanged = false;
@@ -556,7 +556,9 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
                 // UNO broadcasts are done after UpdateChartRef, so the chart will get this
                 // reference change.
 
-                uno::Reference< embed::XEmbeddedObject > xIPObj = FindOleObjectByName( pChartListener->GetString() );
+                uno::Reference<embed::XEmbeddedObject> xIPObj =
+                    FindOleObjectByName(pChartListener->GetName());
+
                 svt::EmbeddedObjectRef::TryRunningState( xIPObj );
 
                 // After the change, chart keeps track of its own data source ranges,
@@ -715,13 +717,10 @@ void ScDocument::UpdateChartListenerCollection()
                 continue;
 
             rtl::OUString aObjName = ((SdrOle2Obj*)pObject)->GetPersistName();
-            aCLSearcher.SetString( aObjName );
-            sal_uInt16 nIndex;
-            if ( pChartListenerCollection->Search( &aCLSearcher, nIndex ) )
-            {
-                ((ScChartListener*) (pChartListenerCollection->
-                    At( nIndex )))->SetUsed( true );
-            }
+            aCLSearcher.SetName(aObjName);
+            ScChartListener* pListener = pChartListenerCollection->Find(aCLSearcher);
+            if (pListener)
+                pListener->SetUsed(true);
             else if ( lcl_StringInCollection( pOtherObjects, aObjName ) )
             {
                 // non-chart OLE object -> don't touch
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 9110f4d..08db4fc 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1464,7 +1464,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
 // TimerDelays etc.
 void ScDocument::KeyInput( const KeyEvent& )
 {
-    if ( pChartListenerCollection->GetCount() )
+    if ( pChartListenerCollection->HasListeners() )
         pChartListenerCollection->StartTimer();
     if( apTemporaryChartLock.get() )
         apTemporaryChartLock->StartOrContinueLocking();
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 02790bc..6d23825 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3467,13 +3467,15 @@ void ScDocument::CalcAfterLoad()
         return;     // dann wird erst beim Einfuegen in das richtige Doc berechnet
 
     bCalcingAfterLoad = true;
-    TableContainer::iterator it = maTabs.begin();
-    for (; it != maTabs.end(); ++it)
-        if (*it)
-            (*it)->CalcAfterLoad();
-    for (it = maTabs.begin(); it != maTabs.end(); ++it)
-        if (*it)
-            (*it)->SetDirtyAfterLoad();
+    {
+        TableContainer::iterator it = maTabs.begin();
+        for (; it != maTabs.end(); ++it)
+            if (*it)
+                (*it)->CalcAfterLoad();
+        for (it = maTabs.begin(); it != maTabs.end(); ++it)
+            if (*it)
+                (*it)->SetDirtyAfterLoad();
+    }
     bCalcingAfterLoad = false;
 
     SetDetectiveDirty(false);   // noch keine wirklichen Aenderungen
@@ -3483,11 +3485,12 @@ void ScDocument::CalcAfterLoad()
     // similar to ScMyShapeResizer::CreateChartListener for loading own files (i104899).
     if (pChartListenerCollection)
     {
-        sal_uInt16 nChartCount = pChartListenerCollection->GetCount();
-        for ( sal_uInt16 nIndex = 0; nIndex < nChartCount; nIndex++ )
+        const ScChartListenerCollection::ListenersType& rListeners = pChartListenerCollection->GetListeners();
+        ScChartListenerCollection::ListenersType::const_iterator it = rListeners.begin(), itEnd = rListeners.end();
+        for (; it != itEnd; ++it)
         {
-            ScChartListener* pChartListener = static_cast<ScChartListener*>(pChartListenerCollection->At(nIndex));
-            InterpretDirtyCells(*pChartListener->GetRangeList());
+            const ScChartListener* p = it->second;
+            InterpretDirtyCells(*p->GetRangeList());
         }
     }
 }
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 6cd84f1..180c001 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -301,15 +301,14 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
                      ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) &&
                      bDisableDataTableDialog )
                 {
-                    ::rtl::OUString aChartName = pSdrOle2Obj->GetPersistName();
-                    ScRange aEmptyRange;
-                    ScChartListener aSearcher( aChartName, pDocument, aEmptyRange );
-                    sal_uInt16 nIndex = 0;
                     ScChartListenerCollection* pCollection = pDocument->GetChartListenerCollection();
-                    if ( pCollection && pCollection->Search( &aSearcher, nIndex ) )
+                    if (pCollection)
                     {
-                        ScChartListener* pListener = static_cast< ScChartListener* >( pCollection->At( nIndex ) );
-                        if ( pListener )
+                        ::rtl::OUString aChartName = pSdrOle2Obj->GetPersistName();
+                        ScRange aEmptyRange;
+                        ScChartListener aSearcher( aChartName, pDocument, aEmptyRange );
+                        const ScChartListener* pListener = pCollection->Find(aSearcher);
+                        if (pListener)
                         {
                             const ScRangeListRef& rRangeList = pListener->GetRangeList();
                             if ( rRangeList.Is() )
@@ -398,9 +397,8 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, Sd
                                 {
                                     ScRange aEmptyRange;
                                     ScChartListener aSearcher( aChartName, pDoc, aEmptyRange );
-                                    sal_uInt16 nIndex = 0;
                                     ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
-                                    if ( pCollection && !pCollection->Search( &aSearcher, nIndex ) )
+                                    if (pCollection && !pCollection->Find(aSearcher))
                                     {
                                         ScRangeList aRangeList( rRangesVector[ nRangeList++ ] );
                                         ScRangeListRef rRangeList( new ScRangeList( aRangeList ) );
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 1526e97..48974e2 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -35,6 +35,7 @@
 #include "brdcst.hxx"
 #include "document.hxx"
 #include "reftokenhelper.hxx"
+#include "stlalgorithm.hxx"
 
 using namespace com::sun::star;
 using ::std::vector;
@@ -118,12 +119,12 @@ boost::unordered_set<sal_uInt16>& ScChartListener::ExternalRefListener::getAllFi
 
 // ----------------------------------------------------------------------------
 
-ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP,
+ScChartListener::ScChartListener( const rtl::OUString& rName, ScDocument* pDocP,
         const ScRange& rRange ) :
-    StrData( rName ),
     SvtListener(),
     mpExtRefListener(NULL),
     mpTokens(new vector<ScTokenRef>),
+    maName(rName),
     pUnoData( NULL ),
     pDoc( pDocP ),
     bUsed( false ),
@@ -133,12 +134,12 @@ ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP,
     SetRangeList( rRange );
 }
 
-ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP,
+ScChartListener::ScChartListener( const rtl::OUString& rName, ScDocument* pDocP,
         const ScRangeListRef& rRangeList ) :
-    StrData( rName ),
     SvtListener(),
     mpExtRefListener(NULL),
     mpTokens(new vector<ScTokenRef>),
+    maName(rName),
     pUnoData( NULL ),
     pDoc( pDocP ),
     bUsed( false ),
@@ -148,11 +149,11 @@ ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP,
     ScRefTokenHelper::getTokensFromRangeList(*mpTokens, *rRangeList);
 }
 
-ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP, vector<ScTokenRef>* pTokens ) :
-    StrData( rName ),
+ScChartListener::ScChartListener( const rtl::OUString& rName, ScDocument* pDocP, vector<ScTokenRef>* pTokens ) :
     SvtListener(),
     mpExtRefListener(NULL),
     mpTokens(pTokens),
+    maName(rName),
     pUnoData( NULL ),
     pDoc( pDocP ),
     bUsed( false ),
@@ -162,10 +163,10 @@ ScChartListener::ScChartListener( const String& rName, ScDocument* pDocP, vector
 }
 
 ScChartListener::ScChartListener( const ScChartListener& r ) :
-    StrData( r ),
     SvtListener(),
     mpExtRefListener(NULL),
     mpTokens(new vector<ScTokenRef>(*r.mpTokens)),
+    maName(r.maName),
     pUnoData( NULL ),
     pDoc( r.pDoc ),
     bUsed( false ),
@@ -209,9 +210,14 @@ ScChartListener::~ScChartListener()
     }
 }
 
-ScDataObject* ScChartListener::Clone() const
+const rtl::OUString& ScChartListener::GetName() const
 {
-    return new ScChartListener( *this );
+    return maName;
+}
+
+void ScChartListener::SetName(const rtl::OUString& rName)
+{
+    maName = rName;
 }
 
 void ScChartListener::SetUno(
@@ -264,7 +270,7 @@ void ScChartListener::Update()
     else if ( pDoc->GetAutoCalc() )
     {
         bDirty = false;
-        pDoc->UpdateChart( GetString());
+        pDoc->UpdateChart(GetName());
     }
 }
 
@@ -401,7 +407,7 @@ void ScChartListener::UpdateChartIntersecting( const ScRange& rRange )
     if (ScRefTokenHelper::intersects(*mpTokens, pToken))
     {
         // force update (chart has to be loaded), don't use ScChartListener::Update
-        pDoc->UpdateChart( GetString());
+        pDoc->UpdateChart(GetName());
     }
 }
 
@@ -410,7 +416,7 @@ void ScChartListener::UpdateSeriesRanges()
 {
     ScRangeListRef pRangeList(new ScRangeList);
     ScRefTokenHelper::getRangeListFromTokens(*pRangeList, *mpTokens);
-    pDoc->SetChartRangeList(GetString(), pRangeList);
+    pDoc->SetChartRangeList(GetName(), pRangeList);
 }
 
 ScChartListener::ExternalRefListener* ScChartListener::GetExtRefListener()
@@ -427,14 +433,14 @@ void ScChartListener::SetUpdateQueue()
     pDoc->GetChartListenerCollection()->StartTimer();
 }
 
-bool ScChartListener::operator==( const ScChartListener& r )
+bool ScChartListener::operator==( const ScChartListener& r ) const
 {
     bool b1 = (mpTokens.get() && !mpTokens->empty());
     bool b2 = (r.mpTokens.get() && !r.mpTokens->empty());
 
     if (pDoc != r.pDoc || bUsed != r.bUsed || bDirty != r.bDirty ||
         bSeriesRangesScheduled != r.bSeriesRangesScheduled ||
-        GetString() != r.GetString() || b1 != b2)
+        GetName() != r.GetName() || b1 != b2)
         return false;
 
     if (!b1 && !b2)
@@ -444,6 +450,11 @@ bool ScChartListener::operator==( const ScChartListener& r )
     return *mpTokens == *r.mpTokens;
 }
 
+bool ScChartListener::operator!=( const ScChartListener& r ) const
+{
+    return !operator==(r);
+}
+
 // ============================================================================
 
 ScChartHiddenRangeListener::ScChartHiddenRangeListener()
@@ -463,7 +474,6 @@ ScChartListenerCollection::RangeListenerItem::RangeListenerItem(const ScRange& r
 }
 
 ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
-    ScStrCollection( 4, 4, false ),
     pDoc( pDocP )
 {
     aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) );
@@ -471,7 +481,6 @@ ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
 
 ScChartListenerCollection::ScChartListenerCollection(
         const ScChartListenerCollection& rColl ) :
-    ScStrCollection( rColl ),
     pDoc( rColl.pDoc )
 {
     aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) );
@@ -483,32 +492,88 @@ ScChartListenerCollection::~ScChartListenerCollection()
     //  ScChartListener::EndListeningTo may cause ScChartListenerCollection::StartTimer
     //  to be called if an empty ScNoteCell is deleted
 
-    if (GetCount())
-        FreeAll();
+    maListeners.clear();
 }
 
-ScDataObject*   ScChartListenerCollection::Clone() const
+void ScChartListenerCollection::StartAllListeners()
 {
-    return new ScChartListenerCollection( *this );
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
+        it->second->StartListeningTo();
 }
 
-void ScChartListenerCollection::StartAllListeners()
+void ScChartListenerCollection::Insert(ScChartListener* pListener)
+{
+    rtl::OUString aName = pListener->GetName();
+    maListeners.insert(aName, pListener);
+}
+
+ScChartListener* ScChartListenerCollection::Find(const ScChartListener& rListener)
+{
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
+    {
+        ScChartListener* p = it->second;
+        OSL_ASSERT(p);
+        if (*p == rListener)
+            return p;
+    }
+    return NULL;
+}
+
+const ScChartListener* ScChartListenerCollection::Find(const ScChartListener& rListener) const
+{
+    ListenersType::const_iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
+    {
+        const ScChartListener* p = it->second;
+        OSL_ASSERT(p);
+        if (*p == rListener)
+            return p;
+    }
+    return NULL;
+}
+
+bool ScChartListenerCollection::HasListeners() const
+{
+    return !maListeners.empty();
+}
+
+const ScChartListenerCollection::ListenersType& ScChartListenerCollection::GetListeners() const
+{
+    return maListeners;
+}
+
+ScChartListenerCollection::ListenersType& ScChartListenerCollection::GetListeners()
 {
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+    return maListeners;
+}
+
+size_t ScChartListenerCollection::GetCount() const
+{
+    return maListeners.size();
+}
+
+rtl::OUString ScChartListenerCollection::GetUniqueName(const rtl::OUString& rPrefix) const
+{
+    for (sal_Int32 nNum = 1; nNum < 10000; ++nNum) // arbitrary limit to prevent infinite loop.
     {
-        ((ScChartListener*) pItems[ nIndex ])->StartListeningTo();
+        rtl::OUStringBuffer aBuf(rPrefix);
+        aBuf.append(nNum);
+        rtl::OUString aTestName = aBuf.makeStringAndClear();
+        if (maListeners.find(aTestName) == maListeners.end())
+            return aTestName;
     }
+    return rtl::OUString();
 }
 
 void ScChartListenerCollection::ChangeListening( const String& rName,
         const ScRangeListRef& rRangeListRef, bool bDirty )
 {
     ScChartListener aCLSearcher( rName, pDoc, rRangeListRef );
-    ScChartListener* pCL;
-    sal_uInt16 nIndex;
-    if ( Search( &aCLSearcher, nIndex ) )
+    ScChartListener* pCL = Find(aCLSearcher);
+    if (pCL)
     {
-        pCL = (ScChartListener*) pItems[ nIndex ];
         pCL->EndListeningTo();
         pCL->SetRangeList( rRangeListRef );
     }
@@ -522,39 +587,87 @@ void ScChartListenerCollection::ChangeListening( const String& rName,
         pCL->SetDirty( true );
 }
 
+namespace {
+
+class InsertChartListener : public std::unary_function<ScChartListener*, void>
+{
+    ScChartListenerCollection::ListenersType& mrListeners;
+public:
+    InsertChartListener(ScChartListenerCollection::ListenersType& rListeners) :
+        mrListeners(rListeners) {}
+
+    void operator() (ScChartListener* p)
+    {
+        rtl::OUString aName = p->GetName();
+        mrListeners.insert(aName, p);
+    }
+};
+
+}
+
 void ScChartListenerCollection::FreeUnused()
 {
-    // rueckwaerts wg. Pointer-Aufrueckerei im Array
-    for ( sal_uInt16 nIndex = nCount; nIndex-- >0; )
+    std::vector<ScChartListener*> aUsed, aUnused;
+
+    // First, filter each listener into 'used' and 'unused' categories.
     {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        //  Uno-Charts nicht rauskicken
-        //  (werden per FreeUno von aussen geloescht)
-        if ( !pCL->IsUno() )
+        ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+        for (; it != itEnd; ++it)
         {
-            if ( pCL->IsUsed() )
-                pCL->SetUsed( false );
+            ScChartListener* p = it->second;
+            if (p->IsUno())
+            {
+                // We don't delete UNO charts; they are to be deleted separately via FreeUno().
+                aUsed.push_back(p);
+                continue;
+            }
+
+            if (p->IsUsed())
+            {
+                p->SetUsed(false);
+                aUsed.push_back(p);
+            }
             else
-                Free( pCL );
+                aUnused.push_back(p);
         }
     }
+
+    // Release all pointers currently managed by the ptr_map container.
+    maListeners.release().release();
+
+    // Re-insert the listeners we need to keep.
+    std::for_each(aUsed.begin(), aUsed.end(), InsertChartListener(maListeners));
+
+    // Now, delete the ones no longer needed.
+    std::for_each(aUnused.begin(), aUnused.end(), ScDeleteObjectByPtr<ScChartListener>());
 }
 
 void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartDataChangeEventListener >& rListener,
                                          const uno::Reference< chart::XChartData >& rSource )
 {
-    // rueckwaerts wg. Pointer-Aufrueckerei im Array
-    for ( sal_uInt16 nIndex = nCount; nIndex-- >0; )
+    std::vector<ScChartListener*> aUsed, aUnused;
+
+    // First, filter each listener into 'used' and 'unused' categories.
     {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        if ( pCL->IsUno() &&
-             pCL->GetUnoListener() == rListener &&
-             pCL->GetUnoSource() == rSource )
+        ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+        for (; it != itEnd; ++it)
         {
-            Free( pCL );
+            ScChartListener* p = it->second;
+            if (p->IsUno() && p->GetUnoListener() == rListener && p->GetUnoSource() == rSource)
+                aUnused.push_back(p);
+            else
+                aUsed.push_back(p);
         }
-        //! sollte nur einmal vorkommen?
     }
+
+    // Release all pointers currently managed by the ptr_map container.
+    maListeners.release().release();
+
+    // Re-insert the listeners we need to keep.
+    std::for_each(aUsed.begin(), aUsed.end(), InsertChartListener(maListeners));
+
+    // Now, delete the ones no longer needed.
+    std::for_each(aUnused.begin(), aUnused.end(), ScDeleteObjectByPtr<ScChartListener>());
 }
 
 void ScChartListenerCollection::StartTimer()
@@ -576,12 +689,14 @@ IMPL_LINK( ScChartListenerCollection, TimerHdl, Timer*, EMPTYARG )
 
 void ScChartListenerCollection::UpdateDirtyCharts()
 {
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
     {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        if ( pCL->IsDirty() )
-            pCL->Update();
-        if ( aTimer.IsActive() && !pDoc->IsImportingXML())
+        ScChartListener* p = it->second;
+        if (p->IsDirty())
+            p->Update();
+
+        if (aTimer.IsActive() && !pDoc->IsImportingXML())
             break;                      // da kam einer dazwischen
     }
 }
@@ -589,11 +704,10 @@ void ScChartListenerCollection::UpdateDirtyCharts()
 
 void ScChartListenerCollection::SetDirty()
 {
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
-    {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        pCL->SetDirty( true );
-    }
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
+        it->second->SetDirty(true);
+
     StartTimer();
 }
 
@@ -602,27 +716,27 @@ void ScChartListenerCollection::SetDiffDirty(
             const ScChartListenerCollection& rCmp, bool bSetChartRangeLists )
 {
     bool bDirty = false;
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
     {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        sal_uInt16 nFound;
-        bool bFound = rCmp.Search( pCL, nFound );
-        if ( !bFound || (*pCL != *((const ScChartListener*) rCmp.pItems[ nFound ])) )
+        ScChartListener* pCL = it->second;
+        OSL_ASSERT(pCL);
+        const ScChartListener* pCLCmp = rCmp.Find(*pCL);
+        if (!pCLCmp || *pCL != *pCLCmp)
         {
             if ( bSetChartRangeLists )
             {
-                if ( bFound )
+                if (pCLCmp)
                 {
                     const ScRangeListRef& rList1 = pCL->GetRangeList();
-                    const ScRangeListRef& rList2 =
-                        ((const ScChartListener*) rCmp.pItems[ nFound ])->GetRangeList();
+                    const ScRangeListRef& rList2 = pCLCmp->GetRangeList();
                     bool b1 = rList1.Is();
                     bool b2 = rList2.Is();
                     if ( b1 != b2 || (b1 && b2 && (*rList1 != *rList2)) )
-                        pDoc->SetChartRangeList( pCL->GetString(), rList1 );
+                        pDoc->SetChartRangeList( pCL->GetName(), rList1 );
                 }
                 else
-                    pDoc->SetChartRangeList( pCL->GetString(), pCL->GetRangeList() );
+                    pDoc->SetChartRangeList( pCL->GetName(), pCL->GetRangeList() );
             }
             bDirty = true;
             pCL->SetDirty( true );
@@ -636,9 +750,10 @@ void ScChartListenerCollection::SetDiffDirty(
 void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
 {
     bool bDirty = false;
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
     {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
+        ScChartListener* pCL = it->second;
         const ScRangeListRef& rList = pCL->GetRangeList();
         if ( rList.Is() && rList->Intersects( rRange ) )
         {
@@ -661,40 +776,43 @@ void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
 
 void ScChartListenerCollection::UpdateScheduledSeriesRanges()
 {
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
-    {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        pCL->UpdateScheduledSeriesRanges();
-    }
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
+        it->second->UpdateScheduledSeriesRanges();
 }
 
 
 void ScChartListenerCollection::UpdateChartsContainingTab( SCTAB nTab )
 {
     ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
-    {
-        ScChartListener* pCL = (ScChartListener*) pItems[ nIndex ];
-        pCL->UpdateChartIntersecting( aRange );
-    }
+    ListenersType::iterator it = maListeners.begin(), itEnd = maListeners.end();
+    for (; it != itEnd; ++it)
+        it->second->UpdateChartIntersecting(aRange);
 }
 
 
-bool ScChartListenerCollection::operator==( const ScChartListenerCollection& r )
+bool ScChartListenerCollection::operator==( const ScChartListenerCollection& r ) const
 {
     // hier nicht ScStrCollection::operator==() verwenden, der umstaendlich via
     // IsEqual und Compare laeuft, stattdessen ScChartListener::operator==()
-    if ( pDoc != r.pDoc || nCount != r.nCount )
+    if (pDoc != r.pDoc || maListeners.size() != r.maListeners.size())
         return false;
-    for ( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+
+    ListenersType::const_iterator it = maListeners.begin(), itEnd = maListeners.end();
+    ListenersType::const_iterator it2 = r.maListeners.begin();
+    for (; it != itEnd; ++it, ++it2)
     {
-        if ( *((ScChartListener*) pItems[ nIndex ]) !=
-                *((ScChartListener*) r.pItems[ nIndex ]) )
+        if (*it != *it2)
             return false;
     }
     return true;
 }
 
+bool ScChartListenerCollection::operator!=( const ScChartListenerCollection& r ) const
+{
+    return !operator==(r);
+}
+
 void ScChartListenerCollection::StartListeningHiddenRange( const ScRange& rRange, ScChartHiddenRangeListener* pListener )
 {
     RangeListenerItem aItem(rRange, pListener);
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index e3a90dd..2d6dbad 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3062,12 +3062,11 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
                         xShapeProps->getPropertyValue( sPersistName ) >>= aChartName;
                         ScRange aEmptyRange;
                         ScChartListener aSearcher( aChartName, pDoc, aEmptyRange );
-                        sal_uInt16 nIndex = 0;
                         ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
-                        if ( pCollection && pCollection->Search( &aSearcher, nIndex ) )
+                        if (pCollection)
                         {
-                            ScChartListener* pListener = static_cast< ScChartListener* >( pCollection->At( nIndex ) );
-                            if ( pListener )
+                            ScChartListener* pListener = pCollection->Find(aSearcher);
+                            if (pListener)
                             {
                                 const ScRangeListRef& rRangeList = pListener->GetRangeList();
                                 if ( rRangeList.Is() )
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 075421c..a19091e 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3246,42 +3246,21 @@ void ScCellRangesBase::ForceChartListener_Impl()
     //  call Update immediately so the caller to setData etc. can
     //  regognize the listener call
 
-    if ( pDocShell )
-    {
-        ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection();
-        if ( pColl )
-        {
-            sal_uInt16 nCollCount = pColl->GetCount();
-            for ( sal_uInt16 nIndex = 0; nIndex < nCollCount; nIndex++ )
-            {
-                ScChartListener* pChartListener = (ScChartListener*)pColl->At(nIndex);
-                if ( pChartListener &&
-                        pChartListener->GetUnoSource() == static_cast<chart::XChartData*>(this) &&
-                        pChartListener->IsDirty() )
-                    pChartListener->Update();
-            }
-        }
-    }
-}
+    if (!pDocShell)
+        return;
 
-String lcl_UniqueName( ScStrCollection& rColl, const String& rPrefix )
-{
-    long nNumber = 1;
-    sal_uInt16 nCollCount = rColl.GetCount();
-    while (sal_True)
+    ScChartListenerCollection* pColl = pDocShell->GetDocument()->GetChartListenerCollection();
+    if (!pColl)
+        return;
+
+    ScChartListenerCollection::ListenersType& rListeners = pColl->GetListeners();
+    ScChartListenerCollection::ListenersType::iterator it = rListeners.begin(), itEnd = rListeners.end();
+    for (; it != itEnd; ++it)
     {
-        String aName(rPrefix);
-        aName += String::CreateFromInt32( nNumber );
-        sal_Bool bFound = false;
-        for (sal_uInt16 i=0; i<nCollCount; i++)
-            if ( rColl[i]->GetString() == aName )
-            {
-                bFound = sal_True;
-                break;
-            }
-        if (!bFound)
-            return aName;
-        ++nNumber;
+        ScChartListener* p = it->second;
+        OSL_ASSERT(p);
+        if (p->GetUnoSource() == static_cast<chart::XChartData*>(this) && p->IsDirty())
+            p->Update();
     }
 }
 
@@ -3297,8 +3276,11 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe
         ScDocument* pDoc = pDocShell->GetDocument();
         ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
         ScChartListenerCollection* pColl = pDoc->GetChartListenerCollection();
-        String aName(lcl_UniqueName( *pColl,
-                        String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("__Uno")) ));
+        rtl::OUString aName = pColl->GetUniqueName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("__Uno")));
+        if (aName.isEmpty())
+            // failed to create unique name.
+            return;
+
         ScChartListener* pListener = new ScChartListener( aName, pDoc, aRangesRef );
         pListener->SetUno( aListener, this );
         pColl->Insert( pListener );
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 02ce4c1..f2218b9 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -602,41 +602,40 @@ void ScChartObj::getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) con
     switch ( nHandle )
     {
         case PROP_HANDLE_RELATED_CELLRANGES:
+        {
+            ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
+            if (!pDoc)
+                break;
+
+            ScRange aEmptyRange;
+            ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
+            if (!pCollection)
+                break;
+
+            ScChartListener aSearcher(aChartName, pDoc, aEmptyRange);
+            ScChartListener* pListener = pCollection->Find(aSearcher);
+            if (!pListener)
+                break;
+
+            const ScRangeListRef& rRangeList = pListener->GetRangeList();
+            if (!rRangeList.Is())
+                break;
+
+            size_t nCount = rRangeList->size();
+            uno::Sequence<table::CellRangeAddress> aCellRanges(nCount);
+            table::CellRangeAddress* pCellRanges = aCellRanges.getArray();
+            for (size_t i = 0; i < nCount; ++i)
             {
-                ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
-                if ( pDoc )
-                {
-                    ScRange aEmptyRange;
-                    sal_uInt16 nIndex = 0;
-                    ScChartListener aSearcher( aChartName, pDoc, aEmptyRange );
-                    ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection();
-                    if ( pCollection && pCollection->Search( &aSearcher, nIndex ) )
-                    {
-                        ScChartListener* pListener = static_cast< ScChartListener* >( pCollection->At( nIndex ) );
-                        if ( pListener )
-                        {
-                            const ScRangeListRef& rRangeList = pListener->GetRangeList();
-                            if ( rRangeList.Is() )
-                            {
-                                size_t nCount = rRangeList->size();
-                                uno::Sequence< table::CellRangeAddress > aCellRanges( nCount );
-                                table::CellRangeAddress* pCellRanges = aCellRanges.getArray();
-                                for ( size_t i = 0; i < nCount; ++i )
-                                {
-                                    ScRange aRange( *(*rRangeList)[i] );
-                                    table::CellRangeAddress aCellRange;
-                                    ScUnoConversion::FillApiRange( aCellRange, aRange );
-                                    pCellRanges[ i ] = aCellRange;
-                                }
-                                rValue <<= aCellRanges;
-                            }
-                        }
-                    }
-                }
+                ScRange aRange(*(*rRangeList)[i]);
+                table::CellRangeAddress aCellRange;
+                ScUnoConversion::FillApiRange(aCellRange, aRange);
+                pCellRanges[i] = aCellRange;
             }
-            break;
+            rValue <<= aCellRanges;
+        }
+        break;
         default:
-            break;
+            ;
     }
 }
 
commit 47de5f1c09cab1ea18b870d675b7bfb0cdfa74d3
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 11:52:30 2012 -0500

    std::auto_ptr to boost::scoped_ptr.

diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index aa8434b..970f796 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -40,7 +40,9 @@
 #include <memory>
 #include <vector>
 #include <list>
+
 #include <boost/unordered_set.hpp>
+#include <boost/scoped_ptr.hpp>
 
 class ScDocument;
 class ScChartUnoData;
@@ -71,14 +73,14 @@ public:
 
 private:
 
-    ::std::auto_ptr<ExternalRefListener>                mpExtRefListener;
-    ::std::auto_ptr< ::std::vector<ScTokenRef> >  mpTokens;
+    boost::scoped_ptr<ExternalRefListener> mpExtRefListener;
+    boost::scoped_ptr<std::vector<ScTokenRef> > mpTokens;
 
     ScChartUnoData* pUnoData;
     ScDocument*     pDoc;
-    bool            bUsed;  // for ScChartListenerCollection::FreeUnused
-    bool            bDirty;
-    bool            bSeriesRangesScheduled;
+    bool            bUsed:1;  // for ScChartListenerCollection::FreeUnused
+    bool            bDirty:1;
+    bool            bSeriesRangesScheduled:1;
 
                     // not implemented
     ScChartListener& operator=( const ScChartListener& );
commit 30fc28a477174806384a07ebe8e44e2fec440b73
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 11:38:02 2012 -0500

    non-inline the chart collection getter.

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 4a0c186..7cbebcc 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1559,8 +1559,7 @@ public:
     bool            GetNoListening() const { return bNoListening; }
     ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; }
 
-    ScChartListenerCollection* GetChartListenerCollection() const
-                        { return pChartListenerCollection; }
+    SC_DLLPUBLIC ScChartListenerCollection* GetChartListenerCollection() const;
     void            SetChartListenerCollection( ScChartListenerCollection*,
                         bool bSetChartRangeLists = false );
     void            UpdateChart( const rtl::OUString& rName );
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 991eb6b..822d8a5 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -357,6 +357,11 @@ void ScDocument::StopTemporaryChartLock()
         apTemporaryChartLock->StopLocking();
 }
 
+ScChartListenerCollection* ScDocument::GetChartListenerCollection() const
+{
+    return pChartListenerCollection;
+}
+
 void ScDocument::SetChartListenerCollection(
             ScChartListenerCollection* pNewChartListenerCollection,
             bool bSetChartRangeLists )
commit 2a7c07e2e5fbdce057aaecb87231c62d98981bcb
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Feb 1 10:38:57 2012 -0500

    InsertData to AppendData, to hide the insert position.
    
    Only a few places in sc specified insert position, and those were
    not strictly necessary.

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 6493513..e781e60 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1836,7 +1836,7 @@ ScDrawObjData* ScDrawLayer::GetObjData( SdrObject* pObj, sal_Bool bCreate )
     if( pObj && bCreate )
     {
         ScDrawObjData* pData = new ScDrawObjData;
-        pObj->InsertUserData( pData, 0 );
+        pObj->AppendUserData(pData);
         return pData;
     }
     return 0;
@@ -1945,7 +1945,7 @@ ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, sal_Bool bCreate )
     if ( bCreate )
     {
         ScMacroInfo* pData = new ScMacroInfo;
-        pObj->InsertUserData( pData, 0 );
+        pObj->AppendUserData(pData);
         return pData;
     }
     return 0;
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index f794994..efbce66 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -470,7 +470,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(
             else
             {
                 // insert new user data with image map
-                pObj->InsertUserData(new ScIMapInfo(aImageMap) );
+                pObj->AppendUserData(new ScIMapInfo(aImageMap) );
             }
         }
     }
diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx
index c4c1133..931ec01 100644
--- a/sc/source/ui/view/tabvwsh9.cxx
+++ b/sc/source/ui/view/tabvwsh9.cxx
@@ -207,7 +207,7 @@ void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
                     ScIMapInfo*     pIMapInfo = ScDrawLayer::GetIMapInfo( pSdrObj );
 
                     if ( !pIMapInfo )
-                        pSdrObj->InsertUserData( new ScIMapInfo( rImageMap ) );
+                        pSdrObj->AppendUserData( new ScIMapInfo( rImageMap ) );
                     else
                         pIMapInfo->SetImageMap( rImageMap );
 
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 59a73d0..be9f2d1 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1059,7 +1059,7 @@ SdAnimationInfo* SdDrawDocument::GetShapeUserData(SdrObject& rObject, bool bCrea
     if( (pRet == 0) && bCreate )
     {
         pRet = new SdAnimationInfo( rObject );
-        rObject.InsertUserData( pRet);
+        rObject.AppendUserData( pRet);
     }
 
     return pRet;
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 9431aa8..82380b6 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -676,7 +676,7 @@ void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName,
                         else
                         {
                             // insert new user data with image map
-                            pObj->InsertUserData(new SdIMapInfo(aImageMap) );
+                            pObj->AppendUserData(new SdIMapInfo(aImageMap) );
                         }
                     }
                 }
diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx
index 9a9ad2a..d937745 100644
--- a/sd/source/ui/view/drviewsg.cxx
+++ b/sd/source/ui/view/drviewsg.cxx
@@ -76,7 +76,7 @@ void DrawViewShell::ExecIMap( SfxRequest& rReq )
                 SdIMapInfo*     pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
 
                 if ( !pIMapInfo )
-                    pSdrObj->InsertUserData( new SdIMapInfo( rImageMap ) );
+                    pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
                 else
                     pIMapInfo->SetImageMap( rImageMap );
 
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 78e3a3b..70f2a7a 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -967,7 +967,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     InsertObjectAtView( pObj, *pPV, nOptions );
 
                     if( pImageMap )
-                        pObj->InsertUserData( new SdIMapInfo( *pImageMap ) );
+                        pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
 
                     if ( pObj && pObj->IsChart() )
                     {
@@ -1137,7 +1137,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     InsertObjectAtView( pObj, *pPV, nOptions );
 
                     if( pImageMap )
-                        pObj->InsertUserData( new SdIMapInfo( *pImageMap ) );
+                        pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
 
                     // let the object stay in loaded state after insertion
                     pObj->Unload();
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index afc2eb9..d953f73 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -150,7 +150,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
             }
 
             if (pImageMap)
-                pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
+                pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
 
             ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
 
@@ -229,7 +229,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
         {
             // replace object
             if (pImageMap)
-                pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
+                pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
 
             Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
             Size aPickObjSize(aPickObjRect.GetSize());
@@ -272,7 +272,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
             InsertObjectAtView(pNewGrafObj, *pPV, nOptions);
 
             if( pImageMap )
-                pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
+                pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
         }
     }
 
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index 0349444..ed8d8c7 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -996,9 +996,7 @@ public:
     sal_uInt16 GetUserDataCount() const;
     SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
 
-    // Insert uebernimmt den auf dem Heap angelegten Record in den Besitz
-    // des Zeichenobjekts
-    void InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos=0xFFFF);
+    void AppendUserData(SdrObjUserData* pData);
 
     // Delete entfernt den Record aus der Liste und ruft
     // ein delete (FreeMem+Dtor).
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 7fbf771..262e554 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -280,7 +280,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
 
         pSdrObj->SetMergedItemSetAndBroadcast(aSet);
 
-        pSdrObj->InsertUserData( new IMapUserData( pCloneIMapObj ) );
+        pSdrObj->AppendUserData( new IMapUserData( pCloneIMapObj ) );
         pSdrObj->SetUserCall( GetSdrUserCall() );
     }
 
@@ -309,7 +309,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj )
             IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(),
                 String(), String(), String(), String(), String(), sal_True, sal_False );
 
-            pRectObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+            pRectObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
         }
         break;
 
@@ -322,7 +322,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj )
 
             IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(),  sal_True, sal_False );
             pObj->SetExtraEllipse( aPoly.GetBoundRect() );
-            pCircObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+            pCircObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
         }
         break;
 
@@ -338,7 +338,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj )
             {
                 Polygon aPoly(rXPolyPoly.getB2DPolygon(0L));
                 IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(),  sal_True, sal_False );
-                pPathObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+                pPathObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
             }
         }
         break;
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index c64fbb6..de4de73 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -1310,7 +1310,7 @@ sal_Bool GalleryTheme::InsertTransferable( const uno::Reference< datatransfer::X
                         SdrPage*    pPage = aModel.GetModel()->GetPage(0);
                         SdrGrafObj* pGrafObj = new SdrGrafObj( *pGraphic );
 
-                        pGrafObj->InsertUserData( new SgaIMapInfo( aImageMap ) );
+                        pGrafObj->AppendUserData( new SgaIMapInfo( aImageMap ) );
                         pPage->InsertObject( pGrafObj );
                         bRet = InsertModel( *aModel.GetModel(), nInsertPos );
                     }
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 5ce27e6..2ac68a2 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2842,23 +2842,19 @@ SdrObjUserData* SdrObject::GetUserData(sal_uInt16 nNum) const
     return pPlusData->pUserDataList->GetUserData(nNum);
 }
 
-void SdrObject::InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos)
+void SdrObject::AppendUserData(SdrObjUserData* pData)
 {
-    if (pData!=NULL)
+    if (!pData)
     {
-        ImpForcePlusData();
-        if (!pPlusData->pUserDataList)
-            pPlusData->pUserDataList = new SdrObjUserDataList;
-
-        if (nPos == 0xFFFF)
-            pPlusData->pUserDataList->AppendUserData(pData);
-        else
-            pPlusData->pUserDataList->InsertUserData(pData, nPos);
-    }
-    else
-    {
-        OSL_FAIL("SdrObject::InsertUserData(): pData is NULL pointer.");
+        OSL_FAIL("SdrObject::AppendUserData(): pData is NULL pointer.");
+        return;
     }
+
+    ImpForcePlusData();
+    if (!pPlusData->pUserDataList)
+        pPlusData->pUserDataList = new SdrObjUserDataList;
+
+    pPlusData->pUserDataList->AppendUserData(pData);
 }
 
 void SdrObject::DeleteUserData(sal_uInt16 nNum)
diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx
index 58abf90..e8c8344 100644
--- a/svx/source/svdraw/svdotxln.cxx
+++ b/svx/source/svdraw/svdotxln.cxx
@@ -151,7 +151,7 @@ void SdrTextObj::SetTextLink(const String& rFileName, const String& rFilterName,
     pData->aFileName=rFileName;
     pData->aFilterName=rFilterName;
     pData->eCharSet=eCharSet;
-    InsertUserData(pData);
+    AppendUserData(pData);
     ImpLinkAnmeldung();
 }
 


More information about the Libreoffice-commits mailing list