diff options
author | Eike Rathke <erack@redhat.com> | 2017-01-05 16:32:24 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-01-06 00:45:59 +0000 |
commit | 964cf72012b80ee4cab8923939182450bab28a4f (patch) | |
tree | 218cac876e21a8df2bd63ba64e6fd5193f4a154b /formula | |
parent | cdd309c23de58af306450edfac5d3e74e5c2a913 (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
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)); } |