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

convert aCorrectedFormula in formula::FormulaCompiler to OUString

Change-Id: I048ec33effc33e94943f5110d6a9a0937a1dfdfe
üst 8f23a3b0
......@@ -1382,9 +1382,9 @@ void FormulaCompiler::Factor()
{
if ( eOp == ocStop )
{ // trailing operator w/o operand
xub_StrLen nLen = aCorrectedFormula.Len();
sal_Int32 nLen = aCorrectedFormula.getLength();
if ( nLen )
aCorrectedFormula.Erase( nLen - 1 );
aCorrectedFormula = aCorrectedFormula.copy( 0, nLen - 1 );
aCorrectedSymbol = "";
bCorrected = true;
}
......@@ -1592,7 +1592,7 @@ bool FormulaCompiler::CompileTokenArray()
{
if ( bAutoCorrect )
{
aCorrectedFormula.Erase();
aCorrectedFormula = "";
aCorrectedSymbol = "";
}
pArr->nRefs = 0; // count from start
......@@ -1604,7 +1604,7 @@ bool FormulaCompiler::CompileTokenArray()
if ( bWasForced )
{
if ( bAutoCorrect )
aCorrectedFormula = '=';
aCorrectedFormula = "=";
}
pArr->ClearRecalcMode();
pArr->Reset();
......@@ -1947,18 +1947,18 @@ OpCode FormulaCompiler::NextToken()
}
else
{
xub_StrLen nPos = aCorrectedFormula.Len();
sal_Int32 nPos = aCorrectedFormula.getLength();
if ( nPos )
{
nPos--;
sal_Unicode c = aCorrectedFormula.GetChar( nPos );
sal_Unicode c = aCorrectedFormula[ nPos ];
switch ( eOp )
{ // swap operators
case ocGreater:
if ( c == mxSymbols->getSymbolChar( ocEqual) )
{ // >= instead of =>
aCorrectedFormula.SetChar( nPos,
mxSymbols->getSymbolChar( ocGreater) );
aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1,
OUString( mxSymbols->getSymbolChar(ocGreater) ) );
aCorrectedSymbol = OUString(c);
bCorrected = true;
}
......@@ -1966,15 +1966,15 @@ OpCode FormulaCompiler::NextToken()
case ocLess:
if ( c == mxSymbols->getSymbolChar( ocEqual) )
{ // <= instead of =<
aCorrectedFormula.SetChar( nPos,
mxSymbols->getSymbolChar( ocLess) );
aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1,
OUString( mxSymbols->getSymbolChar(ocLess) ) );
aCorrectedSymbol = OUString(c);
bCorrected = true;
}
else if ( c == mxSymbols->getSymbolChar( ocGreater) )
{ // <> instead of ><
aCorrectedFormula.SetChar( nPos,
mxSymbols->getSymbolChar( ocLess) );
aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1,
OUString( mxSymbols->getSymbolChar(ocLess) ) );
aCorrectedSymbol = OUString(c);
bCorrected = true;
}
......@@ -1982,8 +1982,8 @@ OpCode FormulaCompiler::NextToken()
case ocMul:
if ( c == mxSymbols->getSymbolChar( ocSub) )
{ // *- instead of -*
aCorrectedFormula.SetChar( nPos,
mxSymbols->getSymbolChar( ocMul) );
aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1,
OUString( mxSymbols->getSymbolChar(ocMul) ) );
aCorrectedSymbol = OUString(c);
bCorrected = true;
}
......@@ -1991,8 +1991,8 @@ OpCode FormulaCompiler::NextToken()
case ocDiv:
if ( c == mxSymbols->getSymbolChar( ocSub) )
{ // /- instead of -/
aCorrectedFormula.SetChar( nPos,
mxSymbols->getSymbolChar( ocDiv) );
aCorrectedFormula = aCorrectedFormula.replaceAt( nPos, 1,
OUString( mxSymbols->getSymbolChar(ocDiv) ) );
aCorrectedSymbol = OUString(c);
bCorrected = true;
}
......
......@@ -311,7 +311,7 @@ protected:
bool MergeRangeReference( FormulaToken * * const pCode1, FormulaToken * const * const pCode2 );
String aCorrectedFormula; // autocorrected Formula
OUString aCorrectedFormula; // autocorrected Formula
OUString aCorrectedSymbol; // autocorrected Symbol
OpCodeMapPtr mxSymbols; // which symbols are used
......
......@@ -425,7 +425,7 @@ public:
void SetExtendedErrorDetection( ExtendedErrorDetection eVal ) { meExtendedErrorDetection = eVal; }
bool IsCorrected() { return bCorrected; }
const String& GetCorrectedFormula() { return aCorrectedFormula; }
const OUString& GetCorrectedFormula() { return aCorrectedFormula; }
// Use convention from this->aPos by default
ScTokenArray* CompileString( const OUString& rFormula );
......
......@@ -3664,7 +3664,7 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
bCorrected = false;
if ( bAutoCorrect )
{
aCorrectedFormula.Erase();
aCorrectedFormula = "";
aCorrectedSymbol = "";
}
sal_uInt8 nForced = 0; // ==formula forces recalc even if cell is not visible
......@@ -3673,14 +3673,14 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
nSrcPos++;
nForced++;
if ( bAutoCorrect )
aCorrectedFormula += '=';
aCorrectedFormula += "=";
}
if( aFormula.GetChar(nSrcPos) == '=' )
{
nSrcPos++;
nForced++;
if ( bAutoCorrect )
aCorrectedFormula += '=';
aCorrectedFormula += "=";
}
struct FunctionStack
{
......
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