diff options
author | Eike Rathke <erack@redhat.com> | 2017-01-05 16:32:24 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-01-05 18:23:45 +0100 |
commit | 857be5b2db4b2726306199bc279942f621bf55d8 (patch) | |
tree | c7c32cb4fe3cbd5fe91dd84f575cc54869c6b0e3 /formula | |
parent | f91dc0342de13e648dba5d9a93c01db23ae83533 (diff) |
Resolves: tdf#105024 generate and parse detailed "#ERRxxx!" error constants
Change-Id: I4e5d98cdbbc2f3e7746cd3892f70151376bc5808
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index b0a2adaa813f..9e23149d2dd4 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1185,6 +1185,17 @@ FormulaError FormulaCompiler::GetErrorConstant( const OUString& rName ) const ; // 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; } @@ -1203,7 +1214,6 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError OpCode eOp; switch (nError) { - default: case FormulaError::NoCode: eOp = ocErrNull; break; @@ -1225,6 +1235,15 @@ void FormulaCompiler::AppendErrorConstant( OUStringBuffer& rBuffer, FormulaError case FormulaError::NotAvailable: eOp = ocErrNA; 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)); } |