[Libreoffice-commits] .: 4 commits - sc/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Jan 31 03:48:45 PST 2011


 sc/source/core/data/funcdesc.cxx |    1 
 sc/source/core/inc/addinlis.hxx  |   71 +++++++++++++++++-----------------
 sc/source/core/tool/addinlis.cxx |   80 +++++++++++++++------------------------
 3 files changed, 67 insertions(+), 85 deletions(-)

New commits:
commit 1296b0c57a7e831c8c64cc6db5edf432db3d1d5a
Author: Thies Pierdola <thiespierdola at gmail.com>
Date:   Fri Jan 28 22:53:30 2011 +0100

    Removed include of tools/string as no longer used

diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index 68dc04b..9d48db7 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -41,7 +41,6 @@
 #include <rtl/ustrbuf.hxx>
 #include <tools/rcid.h>
 #include <tools/resid.hxx>
-#include <tools/string.hxx>
 #include <unotools/collatorwrapper.hxx>
 
 #include <numeric>
commit 54a1e91f9097e14fe6fc94b4dff0941a8c59f80e
Author: Thies Pierdola <thiespierdola at gmail.com>
Date:   Sat Jan 29 17:34:52 2011 +0100

    Replaced use of tools/list by std::list

diff --git a/sc/source/core/inc/addinlis.hxx b/sc/source/core/inc/addinlis.hxx
index ace8d49..753998a 100644
--- a/sc/source/core/inc/addinlis.hxx
+++ b/sc/source/core/inc/addinlis.hxx
@@ -30,7 +30,6 @@
 #define SC_ADDINLIS_HXX
 
 #include "adiasync.hxx" // for ScAddInDocs PtrArr
-#include <tools/list.hxx>
 #include <com/sun/star/sheet/XResultListener.hpp>
 #include <com/sun/star/sheet/XVolatileResult.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -48,7 +47,7 @@ private:
     com::sun::star::uno::Any aResult;
     ScAddInDocs* pDocs; // documents where this is used
 
-    static List aAllListeners;
+    static ::std::list<ScAddInListener*> aAllListeners;
 
     // always allocated via CreateListener
     ScAddInListener( com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index d8c7823..69a8f52 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -29,7 +29,6 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
-#include <tools/debug.hxx>
 #include <sfx2/objsh.hxx>
 #include <vcl/svapp.hxx>
 
@@ -43,7 +42,7 @@ using namespace com::sun::star;
 
 SC_SIMPLE_SERVICE_INFO( ScAddInListener, "ScAddInListener", "stardiv.one.sheet.AddInListener" )
 
-List ScAddInListener::aAllListeners;
+::std::list<ScAddInListener*> ScAddInListener::aAllListeners;
 
 ScAddInListener* ScAddInListener::CreateListener(
                         uno::Reference<sheet::XVolatileResult> xVR, ScDocument* pDoc )
@@ -51,7 +50,7 @@ ScAddInListener* ScAddInListener::CreateListener(
     ScAddInListener* pNew = new ScAddInListener( xVR, pDoc );
 
     pNew->acquire(); // for aAllListeners
-    aAllListeners.Insert( pNew, LIST_APPEND );
+    aAllListeners.push_back( pNew );
 
     if ( xVR.is() )
         xVR->addResultListener( pNew ); // after at least 1 ref exists!
@@ -73,45 +72,46 @@ ScAddInListener::~ScAddInListener()
 
 ScAddInListener* ScAddInListener::Get( uno::Reference<sheet::XVolatileResult> xVR )
 {
+    ScAddInListener* pLst = NULL;
     sheet::XVolatileResult* pComp = xVR.get();
 
-    sal_uInt32 nCount = aAllListeners.Count();
-    for (sal_uInt32 nPos=0; nPos<nCount; nPos++)
+    for(::std::list<ScAddInListener*>::iterator iter = aAllListeners.begin(); iter != aAllListeners.end(); ++iter)
     {
-        ScAddInListener* pLst = (ScAddInListener*)aAllListeners.GetObject(nPos);
-        if ( pComp == (sheet::XVolatileResult*)pLst->xVolRes.get() )
-            return pLst;
+        if ( pComp == (sheet::XVolatileResult*)(*iter)->xVolRes.get() )
+        {
+            pLst = *iter;
+            break;
+        }
     }
-    return NULL; // not found
+    return pLst;
 }
 
 //! move to some container object?
 void ScAddInListener::RemoveDocument( ScDocument* pDocumentP )
 {
-    sal_uInt32 nPos = aAllListeners.Count();
-    while (nPos)
+    ::std::list<ScAddInListener*>::iterator iter = aAllListeners.begin();
+    while(iter != aAllListeners.end())
     {
-        // loop backwards because elements are removed
-        --nPos;
-        ScAddInListener* pLst = (ScAddInListener*)aAllListeners.GetObject(nPos);
-        ScAddInDocs* p = pLst->pDocs;
+        ScAddInDocs* p = (*iter)->pDocs;
         sal_uInt16 nFoundPos;
         if ( p->Seek_Entry( pDocumentP, &nFoundPos ) )
         {
             p->Remove( nFoundPos );
             if ( p->Count() == 0 )
             {
-                // this AddIn is no longer used
-                // dont delete, just remove the ref for the list
+                if ( (*iter)->xVolRes.is() )
+                    (*iter)->xVolRes->removeResultListener( *iter );
 
-                aAllListeners.Remove( nPos );
+                (*iter)->release(); // Ref for aAllListeners - pLst may be deleted here
 
-                if ( pLst->xVolRes.is() )
-                    pLst->xVolRes->removeResultListener( pLst );
+                // this AddIn is no longer used
+                // dont delete, just remove the ref for the list
 
-                pLst->release(); // Ref for aAllListeners - pLst may be deleted here
+                iter = aAllListeners.erase( iter );
+                continue;
             }
         }
+        ++iter;
     }
 }
 
commit fb5d156ad8faffc5968ef5093e2c76f4218973c4
Author: Thies Pierdola <thiespierdola at gmail.com>
Date:   Sat Jan 29 16:17:15 2011 +0100

    Cleaned up spacings

diff --git a/sc/source/core/inc/addinlis.hxx b/sc/source/core/inc/addinlis.hxx
index 9c8b471..ace8d49 100644
--- a/sc/source/core/inc/addinlis.hxx
+++ b/sc/source/core/inc/addinlis.hxx
@@ -29,18 +29,15 @@
 #ifndef SC_ADDINLIS_HXX
 #define SC_ADDINLIS_HXX
 
-#include "adiasync.hxx"			// for ScAddInDocs PtrArr
+#include "adiasync.hxx" // for ScAddInDocs PtrArr
 #include <tools/list.hxx>
 #include <com/sun/star/sheet/XResultListener.hpp>
 #include <com/sun/star/sheet/XVolatileResult.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <cppuhelper/implbase2.hxx>
 
-
-
 class ScDocument;
 
-
 class ScAddInListener : public cppu::WeakImplHelper2<
                             com::sun::star::sheet::XResultListener,
                             com::sun::star::lang::XServiceInfo >,
@@ -48,53 +45,56 @@ class ScAddInListener : public cppu::WeakImplHelper2<
 {
 private:
     com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVolRes;
-    com::sun::star::uno::Any	aResult;
-    ScAddInDocs*				pDocs;			// documents where this is used
+    com::sun::star::uno::Any aResult;
+    ScAddInDocs* pDocs; // documents where this is used
 
-    static List					aAllListeners;
+    static List aAllListeners;
 
-                            // always allocated via CreateListener
-                            ScAddInListener(
-                                com::sun::star::uno::Reference<
-                                    com::sun::star::sheet::XVolatileResult> xVR,
-                                ScDocument* pD );
+    // always allocated via CreateListener
+    ScAddInListener( com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
+                    ScDocument* pD );
 
 public:
-    virtual					~ScAddInListener();
+    virtual ~ScAddInListener();
 
-                            // create Listener and put it into global list
-    static ScAddInListener*	CreateListener(
-                                com::sun::star::uno::Reference<
-                                    com::sun::star::sheet::XVolatileResult> xVR,
+    // create Listener and put it into global list
+    static ScAddInListener* CreateListener(
+                                com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVR,
                                 ScDocument* pDoc );
 
-    static ScAddInListener*	Get( com::sun::star::uno::Reference<
+    static ScAddInListener*Get( com::sun::star::uno::Reference<
                                     com::sun::star::sheet::XVolatileResult> xVR );
-    static void				RemoveDocument( ScDocument* pDocument );
 
-    bool					HasDocument( ScDocument* pDoc ) const	{ return pDocs->Seek_Entry( pDoc ); }
-    void					AddDocument( ScDocument* pDoc )			{ pDocs->Insert( pDoc ); }
-    const com::sun::star::uno::Any& GetResult() const				{ return aResult; }
+    static void RemoveDocument( ScDocument* pDocument );
 
+    bool HasDocument( ScDocument* pDoc ) const
+         { return pDocs->Seek_Entry( pDoc ); }
 
-                            // XResultListener
-    virtual void SAL_CALL	modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
-                                throw(::com::sun::star::uno::RuntimeException);
+    void AddDocument( ScDocument* pDoc )
+         { pDocs->Insert( pDoc ); }
 
-                            // XEventListener
-    virtual void SAL_CALL	disposing( const ::com::sun::star::lang::EventObject& Source )
-                                throw(::com::sun::star::uno::RuntimeException);
+    const com::sun::star::uno::Any& GetResult() const
+          { return aResult; }
+
+    // XResultListener
+    virtual void SAL_CALL modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
+                              throw(::com::sun::star::uno::RuntimeException);
+
+    // XEventListener
+    virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+                              throw(::com::sun::star::uno::RuntimeException);
+
+    // XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName()
+                                         throw(::com::sun::star::uno::RuntimeException);
 
-                            // XServiceInfo
-    virtual ::rtl::OUString SAL_CALL getImplementationName(  )
-                                throw(::com::sun::star::uno::RuntimeException);
     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
-                                throw(::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
+                                  throw(::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
                                 throw(::com::sun::star::uno::RuntimeException);
 };
 
-
-#endif
+#endif // SC_ADDINLIS_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index 81fdd80..d8c7823 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -29,41 +29,32 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sc.hxx"
 
-
-
 #include <tools/debug.hxx>
 #include <sfx2/objsh.hxx>
 #include <vcl/svapp.hxx>
 
-
 #include "addinlis.hxx"
-#include "miscuno.hxx"		// SC_IMPL_SERVICE_INFO
+#include "miscuno.hxx" // SC_IMPL_SERVICE_INFO
 #include "document.hxx"
 #include "brdcst.hxx"
 #include "sc.hrc"
 
 using namespace com::sun::star;
 
-//------------------------------------------------------------------------
-
 SC_SIMPLE_SERVICE_INFO( ScAddInListener, "ScAddInListener", "stardiv.one.sheet.AddInListener" )
 
-//------------------------------------------------------------------------
-
 List ScAddInListener::aAllListeners;
 
-//------------------------------------------------------------------------
-
 ScAddInListener* ScAddInListener::CreateListener(
                         uno::Reference<sheet::XVolatileResult> xVR, ScDocument* pDoc )
 {
     ScAddInListener* pNew = new ScAddInListener( xVR, pDoc );
 
-    pNew->acquire();								// for aAllListeners
+    pNew->acquire(); // for aAllListeners
     aAllListeners.Insert( pNew, LIST_APPEND );
 
-    if ( xVR.is() )	
-        xVR->addResultListener( pNew );				// after at least 1 ref exists!
+    if ( xVR.is() )
+        xVR->addResultListener( pNew ); // after at least 1 ref exists!
 
     return pNew;
 }
@@ -91,16 +82,16 @@ ScAddInListener* ScAddInListener::Get( uno::Reference<sheet::XVolatileResult> xV
         if ( pComp == (sheet::XVolatileResult*)pLst->xVolRes.get() )
             return pLst;
     }
-    return NULL;		// not found
+    return NULL; // not found
 }
 
-//!	move to some container object?
+//! move to some container object?
 void ScAddInListener::RemoveDocument( ScDocument* pDocumentP )
 {
     sal_uInt32 nPos = aAllListeners.Count();
     while (nPos)
     {
-        //	loop backwards because elements are removed
+        // loop backwards because elements are removed
         --nPos;
         ScAddInListener* pLst = (ScAddInListener*)aAllListeners.GetObject(nPos);
         ScAddInDocs* p = pLst->pDocs;
@@ -111,31 +102,29 @@ void ScAddInListener::RemoveDocument( ScDocument* pDocumentP )
             if ( p->Count() == 0 )
             {
                 // this AddIn is no longer used
-                //	dont delete, just remove the ref for the list
+                // dont delete, just remove the ref for the list
 
                 aAllListeners.Remove( nPos );
 
-                if ( pLst->xVolRes.is() )	
+                if ( pLst->xVolRes.is() )
                     pLst->xVolRes->removeResultListener( pLst );
 
-                pLst->release();	// Ref for aAllListeners - pLst may be deleted here
+                pLst->release(); // Ref for aAllListeners - pLst may be deleted here
             }
         }
     }
 }
 
-//------------------------------------------------------------------------
-
 // XResultListener
 
 void SAL_CALL ScAddInListener::modified( const ::com::sun::star::sheet::ResultEvent& aEvent )
                                 throw(::com::sun::star::uno::RuntimeException)
 {
-    SolarMutexGuard aGuard;			//! or generate a UserEvent
+    SolarMutexGuard aGuard; //! or generate a UserEvent
 
-    aResult = aEvent.Value;		// store result
+    aResult = aEvent.Value; // store result
 
-    //	notify document of changes
+    // notify document of changes
 
     Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress(), NULL ) );
 
@@ -165,9 +154,4 @@ void SAL_CALL ScAddInListener::disposing( const ::com::sun::star::lang::EventObj
     }
 }
 
-
-//------------------------------------------------------------------------
-
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 2f64ef03f54fac096d2f1f46629f5453f55b539f
Author: Thies Pierdola <thiespierdola at gmail.com>
Date:   Sat Jan 29 17:39:34 2011 +0100

    Replaced deprecated types with sal types

diff --git a/sc/source/core/inc/addinlis.hxx b/sc/source/core/inc/addinlis.hxx
index d3cb130..9c8b471 100644
--- a/sc/source/core/inc/addinlis.hxx
+++ b/sc/source/core/inc/addinlis.hxx
@@ -72,7 +72,7 @@ public:
                                     com::sun::star::sheet::XVolatileResult> xVR );
     static void				RemoveDocument( ScDocument* pDocument );
 
-    BOOL					HasDocument( ScDocument* pDoc ) const	{ return pDocs->Seek_Entry( pDoc ); }
+    bool					HasDocument( ScDocument* pDoc ) const	{ return pDocs->Seek_Entry( pDoc ); }
     void					AddDocument( ScDocument* pDoc )			{ pDocs->Insert( pDoc ); }
     const com::sun::star::uno::Any& GetResult() const				{ return aResult; }
 
diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index 71b3d72..81fdd80 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -84,8 +84,8 @@ ScAddInListener* ScAddInListener::Get( uno::Reference<sheet::XVolatileResult> xV
 {
     sheet::XVolatileResult* pComp = xVR.get();
 
-    ULONG nCount = aAllListeners.Count();
-    for (ULONG nPos=0; nPos<nCount; nPos++)
+    sal_uInt32 nCount = aAllListeners.Count();
+    for (sal_uInt32 nPos=0; nPos<nCount; nPos++)
     {
         ScAddInListener* pLst = (ScAddInListener*)aAllListeners.GetObject(nPos);
         if ( pComp == (sheet::XVolatileResult*)pLst->xVolRes.get() )
@@ -97,14 +97,14 @@ ScAddInListener* ScAddInListener::Get( uno::Reference<sheet::XVolatileResult> xV
 //!	move to some container object?
 void ScAddInListener::RemoveDocument( ScDocument* pDocumentP )
 {
-    ULONG nPos = aAllListeners.Count();
+    sal_uInt32 nPos = aAllListeners.Count();
     while (nPos)
     {
         //	loop backwards because elements are removed
         --nPos;
         ScAddInListener* pLst = (ScAddInListener*)aAllListeners.GetObject(nPos);
         ScAddInDocs* p = pLst->pDocs;
-        USHORT nFoundPos;
+        sal_uInt16 nFoundPos;
         if ( p->Seek_Entry( pDocumentP, &nFoundPos ) )
         {
             p->Remove( nFoundPos );
@@ -140,8 +140,8 @@ void SAL_CALL ScAddInListener::modified( const ::com::sun::star::sheet::ResultEv
     Broadcast( ScHint( SC_HINT_DATACHANGED, ScAddress(), NULL ) );
 
     const ScDocument** ppDoc = (const ScDocument**) pDocs->GetData();
-    USHORT nCount = pDocs->Count();
-    for ( USHORT j=0; j<nCount; j++, ppDoc++ )
+    sal_uInt16 nCount = pDocs->Count();
+    for ( sal_uInt16 j=0; j<nCount; j++, ppDoc++ )
     {
         ScDocument* pDoc = (ScDocument*)*ppDoc;
         pDoc->TrackFormulas();


More information about the Libreoffice-commits mailing list