[Libreoffice-commits] .: 5 commits - comphelper/inc sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Feb 6 14:05:14 PST 2012


 comphelper/inc/comphelper/string.hxx |    4 
 sc/inc/callform.hxx                  |   24 ++--
 sc/source/core/data/globalx.cxx      |  108 ++++++++++------------
 sc/source/core/tool/callform.cxx     |  171 +++++++++++++++++------------------
 4 files changed, 151 insertions(+), 156 deletions(-)

New commits:
commit eb13dcf4bf1faa47c3edd5679c80c25afde50f5d
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Feb 6 17:04:51 2012 -0500

    We don't need this macro; we can safely pass const char* as-is.

diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index 10fefe7..fb8b8fe 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -88,11 +88,6 @@ typedef void (CALLTYPE* FARPROC) ( void );
 #define ADVICE                  "Advice"
 #define UNADVICE                "Unadvice"
 
-#define LIBFUNCNAME( name ) \
-    (String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( name ) ))
-
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
 FuncData::FuncData(const rtl::OUString& rIName) :
     pModuleData     (NULL),
     aInternalName   (rIName),
@@ -234,13 +229,13 @@ bool InitExternalFunc(const rtl::OUString& rModuleName)
     osl::Module* pLib = new osl::Module( aNP );
     if (pLib->is())
     {
-        FARPROC fpGetCount = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(GETFUNCTIONCOUNT));
-        FARPROC fpGetData = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(GETFUNCTIONDATA));
+        FARPROC fpGetCount = (FARPROC)pLib->getFunctionSymbol(GETFUNCTIONCOUNT);
+        FARPROC fpGetData = (FARPROC)pLib->getFunctionSymbol(GETFUNCTIONDATA);
         if ((fpGetCount != NULL) && (fpGetData != NULL))
         {
-            FARPROC fpIsAsync = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(ISASYNC));
-            FARPROC fpAdvice = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(ADVICE));
-            FARPROC fpSetLanguage = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(SETLANGUAGE));
+            FARPROC fpIsAsync = (FARPROC)pLib->getFunctionSymbol(ISASYNC);
+            FARPROC fpAdvice = (FARPROC)pLib->getFunctionSymbol(ADVICE);
+            FARPROC fpSetLanguage = (FARPROC)pLib->getFunctionSymbol(SETLANGUAGE);
             if ( fpSetLanguage )
             {
                 LanguageType eLanguage = Application::GetSettings().GetUILanguage();
@@ -410,7 +405,7 @@ bool FuncData::Unadvice( double nHandle )
 {
     bool bRet = false;
     osl::Module* pLib = pModuleData->GetInstance();
-    FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(UNADVICE));
+    FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(UNADVICE);
     if (fProc != NULL)
     {
         ((::Unadvice)fProc)(nHandle);
@@ -432,7 +427,7 @@ bool FuncData::getParamDesc( ::rtl::OUString& aName, ::rtl::OUString& aDesc, sal
     if ( nParam <= nParamCount )
     {
         osl::Module* pLib = pModuleData->GetInstance();
-        FARPROC fProc = (FARPROC) pLib->getFunctionSymbol( LIBFUNCNAME(GETPARAMDESC) );
+        FARPROC fProc = (FARPROC) pLib->getFunctionSymbol(GETPARAMDESC);
         if ( fProc != NULL )
         {
             sal_Char pcName[256];
commit d0d9c819b9ce20e7b9a666449c3b5c7007ff7ac0
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Feb 6 17:02:21 2012 -0500

    ModuleCollection no longer a child of ScSortedCollection.

diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index 5fa4d87..10fefe7 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -39,6 +39,8 @@
 #include "global.hxx"
 #include "adiasync.hxx"
 
+#include <boost/ptr_container/ptr_map.hpp>
+
 //------------------------------------------------------------------------
 
 extern "C" {
@@ -154,74 +156,81 @@ bool FuncCollection::SearchFunc( const rtl::OUString& rName, sal_uInt16& rIndex
 }
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-class ModuleData : public ScDataObject
+class ModuleData
 {
 friend class ModuleCollection;
     rtl::OUString aName;
     osl::Module* pInstance;
 public:
-    ModuleData(const String& rStr, osl::Module* pInst) : aName (rStr), pInstance (pInst) {}
-    ModuleData(const ModuleData& rData) : ScDataObject(), aName (rData.aName) {pInstance = new osl::Module(aName);}
+    ModuleData(const rtl::OUString& rStr, osl::Module* pInst) : aName(rStr), pInstance(pInst) {}
+    ModuleData(const ModuleData& rData) : aName(rData.aName) {pInstance = new osl::Module(aName);}
     ~ModuleData() { delete pInstance; }
-    virtual ScDataObject*   Clone() const { return new ModuleData(*this); }
 
     const rtl::OUString& GetName() const { return aName; }
     osl::Module*    GetInstance() const { return pInstance; }
     void            FreeInstance() { delete pInstance; pInstance = 0; }
+
+    struct less : public ::std::binary_function<ModuleData, ModuleData, bool>
+    {
+        bool operator() (const ModuleData& left, const ModuleData& right) const
+        {
+            return ScGlobal::GetpTransliteration()->compareString(left.GetName(), right.GetName()) < 0;
+        }
+    };
 };
 
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-class ModuleCollection : public ScSortedCollection
+namespace {
+
+class ModuleCollection
 {
+    typedef boost::ptr_map<rtl::OUString, ModuleData> MapType;
+    MapType maData;
 public:
-    ModuleCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false) : ScSortedCollection ( nLim, nDel, bDup ) {}
-    ModuleCollection(const ModuleCollection& rModuleCollection) : ScSortedCollection ( rModuleCollection ) {}
-
-    virtual ScDataObject*       Clone() const { return new ModuleCollection(*this); }
-            ModuleData*     operator[]( const sal_uInt16 nIndex) const {return (ModuleData*)At(nIndex);}
-    virtual short           Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
-    bool SearchModule(
-        const rtl::OUString& rName, const ModuleData*& rpModule ) const;
+    ModuleCollection() {}
+    ModuleCollection(const ModuleCollection& r) : maData(r.maData) {}
+
+    const ModuleData* findByName(const rtl::OUString& rName) const;
+    void insert(ModuleData* pNew);
+    void clear();
 };
 
-static ModuleCollection aModuleCollection;
+ModuleCollection aModuleCollection;
 
-//------------------------------------------------------------------------
+}
 
-short ModuleCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
+const ModuleData* ModuleCollection::findByName(const rtl::OUString& rName) const
 {
-    return (short) ScGlobal::GetpTransliteration()->compareString(
-        ((ModuleData*)pKey1)->aName, ((ModuleData*)pKey2)->aName );
+    MapType::const_iterator it = maData.find(rName);
+    return it == maData.end() ? NULL : it->second;
 }
 
-//------------------------------------------------------------------------
+void ModuleCollection::insert(ModuleData* pNew)
+{
+    if (!pNew)
+        return;
+
+    rtl::OUString aName = pNew->GetName();
+    maData.insert(aName, pNew);
+}
 
-bool ModuleCollection::SearchModule(
-    const rtl::OUString& rName, const ModuleData*& rpModule ) const
+void ModuleCollection::clear()
 {
-    sal_uInt16 nIndex;
-    ModuleData aSearchModule(rName, 0);
-    sal_Bool bFound = Search( &aSearchModule, nIndex );
-    if (bFound)
-        rpModule = (ModuleData*)At(nIndex);
-    else
-        rpModule = 0;
-    return bFound;
+    maData.clear();
 }
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 bool InitExternalFunc(const rtl::OUString& rModuleName)
 {
-    // Module schon geladen?
-    const ModuleData* pTemp;
-    if (aModuleCollection.SearchModule(rModuleName, pTemp))
+    // Module already loaded?
+    const ModuleData* pTemp = aModuleCollection.findByName(rModuleName);
+    if (pTemp)
         return false;
 
     rtl::OUString aNP;
     aNP = rModuleName;
 
-    sal_Bool bRet = false;
+    bool bRet = false;
     osl::Module* pLib = new osl::Module( aNP );
     if (pLib->is())
     {
@@ -241,7 +250,7 @@ bool InitExternalFunc(const rtl::OUString& rModuleName)
 
             // Module in die Collection aufnehmen
             ModuleData* pModuleData = new ModuleData(rModuleName, pLib);
-            aModuleCollection.Insert(pModuleData);
+            aModuleCollection.insert(pModuleData);
 
             // Schnittstelle initialisieren
             AdvData pfCallBack = &ScAddInAsyncCallBack;
@@ -297,12 +306,7 @@ bool InitExternalFunc(const rtl::OUString& rModuleName)
 
 void ExitExternalFunc()
 {
-    sal_uInt16 nCount = aModuleCollection.GetCount();
-    for (sal_uInt16 i=0; i<nCount; i++)
-    {
-        ModuleData* pData = aModuleCollection[i];
-        pData->FreeInstance();
-    }
+    aModuleCollection.clear();
 }
 
 //------------------------------------------------------------------------
commit b03bc5764785394930beaabe4f685fa6dfa3c8ce
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Feb 6 16:12:30 2012 -0500

    Typos in method descriptions.

diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 1b8e18d..e3d11d9 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -283,7 +283,7 @@ COMPHELPER_DLLPUBLIC rtl::OUString strip(const rtl::OUString &rIn,
 /** Returns a token in an OString
 
   @param    rIn         the input OString
-  @param    token       the number of the token to return
+  @param    nToken      the number of the token to return
   @param    cTok        the character which seperate the tokens.
   @return   the token   if token is negative or doesn't exist an empty token
                         is returned
@@ -298,7 +298,7 @@ COMPHELPER_DLLPUBLIC inline rtl::OString getToken(const rtl::OString &rIn,
 /** Returns a token in an OUString
 
   @param    rIn         the input OUString
-  @param    token       the number of the token to return
+  @param    nToken      the number of the token to return
   @param    cTok        the character which seperate the tokens.
   @return   the token   if token is negative or doesn't exist an empty token
                         is returned
commit 7a4d7b2fa2d0b9c8daea5755976faf3c01526ec8
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Feb 6 16:09:22 2012 -0500

    More on string/bool conversion.

diff --git a/sc/inc/callform.hxx b/sc/inc/callform.hxx
index e299e61..4708a47 100644
--- a/sc/inc/callform.hxx
+++ b/sc/inc/callform.hxx
@@ -61,18 +61,18 @@ class FuncData : public ScDataObject
 {
 friend class FuncCollection;
     const ModuleData* pModuleData;
-    String      aInternalName;
-    String      aFuncName;
+    rtl::OUString aInternalName;
+    rtl::OUString aFuncName;
     sal_uInt16      nNumber;
     sal_uInt16      nParamCount;
     ParamType   eAsyncType;
     ParamType   eParamType[MAXFUNCPARAM];
 private:
-    FuncData(const String& rIName);
+    FuncData(const rtl::OUString& rIName);
 public:
     FuncData(const ModuleData*pModule,
-             const String&    rIName,
-             const String&    rFName,
+             const rtl::OUString& rIName,
+             const rtl::OUString& rFName,
                    sal_uInt16     nNo,
                    sal_uInt16     nCount,
              const ParamType* peType,
@@ -80,15 +80,15 @@ public:
     FuncData(const FuncData& rData);
     virtual ScDataObject*   Clone() const { return new FuncData(*this); }
 
-    const   String&     GetModuleName() const;
-    const   String&     GetInternalName() const { return aInternalName; }
-    const   String&     GetFuncName() const { return aFuncName; }
+    const rtl::OUString& GetModuleName() const;
+    const rtl::OUString& GetInternalName() const { return aInternalName; }
+    const rtl::OUString& GetFuncName() const { return aFuncName; }
             sal_uInt16      GetParamCount() const { return nParamCount; }
             ParamType   GetParamType(sal_uInt16 nIndex) const { return eParamType[nIndex]; }
             ParamType   GetReturnType() const { return eParamType[0]; }
             ParamType   GetAsyncType() const { return eAsyncType; }
-            sal_Bool        Call(void** ppParam);
-            sal_Bool        Unadvice(double nHandle);
+    bool        Call(void** ppParam);
+    bool        Unadvice(double nHandle);
 
                         // name and description of parameter nParam.
                         // nParam==0 => Desc := function description,
@@ -107,11 +107,11 @@ public:
     virtual ScDataObject*   Clone() const { return new FuncCollection(*this); }
             FuncData*   operator[]( const sal_uInt16 nIndex) const {return (FuncData*)At(nIndex);}
     virtual short       Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
-            sal_Bool        SearchFunc( const String& rName, sal_uInt16& rIndex ) const;
+    bool        SearchFunc( const rtl::OUString& rName, sal_uInt16& rIndex ) const;
 };
 
 
-sal_Bool InitExternalFunc(const rtl::OUString& rModuleName);
+bool InitExternalFunc(const rtl::OUString& rModuleName);
 void ExitExternalFunc();
 
 #endif
diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index f2a5da1..5fa4d87 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -91,7 +91,7 @@ typedef void (CALLTYPE* FARPROC) ( void );
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-FuncData::FuncData(const String& rIName) :
+FuncData::FuncData(const rtl::OUString& rIName) :
     pModuleData     (NULL),
     aInternalName   (rIName),
     nNumber         (0),
@@ -105,8 +105,8 @@ FuncData::FuncData(const String& rIName) :
 //------------------------------------------------------------------------
 
 FuncData::FuncData(const ModuleData*pModule,
-                   const String&    rIName,
-                   const String&    rFName,
+                   const rtl::OUString& rIName,
+                   const rtl::OUString& rFName,
                          sal_uInt16 nNo,
                     sal_uInt16  nCount,
                    const ParamType* peType,
@@ -147,7 +147,7 @@ short FuncCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
 
 //------------------------------------------------------------------------
 
-sal_Bool FuncCollection::SearchFunc( const String& rName, sal_uInt16& rIndex ) const
+bool FuncCollection::SearchFunc( const rtl::OUString& rName, sal_uInt16& rIndex ) const
 {
     FuncData aDataObj(rName);
     return Search( &aDataObj, rIndex );
@@ -157,7 +157,7 @@ sal_Bool FuncCollection::SearchFunc( const String& rName, sal_uInt16& rIndex ) c
 class ModuleData : public ScDataObject
 {
 friend class ModuleCollection;
-    String      aName;
+    rtl::OUString aName;
     osl::Module* pInstance;
 public:
     ModuleData(const String& rStr, osl::Module* pInst) : aName (rStr), pInstance (pInst) {}
@@ -165,9 +165,9 @@ public:
     ~ModuleData() { delete pInstance; }
     virtual ScDataObject*   Clone() const { return new ModuleData(*this); }
 
-    const   String&         GetName() const { return aName; }
-            osl::Module*    GetInstance() const { return pInstance; }
-            void            FreeInstance() { delete pInstance; pInstance = 0; }
+    const rtl::OUString& GetName() const { return aName; }
+    osl::Module*    GetInstance() const { return pInstance; }
+    void            FreeInstance() { delete pInstance; pInstance = 0; }
 };
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -180,8 +180,8 @@ public:
     virtual ScDataObject*       Clone() const { return new ModuleCollection(*this); }
             ModuleData*     operator[]( const sal_uInt16 nIndex) const {return (ModuleData*)At(nIndex);}
     virtual short           Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
-            sal_Bool            SearchModule( const String& rName,
-                                          const ModuleData*& rpModule ) const;
+    bool SearchModule(
+        const rtl::OUString& rName, const ModuleData*& rpModule ) const;
 };
 
 static ModuleCollection aModuleCollection;
@@ -196,8 +196,8 @@ short ModuleCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
 
 //------------------------------------------------------------------------
 
-sal_Bool ModuleCollection::SearchModule( const String& rName,
-                                     const ModuleData*& rpModule ) const
+bool ModuleCollection::SearchModule(
+    const rtl::OUString& rName, const ModuleData*& rpModule ) const
 {
     sal_uInt16 nIndex;
     ModuleData aSearchModule(rName, 0);
@@ -211,13 +211,11 @@ sal_Bool ModuleCollection::SearchModule( const String& rName,
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-sal_Bool InitExternalFunc(const rtl::OUString& rModuleName)
+bool InitExternalFunc(const rtl::OUString& rModuleName)
 {
-    String aModuleName( rModuleName );
-
     // Module schon geladen?
     const ModuleData* pTemp;
-    if (aModuleCollection.SearchModule(aModuleName, pTemp))
+    if (aModuleCollection.SearchModule(rModuleName, pTemp))
         return false;
 
     rtl::OUString aNP;
@@ -242,7 +240,7 @@ sal_Bool InitExternalFunc(const rtl::OUString& rModuleName)
             }
 
             // Module in die Collection aufnehmen
-            ModuleData* pModuleData = new ModuleData(aModuleName, pLib);
+            ModuleData* pModuleData = new ModuleData(rModuleName, pLib);
             aModuleCollection.Insert(pModuleData);
 
             // Schnittstelle initialisieren
@@ -309,9 +307,9 @@ void ExitExternalFunc()
 
 //------------------------------------------------------------------------
 
-sal_Bool FuncData::Call(void** ppParam)
+bool FuncData::Call(void** ppParam)
 {
-    sal_Bool bRet = false;
+    bool bRet = false;
     osl::Module* pLib = pModuleData->GetInstance();
     FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(aFuncName);
     if (fProc != NULL)
@@ -320,81 +318,81 @@ sal_Bool FuncData::Call(void** ppParam)
         {
             case 1 :
                 (*((ExFuncPtr1)fProc))(ppParam[0]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 2 :
                 (*((ExFuncPtr2)fProc))(ppParam[0], ppParam[1]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 3 :
                 (*((ExFuncPtr3)fProc))(ppParam[0], ppParam[1], ppParam[2]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 4 :
                 (*((ExFuncPtr4)fProc))(ppParam[0], ppParam[1], ppParam[2], ppParam[3]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 5 :
                 (*((ExFuncPtr5)fProc))(ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 6 :
                 (*((ExFuncPtr6)fProc))(ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 7 :
                 (*((ExFuncPtr7)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 8 :
                 (*((ExFuncPtr8)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 9 :
                 (*((ExFuncPtr9)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 10 :
                 (*((ExFuncPtr10)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 11 :
                 (*((ExFuncPtr11)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 12:
                 (*((ExFuncPtr12)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 13:
                 (*((ExFuncPtr13)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
                                         ppParam[12]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 14 :
                 (*((ExFuncPtr14)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
                                         ppParam[12], ppParam[13]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 15 :
                 (*((ExFuncPtr15)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
                                         ppParam[12], ppParam[13], ppParam[14]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             case 16 :
                 (*((ExFuncPtr16)fProc))( ppParam[0], ppParam[1], ppParam[2], ppParam[3], ppParam[4], ppParam[5],
                                         ppParam[6], ppParam[7], ppParam[8], ppParam[9], ppParam[10], ppParam[11],
                                         ppParam[12], ppParam[13], ppParam[14], ppParam[15]);
-                bRet = sal_True;
+                bRet = true;
                 break;
             default : break;
         }
@@ -404,22 +402,22 @@ sal_Bool FuncData::Call(void** ppParam)
 
 //------------------------------------------------------------------------
 
-sal_Bool FuncData::Unadvice( double nHandle )
+bool FuncData::Unadvice( double nHandle )
 {
-    sal_Bool bRet = false;
+    bool bRet = false;
     osl::Module* pLib = pModuleData->GetInstance();
     FARPROC fProc = (FARPROC)pLib->getFunctionSymbol(LIBFUNCNAME(UNADVICE));
     if (fProc != NULL)
     {
         ((::Unadvice)fProc)(nHandle);
-        bRet = sal_True;
+        bRet = true;
     }
     return bRet;
 }
 
 //------------------------------------------------------------------------
 
-const String& FuncData::GetModuleName() const
+const rtl::OUString& FuncData::GetModuleName() const
 {
     return pModuleData->GetName();
 }
commit 6a7250d7c7da23b427869f826f712c2abd41ab8c
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Feb 6 16:00:34 2012 -0500

    String to rtl::OUString & reduce indent levels.

diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index 092d117..d5b7999 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -58,76 +58,74 @@ void ScGlobal::InitAddIns()
 {
     // multi paths separated by semicolons
     SvtPathOptions aPathOpt;
-    String aMultiPath = aPathOpt.GetAddinPath();
-    if ( aMultiPath.Len() > 0 )
+    rtl::OUString aMultiPath = aPathOpt.GetAddinPath();
+    if (aMultiPath.isEmpty())
+        return;
+
+    sal_Int32 nTokens = comphelper::string::getTokenCount(aMultiPath, ';');
+    for (sal_Int32 j = 0; j < nTokens; ++j)
     {
-        xub_StrLen nTokens = comphelper::string::getTokenCount(aMultiPath, ';');
-        xub_StrLen nIndex = 0;
-        for ( xub_StrLen j=0; j<nTokens; j++ )
+        rtl::OUString aPath = comphelper::string::getToken(aMultiPath, j, ';');
+        if (aPath.isEmpty())
+            continue;
+
+        //  use LocalFileHelper to convert the path to a URL that always points
+        //  to the file on the server
+        rtl::OUString aUrl;
+        if ( utl::LocalFileHelper::ConvertPhysicalNameToURL( aPath, aUrl ) )
+            aPath = aUrl;
+
+        INetURLObject aObj;
+        aObj.SetSmartURL( aPath );
+        aObj.setFinalSlash();
+        try
         {
-            String aPath( aMultiPath.GetToken( 0, ';', nIndex ) );
-            if ( aPath.Len() > 0 )
+            ::ucbhelper::Content aCnt( aObj.GetMainURL(INetURLObject::NO_DECODE),
+                Reference< XCommandEnvironment > () );
+            Reference< sdbc::XResultSet > xResultSet;
+            Sequence< rtl::OUString > aProps;
+            try
+            {
+                xResultSet = aCnt.createCursor(
+                    aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
+            }
+            catch ( Exception& )
             {
-                //  use LocalFileHelper to convert the path to a URL that always points
-                //  to the file on the server
-                rtl::OUString aUrl;
-                if ( utl::LocalFileHelper::ConvertPhysicalNameToURL( aPath, aUrl ) )
-                    aPath = aUrl;
-
-                INetURLObject aObj;
-                aObj.SetSmartURL( aPath );
-                aObj.setFinalSlash();
+                // ucb may throw different exceptions on failure now
+                // no assertion if AddIn directory doesn't exist
+            }
+
+            if ( xResultSet.is() )
+            {
+                Reference< sdbc::XRow > xRow( xResultSet, UNO_QUERY );
+                Reference< XContentAccess >
+                    xContentAccess( xResultSet, UNO_QUERY );
                 try
                 {
-                    ::ucbhelper::Content aCnt( aObj.GetMainURL(INetURLObject::NO_DECODE),
-                        Reference< XCommandEnvironment > () );
-                    Reference< sdbc::XResultSet > xResultSet;
-                    Sequence< rtl::OUString > aProps;
-                    try
-                    {
-                        xResultSet = aCnt.createCursor(
-                            aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
-                    }
-                    catch ( Exception& )
-                    {
-                        // ucb may throw different exceptions on failure now
-                        // no assertion if AddIn directory doesn't exist
-                    }
-
-                    if ( xResultSet.is() )
+                    if ( xResultSet->first() )
                     {
-                        Reference< sdbc::XRow > xRow( xResultSet, UNO_QUERY );
-                        Reference< XContentAccess >
-                            xContentAccess( xResultSet, UNO_QUERY );
-                        try
-                        {
-                            if ( xResultSet->first() )
-                            {
-                                do
-                                {
-                                    rtl::OUString aId( xContentAccess->queryContentIdentifierString() );
-                                    InitExternalFunc( aId );
-                                }
-                                while ( xResultSet->next() );
-                            }
-                        }
-                        catch ( Exception& )
+                        do
                         {
-                            OSL_FAIL( "ResultSetException catched!" );
+                            rtl::OUString aId = xContentAccess->queryContentIdentifierString();
+                            InitExternalFunc( aId );
                         }
+                        while ( xResultSet->next() );
                     }
                 }
                 catch ( Exception& )
                 {
-                    OSL_FAIL( "Exception catched!" );
-                }
-                catch ( ... )
-                {
-
-                    OSL_FAIL( "unexpected exception caught!" );
+                    OSL_FAIL( "ResultSetException caught!" );
                 }
             }
         }
+        catch ( Exception& )
+        {
+            OSL_FAIL( "Exception caught!" );
+        }
+        catch ( ... )
+        {
+            OSL_FAIL( "unexpected exception caught!" );
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list