diff options
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/addincol.hxx | 4 | ||||
-rw-r--r-- | sc/inc/column.hxx | 6 | ||||
-rw-r--r-- | sc/inc/compiler.hxx | 6 | ||||
-rw-r--r-- | sc/inc/dociter.hxx | 12 | ||||
-rw-r--r-- | sc/inc/document.hxx | 9 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 12 | ||||
-rw-r--r-- | sc/inc/formularesult.hxx | 14 | ||||
-rw-r--r-- | sc/inc/global.hxx | 11 | ||||
-rw-r--r-- | sc/inc/math.hxx | 2 | ||||
-rw-r--r-- | sc/inc/rangenam.hxx | 2 | ||||
-rw-r--r-- | sc/inc/scmatrix.hxx | 19 | ||||
-rw-r--r-- | sc/inc/simpleformulacalc.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 9 |
13 files changed, 56 insertions, 52 deletions
diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx index 09d6fc524146..49d30b6a7b7a 100644 --- a/sc/inc/addincol.hxx +++ b/sc/inc/addincol.hxx @@ -187,7 +187,7 @@ private: css::uno::Reference<css::uno::XInterface> xCaller; bool bValidCount; // result: - sal_uInt16 nErrCode; + FormulaError nErrCode; bool bHasString; double fValue; OUString aString; @@ -214,7 +214,7 @@ public: void SetResult( const css::uno::Any& rNewRes ); - sal_uInt16 GetErrCode() const { return nErrCode; } + FormulaError GetErrCode() const { return nErrCode; } bool HasString() const { return bHasString; } bool HasMatrix() const { return xMatrix.get(); } bool HasVarRes() const { return ( xVarRes.is() ); } diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 186e41565048..2041ce79f87c 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -360,7 +360,7 @@ public: void SetValue( SCROW nRow, double fVal ); void SetValues( SCROW nRow, const std::vector<double>& rVals ); void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true ); - void SetError( SCROW nRow, const sal_uInt16 nError); + void SetError( SCROW nRow, const FormulaError nError); void GetString( SCROW nRow, OUString& rString ) const; double* GetValueCell( SCROW nRow ); @@ -376,7 +376,7 @@ public: SCSIZE GetCellCount() const; sal_uInt32 GetWeightedCount() const; sal_uInt32 GetCodeCount() const; // RPN-Code in formulas - sal_uInt16 GetErrCode( SCROW nRow ) const; + FormulaError GetErrCode( SCROW nRow ) const; bool HasStringData( SCROW nRow ) const; bool HasValueData( SCROW nRow ) const; @@ -403,7 +403,7 @@ public: position broadcasted. */ bool BroadcastBroadcasters( SCROW nRow1, SCROW nRow2, ScHint& rHint ); - bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode ); + bool CompileErrorCells( sc::CompileFormulaContext& rCxt, FormulaError nErrCode ); void ResetChanged( SCROW nStartRow, SCROW nEndRow ); diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 26be57dee30f..8c6485627cd1 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -130,7 +130,7 @@ public: rtl_uString* mpDataIgnoreCase; } sharedstring; ScMatrix* pMat; - sal_uInt16 nError; + FormulaError nError; sal_Unicode cStr[ MAXSTRLEN+1 ]; // string (up to 255 characters + 0) short nJump[ FORMULA_MAXJUMPCOUNT + 1 ]; // If/Chose token }; @@ -152,7 +152,7 @@ public: void SetSingleReference( const ScSingleRefData& rRef ); void SetDoubleReference( const ScComplexRefData& rRef ); void SetDouble( double fVal ); - void SetErrorConstant( sal_uInt16 nErr ); + void SetErrorConstant( FormulaError nErr ); // These methods are ok to use, reference count not cleared. void SetName(sal_Int16 nSheet, sal_uInt16 nIndex); @@ -304,7 +304,7 @@ private: bool NextNewToken(bool bInArray); - virtual void SetError(sal_uInt16 nError) override; + virtual void SetError(FormulaError nError) override; sal_Int32 NextSymbol(bool bInArray); bool IsValue( const OUString& ); bool IsOpCode( const OUString&, bool bInArray ); diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 088ca7f37fc3..21f5ffcdac3e 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -77,7 +77,7 @@ class ScValueIterator // walk through all values in an area * See if the cell at the current position is a non-empty cell. If not, * move to the next non-empty cell position. */ - bool GetThis( double& rValue, sal_uInt16& rErr ); + bool GetThis( double& rValue, FormulaError& rErr ); public: @@ -88,10 +88,10 @@ public: void GetCurNumFmtInfo( short& nType, sal_uLong& nIndex ); /// Does NOT reset rValue if no value found! - bool GetFirst( double& rValue, sal_uInt16& rErr ); + bool GetFirst( double& rValue, FormulaError& rErr ); /// Does NOT reset rValue if no value found! - bool GetNext( double& rValue, sal_uInt16& rErr ); + bool GetNext( double& rValue, FormulaError& rErr ); }; class ScDBQueryDataIterator @@ -99,9 +99,9 @@ class ScDBQueryDataIterator public: struct Value { - OUString maString; + OUString maString; double mfValue; - sal_uInt16 mnError; + FormulaError mnError; bool mbIsNumber; Value(); @@ -466,7 +466,7 @@ public: const ScRange& rRange ); ~ScHorizontalValueIterator(); /// Does NOT reset rValue if no value found! - bool GetNext( double& rValue, sal_uInt16& rErr ); + bool GetNext( double& rValue, FormulaError& rErr ); }; // returns all areas with non-default formatting (horizontal) diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 289d6df8a8f0..979257ec71ac 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -49,6 +49,7 @@ enum class SvtScriptType; enum class ScMF; +enum class FormulaError : sal_uInt16; namespace editeng { class SvxBorderLine; } namespace formula { struct VectorRefArray; } namespace svl { @@ -1000,7 +1001,7 @@ public: void SetValues( const ScAddress& rPos, const std::vector<double>& rVals ); - void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError); + void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const FormulaError nError); SC_DLLPUBLIC void SetFormula( const ScAddress& rPos, const ScTokenArray& rArray ); @@ -1057,7 +1058,7 @@ public: std::shared_ptr<sc::FormulaGroupContext>& GetFormulaGroupContext(); SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString ); - sal_uInt16 GetStringForFormula( const ScAddress& rPos, OUString& rString ); + FormulaError GetStringForFormula( const ScAddress& rPos, OUString& rString ); SC_DLLPUBLIC double GetValue( const ScAddress& rPos ) const; SC_DLLPUBLIC double GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ) const; @@ -1188,7 +1189,7 @@ public: * @return true if at least one cell is re-compiled, false if no cells are * re-compiled. */ - bool CompileErrorCells(sal_uInt16 nErrCode); + bool CompileErrorCells(FormulaError nErrCode); ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; } void SetPreviewFont( SfxItemSet* pFontSet ); @@ -1225,7 +1226,7 @@ public: // if CalcFormulaTree() is currently running bool IsCalculatingFormulaTree() { return bCalculatingFormulaTree; } - sal_uInt16 GetErrCode( const ScAddress& ) const; + FormulaError GetErrCode( const ScAddress& ) const; /** Shrink a range to only include data area. diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index cec4b2d64db3..d30facaf4ce0 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -296,13 +296,13 @@ public: bool GetMatrixOrigin( ScAddress& rPos ) const; void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ); sc::MatrixEdge GetMatrixEdge( ScAddress& rOrgPos ) const; - sal_uInt16 GetErrCode(); // interpret first if necessary - sal_uInt16 GetRawError(); // don't interpret, just return code or result error - bool GetErrorOrValue( sal_uInt16& rErr, double& rVal ); + FormulaError GetErrCode(); // interpret first if necessary + FormulaError GetRawError(); // don't interpret, just return code or result error + bool GetErrorOrValue( FormulaError& rErr, double& rVal ); sc::FormulaResultValue GetResult(); sc::FormulaResultValue GetResult() const; sal_uInt8 GetMatrixFlag() const { return cMatrixFlag;} - ScTokenArray* GetCode() { return pCode;} + ScTokenArray* GetCode() { return pCode;} const ScTokenArray* GetCode() const { return pCode;} void SetCode( ScTokenArray* pNew ); @@ -364,10 +364,10 @@ public: svl::SharedString GetResultString() const; /* Sets the shared code array to error state in addition to the cell result */ - void SetErrCode( sal_uInt16 n ); + void SetErrCode( FormulaError n ); /* Sets just the result to error */ - void SetResultError( sal_uInt16 n ); + void SetResultError( FormulaError n ); bool IsHyperLinkCell() const; EditTextObject* CreateURLObject(); diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx index 68a08e52d797..0a977dcf043a 100644 --- a/sc/inc/formularesult.hxx +++ b/sc/inc/formularesult.hxx @@ -33,12 +33,12 @@ struct FormulaResultValue double mfValue; svl::SharedString maString; - sal_uInt16 mnError; + FormulaError mnError; FormulaResultValue(); FormulaResultValue( double fValue ); - FormulaResultValue(const svl::SharedString& rStr ); - FormulaResultValue( sal_uInt16 nErr ); + FormulaResultValue( const svl::SharedString& rStr ); + FormulaResultValue( FormulaError nErr ); }; } @@ -71,7 +71,7 @@ class ScFormulaResult double mfValue; // double result direct for performance and memory consumption const formula::FormulaToken* mpToken; // if not, result token obtained from interpreter }; - sal_uInt16 mnError; // error code + FormulaError mnError; // error code bool mbToken :1; // whether content of union is a token bool mbEmpty :1; // empty cell result bool mbEmptyDisplayedAsString :1; // only if mbEmpty @@ -154,15 +154,15 @@ public: one paragraph */ bool IsMultiline() const; - bool GetErrorOrDouble( sal_uInt16& rErr, double& rVal ) const; + bool GetErrorOrDouble( FormulaError& rErr, double& rVal ) const; sc::FormulaResultValue GetResult() const; /** Get error code if set or GetCellResultType() is formula::svError or svUnknown, else 0. */ - sal_uInt16 GetResultError() const; + FormulaError GetResultError() const; /** Set error code, don't touch token or double. */ - void SetResultError( sal_uInt16 nErr ); + void SetResultError( FormulaError nErr ); /** Set direct double. Shouldn't be used externally except in ScFormulaCell for rounded CalcAsShown or SetErrCode() or diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 0e606f8563eb..63a716457c94 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -35,6 +35,7 @@ class SfxItemSet; class Color; struct ScCalcConfig; enum class SvtScriptType; +enum class FormulaError : sal_uInt16; #define SC_COLLATOR_IGNORES ( \ css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ) @@ -571,8 +572,8 @@ public: static ScFunctionMgr* GetStarCalcFunctionMgr(); static void ResetFunctionList(); - static OUString GetErrorString(sal_uInt16 nErrNumber); - static OUString GetLongErrorString(sal_uInt16 nErrNumber); + static OUString GetErrorString(FormulaError nErrNumber); + static OUString GetLongErrorString(FormulaError nErrNumber); static bool EETextObjEqual( const EditTextObject* pObj1, const EditTextObject* pObj2 ); static bool CheckWidthInvalidate( bool& bNumFormatChanged, @@ -676,11 +677,11 @@ SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pStri In any case, if rError is set 0.0 is returned. - If nStringNoValueError is errCellNoValue, that is unconditionally + If nStringNoValueError is FormulaError::CellNoValue, that is unconditionally assigned to rError and 0.0 is returned. The caller is expected to handle this situation. Used by the interpreter. - Usually errNoValue is passed as nStringNoValueError. + Usually FormulaError::NoValue is passed as nStringNoValueError. Otherwise, depending on the string conversion configuration different approaches are taken: @@ -778,7 +779,7 @@ SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pStri */ static double ConvertStringToValue( const OUString& rStr, const ScCalcConfig& rConfig, - sal_uInt16 & rError, sal_uInt16 nStringNoValueError, + FormulaError & rError, FormulaError nStringNoValueError, SvNumberFormatter* pFormatter, short & rCurFmtType ); }; diff --git a/sc/inc/math.hxx b/sc/inc/math.hxx index ecea704052a4..c2a3b992dd00 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) : - formula::CreateDoubleError( formula::errDivisionByZero); + CreateDoubleError( FormulaError::DivisionByZero); } /** Return fNumerator/fDenominator if fDenominator!=0 else +-Infinity if diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index e5a6dfea8a21..a1924de86a26 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -119,7 +119,7 @@ public: ScTokenArray* GetCode() { return pCode; } SC_DLLPUBLIC void SetCode( ScTokenArray& ); const ScTokenArray* GetCode() const { return pCode; } - SC_DLLPUBLIC sal_uInt16 GetErrCode() const; + SC_DLLPUBLIC FormulaError GetErrCode() const; bool HasReferences() const; void AddType( Type nType ); Type GetType() const { return eType; } diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index b4899681b70b..d26961d155fd 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -40,6 +40,7 @@ class ScInterpreter; class SvNumberFormatter; class ScMatrixImpl; +enum class FormulaError : sal_uInt16; namespace formula { class DoubleVectorRefToken; } @@ -64,7 +65,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 formula::GetDoubleErrorValue( fVal); } + FormulaError GetError() const { return GetDoubleErrorValue(fVal); } /// Only valid if ScMatrix methods indicate that this is a boolean bool GetBoolean() const { return fVal != 0.0; } @@ -274,7 +275,7 @@ public: /// Jump sal_False without path virtual void PutEmptyPath( SCSIZE nC, SCSIZE nR) = 0; - virtual void PutError( sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR ) = 0; + virtual void PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) = 0; virtual void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR) = 0; virtual void FillDouble( double fVal, @@ -300,12 +301,12 @@ public: @ATTENTION: MUST NOT be used if the element is a string! Use GetErrorIfNotString() instead if not sure. @returns 0 if no error, else one of err... constants */ - virtual sal_uInt16 GetError( SCSIZE nC, SCSIZE nR) const = 0; + virtual FormulaError GetError( SCSIZE nC, SCSIZE nR) const = 0; /** Use in ScInterpreter to obtain the error code, if any. @returns 0 if no error or string element, else one of err... constants */ - sal_uInt16 GetErrorIfNotString( SCSIZE nC, SCSIZE nR) const - { return IsValue( nC, nR) ? GetError( nC, nR) : 0; } + FormulaError GetErrorIfNotString( SCSIZE nC, SCSIZE nR) const + { return IsValue( nC, nR) ? GetError( nC, nR) : FormulaError::NONE; } /// @return 0.0 if empty or empty path, else value or DoubleError. virtual double GetDouble( SCSIZE nC, SCSIZE nR) const = 0; @@ -493,7 +494,7 @@ public: /// Jump sal_False without path virtual void PutEmptyPath( SCSIZE nC, SCSIZE nR) override; - virtual void PutError( sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR ) override; + virtual void PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) override; virtual void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR) override; virtual void FillDouble( double fVal, @@ -519,7 +520,7 @@ public: @ATTENTION: MUST NOT be used if the element is a string! Use GetErrorIfNotString() instead if not sure. @returns 0 if no error, else one of err... constants */ - virtual sal_uInt16 GetError( SCSIZE nC, SCSIZE nR) const override; + virtual FormulaError GetError( SCSIZE nC, SCSIZE nR) const override; /// @return 0.0 if empty or empty path, else value or DoubleError. virtual double GetDouble( SCSIZE nC, SCSIZE nR) const override; @@ -711,7 +712,7 @@ public: /// Jump sal_False without path virtual void PutEmptyPath(SCSIZE nC, SCSIZE nR) override; - virtual void PutError(sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR ) override; + virtual void PutError(FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) override; virtual void PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR) override; virtual void FillDouble(double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2) override; @@ -736,7 +737,7 @@ public: @ATTENTION: MUST NOT be used if the element is a string! Use GetErrorIfNotString() instead if not sure. @returns 0 if no error, else one of err... constants */ - virtual sal_uInt16 GetError(SCSIZE nC, SCSIZE nR) const override; + virtual FormulaError GetError(SCSIZE nC, SCSIZE nR) const override; /// @return 0.0 if empty or empty path, else value or DoubleError. virtual double GetDouble(SCSIZE nC, SCSIZE nR) const override; diff --git a/sc/inc/simpleformulacalc.hxx b/sc/inc/simpleformulacalc.hxx index fef4fe9400a7..64229aff77ce 100644 --- a/sc/inc/simpleformulacalc.hxx +++ b/sc/inc/simpleformulacalc.hxx @@ -45,7 +45,7 @@ public: void Calculate(); bool IsValue(); bool IsMatrix(); - sal_uInt16 GetErrCode(); + FormulaError GetErrCode(); double GetValue(); svl::SharedString GetString(); short GetFormatType() const { return mnFormatType; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8e35256f48c0..d987071274a5 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -34,6 +34,7 @@ #include "cellvalue.hxx" #include <formula/types.hxx> #include "calcmacros.hxx" +#include "formula/errorcodes.hxx" #include <set> #include <map> @@ -362,7 +363,7 @@ public: void SetValue( SCCOL nCol, SCROW nRow, const double& rVal ); void SetValues( SCCOL nCol, SCROW nRow, const std::vector<double>& rVals ); - void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError); + void SetError( SCCOL nCol, SCROW nRow, FormulaError nError); SCSIZE GetPatternCount( SCCOL nCol ) const; SCSIZE GetPatternCount( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; bool ReservePatternCount( SCCOL nCol, SCSIZE nReserve ); @@ -522,11 +523,11 @@ public: bool HasStringCells( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const; - sal_uInt16 GetErrCode( const ScAddress& rPos ) const + FormulaError GetErrCode( const ScAddress& rPos ) const { return ValidColRow(rPos.Col(),rPos.Row()) ? aCol[rPos.Col()].GetErrCode( rPos.Row() ) : - 0; + FormulaError::NONE; } void ResetChanged( const ScRange& rRange ); @@ -549,7 +550,7 @@ public: position broadcasted. */ bool BroadcastBroadcasters( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScHint& rHint ); - bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode ); + bool CompileErrorCells( sc::CompileFormulaContext& rCxt, FormulaError nErrCode ); void UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr, |