Kaydet (Commit) f32da852 authored tarafından Noel Grandin's avatar Noel Grandin

convert include/formula/formulahelper.hxx from String to OUString

Change-Id: I4ab7595cecede03b4ad2a4b9dbe373e67c2912f4
üst 805738b0
...@@ -65,7 +65,8 @@ FormulaHelper::FormulaHelper(const IFunctionManager* _pFunctionManager) ...@@ -65,7 +65,8 @@ FormulaHelper::FormulaHelper(const IFunctionManager* _pFunctionManager)
{ {
m_pCharClass = m_pSysLocale->GetCharClassPtr(); m_pCharClass = m_pSysLocale->GetCharClassPtr();
} }
sal_Bool FormulaHelper::GetNextFunc( const String& rFormula,
sal_Bool FormulaHelper::GetNextFunc( const OUString& rFormula,
sal_Bool bBack, sal_Bool bBack,
xub_StrLen& rFStart, // Input and output xub_StrLen& rFStart, // Input and output
xub_StrLen* pFEnd, // = NULL xub_StrLen* pFEnd, // = NULL
...@@ -73,7 +74,7 @@ sal_Bool FormulaHelper::GetNextFunc( const String& rFormula, ...@@ -73,7 +74,7 @@ sal_Bool FormulaHelper::GetNextFunc( const String& rFormula,
::std::vector< OUString>* pArgs ) const // = NULL ::std::vector< OUString>* pArgs ) const // = NULL
{ {
xub_StrLen nOldStart = rFStart; xub_StrLen nOldStart = rFStart;
String aFname; OUString aFname;
rFStart = GetFunctionStart( rFormula, rFStart, bBack, ppFDesc ? &aFname : NULL ); rFStart = GetFunctionStart( rFormula, rFStart, bBack, ppFDesc ? &aFname : NULL );
sal_Bool bFound = ( rFStart != FUNC_NOTFOUND ); sal_Bool bFound = ( rFStart != FUNC_NOTFOUND );
...@@ -121,7 +122,7 @@ sal_Bool FormulaHelper::GetNextFunc( const String& rFormula, ...@@ -121,7 +122,7 @@ sal_Bool FormulaHelper::GetNextFunc( const String& rFormula,
//------------------------------------------------------------------------ //------------------------------------------------------------------------
void FormulaHelper::FillArgStrings( const String& rFormula, void FormulaHelper::FillArgStrings( const OUString& rFormula,
xub_StrLen nFuncPos, xub_StrLen nFuncPos,
sal_uInt16 nArgs, sal_uInt16 nArgs,
::std::vector< OUString >& _rArgs ) const ::std::vector< OUString >& _rArgs ) const
...@@ -140,31 +141,31 @@ void FormulaHelper::FillArgStrings( const String& rFormula, ...@@ -140,31 +141,31 @@ void FormulaHelper::FillArgStrings( const String& rFormula,
nEnd = GetArgStart( rFormula, nFuncPos, i+1 ); nEnd = GetArgStart( rFormula, nFuncPos, i+1 );
if ( nEnd != nStart ) if ( nEnd != nStart )
_rArgs.push_back(rFormula.Copy( nStart, nEnd-1-nStart )); _rArgs.push_back(rFormula.copy( nStart, nEnd-1-nStart ));
else else
_rArgs.push_back(String()), bLast = sal_True; _rArgs.push_back(OUString()), bLast = sal_True;
} }
else else
{ {
nEnd = GetFunctionEnd( rFormula, nFuncPos )-1; nEnd = GetFunctionEnd( rFormula, nFuncPos )-1;
if ( nStart < nEnd ) if ( nStart < nEnd )
_rArgs.push_back( rFormula.Copy( nStart, nEnd-nStart ) ); _rArgs.push_back( rFormula.copy( nStart, nEnd-nStart ) );
else else
_rArgs.push_back(String()); _rArgs.push_back(OUString());
} }
} }
if ( bLast ) if ( bLast )
for ( ; i<nArgs; i++ ) for ( ; i<nArgs; i++ )
_rArgs.push_back(String()); _rArgs.push_back(OUString());
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
void FormulaHelper::GetArgStrings( ::std::vector< OUString >& _rArgs void FormulaHelper::GetArgStrings( ::std::vector< OUString >& _rArgs,
,const String& rFormula, const OUString& rFormula,
xub_StrLen nFuncPos, xub_StrLen nFuncPos,
sal_uInt16 nArgs ) const sal_uInt16 nArgs ) const
{ {
if (nArgs) if (nArgs)
{ {
...@@ -187,12 +188,12 @@ inline sal_Bool IsFormulaText( const CharClass* _pCharClass,const String& rStr, ...@@ -187,12 +188,12 @@ inline sal_Bool IsFormulaText( const CharClass* _pCharClass,const String& rStr,
} }
xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula, xub_StrLen FormulaHelper::GetFunctionStart( const OUString& rFormula,
xub_StrLen nStart, xub_StrLen nStart,
sal_Bool bBack, sal_Bool bBack,
String* pFuncName ) const OUString* pFuncName ) const
{ {
xub_StrLen nStrLen = rFormula.Len(); xub_StrLen nStrLen = rFormula.getLength();
if ( nStrLen < nStart ) if ( nStrLen < nStart )
return nStart; return nStart;
...@@ -210,15 +211,15 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula, ...@@ -210,15 +211,15 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula,
{ {
while ( !bFound && (nParPos > 0) ) while ( !bFound && (nParPos > 0) )
{ {
if ( rFormula.GetChar(nParPos) == '"' ) if ( rFormula[nParPos] == '"' )
{ {
nParPos--; nParPos--;
while ( (nParPos > 0) && rFormula.GetChar(nParPos) != '"' ) while ( (nParPos > 0) && rFormula[nParPos] != '"' )
nParPos--; nParPos--;
if (nParPos > 0) if (nParPos > 0)
nParPos--; nParPos--;
} }
else if ( (bFound = ( rFormula.GetChar(nParPos) == '(' ) ) == sal_False ) else if ( (bFound = ( rFormula[nParPos] == '(' ) ) == sal_False )
nParPos--; nParPos--;
} }
} }
...@@ -226,14 +227,14 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula, ...@@ -226,14 +227,14 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula,
{ {
while ( !bFound && (nParPos < nStrLen) ) while ( !bFound && (nParPos < nStrLen) )
{ {
if ( rFormula.GetChar(nParPos) == '"' ) if ( rFormula[nParPos] == '"' )
{ {
nParPos++; nParPos++;
while ( (nParPos < nStrLen) && rFormula.GetChar(nParPos) != '"' ) while ( (nParPos < nStrLen) && rFormula[nParPos] != '"' )
nParPos++; nParPos++;
nParPos++; nParPos++;
} }
else if ( (bFound = ( rFormula.GetChar(nParPos) == '(' ) ) == sal_False ) else if ( (bFound = ( rFormula[nParPos] == '(' ) ) == sal_False )
nParPos++; nParPos++;
} }
} }
...@@ -254,7 +255,7 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula, ...@@ -254,7 +255,7 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula,
{ {
// Function found // Function found
if ( pFuncName ) if ( pFuncName )
*pFuncName = rFormula.Copy( nFStart, nParPos-nFStart ); *pFuncName = rFormula.copy( nFStart, nParPos-nFStart );
} }
else // Brackets without function -> keep searching else // Brackets without function -> keep searching
{ {
...@@ -271,7 +272,7 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula, ...@@ -271,7 +272,7 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula,
{ {
nFStart = FUNC_NOTFOUND; nFStart = FUNC_NOTFOUND;
if ( pFuncName ) if ( pFuncName )
pFuncName->Erase(); (*pFuncName) = "";
} }
} }
while(bRepeat); while(bRepeat);
...@@ -281,9 +282,9 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula, ...@@ -281,9 +282,9 @@ xub_StrLen FormulaHelper::GetFunctionStart( const String& rFormula,
//------------------------------------------------------------------------ //------------------------------------------------------------------------
xub_StrLen FormulaHelper::GetFunctionEnd( const String& rStr, xub_StrLen nStart ) const xub_StrLen FormulaHelper::GetFunctionEnd( const OUString& rStr, xub_StrLen nStart ) const
{ {
xub_StrLen nStrLen = rStr.Len(); xub_StrLen nStrLen = rStr.getLength();
if ( nStrLen < nStart ) if ( nStrLen < nStart )
return nStart; return nStart;
...@@ -294,12 +295,12 @@ xub_StrLen FormulaHelper::GetFunctionEnd( const String& rStr, xub_StrLen nStart ...@@ -294,12 +295,12 @@ xub_StrLen FormulaHelper::GetFunctionEnd( const String& rStr, xub_StrLen nStart
while ( !bFound && (nStart < nStrLen) ) while ( !bFound && (nStart < nStrLen) )
{ {
sal_Unicode c = rStr.GetChar(nStart); sal_Unicode c = rStr[nStart];
if ( c == '"' ) if ( c == '"' )
{ {
nStart++; nStart++;
while ( (nStart < nStrLen) && rStr.GetChar(nStart) != '"' ) while ( (nStart < nStrLen) && rStr[nStart] != '"' )
nStart++; nStart++;
} }
else if ( c == open ) else if ( c == open )
...@@ -339,9 +340,9 @@ xub_StrLen FormulaHelper::GetFunctionEnd( const String& rStr, xub_StrLen nStart ...@@ -339,9 +340,9 @@ xub_StrLen FormulaHelper::GetFunctionEnd( const String& rStr, xub_StrLen nStart
//------------------------------------------------------------------ //------------------------------------------------------------------
xub_StrLen FormulaHelper::GetArgStart( const String& rStr, xub_StrLen nStart, sal_uInt16 nArg ) const xub_StrLen FormulaHelper::GetArgStart( const OUString& rStr, xub_StrLen nStart, sal_uInt16 nArg ) const
{ {
xub_StrLen nStrLen = rStr.Len(); xub_StrLen nStrLen = rStr.getLength();
if ( nStrLen < nStart ) if ( nStrLen < nStart )
return nStart; return nStart;
...@@ -352,12 +353,12 @@ xub_StrLen FormulaHelper::GetArgStart( const String& rStr, xub_StrLen nStart, sa ...@@ -352,12 +353,12 @@ xub_StrLen FormulaHelper::GetArgStart( const String& rStr, xub_StrLen nStart, sa
while ( !bFound && (nStart < nStrLen) ) while ( !bFound && (nStart < nStrLen) )
{ {
sal_Unicode c = rStr.GetChar(nStart); sal_Unicode c = rStr[nStart];
if ( c == '"' ) if ( c == '"' )
{ {
nStart++; nStart++;
while ( (nStart < nStrLen) && rStr.GetChar(nStart) != '"' ) while ( (nStart < nStrLen) && rStr[nStart] != '"' )
nStart++; nStart++;
} }
else if ( c == open ) else if ( c == open )
......
...@@ -46,27 +46,27 @@ namespace formula ...@@ -46,27 +46,27 @@ namespace formula
inline const CharClass* GetCharClass() const { return m_pCharClass; } inline const CharClass* GetCharClass() const { return m_pCharClass; }
sal_Bool GetNextFunc( const String& rFormula, sal_Bool GetNextFunc( const OUString& rFormula,
sal_Bool bBack, sal_Bool bBack,
xub_StrLen& rFStart, // Ein- und Ausgabe xub_StrLen& rFStart, // Ein- und Ausgabe
xub_StrLen* pFEnd = NULL, xub_StrLen* pFEnd = NULL,
const IFunctionDescription** ppFDesc = NULL, const IFunctionDescription** ppFDesc = NULL,
::std::vector< OUString>* pArgs = NULL ) const; ::std::vector< OUString>* pArgs = NULL ) const;
xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart, xub_StrLen GetFunctionStart( const OUString& rFormula, xub_StrLen nStart,
sal_Bool bBack, String* pFuncName = NULL ) const; sal_Bool bBack, OUString* pFuncName = NULL ) const;
xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart ) const; xub_StrLen GetFunctionEnd ( const OUString& rFormula, xub_StrLen nStart ) const;
xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart, xub_StrLen GetArgStart ( const OUString& rFormula, xub_StrLen nStart,
sal_uInt16 nArg ) const; sal_uInt16 nArg ) const;
void GetArgStrings ( ::std::vector< OUString >& _rArgs, void GetArgStrings ( ::std::vector< OUString >& _rArgs,
const String& rFormula, const OUString& rFormula,
xub_StrLen nFuncPos, xub_StrLen nFuncPos,
sal_uInt16 nArgs ) const; sal_uInt16 nArgs ) const;
void FillArgStrings ( const String& rFormula, void FillArgStrings ( const OUString& rFormula,
xub_StrLen nFuncPos, xub_StrLen nFuncPos,
sal_uInt16 nArgs, sal_uInt16 nArgs,
::std::vector< OUString >& _rArgs ) const; ::std::vector< OUString >& _rArgs ) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment