Kaydet (Commit) 857be5b2 authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#105024 generate and parse detailed "#ERRxxx!" error constants

Change-Id: I4e5d98cdbbc2f3e7746cd3892f70151376bc5808
üst f91dc034
...@@ -1185,6 +1185,17 @@ FormulaError FormulaCompiler::GetErrorConstant( const OUString& rName ) const ...@@ -1185,6 +1185,17 @@ FormulaError FormulaCompiler::GetErrorConstant( const OUString& rName ) const
; // nothing ; // nothing
} }
} }
else
{
// Per convention recognize detailed "#ERRxxx!" constants, always
// untranslated.
if (rName.startsWithIgnoreAsciiCase("#ERR") && rName[rName.getLength()-1] == '!')
{
sal_uInt32 nErr = rName.copy( 4, rName.getLength() - 5).toUInt32();
if (0 < nErr && nErr <= SAL_MAX_UINT16)
nError = static_cast<FormulaError>(nErr);
}
}
return nError; return nError;
} }
...@@ -1203,7 +1214,6 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError ...@@ -1203,7 +1214,6 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError
OpCode eOp; OpCode eOp;
switch (nError) switch (nError)
{ {
default:
case FormulaError::NoCode: case FormulaError::NoCode:
eOp = ocErrNull; eOp = ocErrNull;
break; break;
...@@ -1225,6 +1235,15 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError ...@@ -1225,6 +1235,15 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError
case FormulaError::NotAvailable: case FormulaError::NotAvailable:
eOp = ocErrNA; eOp = ocErrNA;
break; break;
default:
{
// Per convention create detailed "#ERRxxx!" constants, always
// untranslated.
rBuffer.append("#ERR");
rBuffer.append(static_cast<sal_Int32>(nError));
rBuffer.append('!');
return;
}
} }
rBuffer.append( mxSymbols->getSymbol( eOp)); rBuffer.append( mxSymbols->getSymbol( eOp));
} }
......
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