formula/source/core/api/FormulaCompiler.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
New commits: commit 964cf72012b80ee4cab8923939182450bab28a4f Author: Eike Rathke <[email protected]> Date: Thu Jan 5 16:32:24 2017 +0100 Resolves: tdf#105024 generate and parse detailed "#ERRxxx!" error constants Change-Id: I4e5d98cdbbc2f3e7746cd3892f70151376bc5808 (cherry picked from commit 857be5b2db4b2726306199bc279942f621bf55d8) Reviewed-on: https://gerrit.libreoffice.org/32761 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins <[email protected]> diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index b0a2ada..9e23149 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)); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
