From 20cd7f058892c76c9d794c6ff0a776ced306b34d Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Wed, 18 Aug 2010 18:56:10 +0200 Subject: calc58: #i113739# make N return 0 for all strings again --- sc/source/core/tool/interpr1.cxx | 23 +++++++---------------- sc/source/core/tool/interpr4.cxx | 6 ++++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2e6ce932b466..1e4c02967152 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2481,22 +2481,13 @@ void ScInterpreter::ScN() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScN" ); USHORT nErr = nGlobalError; nGlobalError = 0; - double fVal; - if ( GetRawStackType() == svString ) - { - fVal = 0.0; - Pop(); - } - else - { - // Temporarily override the ConvertStringToValue() error for - // GetCellValue() / GetCellValueOrZero() - USHORT nSErr = mnStringNoValueError; - mnStringNoValueError = errCellNoValue; - fVal = GetDouble(); - mnStringNoValueError = nSErr; - } - if ( nGlobalError == NOTAVAILABLE || nGlobalError == errIllegalArgument ) + // Temporarily override the ConvertStringToValue() error for + // GetCellValue() / GetCellValueOrZero() + USHORT nSErr = mnStringNoValueError; + mnStringNoValueError = errCellNoValue; + double fVal = GetDouble(); + mnStringNoValueError = nSErr; + if ( nGlobalError == NOTAVAILABLE || nGlobalError == errCellNoValue ) nGlobalError = 0; // N(#NA) and N("text") are ok if ( !nGlobalError && nErr != NOTAVAILABLE ) nGlobalError = nErr; diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 5c326001ff02..dccb2355b3d5 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -231,6 +231,12 @@ double ScInterpreter::ConvertStringToValue( const String& rStr ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertStringToValue" ); double fValue = 0.0; + if (mnStringNoValueError == errCellNoValue) + { + // Requested that all strings result in 0, error handled by caller. + SetError( mnStringNoValueError); + return fValue; + } ::rtl::OUString aStr( rStr); rtl_math_ConversionStatus eStatus; sal_Int32 nParseEnd; -- cgit