And here another patch for sc/inc/funcdesc.hxx and related source
files, changing even more occurrences of (deprecated) String to
OUString. I also changed the uses of these variables/functions to use
OUString instead (using casts when forced to use String originally
because of ResId).

Please review and apply
Regards
Sören Möller
(LGPLv3+ / MPL)
From a2ff17423179900f4d0fa28243a91bca67cdbc52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20M=C3=B6ller?= <[email protected]>
Date: Sun, 9 Jan 2011 20:30:43 +0100
Subject: [PATCH] Changed String to OUString in funcdesc.hxx

I have changed variables and functions in sc/inc/funcdesc.hxx to use OUString instead of deprecated String, and I have also changed all uses of these variables/functions to use OUString
---
 sc/inc/funcdesc.hxx               |    7 ++--
 sc/source/core/data/global.cxx    |   64 +++++++++++++++++-------------------
 sc/source/ui/app/inputhdl.cxx     |    2 +-
 sc/source/ui/formdlg/dwfunctr.cxx |    2 +-
 4 files changed, 35 insertions(+), 40 deletions(-)

diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx
index c07dda0..edc50df 100644
--- a/sc/inc/funcdesc.hxx
+++ b/sc/inc/funcdesc.hxx
@@ -57,6 +57,7 @@ public:
         parameters only one element is added to the end of the sequence. */
     virtual void fillVisibleArgumentMapping(::std::vector<USHORT>& _rArguments) const ;
     virtual void initArgumentInfo()  const;
+    /** Returns the full function signature: "FUNCTIONNAME( parameter list )". */
     virtual ::rtl::OUString getSignature() const ;
     virtual long getHelpId() const ;
 
@@ -81,9 +82,7 @@ public:
     void        Clear();
 
     /** Returns a semicolon separated list of all parameter names. */
-    String  GetParamList        () const;
-    /** Returns the full function signature: "FUNCTIONNAME( parameter list )". */
-    String  GetSignature        () const;
+    ::rtl::OUString  GetParamList        () const;
     
     
 
@@ -158,7 +157,7 @@ public:
             ScFunctionMgr();
     virtual ~ScFunctionMgr();
 
-    static String       GetCategoryName(sal_uInt32 _nCategoryNumber );
+    static ::rtl::OUString       GetCategoryName(sal_uInt32 _nCategoryNumber );
 
     const ScFuncDesc*   Get( const String& rFName ) const;
     const ScFuncDesc*   Get( USHORT nFIndex ) const;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index e46a3e6..b3de8ba 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -1457,11 +1457,11 @@ void ScFuncDesc::Clear()
 
 //------------------------------------------------------------------------
 
-String ScFuncDesc::GetParamList() const
+::rtl::OUString ScFuncDesc::GetParamList() const
 {
     const String& sep = ScCompiler::GetNativeSymbol(ocSep);
 
-    String aSig;
+    ::rtl::OUString aSig;
 
     if ( nArgCount > 0 )
     {
@@ -1476,19 +1476,19 @@ String ScFuncDesc::GetParamList() const
                 else
                 {
                     nLastAdded = i;
-                    aSig += (String)*(ppDefArgNames[i]);
+                    aSig += *(ppDefArgNames[i]);
                     if ( i != nArgCount-1 )
                     {
-                        aSig.Append(sep);
-                        aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
+                        aSig += ::rtl::OUString(sep);
+                        aSig += ::rtl::OUString::createFromAscii( " " );
                     }
                 }
             }
             // If only suppressed parameters follow the last added parameter,
             // remove one "; "
             if (nLastSuppressed < nArgCount && nLastAdded < nLastSuppressed &&
-                    aSig.Len() >= 2)
-                aSig.Erase( aSig.Len() - 2 );
+                    aSig.getLength() >= 2)
+                aSig = aSig.copy(0,aSig.getLength() - 2);
         }
         else
         {
@@ -1497,23 +1497,23 @@ String ScFuncDesc::GetParamList() const
             {
                 if (!pDefArgFlags[nArg].bSuppress)
                 {
-                    aSig += (String)*(ppDefArgNames[nArg]);
-                    aSig.Append(sep);
-                    aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
+                    aSig += *(ppDefArgNames[nArg]);
+                    aSig += ::rtl::OUString(sep);
+                    aSig += ::rtl::OUString::createFromAscii( " " );
                 }
             }
             /* NOTE: Currently there are no suppressed var args parameters. If
              * there were, we'd have to cope with it here and above for the fix
              * parameters. For now parameters are always added, so no special
              * treatment of a trailing "; " necessary. */
-            aSig += (String)*(ppDefArgNames[nFix]);
-            aSig += '1';
-            aSig.Append(sep);
-            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
-            aSig += (String)*(ppDefArgNames[nFix]);
-            aSig += '2';
-            aSig.Append(sep);
-            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ... " ));
+            aSig += *(ppDefArgNames[nFix]);
+            aSig += ::rtl::OUString('1');
+            aSig += ::rtl::OUString(sep);
+            aSig += ::rtl::OUString::createFromAscii( " " );
+            aSig += *(ppDefArgNames[nFix]);
+            aSig += ::rtl::OUString('2');
+            aSig += ::rtl::OUString(sep);
+            aSig += ::rtl::OUString::createFromAscii(" ... " );
         }
     }
 
@@ -1522,24 +1522,25 @@ String ScFuncDesc::GetParamList() const
 
 //------------------------------------------------------------------------
 
-String ScFuncDesc::GetSignature() const
+::rtl::OUString ScFuncDesc::getSignature() const
 {
-    String aSig;
+    ::rtl::OUString aSig;
 
     if(pFuncName)
     {
         aSig = *pFuncName;
 
-        String aParamList( GetParamList() );
-        if( aParamList.Len() )
+        ::rtl::OUString aParamList = GetParamList();
+        if( aParamList.getLength() )
         {
-            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "( " ));
-            aSig.Append( aParamList );
+            aSig += ::rtl::OUString::createFromAscii( "( " );
+            aSig += aParamList;
             // U+00A0 (NBSP) prevents automatic line break
-            aSig.Append( static_cast< sal_Unicode >(0xA0) ).Append( ')' );
+            aSig += ::rtl::OUString( static_cast< sal_Unicode >(0xA0) );
+            aSig += ::rtl::OUString( ')' );
         }
         else
-            aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "()" ));
+            aSig += ::rtl::OUString::createFromAscii( "()" );
     }
     return aSig;
 }
@@ -1679,11 +1680,6 @@ void ScFuncDesc::initArgumentInfo()  const
     }
 }
 // -----------------------------------------------------------------------------
-::rtl::OUString ScFuncDesc::getSignature() const
-{
-    return GetSignature();
-}
-// -----------------------------------------------------------------------------
 long ScFuncDesc::getHelpId() const
 {
     return nHelpId;
@@ -1846,16 +1842,16 @@ void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::
     }
 }
 // -----------------------------------------------------------------------------
-String ScFunctionMgr::GetCategoryName(sal_uInt32 _nCategoryNumber )
+::rtl::OUString ScFunctionMgr::GetCategoryName(sal_uInt32 _nCategoryNumber )
 {
     if ( _nCategoryNumber > SC_FUNCGROUP_COUNT )
     {
         DBG_ERROR("Invalid category number!");
-        return String();
+        return ::rtl::OUString();
     }
 
     ::std::auto_ptr<ScResourcePublisher> pCategories( new ScResourcePublisher( ScResId( RID_FUNCTION_CATEGORIES ) ) );
-    return String(ScResId((USHORT)_nCategoryNumber));
+    return (::rtl::OUString)String(ScResId((USHORT)_nCategoryNumber));
 }
 sal_Unicode ScFunctionMgr::getSingleToken(const formula::IFunctionManager::EToken _eToken) const
 {
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 37535f0..cdf66be 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -684,7 +684,7 @@ void ScInputHandler::GetFormulaData()
             if ( pDesc->pFuncName )
             {
                 pDesc->initArgumentInfo();
-                String aEntry = pDesc->GetSignature();
+                String aEntry = (String)pDesc->getSignature();
                 TypedStrData* pData = new TypedStrData( aEntry, 0.0, SC_STRTYPE_FUNCTIONS );
                 if (!pFormulaDataPara->Insert(pData))
                     delete pData;
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index 2e1aa63..bad3df0 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -607,7 +607,7 @@ void ScFunctionDockWin::SetDescription()
             aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":   " ));
         }
 
-        aString+=pDesc->GetParamList();
+        aString+=(String)(pDesc->GetParamList());
 
         if(nDockMode==0)
         {
-- 
1.7.0.4

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to