[Libreoffice-commits] .: 6 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Jan 10 19:22:35 PST 2011
sc/inc/appluno.hxx | 1
sc/inc/funcdesc.hxx | 31 +++----
sc/source/core/data/global.cxx | 154 +++++++++++++++++++-------------------
sc/source/core/tool/addincol.cxx | 16 +--
sc/source/ui/app/inputhdl.cxx | 2
sc/source/ui/formdlg/dwfunctr.cxx | 16 +--
sc/source/ui/unoobj/appluno.cxx | 21 ++---
7 files changed, 121 insertions(+), 120 deletions(-)
New commits:
commit c8d46d9722b07985c134feae20450b06b9e74442
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 10 22:17:01 2011 -0500
Removed OUString to String casting & prefer static_cast over C-style cast.
diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx
index edc50df..d94d9b2 100644
--- a/sc/inc/funcdesc.hxx
+++ b/sc/inc/funcdesc.hxx
@@ -159,7 +159,7 @@ public:
static ::rtl::OUString GetCategoryName(sal_uInt32 _nCategoryNumber );
- const ScFuncDesc* Get( const String& rFName ) const;
+ const ScFuncDesc* Get( const ::rtl::OUString& rFName ) const;
const ScFuncDesc* Get( USHORT nFIndex ) const;
const ScFuncDesc* First( USHORT nCategory = 0 ) const;
const ScFuncDesc* Next() const;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index c072602..b1240ff 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -1766,12 +1766,12 @@ ScFunctionMgr::~ScFunctionMgr()
//------------------------------------------------------------------------
-const ScFuncDesc* ScFunctionMgr::Get( const String& rFName ) const
+const ScFuncDesc* ScFunctionMgr::Get( const ::rtl::OUString& rFName ) const
{
const ScFuncDesc* pDesc = NULL;
- if (rFName.Len() <= pFuncList->GetMaxFuncNameLen())
+ if (rFName.getLength() <= pFuncList->GetMaxFuncNameLen())
for (pDesc = First(0); pDesc; pDesc = Next())
- if (rFName.EqualsIgnoreCaseAscii((String)(*(pDesc->pFuncName))))
+ if (rFName.equalsIgnoreAsciiCase(*pDesc->pFuncName))
break;
return pDesc;
}
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index 0400c41..ffbf52e 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -985,7 +985,7 @@ sal_Int32 SAL_CALL ScFunctionListObj::getCount() throw(uno::RuntimeException)
sal_Int32 nCount = 0;
const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
if ( pFuncList )
- nCount = (sal_Int32)pFuncList->GetCount();
+ nCount = static_cast<sal_Int32>(pFuncList->GetCount());
return nCount;
}
commit 1d02310213321f8da4a9b6622b4b916bfae4398c
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 10 22:06:16 2011 -0500
Slight clean-up.
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6fddccd..c072602 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -92,6 +92,9 @@
// -----------------------------------------------------------------------
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
#define CLIPST_AVAILABLE 0
#define CLIPST_CAPTURED 1
#define CLIPST_DELETE 2
@@ -1281,16 +1284,19 @@ ScFunctionList::ScFunctionList() :
FuncData *pAddInFuncData = (FuncData*)pFuncColl->At(i);
USHORT nArgs = pAddInFuncData->GetParamCount() - 1;
pAddInFuncData->GetParamDesc( aArgName, aArgDesc, 0 );
- pDesc->nFIndex = nNextId++; // ??? OpCode vergeben
- pDesc->nCategory = ID_FUNCTION_GRP_ADDINS;
- pDesc->pFuncName = new ::rtl::OUString(pAddInFuncData->GetInternalName());
- pDesc->pFuncName->toAsciiUpperCase();
- pDesc->pFuncDesc = new ::rtl::OUString( aArgDesc );
- *(pDesc->pFuncDesc) += *(new ::rtl::OUString( '\n' ));
- *(pDesc->pFuncDesc) += ::rtl::OUString::createFromAscii("( AddIn: ");
- *(pDesc->pFuncDesc) += pAddInFuncData->GetModuleName();
- *(pDesc->pFuncDesc) += ::rtl::OUString::createFromAscii( " )" );
- pDesc->nArgCount = nArgs;
+ pDesc->nFIndex = nNextId++; // ??? OpCode vergeben
+ pDesc->nCategory = ID_FUNCTION_GRP_ADDINS;
+ pDesc->pFuncName = new ::rtl::OUString(pAddInFuncData->GetInternalName());
+ pDesc->pFuncName->toAsciiUpperCase();
+
+ OUStringBuffer aBuf(aArgDesc);
+ aBuf.append(sal_Unicode('\n'));
+ aBuf.appendAscii("( AddIn: ");
+ aBuf.append(pAddInFuncData->GetModuleName());
+ aBuf.appendAscii(" )");
+ pDesc->pFuncDesc = new OUString(aBuf.makeStringAndClear());
+
+ pDesc->nArgCount = nArgs;
if (nArgs)
{
pDesc->pDefArgFlags = new ScFuncDesc::ParameterFlags[nArgs];
@@ -1507,13 +1513,13 @@ void ScFuncDesc::Clear()
* parameters. For now parameters are always added, so no special
* treatment of a trailing "; " necessary. */
aSig.append(*(ppDefArgNames[nFix]));
- aSig.appendAscii("1");
+ aSig.append(sal_Unicode('1'));
aSig.append(sep);
- aSig.appendAscii( " " );
+ aSig.append(sal_Unicode(' '));
aSig.append(*(ppDefArgNames[nFix]));
- aSig.appendAscii("2");
+ aSig.append(sal_Unicode('2'));
aSig.append(sep);
- aSig.appendAscii(" ... " );
+ aSig.appendAscii(" ... ");
}
}
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 307add6..2bc3760 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -1048,7 +1048,7 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference<uno::XInterface>&
void lcl_UpdateFunctionList( ScFunctionList& rFunctionList, const ScUnoAddInFuncData& rFuncData )
{
- ::rtl::OUString aCompare = (::rtl::OUString)rFuncData.GetUpperLocal(); // as used in FillFunctionDescFromData
+ ::rtl::OUString aCompare = rFuncData.GetUpperLocal(); // as used in FillFunctionDescFromData
ULONG nCount = rFunctionList.GetCount();
for (ULONG nPos=0; nPos<nCount; nPos++)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index cdf66be..26ca554 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 = (String)pDesc->getSignature();
+ String aEntry = 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 bad3df0..60481d7 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -597,30 +597,30 @@ void ScFunctionDockWin::SetDescription()
{
pDesc->initArgumentInfo(); // full argument info is needed
- String aString=pAllFuncList->GetSelectEntry();
+ ::rtl::OUStringBuffer aBuf(pAllFuncList->GetSelectEntry());
if(nDockMode==0)
{
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n\n" ));
+ aBuf.appendAscii(":\n\n");
}
else
{
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " ));
+ aBuf.appendAscii(": ");
}
- aString+=(String)(pDesc->GetParamList());
+ aBuf.append(pDesc->GetParamList());
if(nDockMode==0)
{
- aString.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n\n" ));
+ aBuf.appendAscii("\n\n");
}
else
{
- aString += '\n';
+ aBuf.appendAscii("\n");
}
- aString+=(String)*(pDesc->pFuncDesc);
+ aBuf.append(*pDesc->pFuncDesc);
- aFiFuncDesc.SetText(aString);
+ aFiFuncDesc.SetText(aBuf.makeStringAndClear());
aFiFuncDesc.StateChanged(STATE_CHANGE_TEXT);
aFiFuncDesc.Invalidate();
aFiFuncDesc.Update();
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index edf669e..0400c41 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -1048,7 +1048,7 @@ uno::Sequence<rtl::OUString> SAL_CALL ScFunctionListObj::getElementNames() throw
sal_uInt32 nCount = pFuncList->GetCount();
uno::Sequence<rtl::OUString> aSeq(nCount);
rtl::OUString* pAry = aSeq.getArray();
- for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
{
const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
if ( pDesc && pDesc->pFuncName )
@@ -1067,7 +1067,7 @@ sal_Bool SAL_CALL ScFunctionListObj::hasByName( const rtl::OUString& aName )
if ( pFuncList )
{
sal_uInt32 nCount = pFuncList->GetCount();
- for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
{
const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
//! Case-insensitiv ???
commit 43362503cd5fa528a2ef7bc5dd1260a70b9e4e59
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 10 21:36:23 2011 -0500
Adjusted for the non-pointer-returning toString() method.
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index cc991d9..6fddccd 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -1169,7 +1169,7 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
}
pDesc->pFuncName = new ::rtl::OUString( ScCompiler::GetNativeSymbol( static_cast<OpCode>( aRes.GetId())));
- pDesc->pFuncDesc = ResId::toString(ScResId(1));
+ pDesc->pFuncDesc = new ::rtl::OUString( ResId::toString(ScResId(1)));
if (nArgs)
{
@@ -1177,8 +1177,8 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
pDesc->ppDefArgDescs = new ::rtl::OUString*[nArgs];
for (USHORT i = 0; i < nArgs; i++)
{
- pDesc->ppDefArgNames[i] = ResId::toString(ScResId(2*(i+1) ));
- pDesc->ppDefArgDescs[i] = ResId::toString(ScResId(2*(i+1)+1));
+ pDesc->ppDefArgNames[i] = new ::rtl::OUString(ResId::toString(ScResId(2*(i+1) )));
+ pDesc->ppDefArgDescs[i] = new ::rtl::OUString(ResId::toString(ScResId(2*(i+1)+1)));
}
}
@@ -1851,7 +1851,7 @@ void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::
}
::std::auto_ptr<ScResourcePublisher> pCategories( new ScResourcePublisher( ScResId( RID_FUNCTION_CATEGORIES ) ) );
- return *ResId::toString(ScResId((USHORT)_nCategoryNumber));
+ return ResId::toString(ScResId((USHORT)_nCategoryNumber));
}
sal_Unicode ScFunctionMgr::getSingleToken(const formula::IFunctionManager::EToken _eToken) const
{
commit 8bd63b93c58b2b40cdb11f2cfcf9b8b6fe674fbb
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date: Tue Jan 11 00:21:51 2011 +0100
OUString to OUStringBuffer and fixed ResId to OUString workaround
Replaced OUString with OUStringBuffer in two plaeces where a lot of appending is done, and replaced a workaround for getting a OUString from a ResId by calls to ResId::toString
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index b3de8ba..cc991d9 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -1169,7 +1169,7 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
}
pDesc->pFuncName = new ::rtl::OUString( ScCompiler::GetNativeSymbol( static_cast<OpCode>( aRes.GetId())));
- pDesc->pFuncDesc = (::rtl::OUString*)(new String(ScResId(1)));
+ pDesc->pFuncDesc = ResId::toString(ScResId(1));
if (nArgs)
{
@@ -1177,8 +1177,8 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
pDesc->ppDefArgDescs = new ::rtl::OUString*[nArgs];
for (USHORT i = 0; i < nArgs; i++)
{
- pDesc->ppDefArgNames[i] = (::rtl::OUString*)(new String(ScResId(2*(i+1) )));
- pDesc->ppDefArgDescs[i] = (::rtl::OUString*)(new String(ScResId(2*(i+1)+1)));
+ pDesc->ppDefArgNames[i] = ResId::toString(ScResId(2*(i+1) ));
+ pDesc->ppDefArgDescs[i] = ResId::toString(ScResId(2*(i+1)+1));
}
}
@@ -1459,9 +1459,9 @@ void ScFuncDesc::Clear()
::rtl::OUString ScFuncDesc::GetParamList() const
{
- const String& sep = ScCompiler::GetNativeSymbol(ocSep);
+ ::rtl::OUString sep(ScCompiler::GetNativeSymbol(ocSep));
- ::rtl::OUString aSig;
+ ::rtl::OUStringBuffer aSig;
if ( nArgCount > 0 )
{
@@ -1476,11 +1476,11 @@ void ScFuncDesc::Clear()
else
{
nLastAdded = i;
- aSig += *(ppDefArgNames[i]);
+ aSig.append(*(ppDefArgNames[i]));
if ( i != nArgCount-1 )
{
- aSig += ::rtl::OUString(sep);
- aSig += ::rtl::OUString::createFromAscii( " " );
+ aSig.append(sep);
+ aSig.appendAscii( " " );
}
}
}
@@ -1488,7 +1488,7 @@ void ScFuncDesc::Clear()
// remove one "; "
if (nLastSuppressed < nArgCount && nLastAdded < nLastSuppressed &&
aSig.getLength() >= 2)
- aSig = aSig.copy(0,aSig.getLength() - 2);
+ aSig.setLength(aSig.getLength() - 2);
}
else
{
@@ -1497,52 +1497,52 @@ void ScFuncDesc::Clear()
{
if (!pDefArgFlags[nArg].bSuppress)
{
- aSig += *(ppDefArgNames[nArg]);
- aSig += ::rtl::OUString(sep);
- aSig += ::rtl::OUString::createFromAscii( " " );
+ aSig.append(*(ppDefArgNames[nArg]));
+ aSig.append(sep);
+ aSig.appendAscii( " " );
}
}
/* 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 += *(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(" ... " );
+ aSig.append(*(ppDefArgNames[nFix]));
+ aSig.appendAscii("1");
+ aSig.append(sep);
+ aSig.appendAscii( " " );
+ aSig.append(*(ppDefArgNames[nFix]));
+ aSig.appendAscii("2");
+ aSig.append(sep);
+ aSig.appendAscii(" ... " );
}
}
- return aSig;
+ return aSig.makeStringAndClear();
}
//------------------------------------------------------------------------
::rtl::OUString ScFuncDesc::getSignature() const
{
- ::rtl::OUString aSig;
+ ::rtl::OUStringBuffer aSig;
if(pFuncName)
{
- aSig = *pFuncName;
+ aSig.append(*pFuncName);
::rtl::OUString aParamList = GetParamList();
if( aParamList.getLength() )
{
- aSig += ::rtl::OUString::createFromAscii( "( " );
- aSig += aParamList;
+ aSig.appendAscii( "( " );
+ aSig.append(aParamList);
// U+00A0 (NBSP) prevents automatic line break
- aSig += ::rtl::OUString( static_cast< sal_Unicode >(0xA0) );
- aSig += ::rtl::OUString( ')' );
+ aSig.append( static_cast< sal_Unicode >(0xA0) );
+ aSig.appendAscii( ")" );
}
else
- aSig += ::rtl::OUString::createFromAscii( "()" );
+ aSig.appendAscii( "()" );
}
- return aSig;
+ return aSig.makeStringAndClear();
}
//------------------------------------------------------------------------
@@ -1851,7 +1851,7 @@ void ScFunctionMgr::fillLastRecentlyUsedFunctions(::std::vector< const formula::
}
::std::auto_ptr<ScResourcePublisher> pCategories( new ScResourcePublisher( ScResId( RID_FUNCTION_CATEGORIES ) ) );
- return (::rtl::OUString)String(ScResId((USHORT)_nCategoryNumber));
+ return *ResId::toString(ScResId((USHORT)_nCategoryNumber));
}
sal_Unicode ScFunctionMgr::getSingleToken(const formula::IFunctionManager::EToken _eToken) const
{
commit b24b59fd9ec4a531cf8687f37ac2882de3ea6434
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date: Sun Jan 9 20:30:43 2011 +0100
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
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)
{
commit 42f2fb32cc829b2ea7ce19b8b92c5564af615ae6
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date: Sun Jan 9 18:12:47 2011 +0100
Changed String to OUString in public variables of ScFuncDesc
I have changed four public variables of ScFuncDesc in sc/inc/funcdesc.hxx from deprecated String to OUString and corrected all uses of these variables
diff --git a/sc/inc/appluno.hxx b/sc/inc/appluno.hxx
index 681dd8d..f8d82cd 100644
--- a/sc/inc/appluno.hxx
+++ b/sc/inc/appluno.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase4.hxx>
+#include <rtl/ustring.hxx>
class ScFunctionDescriptionObj;
diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx
index 3640bfc..c07dda0 100644
--- a/sc/inc/funcdesc.hxx
+++ b/sc/inc/funcdesc.hxx
@@ -93,17 +93,17 @@ public:
suppressed). */
USHORT GetSuppressedArgCount() const;
- String *pFuncName; // Function name
- String *pFuncDesc; // Description of function
- String **ppDefArgNames; // Parameter name(s)
- String **ppDefArgDescs; // Description(s) of parameter(s)
- ParameterFlags *pDefArgFlags; // Flags for each parameter
- USHORT nFIndex; // Unique function index
- USHORT nCategory; // Function category
- USHORT nArgCount; // All parameter count, suppressed and unsuppressed
- USHORT nHelpId; // HelpID of function
- bool bIncomplete :1; // Incomplete argument info (set for add-in info from configuration)
- bool bHasSuppressedArgs :1; // Whether there is any suppressed parameter.
+ ::rtl::OUString *pFuncName; // Function name
+ ::rtl::OUString *pFuncDesc; // Description of function
+ ::rtl::OUString **ppDefArgNames; // Parameter name(s)
+ ::rtl::OUString **ppDefArgDescs; // Description(s) of parameter(s)
+ ParameterFlags *pDefArgFlags; // Flags for each parameter
+ USHORT nFIndex; // Unique function index
+ USHORT nCategory; // Function category
+ USHORT nArgCount; // All parameter count, suppressed and unsuppressed
+ USHORT nHelpId; // HelpID of function
+ bool bIncomplete :1; // Incomplete argument info (set for add-in info from configuration)
+ bool bHasSuppressedArgs :1; // Whether there is any suppressed parameter.
};
//============================================================================
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 93550a9..e46a3e6 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -1168,17 +1168,17 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
}
}
- pDesc->pFuncName = new String( ScCompiler::GetNativeSymbol( static_cast<OpCode>( aRes.GetId())));
- pDesc->pFuncDesc = new String(ScResId(1));
+ pDesc->pFuncName = new ::rtl::OUString( ScCompiler::GetNativeSymbol( static_cast<OpCode>( aRes.GetId())));
+ pDesc->pFuncDesc = (::rtl::OUString*)(new String(ScResId(1)));
if (nArgs)
{
- pDesc->ppDefArgNames = new String*[nArgs];
- pDesc->ppDefArgDescs = new String*[nArgs];
+ pDesc->ppDefArgNames = new ::rtl::OUString*[nArgs];
+ pDesc->ppDefArgDescs = new ::rtl::OUString*[nArgs];
for (USHORT i = 0; i < nArgs; i++)
{
- pDesc->ppDefArgNames[i] = new String(ScResId(2*(i+1) ));
- pDesc->ppDefArgDescs[i] = new String(ScResId(2*(i+1)+1));
+ pDesc->ppDefArgNames[i] = (::rtl::OUString*)(new String(ScResId(2*(i+1) )));
+ pDesc->ppDefArgDescs[i] = (::rtl::OUString*)(new String(ScResId(2*(i+1)+1)));
}
}
@@ -1250,7 +1250,7 @@ ScFunctionList::ScFunctionList() :
pDesc->nFIndex = i;
aFunctionList.Insert( pDesc, LIST_APPEND );
- nStrLen = (*(pDesc->pFuncName)).Len();
+ nStrLen = (*(pDesc->pFuncName)).getLength();
if (nStrLen > nMaxFuncNameLen)
nMaxFuncNameLen = nStrLen;
}
@@ -1283,73 +1283,73 @@ ScFunctionList::ScFunctionList() :
pAddInFuncData->GetParamDesc( aArgName, aArgDesc, 0 );
pDesc->nFIndex = nNextId++; // ??? OpCode vergeben
pDesc->nCategory = ID_FUNCTION_GRP_ADDINS;
- pDesc->pFuncName = new String(pAddInFuncData->GetInternalName());
- pDesc->pFuncName->ToUpperAscii();
- pDesc->pFuncDesc = new String( aArgDesc );
- *(pDesc->pFuncDesc) += '\n';
- pDesc->pFuncDesc->AppendAscii(RTL_CONSTASCII_STRINGPARAM( "( AddIn: " ));
+ pDesc->pFuncName = new ::rtl::OUString(pAddInFuncData->GetInternalName());
+ pDesc->pFuncName->toAsciiUpperCase();
+ pDesc->pFuncDesc = new ::rtl::OUString( aArgDesc );
+ *(pDesc->pFuncDesc) += *(new ::rtl::OUString( '\n' ));
+ *(pDesc->pFuncDesc) += ::rtl::OUString::createFromAscii("( AddIn: ");
*(pDesc->pFuncDesc) += pAddInFuncData->GetModuleName();
- pDesc->pFuncDesc->AppendAscii(RTL_CONSTASCII_STRINGPARAM( " )" ));
+ *(pDesc->pFuncDesc) += ::rtl::OUString::createFromAscii( " )" );
pDesc->nArgCount = nArgs;
if (nArgs)
{
pDesc->pDefArgFlags = new ScFuncDesc::ParameterFlags[nArgs];
- pDesc->ppDefArgNames = new String*[nArgs];
- pDesc->ppDefArgDescs = new String*[nArgs];
+ pDesc->ppDefArgNames = new ::rtl::OUString*[nArgs];
+ pDesc->ppDefArgDescs = new ::rtl::OUString*[nArgs];
for (j = 0; j < nArgs; j++)
{
pDesc->pDefArgFlags[j].bOptional = false;
pDesc->pDefArgFlags[j].bSuppress = false;
pAddInFuncData->GetParamDesc( aArgName, aArgDesc, j+1 );
if ( aArgName.Len() )
- pDesc->ppDefArgNames[j] = new String( aArgName );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aArgName );
else
{
switch (pAddInFuncData->GetParamType(j+1))
{
case PTR_DOUBLE:
- pDesc->ppDefArgNames[j] = new String( aDefArgNameValue );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aDefArgNameValue );
break;
case PTR_STRING:
- pDesc->ppDefArgNames[j] = new String( aDefArgNameString );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aDefArgNameString );
break;
case PTR_DOUBLE_ARR:
- pDesc->ppDefArgNames[j] = new String( aDefArgNameValues );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aDefArgNameValues );
break;
case PTR_STRING_ARR:
- pDesc->ppDefArgNames[j] = new String( aDefArgNameStrings );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aDefArgNameStrings );
break;
case PTR_CELL_ARR:
- pDesc->ppDefArgNames[j] = new String( aDefArgNameCells );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aDefArgNameCells );
break;
default:
- pDesc->ppDefArgNames[j] = new String( aDefArgNameNone );
+ pDesc->ppDefArgNames[j] = new ::rtl::OUString( aDefArgNameNone );
break;
}
}
if ( aArgDesc.Len() )
- pDesc->ppDefArgDescs[j] = new String( aArgDesc );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aArgDesc );
else
{
switch (pAddInFuncData->GetParamType(j+1))
{
case PTR_DOUBLE:
- pDesc->ppDefArgDescs[j] = new String( aDefArgDescValue );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aDefArgDescValue );
break;
case PTR_STRING:
- pDesc->ppDefArgDescs[j] = new String( aDefArgDescString );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aDefArgDescString );
break;
case PTR_DOUBLE_ARR:
- pDesc->ppDefArgDescs[j] = new String( aDefArgDescValues );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aDefArgDescValues );
break;
case PTR_STRING_ARR:
- pDesc->ppDefArgDescs[j] = new String( aDefArgDescStrings );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aDefArgDescStrings );
break;
case PTR_CELL_ARR:
- pDesc->ppDefArgDescs[j] = new String( aDefArgDescCells );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aDefArgDescCells );
break;
default:
- pDesc->ppDefArgDescs[j] = new String( aDefArgDescNone );
+ pDesc->ppDefArgDescs[j] = new ::rtl::OUString( aDefArgDescNone );
break;
}
}
@@ -1357,7 +1357,7 @@ ScFunctionList::ScFunctionList() :
}
aFunctionList.Insert(pDesc, LIST_APPEND);
- nStrLen = (*(pDesc->pFuncName)).Len();
+ nStrLen = (*(pDesc->pFuncName)).getLength();
if ( nStrLen > nMaxFuncNameLen)
nMaxFuncNameLen = nStrLen;
}
@@ -1374,7 +1374,7 @@ ScFunctionList::ScFunctionList() :
if ( pUnoAddIns->FillFunctionDesc( nFunc, *pDesc ) )
{
aFunctionList.Insert(pDesc, LIST_APPEND);
- nStrLen = (*(pDesc->pFuncName)).Len();
+ nStrLen = (*(pDesc->pFuncName)).getLength();
if (nStrLen > nMaxFuncNameLen)
nMaxFuncNameLen = nStrLen;
}
@@ -1476,7 +1476,7 @@ String ScFuncDesc::GetParamList() const
else
{
nLastAdded = i;
- aSig += *(ppDefArgNames[i]);
+ aSig += (String)*(ppDefArgNames[i]);
if ( i != nArgCount-1 )
{
aSig.Append(sep);
@@ -1497,7 +1497,7 @@ String ScFuncDesc::GetParamList() const
{
if (!pDefArgFlags[nArg].bSuppress)
{
- aSig += *(ppDefArgNames[nArg]);
+ aSig += (String)*(ppDefArgNames[nArg]);
aSig.Append(sep);
aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
}
@@ -1506,11 +1506,11 @@ String ScFuncDesc::GetParamList() const
* 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 += *(ppDefArgNames[nFix]);
+ aSig += (String)*(ppDefArgNames[nFix]);
aSig += '1';
aSig.Append(sep);
aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " " ));
- aSig += *(ppDefArgNames[nFix]);
+ aSig += (String)*(ppDefArgNames[nFix]);
aSig += '2';
aSig.Append(sep);
aSig.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ... " ));
@@ -1769,7 +1769,7 @@ const ScFuncDesc* ScFunctionMgr::Get( const String& rFName ) const
const ScFuncDesc* pDesc = NULL;
if (rFName.Len() <= pFuncList->GetMaxFuncNameLen())
for (pDesc = First(0); pDesc; pDesc = Next())
- if (rFName.EqualsIgnoreCaseAscii(*(pDesc->pFuncName)))
+ if (rFName.EqualsIgnoreCaseAscii((String)(*(pDesc->pFuncName))))
break;
return pDesc;
}
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index ed7eb29..307add6 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -1048,7 +1048,7 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference<uno::XInterface>&
void lcl_UpdateFunctionList( ScFunctionList& rFunctionList, const ScUnoAddInFuncData& rFuncData )
{
- String aCompare = rFuncData.GetUpperLocal(); // as used in FillFunctionDescFromData
+ ::rtl::OUString aCompare = (::rtl::OUString)rFuncData.GetUpperLocal(); // as used in FillFunctionDescFromData
ULONG nCount = rFunctionList.GetCount();
for (ULONG nPos=0; nPos<nCount; nPos++)
@@ -1328,14 +1328,14 @@ BOOL ScUnoAddInCollection::FillFunctionDescFromData( const ScUnoAddInFuncData& r
// nFIndex is set from outside
- rDesc.pFuncName = new String( rFuncData.GetUpperLocal() ); //! upper?
+ rDesc.pFuncName = new ::rtl::OUString( rFuncData.GetUpperLocal() ); //! upper?
rDesc.nCategory = rFuncData.GetCategory();
rDesc.nHelpId = rFuncData.GetHelpId();
String aDesc = rFuncData.GetDescription();
if (!aDesc.Len())
aDesc = rFuncData.GetLocalName(); // use name if no description is available
- rDesc.pFuncDesc = new String( aDesc );
+ rDesc.pFuncDesc = new ::rtl::OUString( aDesc );
// AddInArgumentType_CALLER is already left out in FuncData
@@ -1345,18 +1345,18 @@ BOOL ScUnoAddInCollection::FillFunctionDescFromData( const ScUnoAddInFuncData& r
BOOL bMultiple = FALSE;
const ScAddInArgDesc* pArgs = rFuncData.GetArguments();
- rDesc.ppDefArgNames = new String*[nArgCount];
- rDesc.ppDefArgDescs = new String*[nArgCount];
+ rDesc.ppDefArgNames = new ::rtl::OUString*[nArgCount];
+ rDesc.ppDefArgDescs = new ::rtl::OUString*[nArgCount];
rDesc.pDefArgFlags = new ScFuncDesc::ParameterFlags[nArgCount];
for ( long nArg=0; nArg<nArgCount; nArg++ )
{
- rDesc.ppDefArgNames[nArg] = new String( pArgs[nArg].aName );
- rDesc.ppDefArgDescs[nArg] = new String( pArgs[nArg].aDescription );
+ rDesc.ppDefArgNames[nArg] = new ::rtl::OUString( pArgs[nArg].aName );
+ rDesc.ppDefArgDescs[nArg] = new ::rtl::OUString( pArgs[nArg].aDescription );
rDesc.pDefArgFlags[nArg].bOptional = pArgs[nArg].bOptional;
rDesc.pDefArgFlags[nArg].bSuppress = false;
// no empty names...
- if ( rDesc.ppDefArgNames[nArg]->Len() == 0 )
+ if ( rDesc.ppDefArgNames[nArg]->getLength() == 0 )
{
String aDefName( RTL_CONSTASCII_USTRINGPARAM("arg") );
aDefName += String::CreateFromInt32( nArg+1 );
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index f003caa..2e1aa63 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -618,7 +618,7 @@ void ScFunctionDockWin::SetDescription()
aString += '\n';
}
- aString+=*(pDesc->pFuncDesc);
+ aString+=(String)*(pDesc->pFuncDesc);
aFiFuncDesc.SetText(aString);
aFiFuncDesc.StateChanged(STATE_CHANGE_TEXT);
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index a30360a..edf669e 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -952,7 +952,7 @@ uno::Any SAL_CALL ScFunctionListObj::getByName( const rtl::OUString& aName )
lang::WrappedTargetException, uno::RuntimeException)
{
SolarMutexGuard aGuard;
- String aNameStr(aName);
+ ::rtl::OUString aNameStr(aName);
const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
if ( pFuncList )
{
@@ -982,10 +982,10 @@ uno::Any SAL_CALL ScFunctionListObj::getByName( const rtl::OUString& aName )
sal_Int32 SAL_CALL ScFunctionListObj::getCount() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- USHORT nCount = 0;
+ sal_Int32 nCount = 0;
const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
if ( pFuncList )
- nCount = (USHORT)pFuncList->GetCount();
+ nCount = (sal_Int32)pFuncList->GetCount();
return nCount;
}
@@ -1045,10 +1045,10 @@ uno::Sequence<rtl::OUString> SAL_CALL ScFunctionListObj::getElementNames() throw
const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
if ( pFuncList )
{
- USHORT nCount = (USHORT)pFuncList->GetCount();
+ sal_uInt32 nCount = pFuncList->GetCount();
uno::Sequence<rtl::OUString> aSeq(nCount);
rtl::OUString* pAry = aSeq.getArray();
- for (USHORT nIndex=0; nIndex<nCount; nIndex++)
+ for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
{
const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
if ( pDesc && pDesc->pFuncName )
@@ -1063,20 +1063,19 @@ sal_Bool SAL_CALL ScFunctionListObj::hasByName( const rtl::OUString& aName )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- String aNameStr(aName);
const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
if ( pFuncList )
{
- USHORT nCount = (USHORT)pFuncList->GetCount();
- for (USHORT nIndex=0; nIndex<nCount; nIndex++)
+ sal_uInt32 nCount = pFuncList->GetCount();
+ for (sal_uInt32 nIndex=0; nIndex<nCount; nIndex++)
{
const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
//! Case-insensitiv ???
- if ( pDesc && pDesc->pFuncName && aNameStr == *pDesc->pFuncName )
- return TRUE;
+ if ( pDesc && pDesc->pFuncName && aName == *pDesc->pFuncName )
+ return sal_True;
}
}
- return FALSE;
+ return sal_False;
}
//------------------------------------------------------------------------
More information about the Libreoffice-commits
mailing list