include/formula/errorcodes.hxx | 8 -- sc/inc/math.hxx | 2 sc/inc/scmatrix.hxx | 2 sc/qa/unit/subsequent_filters-test.cxx | 2 sc/qa/unit/ucalc_formula.cxx | 8 +- sc/source/core/data/column2.cxx | 8 +- sc/source/core/data/dbdocutl.cxx | 2 sc/source/core/data/dpoutput.cxx | 2 sc/source/core/data/global.cxx | 84 +++++++++++++++--------------- sc/source/core/data/global2.cxx | 2 sc/source/core/data/simpleformulacalc.cxx | 4 - sc/source/core/data/table4.cxx | 8 +- sc/source/core/inc/interpre.hxx | 6 +- sc/source/core/tool/addincol.cxx | 18 +++--- sc/source/core/tool/consoli.cxx | 2 sc/source/core/tool/interpr7.cxx | 22 +++---- sc/source/core/tool/jumpmatrix.cxx | 14 ++--- sc/source/core/tool/scmatrix.cxx | 50 ++++++++--------- sc/source/filter/excel/excform.cxx | 36 ++++++------ sc/source/filter/excel/xltools.cxx | 50 ++++++++--------- sc/source/ui/app/scmod.cxx | 2 sc/source/ui/unoobj/cellsuno.cxx | 2 sc/source/ui/unoobj/funcuno.cxx | 4 - 23 files changed, 166 insertions(+), 172 deletions(-)
New commits: commit fa507ae23e1e5e0dd73fe881284bfb41a2eb1315 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Tue May 3 21:22:28 2016 -0400 Replace namespace ScErrorCodes with formula... and remove that 'using namespace' statement in the header... Change-Id: I2f994af5088ce6d1ffe92c8d36285a4f6fdd2248 Reviewed-on: https://gerrit.libreoffice.org/24628 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoff...@kohei.us> diff --git a/include/formula/errorcodes.hxx b/include/formula/errorcodes.hxx index 6c20d8a..13597b9 100644 --- a/include/formula/errorcodes.hxx +++ b/include/formula/errorcodes.hxx @@ -22,8 +22,7 @@ #include <rtl/math.hxx> -namespace ScErrorCodes -{ +namespace formula { const sal_uInt16 errIllegalChar = 501; const sal_uInt16 errIllegalArgument = 502; @@ -111,10 +110,7 @@ inline sal_uInt16 GetDoubleErrorValue( double fVal ) return (sal_uInt16)(nErr & 0x0000ffff); // any other error } -} // namespace ScErrorCodes - -// yes, exceptionally we put a "using namespace" in a header file.. -using namespace ScErrorCodes; +} // namespace formula #endif // INCLUDED_FORMULA_ERRORCODES_HXX diff --git a/sc/inc/math.hxx b/sc/inc/math.hxx index 13355a9..ecea704 100644 --- a/sc/inc/math.hxx +++ b/sc/inc/math.hxx @@ -30,7 +30,7 @@ namespace sc { inline double div( const double& fNumerator, const double& fDenominator ) { return (fDenominator != 0.0) ? (fNumerator / fDenominator) : - CreateDoubleError( errDivisionByZero); + formula::CreateDoubleError( formula::errDivisionByZero); } /** Return fNumerator/fDenominator if fDenominator!=0 else +-Infinity if diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 3e41d5d..aacb9ce 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -64,7 +64,7 @@ struct ScMatrixValue const svl::SharedString& GetString() const { return aStr; } /// Only valid if ScMatrix methods indicate that this is no string! - sal_uInt16 GetError() const { return GetDoubleErrorValue( fVal); } + sal_uInt16 GetError() const { return formula::GetDoubleErrorValue( fVal); } /// Only valid if ScMatrix methods indicate that this is a boolean bool GetBoolean() const { return fVal != 0.0; } diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 847acc1..0c1428e 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -3164,7 +3164,7 @@ void ScFiltersTest::testErrorOnExternalReferences() ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(0,0,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoName, pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(formula::errNoName, pFC->GetErrCode()); if (!checkFormula(rDoc, ScAddress(0,0,0), "'file:///Path/To/FileA.ods'#$Sheet1.A1A")) CPPUNIT_FAIL("Formula changed"); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 54f1318..ffce49a 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1141,11 +1141,11 @@ void Test::testFormulaRefUpdate() aPos = ScAddress(2,1,0); ScFormulaCell* pFC = m_pDoc->GetFormulaCell(aPos); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(formula::errNoRef, pFC->GetErrCode()); aPos = ScAddress(2,2,0); pFC = m_pDoc->GetFormulaCell(aPos); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(formula::errNoRef, pFC->GetErrCode()); // Clear all and start over. clearRange(m_pDoc, ScRange(0,0,0,10,10,0)); @@ -1245,11 +1245,11 @@ void Test::testFormulaRefUpdate() // Both A4 and A5 should show #REF! errors. pFC = m_pDoc->GetFormulaCell(ScAddress(0,3,0)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(formula::errNoRef, pFC->GetErrCode()); pFC = m_pDoc->GetFormulaCell(ScAddress(0,4,0)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL(ScErrorCodes::errNoRef, pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(formula::errNoRef, pFC->GetErrCode()); m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 8921787..9966404 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2254,7 +2254,7 @@ public: ScAddress aAdr(mnCol, nThisRow, mnTab); if (nErr) - fVal = CreateDoubleError(nErr); + fVal = formula::CreateDoubleError(nErr); if (!aBucket.maNumVals.empty() && nThisRow == nPrevRow + 1) { @@ -2387,7 +2387,7 @@ bool appendToBlock( if (aRes.meType == sc::FormulaResultValue::Invalid || aRes.mnError) { - if (aRes.mnError == ScErrorCodes::errCircularReference) + if (aRes.mnError == formula::errCircularReference) { // This cell needs to be recalculated on next visit. rFC.SetErrCode(0); @@ -2508,7 +2508,7 @@ copyFirstFormulaBlock( sc::FormulaResultValue aRes = rFC.GetResult(); if (aRes.meType == sc::FormulaResultValue::Invalid || aRes.mnError) { - if (aRes.mnError == ScErrorCodes::errCircularReference) + if (aRes.mnError == formula::errCircularReference) { // This cell needs to be recalculated on next visit. rFC.SetErrCode(0); @@ -2753,7 +2753,7 @@ void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLe for (; pResults != pResEnd; ++pResults, ++itCell) { ScFormulaCell& rCell = **itCell; - sal_uInt16 nErr = GetDoubleErrorValue(*pResults); + sal_uInt16 nErr = formula::GetDoubleErrorValue(*pResults); if (nErr != 0) rCell.SetResultError(nErr); else diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx index caf30c8..6e681f6 100644 --- a/sc/source/core/data/dbdocutl.cxx +++ b/sc/source/core/data/dbdocutl.cxx @@ -157,7 +157,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB pDoc->SetEmptyCell(aPos); else if (bError) { - pDoc->SetError( nCol, nRow, nTab, NOTAVAILABLE ); + pDoc->SetError( nCol, nRow, nTab, formula::NOTAVAILABLE ); } else if (bValue) { diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index a1d7968..75e9dd3 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -735,7 +735,7 @@ void ScDPOutput::DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab, const sheet::Data long nFlags = rData.Flags; if ( nFlags & sheet::DataResultFlags::ERROR ) { - pDoc->SetError( nCol, nRow, nTab, errNoValue ); + pDoc->SetError( nCol, nRow, nTab, formula::errNoValue ); } else if ( nFlags & sheet::DataResultFlags::HASDATA ) { diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index b878817..cab3b70 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -362,16 +362,16 @@ OUString ScGlobal::GetErrorString(sal_uInt16 nErrNumber) OUString sResStr; switch (nErrNumber) { - case NOTAVAILABLE : nErrNumber = STR_NV_STR; break; - case errNoRef : nErrNumber = STR_NO_REF_TABLE; break; - case errNoName : nErrNumber = STR_NO_NAME_REF; break; - case errNoAddin : nErrNumber = STR_NO_ADDIN; break; - case errNoMacro : nErrNumber = STR_NO_MACRO; break; - case errDoubleRef : - case errNoValue : nErrNumber = STR_NO_VALUE; break; - case errNoCode : nErrNumber = STR_NULL_ERROR; break; - case errDivisionByZero : nErrNumber = STR_DIV_ZERO; break; - case errIllegalFPOperation : nErrNumber = STR_NUM_ERROR; break; + case formula::NOTAVAILABLE : nErrNumber = STR_NV_STR; break; + case formula::errNoRef : nErrNumber = STR_NO_REF_TABLE; break; + case formula::errNoName : nErrNumber = STR_NO_NAME_REF; break; + case formula::errNoAddin : nErrNumber = STR_NO_ADDIN; break; + case formula::errNoMacro : nErrNumber = STR_NO_MACRO; break; + case formula::errDoubleRef : + case formula::errNoValue : nErrNumber = STR_NO_VALUE; break; + case formula::errNoCode : nErrNumber = STR_NULL_ERROR; break; + case formula::errDivisionByZero : nErrNumber = STR_DIV_ZERO; break; + case formula::errIllegalFPOperation : nErrNumber = STR_NUM_ERROR; break; default : sResStr = GetRscString(STR_ERROR_STR) + OUString::number( nErrNumber ); nErrNumber = 0; @@ -389,86 +389,86 @@ OUString ScGlobal::GetLongErrorString(sal_uInt16 nErrNumber) case 0: break; case 1: - case errIllegalArgument: + case formula::errIllegalArgument: nErrNumber = STR_LONG_ERR_ILL_ARG; break; case 2: case 3: case 4: case 5: - case errIllegalFPOperation: + case formula::errIllegalFPOperation: nErrNumber = STR_LONG_ERR_ILL_FPO; break; - case errIllegalChar: + case formula::errIllegalChar: nErrNumber = STR_LONG_ERR_ILL_CHAR; break; - case errIllegalParameter: + case formula::errIllegalParameter: nErrNumber = STR_LONG_ERR_ILL_PAR; break; - case errSeparator: + case formula::errSeparator: nErrNumber = STR_LONG_ERR_ILL_SEP; break; - case errPair: - case errPairExpected: + case formula::errPair: + case formula::errPairExpected: nErrNumber = STR_LONG_ERR_PAIR; break; - case errOperatorExpected: + case formula::errOperatorExpected: nErrNumber = STR_LONG_ERR_OP_EXP; break; - case errVariableExpected: - case errParameterExpected: + case formula::errVariableExpected: + case formula::errParameterExpected: nErrNumber = STR_LONG_ERR_VAR_EXP; break; - case errCodeOverflow: + case formula::errCodeOverflow: nErrNumber = STR_LONG_ERR_CODE_OVF; break; - case errStringOverflow: + case formula::errStringOverflow: nErrNumber = STR_LONG_ERR_STR_OVF; break; - case errStackOverflow: + case formula::errStackOverflow: nErrNumber = STR_LONG_ERR_STACK_OVF; break; - case errMatrixSize: + case formula::errMatrixSize: nErrNumber = STR_LONG_ERR_MATRIX_SIZE; break; - case errIllegalJump: - case errUnknownState: - case errUnknownVariable: - case errUnknownOpCode: - case errUnknownStackVariable: - case errUnknownToken: - case errNoCode: - case errDoubleRef: + case formula::errIllegalJump: + case formula::errUnknownState: + case formula::errUnknownVariable: + case formula::errUnknownOpCode: + case formula::errUnknownStackVariable: + case formula::errUnknownToken: + case formula::errNoCode: + case formula::errDoubleRef: nErrNumber = STR_LONG_ERR_SYNTAX; break; - case errCircularReference: + case formula::errCircularReference: nErrNumber = STR_LONG_ERR_CIRC_REF; break; - case errNoConvergence: + case formula::errNoConvergence: nErrNumber = STR_LONG_ERR_NO_CONV; break; - case errNoRef: + case formula::errNoRef: nErrNumber = STR_LONG_ERR_NO_REF; break; - case errNoName: + case formula::errNoName: nErrNumber = STR_LONG_ERR_NO_NAME; break; - case errNoAddin: + case formula::errNoAddin: nErrNumber = STR_LONG_ERR_NO_ADDIN; break; - case errNoMacro: + case formula::errNoMacro: nErrNumber = STR_LONG_ERR_NO_MACRO; break; - case errDivisionByZero: + case formula::errDivisionByZero: nErrNumber = STR_LONG_ERR_DIV_ZERO; break; - case errNestedArray: + case formula::errNestedArray: nErrNumber = STR_ERR_LONG_NESTED_ARRAY; break; - case errNoValue: + case formula::errNoValue: nErrNumber = STR_LONG_ERR_NO_VALUE; break; - case NOTAVAILABLE: + case formula::NOTAVAILABLE: nErrNumber = STR_LONG_ERR_NV; break; default: diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index 87a3ae0..1862fa5 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -385,7 +385,7 @@ double ScGlobal::ConvertStringToValue( const OUString& rStr, const ScCalcConfig& // we provide a friendly way to convert string numbers into numbers in the UI. double fValue = 0.0; - if (nStringNoValueError == errCellNoValue) + if (nStringNoValueError == formula::errCellNoValue) { // Requested that all strings result in 0, error handled by caller. rError = nStringNoValueError; diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx index 63d8b54..b573544 100644 --- a/sc/source/core/data/simpleformulacalc.cxx +++ b/sc/source/core/data/simpleformulacalc.cxx @@ -113,7 +113,7 @@ double ScSimpleFormulaCalculator::GetValue() { Calculate(); - if ((!mpCode->GetCodeError() || mpCode->GetCodeError() == errDoubleRef) && + if ((!mpCode->GetCodeError() || mpCode->GetCodeError() == formula::errDoubleRef) && !maResult.GetResultError()) return maResult.GetDouble(); @@ -127,7 +127,7 @@ svl::SharedString ScSimpleFormulaCalculator::GetString() if (mbMatrixResult) return maMatrixFormulaResult; - if ((!mpCode->GetCodeError() || mpCode->GetCodeError() == errDoubleRef) && + if ((!mpCode->GetCodeError() || mpCode->GetCodeError() == formula::errDoubleRef) && !maResult.GetResultError()) return maResult.GetString(); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 27e5705..f576ff5 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1697,9 +1697,9 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, } if (bError) - aCol[nCol].SetError(static_cast<SCROW>(nRow), errNoValue); + aCol[nCol].SetError(static_cast<SCROW>(nRow), formula::errNoValue); else if (bOverflow) - aCol[nCol].SetError(static_cast<SCROW>(nRow), errIllegalFPOperation); + aCol[nCol].SetError(static_cast<SCROW>(nRow), formula::errIllegalFPOperation); else aCol[nCol].SetValue(static_cast<SCROW>(nRow), nVal); } @@ -1799,9 +1799,9 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, } if (bError) - aCol[nCol].SetError(static_cast<SCROW>(nRow), errNoValue); + aCol[nCol].SetError(static_cast<SCROW>(nRow), formula::errNoValue); else if (bOverflow) - aCol[nCol].SetError(static_cast<SCROW>(nRow), errIllegalFPOperation); + aCol[nCol].SetError(static_cast<SCROW>(nRow), formula::errIllegalFPOperation); else { nStringValue = (sal_Int32)nVal; diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index d58bad0..8321e3b 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -1030,7 +1030,7 @@ inline bool ScInterpreter::CheckStringResultLen( OUString& rResult, const OUStri { if ( rResult.getLength() + rAdd.getLength() > SAL_MAX_UINT16 ) { - SetError( errStringOverflow ); + SetError( formula::errStringOverflow ); rResult.clear(); return false; } @@ -1041,11 +1041,11 @@ inline void ScInterpreter::TreatDoubleError( double& rVal ) { if ( !::rtl::math::isFinite( rVal ) ) { - sal_uInt16 nErr = GetDoubleErrorValue( rVal ); + sal_uInt16 nErr = formula::GetDoubleErrorValue( rVal ); if ( nErr ) SetError( nErr ); else - SetError( errNoValue ); + SetError( formula::errNoValue ); rVal = 0.0; } } diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index d31542b..18fd947 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -1302,7 +1302,7 @@ bool ScUnoAddInCollection::FillFunctionDescFromData( const ScUnoAddInFuncData& r ScUnoAddInCall::ScUnoAddInCall( ScUnoAddInCollection& rColl, const OUString& rName, long nParamCount ) : bValidCount( false ), - nErrCode( errNoCode ), // before function was called + nErrCode( formula::errNoCode ), // before function was called bHasString( true ), fValue( 0.0 ), xMatrix( nullptr ) @@ -1476,24 +1476,24 @@ void ScUnoAddInCall::ExecuteCallWithArgs(uno::Sequence<uno::Any>& rCallArgs) } catch(lang::IllegalArgumentException&) { - nErrCode = errIllegalArgument; + nErrCode = formula::errIllegalArgument; } catch(const reflection::InvocationTargetException& rWrapped) { if ( rWrapped.TargetException.getValueType().equals( cppu::UnoType<lang::IllegalArgumentException>::get()) ) - nErrCode = errIllegalArgument; + nErrCode = formula::errIllegalArgument; else if ( rWrapped.TargetException.getValueType().equals( cppu::UnoType<sheet::NoConvergenceException>::get()) ) - nErrCode = errNoConvergence; + nErrCode = formula::errNoConvergence; else - nErrCode = errNoValue; + nErrCode = formula::errNoValue; } catch(uno::Exception&) { - nErrCode = errNoValue; + nErrCode = formula::errNoValue; } if (!nErrCode) @@ -1513,7 +1513,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes ) switch (eClass) { case uno::TypeClass_VOID: - nErrCode = NOTAVAILABLE; // #NA + nErrCode = formula::NOTAVAILABLE; // #NA break; case uno::TypeClass_ENUM: @@ -1549,7 +1549,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes ) xVarRes.set( xInterface, uno::UNO_QUERY ); if (!xVarRes.is()) - nErrCode = errNoValue; // unknown interface + nErrCode = formula::errNoValue; // unknown interface } break; @@ -1687,7 +1687,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes ) } if (!xMatrix) // no array found - nErrCode = errNoValue; //TODO: code for error in return type??? + nErrCode = formula::errNoValue; //TODO: code for error in return type??? } } diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx index dd0f101..67bf01d 100644 --- a/sc/source/core/tool/consoli.cxx +++ b/sc/source/core/tool/consoli.cxx @@ -662,7 +662,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, ppSumSqr[nArrX][nArrY]); if (ppCount[nArrX][nArrY] < 0.0) pDestDoc->SetError( sal::static_int_cast<SCCOL>(nCol+nArrX), - sal::static_int_cast<SCROW>(nRow+nArrY), nTab, errNoValue ); + sal::static_int_cast<SCROW>(nRow+nArrY), nTab, formula::errNoValue ); else pDestDoc->SetValue( sal::static_int_cast<SCCOL>(nCol+nArrX), sal::static_int_cast<SCROW>(nRow+nArrY), nTab, fVal ); diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index 67e1039..7b2624b 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -37,7 +37,7 @@ void ScInterpreter::ScFilterXML() OUString aString = GetString().getString(); if(aString.isEmpty() || aXPathExpression.isEmpty()) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -54,7 +54,7 @@ void ScInterpreter::ScFilterXML() if(!pDoc) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -66,7 +66,7 @@ void ScInterpreter::ScFilterXML() if(!pXPathObj) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -81,7 +81,7 @@ void ScInterpreter::ScFilterXML() xmlNodeSetPtr pNodeSet = pXPathObj->nodesetval; if(!pNodeSet) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -104,7 +104,7 @@ void ScInterpreter::ScFilterXML() } else { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } } @@ -154,14 +154,14 @@ void ScInterpreter::ScWebservice() if(aURI.isEmpty()) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), uno::UNO_QUERY ); if(!xFileAccess.is()) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -172,12 +172,12 @@ void ScInterpreter::ScWebservice() catch (...) { // don't let any exceptions pass - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } if ( !xStream.is() ) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -221,7 +221,7 @@ void ScInterpreter::ScEncodeURL() OUString aStr = GetString().getString(); if ( aStr.isEmpty() ) { - PushError( errNoValue ); + PushError( formula::errNoValue ); return; } @@ -252,7 +252,7 @@ void ScInterpreter::ScDebugVar() SvtMiscOptions aMiscOptions; if (!aMiscOptions.IsExperimentalMode()) { - PushError(ScErrorCodes::errNoName); + PushError(formula::errNoName); return; } diff --git a/sc/source/core/tool/jumpmatrix.cxx b/sc/source/core/tool/jumpmatrix.cxx index 48d0a57..b31d2f6 100644 --- a/sc/source/core/tool/jumpmatrix.cxx +++ b/sc/source/core/tool/jumpmatrix.cxx @@ -46,7 +46,7 @@ ScJumpMatrix::ScJumpMatrix(SCSIZE nColsP, SCSIZE nRowsP) // Initialize result matrix in case of // a premature end of the interpreter // due to errors. - pMat->FillDouble(CreateDoubleError(NOTAVAILABLE), 0, 0, nCols - 1, nRows - 1); + pMat->FillDouble(formula::CreateDoubleError(formula::NOTAVAILABLE), 0, 0, nCols - 1, nRows - 1); /*! pJump not initialized */ } @@ -151,15 +151,15 @@ void ScJumpMatrix::SetNewResMat(SCSIZE nNewCols, SCSIZE nNewRows) pMat = pMat->CloneAndExtend(nNewCols, nNewRows); if (nResMatCols < nNewCols) { - pMat->FillDouble(CreateDoubleError( - NOTAVAILABLE), nResMatCols, 0, nNewCols - 1, - nResMatRows - 1); + pMat->FillDouble( + formula::CreateDoubleError(formula::NOTAVAILABLE), + nResMatCols, 0, nNewCols - 1, nResMatRows - 1); } if (nResMatRows < nNewRows) { - pMat->FillDouble(CreateDoubleError( - NOTAVAILABLE), 0, nResMatRows, nNewCols - 1, - nNewRows - 1); + pMat->FillDouble( + formula::CreateDoubleError(formula::NOTAVAILABLE), + 0, nResMatRows, nNewCols - 1, nNewRows - 1); } if (nRows == 1 && nCurCol != 0) { diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 4e33efa..ef8700d 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -347,7 +347,7 @@ void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR) else { // Invalid matrix size, allocate 1x1 matrix with error value. - maMat.resize(1, 1, CreateDoubleError( errMatrixSize)); + maMat.resize(1, 1, formula::CreateDoubleError( formula::errMatrixSize)); maMatFlag.resize(1, 1); } } @@ -362,7 +362,7 @@ void ScMatrixImpl::Resize(SCSIZE nC, SCSIZE nR, double fVal) else { // Invalid matrix size, allocate 1x1 matrix with error value. - maMat.resize(1, 1, CreateDoubleError( errStackOverflow)); + maMat.resize(1, 1, formula::CreateDoubleError( formula::errStackOverflow)); maMatFlag.resize(1, 1); } } @@ -508,7 +508,7 @@ void ScMatrixImpl::PutEmptyPath(SCSIZE nC, SCSIZE nR) void ScMatrixImpl::PutError( sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR ) { - maMat.set(nR, nC, CreateDoubleError(nErrorCode)); + maMat.set(nR, nC, formula::CreateDoubleError(nErrorCode)); } void ScMatrixImpl::PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR) @@ -526,12 +526,12 @@ sal_uInt16 ScMatrixImpl::GetError( SCSIZE nC, SCSIZE nR) const if (ValidColRowOrReplicated( nC, nR )) { double fVal = maMat.get_numeric(nR, nC); - return GetDoubleErrorValue(fVal); + return formula::GetDoubleErrorValue(fVal); } else { OSL_FAIL("ScMatrixImpl::GetError: dimension error"); - return errNoValue; + return formula::errNoValue; } } @@ -542,7 +542,7 @@ double ScMatrixImpl::GetDouble(SCSIZE nC, SCSIZE nR) const double fVal = maMat.get_numeric(nR, nC); if ( pErrorInterpreter ) { - sal_uInt16 nError = GetDoubleErrorValue(fVal); + sal_uInt16 nError = formula::GetDoubleErrorValue(fVal); if ( nError ) SetErrorAtInterpreter( nError); } @@ -551,7 +551,7 @@ double ScMatrixImpl::GetDouble(SCSIZE nC, SCSIZE nR) const else { OSL_FAIL("ScMatrixImpl::GetDouble: dimension error"); - return CreateDoubleError( errNoValue); + return formula::CreateDoubleError( formula::errNoValue); } } @@ -581,7 +581,7 @@ svl::SharedString ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const default: OSL_FAIL("ScMatrixImpl::GetString: access error, no string"); } - SetErrorAtInterpreter(GetDoubleErrorValue(fErr)); + SetErrorAtInterpreter(formula::GetDoubleErrorValue(fErr)); } else { @@ -633,7 +633,7 @@ svl::SharedString ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE ; } - sal_uInt16 nError = GetDoubleErrorValue(fVal); + sal_uInt16 nError = formula::GetDoubleErrorValue(fVal); if (nError) { SetErrorAtInterpreter( nError); @@ -992,7 +992,7 @@ double EvalMatrix(const MatrixImplType& rMat) mdds::mtm::element_t eType = rMat.get_type(aPos); if (eType != mdds::mtm::element_numeric && eType != mdds::mtm::element_boolean) // assuming a CompareMat this is an error - return CreateDoubleError(errIllegalArgument); + return formula::CreateDoubleError(formula::errIllegalArgument); double fVal = rMat.get_numeric(aPos); if (!::rtl::math::isFinite(fVal)) @@ -1471,7 +1471,7 @@ inline double evaluate( double fVal, ScQueryOp eOp ) } OSL_TRACE( "evaluate: unhandled comparison operator: %d", (int)eOp); - return CreateDoubleError( errUnknownState); + return formula::CreateDoubleError( formula::errUnknownState); } class CompareMatrixFunc : public std::unary_function<MatrixImplType::element_block_type, void> @@ -1668,7 +1668,7 @@ public: ToDoubleArray( size_t nSize, bool bEmptyAsZero ) : maArray(nSize, 0.0), miPos(maArray.begin()), mbEmptyAsZero(bEmptyAsZero) { - mfNaN = CreateDoubleError( errElementNaN); + mfNaN = formula::CreateDoubleError( formula::errElementNaN); } void operator() (const MatrixImplType::element_block_node_type& node) @@ -1739,7 +1739,7 @@ class MergeDoubleArrayFunc : public std::unary_function<MatrixImplType::element_ public: MergeDoubleArrayFunc(std::vector<double>& rArray) : mrArray(rArray), miPos(mrArray.begin()) { - mfNaN = CreateDoubleError( errElementNaN); + mfNaN = formula::CreateDoubleError( formula::errElementNaN); } void operator() (const MatrixImplType::element_block_node_type& node) @@ -1755,7 +1755,7 @@ public: numeric_element_block::const_iterator itEnd = numeric_element_block::end(*node.data); for (; it != itEnd; ++it, ++miPos) { - if (GetDoubleErrorValue(*miPos) == errElementNaN) + if (formula::GetDoubleErrorValue(*miPos) == formula::errElementNaN) continue; *miPos = op(*miPos, *it); @@ -1768,7 +1768,7 @@ public: boolean_element_block::const_iterator itEnd = boolean_element_block::end(*node.data); for (; it != itEnd; ++it, ++miPos) { - if (GetDoubleErrorValue(*miPos) == errElementNaN) + if (formula::GetDoubleErrorValue(*miPos) == formula::errElementNaN) continue; *miPos = op(*miPos, *it ? 1.0 : 0.0); @@ -1786,7 +1786,7 @@ public: // Empty element is equivalent of having a numeric value of 0.0. for (size_t i = 0; i < node.size; ++i, ++miPos) { - if (GetDoubleErrorValue(*miPos) == errElementNaN) + if (formula::GetDoubleErrorValue(*miPos) == formula::errElementNaN) continue; *miPos = op(*miPos, 0.0); @@ -2402,7 +2402,7 @@ void ScMatrixImpl::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& std::function<void(size_t, size_t, double)> aDoubleFunc = [&](size_t nRow, size_t nCol, double nVal) { - sal_uInt16 nErr = GetDoubleErrorValue(nVal); + sal_uInt16 nErr = formula::GetDoubleErrorValue(nVal); if (nErr) { aValid[get_index(nMaxRow, nMaxCol, nRow, nCol, nRowOffset, nColOffset)] = false; @@ -2452,7 +2452,7 @@ void ScMatrixImpl::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& std::function<void(size_t, size_t, double)> aDoubleFunc2 = [&](size_t nRow, size_t nCol, double nVal) { - sal_uInt16 nErr = GetDoubleErrorValue(nVal); + sal_uInt16 nErr = formula::GetDoubleErrorValue(nVal); if (nErr) { aValid[get_index(nMaxRow, nMaxCol, nRow, nCol, nRowOffset, nColOffset)] = false; @@ -2528,7 +2528,7 @@ void ScMatrixImpl::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& } else { - pos = maMat.set(pos, CreateDoubleError(nErrors[nMaxRow * i + j])); + pos = maMat.set(pos, formula::CreateDoubleError(nErrors[nMaxRow * i + j])); } pos = MatrixImplType::next_position(pos); } @@ -2572,7 +2572,7 @@ ScFullMatrix::ScFullMatrix( SCSIZE nC, SCSIZE nR) : pImpl.reset( new ScMatrixImpl( nC, nR)); else // Invalid matrix size, allocate 1x1 matrix with error value. - pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errMatrixSize))); + pImpl.reset( new ScMatrixImpl( 1,1, formula::CreateDoubleError( formula::errMatrixSize))); } ScFullMatrix::ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) : @@ -2582,7 +2582,7 @@ ScFullMatrix::ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) : pImpl.reset( new ScMatrixImpl( nC, nR, fInitVal)); else // Invalid matrix size, allocate 1x1 matrix with error value. - pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errMatrixSize))); + pImpl.reset( new ScMatrixImpl( 1,1, formula::CreateDoubleError( formula::errMatrixSize))); } ScFullMatrix::ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ) : @@ -2592,7 +2592,7 @@ ScFullMatrix::ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rIn pImpl.reset( new ScMatrixImpl( nC, nR, rInitVals)); else // Invalid matrix size, allocate 1x1 matrix with error value. - pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( errMatrixSize))); + pImpl.reset( new ScMatrixImpl( 1,1, formula::CreateDoubleError( formula::errMatrixSize))); } ScFullMatrix::~ScFullMatrix() @@ -3016,7 +3016,7 @@ public: { sal_uInt16 nErr = mpErrorInterpreter->GetError(); if (nErr) - mfVal = CreateDoubleError( nErr); + mfVal = formula::CreateDoubleError( nErr); } } @@ -3038,10 +3038,10 @@ public: short nCurFmtType = 0; double fValue = mpErrorInterpreter->ConvertStringToValue( rStr.getString(), nError, nCurFmtType); if (nError) - return CreateDoubleError( nError); + return formula::CreateDoubleError( nError); return fValue; } - return CreateDoubleError( errNoValue); + return formula::CreateDoubleError( formula::errNoValue); } TEmptyRes operator()(char) const diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index fed5b0e..27774c1 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1707,28 +1707,28 @@ void ExcelToSc::ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData const ScTokenArray* ExcelToSc::GetBoolErr( XclBoolError eType ) { - sal_uInt16 nError; + sal_uInt16 nError; aPool.Reset(); aStack.Reset(); - DefTokenId eOc; + DefTokenId eOc; switch( eType ) { - case xlErrNull: eOc = ocStop; nError = errNoCode; break; - case xlErrDiv0: eOc = ocStop; nError = errDivisionByZero; break; - case xlErrValue: eOc = ocStop; nError = errNoValue; break; - case xlErrRef: eOc = ocStop; nError = errNoRef; break; - case xlErrName: eOc = ocStop; nError = errNoName; break; - case xlErrNum: eOc = ocStop; nError = errIllegalFPOperation; break; - case xlErrNA: eOc = ocNotAvail; nError = NOTAVAILABLE; break; - case xlErrTrue: eOc = ocTrue; nError = 0; break; - case xlErrFalse: eOc = ocFalse; nError = 0; break; - case xlErrUnknown: eOc = ocStop; nError = errUnknownState; break; + case xlErrNull: eOc = ocStop; nError = formula::errNoCode; break; + case xlErrDiv0: eOc = ocStop; nError = formula::errDivisionByZero; break; + case xlErrValue: eOc = ocStop; nError = formula::errNoValue; break; + case xlErrRef: eOc = ocStop; nError = formula::errNoRef; break; + case xlErrName: eOc = ocStop; nError = formula::errNoName; break; + case xlErrNum: eOc = ocStop; nError = formula::errIllegalFPOperation; break; + case xlErrNA: eOc = ocNotAvail; nError = formula::NOTAVAILABLE; break; + case xlErrTrue: eOc = ocTrue; nError = 0; break; + case xlErrFalse: eOc = ocFalse; nError = 0; break; + case xlErrUnknown: eOc = ocStop; nError = formula::errUnknownState; break; default: OSL_FAIL( "ExcelToSc::GetBoolErr - wrong enum!" ); eOc = ocNoName; - nError = errUnknownState; + nError = formula::errUnknownState; } aPool << eOc; @@ -1779,11 +1779,11 @@ void ExcelToSc::SetError( ScFormulaCell &rCell, const ConvErr eErr ) switch( eErr ) { - case ConvErrNi: nInd = errUnknownToken; break; - case ConvErrNoMem: nInd = errCodeOverflow; break; - case ConvErrExternal: nInd = errNoName; break; - case ConvErrCount: nInd = errCodeOverflow; break; - default: nInd = errNoCode; // I had no better idea + case ConvErrNi: nInd = formula::errUnknownToken; break; + case ConvErrNoMem: nInd = formula::errCodeOverflow; break; + case ConvErrExternal: nInd = formula::errNoName; break; + case ConvErrCount: nInd = formula::errCodeOverflow; break; + default: nInd = formula::errNoCode; // I had no better idea } rCell.SetErrCode( nInd ); diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index f2a786c..d6e0b44 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -199,44 +199,42 @@ sal_uInt8 XclTools::GetXclOrientFromRot( sal_uInt16 nXclRot ) sal_uInt8 XclTools::GetXclErrorCode( sal_uInt16 nScError ) { - using namespace ScErrorCodes; switch( nScError ) { - case errIllegalArgument: return EXC_ERR_VALUE; - case errIllegalFPOperation: return EXC_ERR_NUM; // maybe DIV/0 or NUM... - case errDivisionByZero: return EXC_ERR_DIV0; - case errIllegalParameter: return EXC_ERR_VALUE; - case errPairExpected: return EXC_ERR_VALUE; - case errOperatorExpected: return EXC_ERR_VALUE; - case errVariableExpected: return EXC_ERR_VALUE; - case errParameterExpected: return EXC_ERR_VALUE; - case errNoValue: return EXC_ERR_VALUE; - case errCircularReference: return EXC_ERR_VALUE; - case errNoCode: return EXC_ERR_NULL; - case errNoRef: return EXC_ERR_REF; - case errNoName: return EXC_ERR_NAME; - case errNoAddin: return EXC_ERR_NAME; - case errNoMacro: return EXC_ERR_NAME; - case NOTAVAILABLE: return EXC_ERR_NA; + case formula::errIllegalArgument: return EXC_ERR_VALUE; + case formula::errIllegalFPOperation: return EXC_ERR_NUM; // maybe DIV/0 or NUM... + case formula::errDivisionByZero: return EXC_ERR_DIV0; + case formula::errIllegalParameter: return EXC_ERR_VALUE; + case formula::errPairExpected: return EXC_ERR_VALUE; + case formula::errOperatorExpected: return EXC_ERR_VALUE; + case formula::errVariableExpected: return EXC_ERR_VALUE; + case formula::errParameterExpected: return EXC_ERR_VALUE; + case formula::errNoValue: return EXC_ERR_VALUE; + case formula::errCircularReference: return EXC_ERR_VALUE; + case formula::errNoCode: return EXC_ERR_NULL; + case formula::errNoRef: return EXC_ERR_REF; + case formula::errNoName: return EXC_ERR_NAME; + case formula::errNoAddin: return EXC_ERR_NAME; + case formula::errNoMacro: return EXC_ERR_NAME; + case formula::NOTAVAILABLE: return EXC_ERR_NA; } return EXC_ERR_NA; } sal_uInt16 XclTools::GetScErrorCode( sal_uInt8 nXclError ) { - using namespace ScErrorCodes; switch( nXclError ) { - case EXC_ERR_NULL: return errNoCode; - case EXC_ERR_DIV0: return errDivisionByZero; - case EXC_ERR_VALUE: return errNoValue; - case EXC_ERR_REF: return errNoRef; - case EXC_ERR_NAME: return errNoName; - case EXC_ERR_NUM: return errIllegalFPOperation; - case EXC_ERR_NA: return NOTAVAILABLE; + case EXC_ERR_NULL: return formula::errNoCode; + case EXC_ERR_DIV0: return formula::errDivisionByZero; + case EXC_ERR_VALUE: return formula::errNoValue; + case EXC_ERR_REF: return formula::errNoRef; + case EXC_ERR_NAME: return formula::errNoName; + case EXC_ERR_NUM: return formula::errIllegalFPOperation; + case EXC_ERR_NA: return formula::NOTAVAILABLE; default: OSL_FAIL( "XclTools::GetScErrorCode - unknown error code" ); } - return NOTAVAILABLE; + return formula::NOTAVAILABLE; } double XclTools::ErrorToDouble( sal_uInt8 nXclError ) diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index c385bbe..756d028 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1264,7 +1264,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) // Re-compile cells with name error, and recalc if at least one cell // has been re-compiled. In the future we may want to find a way to // recalc only those that are affected. - if (pDoc->CompileErrorCells(ScErrorCodes::errNoName)) + if (pDoc->CompileErrorCells(formula::errNoName)) bCalcAll = true; } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index fcc1266..9b04fb1 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1147,7 +1147,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, case uno::TypeClass_VOID: { // void = "no value" - rDoc.SetError( nDocCol, nDocRow, nTab, NOTAVAILABLE ); + rDoc.SetError( nDocCol, nDocRow, nTab, formula::NOTAVAILABLE ); } break; diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 0ec8659..c5cb6d2 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -621,7 +621,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, // if there is no matrix result const ScMatrix* pMat = (mbArray && pFormula) ? pFormula->GetMatrix() : nullptr; - sal_uInt16 nErrCode = pFormula ? pFormula->GetErrCode() : errIllegalArgument; + sal_uInt16 nErrCode = pFormula ? pFormula->GetErrCode() : formula::errIllegalArgument; if ( nErrCode == 0 ) { if ( pMat ) @@ -641,7 +641,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, aRet <<= aStrVal; } } - else if ( nErrCode == NOTAVAILABLE ) + else if ( nErrCode == formula::NOTAVAILABLE ) { // #N/A: leave result empty, no exception } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits