[Libreoffice-commits] .: 2 commits - basic/inc basic/source sfx2/source

Tor Lillqvist tml at kemper.freedesktop.org
Mon Mar 5 02:57:23 PST 2012


 basic/inc/basic/sbxbase.hxx    |    3 ++-
 basic/source/sbx/sbxbase.cxx   |   25 +++++++++++--------------
 basic/source/sbx/sbxscan.cxx   |    1 +
 sfx2/source/appl/appbaslib.cxx |    4 +++-
 sfx2/source/appl/appdde.cxx    |    4 +++-
 5 files changed, 20 insertions(+), 17 deletions(-)

New commits:
commit 8d4fe3ed1fcd826200e2611e7743b755eff923a6
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Feb 27 16:26:41 2012 +0200

    Convert SbxFactory from SV_DECL_PTRARR_DEL to boost::ptr_vector

diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx
index 55341fa..e760c4f 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -33,12 +33,13 @@
 #include "svl/svarray.hxx"
 #include <basic/sbxdef.hxx>
 #include "basicdllapi.h"
+#include <boost/ptr_container/ptr_vector.hpp>
 
 class SbxFactory;
 class SbxVariable;
 class SbxBasicFormater;
 
-SV_DECL_PTRARR_DEL(SbxFacs,SbxFactory*,5)
+typedef boost::ptr_vector<SbxFactory> SbxFacs;
 
 // AppData structure for SBX:
 struct SbxAppData
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index e2987d0..048ea3c 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -36,11 +36,10 @@
 #include <rtl/instance.hxx>
 #include <rtl/oustringostreaminserter.hxx>
 #include <sal/log.hxx>
+#include <boost/foreach.hpp>
 
 // AppData-Structure for SBX:
 
-SV_IMPL_PTRARR(SbxFacs,SbxFactory*);
-
 TYPEINIT0(SbxBase)
 
 namespace
@@ -147,28 +146,27 @@ void SbxBase::ResetError()
 void SbxBase::AddFactory( SbxFactory* pFac )
 {
     SbxAppData& r = GetSbxData_Impl();
-    const SbxFactory* pTemp = pFac;
 
     // From 1996-03-06: take the HandleLast-Flag into account
-    sal_uInt16 nPos = r.aFacs.Count(); // Insert position
+    sal_uInt16 nPos = r.aFacs.size(); // Insert position
     if( !pFac->IsHandleLast() )         // Only if not self HandleLast
     {
         // Rank new factory in front of factories with HandleLast
         while( nPos > 0 &&
-                (static_cast<SbxFactory*>(r.aFacs.GetObject( nPos-1 )))->IsHandleLast() )
+                r.aFacs[ nPos-1 ].IsHandleLast() )
             nPos--;
     }
-    r.aFacs.Insert( pTemp, nPos );
+    r.aFacs.insert( r.aFacs.begin() + nPos, pFac );
 }
 
 void SbxBase::RemoveFactory( SbxFactory* pFac )
 {
     SbxAppData& r = GetSbxData_Impl();
-    for( sal_uInt16 i = 0; i < r.aFacs.Count(); i++ )
+    for(SbxFacs::iterator it = r.aFacs.begin(); it != r.aFacs.end(); ++it)
     {
-        if( r.aFacs.GetObject( i ) == pFac )
+        if( &(*it) == pFac )
         {
-            r.aFacs.Remove( i, 1 ); break;
+            r.aFacs.release( it ).release(); break;
         }
     }
 }
@@ -200,10 +198,9 @@ SbxBase* SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
     // Unknown type: go over the factories!
     SbxAppData& r = GetSbxData_Impl();
     SbxBase* pNew = NULL;
-    for( sal_uInt16 i = 0; i < r.aFacs.Count(); i++ )
+    BOOST_FOREACH(SbxFactory& rFac, r.aFacs)
     {
-        SbxFactory* pFac = r.aFacs.GetObject( i );
-        pNew = pFac->Create( nSbxId, nCreator );
+        pNew = rFac.Create( nSbxId, nCreator );
         if( pNew )
             break;
     }
@@ -215,9 +212,9 @@ SbxObject* SbxBase::CreateObject( const rtl::OUString& rClass )
 {
     SbxAppData& r = GetSbxData_Impl();
     SbxObject* pNew = NULL;
-    for( sal_uInt16 i = 0; i < r.aFacs.Count(); i++ )
+    BOOST_FOREACH(SbxFactory& rFac, r.aFacs)
     {
-        pNew = r.aFacs.GetObject( i )->CreateObject( rClass );
+        pNew = rFac.CreateObject( rClass );
         if( pNew )
             break;
     }
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 18bb46d..a253377 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -43,6 +43,7 @@
 
 #include "sbxres.hxx"
 #include <basic/sbxbase.hxx>
+#include <basic/sbxfac.hxx>
 #include <basic/sbxform.hxx>
 #include <svtools/svtools.hrc>
 
commit 695f0be4d184f4845cb2fedb1d64bb0597f52be4
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Mar 5 12:20:37 2012 +0200

    WaE: unused parameters in the DISABLE_SCRIPTING case

diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx
index a8fb71e..fcb3728 100644
--- a/sfx2/source/appl/appbaslib.cxx
+++ b/sfx2/source/appl/appbaslib.cxx
@@ -55,7 +55,9 @@ void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager )
 {
     impl_releaseContainers();
 
-#ifndef DISABLE_SCRIPTING
+#ifdef DISABLE_SCRIPTING
+    (void) _pBasicManager;
+#else
     // Note: we do not delete the old BasicManager. BasicManager instances are
     // nowadays obtained from the BasicManagerRepository, and the ownership is with
     // the repository.
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index d46a016..5f2420a 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -350,7 +350,9 @@ long SfxObjectShell::DdeExecute
 */
 
 {
-#ifndef DISABLE_SCRIPTING
+#ifdef DISABLE_SCRIPTING
+    (void) rCmd;
+#else
     StarBASIC* pBasic = GetBasic();
     DBG_ASSERT( pBasic, "Where is the Basic???" ) ;
     SbxVariable* pRet = pBasic->Execute( rCmd );


More information about the Libreoffice-commits mailing list