diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-02 17:19:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-03 08:26:38 +0200 |
commit | c3b7f134b94bf2f0830b16b42bd72d235de377fb (patch) | |
tree | bf11a43bfce06ad9eb65c885a7b4470e946d9f43 | |
parent | be98dffedd70f36e7c74c4ebd6509c5868a016d1 (diff) |
loplugin:mergeclass merge ScFullMatrix into ScMatrix
ever since
commit b26f83b1cc184a79caa9e9c0ae15717ef61dde4a
Date: Fri Aug 10 21:43:32 2018 +0200
loplugin:unusedmethods
mostly this seems to be fallout from
commit 089a4f245325a5be5cd5951d85305d791b4d9cb6
Date: Mon Aug 6 14:55:04 2018 +0200
remove Calc's software interpreter
Change-Id: Id1cb89bb3d95521b7ddf7d072ee9392053e5a52b
Reviewed-on: https://gerrit.libreoffice.org/61257
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/inc/scmatrix.hxx | 416 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/validat.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/addincol.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/ddelink.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr5.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/jumpmatrix.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/rangeseq.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 272 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/tokstack.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xihelper.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xilink.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/xihelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLDDELinksContext.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 18 |
18 files changed, 256 insertions, 502 deletions
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index c7e50fe408ab..12baa8e1e7ed 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -107,19 +107,28 @@ struct ScMatrixValue } }; -/// Abstract base class for ScFullMatrix and ScVectorRefMatrix implementations. -class SC_DLLPUBLIC ScMatrix +/** + * Matrix data type that can store values of mixed types. Each element can + * be one of the following types: numeric, string, boolean, empty, and empty + * path. + */ +class SC_DLLPUBLIC ScMatrix final { + friend class ScMatrixImpl; + mutable size_t nRefCnt; // reference count mutable bool mbCloneIfConst; // Whether the matrix is cloned with a CloneIfConst() call. + std::unique_ptr<ScMatrixImpl> pImpl; ScMatrix( const ScMatrix& ) = delete; ScMatrix& operator=( const ScMatrix&) = delete; -protected: - virtual ~ScMatrix() {} - public: + ScMatrix(SCSIZE nC, SCSIZE nR); + ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal); + ScMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ); + ~ScMatrix(); + enum Op { Add, Sub, Mul, Div }; typedef std::function<void(size_t, size_t, double)> DoubleOpFunction; @@ -193,10 +202,8 @@ public: return (nType & ScMatValType::NonvalueMask) == ScMatValType::EmptyPath; } - ScMatrix() : nRefCnt(0), mbCloneIfConst(true) {} - /** Clone the matrix. */ - virtual ScMatrix* Clone() const = 0; + ScMatrix* Clone() const; /** Clone the matrix if mbCloneIfConst (immutable) is set, otherwise return _this_ matrix, to be assigned to a ScMatrixRef. */ @@ -213,21 +220,21 @@ public: /** * Resize the matrix to specified new dimension. */ - virtual void Resize(SCSIZE nC, SCSIZE nR) = 0; + void Resize(SCSIZE nC, SCSIZE nR); - virtual void Resize(SCSIZE nC, SCSIZE nR, double fVal) = 0; + void Resize(SCSIZE nC, SCSIZE nR, double fVal); /** Clone the matrix and extend it to the new size. nNewCols and nNewRows MUST be at least of the size of the original matrix. */ - virtual ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const = 0; + ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const; void IncRef() const; void DecRef() const; - virtual void SetErrorInterpreter( ScInterpreter* p) = 0; - virtual void GetDimensions( SCSIZE& rC, SCSIZE& rR) const = 0; - virtual SCSIZE GetElementCount() const = 0; - virtual bool ValidColRow( SCSIZE nC, SCSIZE nR) const = 0; + void SetErrorInterpreter( ScInterpreter* p); + void GetDimensions( SCSIZE& rC, SCSIZE& rR) const; + SCSIZE GetElementCount() const; + bool ValidColRow( SCSIZE nC, SCSIZE nR) const; /** For a row vector or column vector, if the position does not point into the vector but is a valid column or row offset it is adapted such that @@ -235,7 +242,7 @@ public: vector, same row column 0 for a column vector. Else, for a 2D matrix, returns false. */ - virtual bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const = 0; + bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const; /** Checks if the matrix position is within the matrix. If it is not, for a row vector or column vector the position is adapted such that it points @@ -243,47 +250,47 @@ public: same row column 0 for a column vector. Else, for a 2D matrix and position not within matrix, returns false. */ - virtual bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const = 0; + bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const; - virtual void PutDouble( double fVal, SCSIZE nC, SCSIZE nR) = 0; - virtual void PutDouble( double fVal, SCSIZE nIndex) = 0; - virtual void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) = 0; + void PutDouble( double fVal, SCSIZE nC, SCSIZE nR); + void PutDouble( double fVal, SCSIZE nIndex); + void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR); - virtual void PutString( const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) = 0; - virtual void PutString( const svl::SharedString& rStr, SCSIZE nIndex) = 0; - virtual void PutString( const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) = 0; + void PutString( const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) ; + void PutString( const svl::SharedString& rStr, SCSIZE nIndex) ; + void PutString( const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) ; - virtual void PutEmpty( SCSIZE nC, SCSIZE nR) = 0; + void PutEmpty( SCSIZE nC, SCSIZE nR); /// Jump sal_False without path - virtual void PutEmptyPath( 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; + void PutEmptyPath( SCSIZE nC, SCSIZE nR) ; + void PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) ; + void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR) ; - virtual void FillDouble( double fVal, - SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) = 0; + void FillDouble( double fVal, + SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) ; /** Put a column vector of doubles, starting at row nR, must fit into dimensions. */ - virtual void PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) = 0; + void PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of strings, starting at row nR, must fit into dimensions. */ - virtual void PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) = 0; + void PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of empties, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) = 0; + void PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of empty results, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) = 0; + void PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of empty paths, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) = 0; + void PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) ; /** May be used before obtaining the double value of an element to avoid passing its NAN around. @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 FormulaError GetError( SCSIZE nC, SCSIZE nR) const = 0; + FormulaError GetError( SCSIZE nC, SCSIZE nR) const ; /** Use in ScInterpreter to obtain the error code, if any. @returns 0 if no error or string element, else one of err... constants */ @@ -291,91 +298,91 @@ public: { 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; + double GetDouble( SCSIZE nC, SCSIZE nR) const ; /// @return 0.0 if empty or empty path, else value or DoubleError. - virtual double GetDouble( SCSIZE nIndex) const = 0; + double GetDouble( SCSIZE nIndex) const ; /// @return value or DoubleError or string converted to value. - virtual double GetDoubleWithStringConversion( SCSIZE nC, SCSIZE nR ) const = 0; + double GetDoubleWithStringConversion( SCSIZE nC, SCSIZE nR ) const ; /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nC, SCSIZE nR) const = 0; + svl::SharedString GetString( SCSIZE nC, SCSIZE nR) const ; /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nIndex) const = 0; + svl::SharedString GetString( SCSIZE nIndex) const ; /** @returns the matrix element's string if one is present, otherwise the numerical value formatted as string, or in case of an error the error string is returned; an empty string for empty, a "FALSE" string for empty path. */ - virtual svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const = 0; + svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const ; /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate /// an empty string! - virtual ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const = 0; + ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const ; /** @return <TRUE/> if string or any empty, empty cell, empty result, empty path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nIndex ) const = 0; + bool IsStringOrEmpty( SCSIZE nIndex ) const ; /** @return <TRUE/> if string or any empty, empty cell, empty result, empty path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty or empty cell or empty result, not empty path. - virtual bool IsEmpty( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmpty( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty cell, not empty or empty result or empty path. - virtual bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty result, not empty or empty cell or empty path. - virtual bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty path, not empty or empty cell or empty result. - virtual bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nIndex ) const = 0; + bool IsValue( SCSIZE nIndex ) const ; /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsValue( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if value or boolean or empty or empty path. - virtual bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if boolean. - virtual bool IsBoolean( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsBoolean( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties - virtual bool IsNumeric() const = 0; + bool IsNumeric() const ; - virtual void MatTrans( ScMatrix& mRes) const = 0; - virtual void MatCopy ( ScMatrix& mRes) const = 0; + void MatTrans( ScMatrix& mRes) const ; + void MatCopy ( ScMatrix& mRes) const ; // Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values - virtual void CompareEqual() = 0; - virtual void CompareNotEqual() = 0; - virtual void CompareLess() = 0; - virtual void CompareGreater() = 0; - virtual void CompareLessEqual() = 0; - virtual void CompareGreaterEqual() = 0; - - virtual double And() const = 0; // logical AND of all matrix values, or NAN - virtual double Or() const = 0; // logical OR of all matrix values, or NAN - virtual double Xor() const = 0; // logical XOR of all matrix values, or NAN - - virtual IterateResult Sum(bool bTextAsZero) const = 0; - virtual IterateResult SumSquare(bool bTextAsZero) const = 0; - virtual IterateResult Product(bool bTextAsZero) const = 0; - virtual size_t Count(bool bCountStrings, bool bCountErrors) const = 0; - virtual size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const = 0; - virtual size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const = 0; - - virtual double GetMaxValue( bool bTextAsZero ) const = 0; - virtual double GetMinValue( bool bTextAsZero ) const = 0; - virtual double GetGcd() const = 0; - virtual double GetLcm() const = 0; - - virtual ScMatrixRef CompareMatrix( - sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const = 0; + void CompareEqual() ; + void CompareNotEqual() ; + void CompareLess() ; + void CompareGreater() ; + void CompareLessEqual() ; + void CompareGreaterEqual() ; + + double And() const ; // logical AND of all matrix values, or NAN + double Or() const ; // logical OR of all matrix values, or NAN + double Xor() const ; // logical XOR of all matrix values, or NAN + + IterateResult Sum(bool bTextAsZero) const ; + IterateResult SumSquare(bool bTextAsZero) const ; + IterateResult Product(bool bTextAsZero) const ; + size_t Count(bool bCountStrings, bool bCountErrors) const ; + size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const ; + size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const ; + + double GetMaxValue( bool bTextAsZero ) const ; + double GetMinValue( bool bTextAsZero ) const ; + double GetGcd() const ; + double GetLcm() const ; + + ScMatrixRef CompareMatrix( + sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const ; /** * Convert the content of matrix into a linear array of numeric values. @@ -385,247 +392,30 @@ public: * @param bEmptyAsZero if true empty elements are mapped to zero values, * otherwise they become NaN values. */ - virtual void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const = 0; - virtual void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const = 0; + void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const ; + void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const ; - virtual void NotOp(ScMatrix& rMat) = 0; - virtual void NegOp(ScMatrix& rMat) = 0; - virtual void AddOp(double fVal, ScMatrix& rMat) = 0; - virtual void SubOp(bool bFlag, double fVal, ScMatrix& rMat) = 0; - virtual void MulOp(double fVal, ScMatrix& rMat) = 0; - virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) = 0; - virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) = 0; + void NotOp(ScMatrix& rMat) ; + void NegOp(ScMatrix& rMat) ; + void AddOp(double fVal, ScMatrix& rMat) ; + void SubOp(bool bFlag, double fVal, ScMatrix& rMat) ; + void MulOp(double fVal, ScMatrix& rMat) ; + void DivOp(bool bFlag, double fVal, ScMatrix& rMat) ; + void PowOp(bool bFlag, double fVal, ScMatrix& rMat) ; - virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) = 0; + std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) ; - virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, + void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc, - EmptyOpFunction aEmptyFunc) const = 0; - - virtual void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, - SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) = 0; - -#if DEBUG_MATRIX - virtual void Dump() const = 0; -#endif -}; - -/** - * Matrix data type that can store values of mixed types. Each element can - * be one of the following types: numeric, string, boolean, empty, and empty - * path. - */ -class SC_DLLPUBLIC ScFullMatrix : public ScMatrix -{ - friend class ScMatrixImpl; - - std::unique_ptr<ScMatrixImpl> pImpl; - - ScFullMatrix( const ScFullMatrix& ) = delete; - ScFullMatrix& operator=( const ScFullMatrix&) = delete; - -public: - - ScFullMatrix(SCSIZE nC, SCSIZE nR); - ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal); - - ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ); - - virtual ~ScFullMatrix() override; - - /** Clone the matrix. */ - virtual ScMatrix* Clone() const override; - - /** - * Resize the matrix to specified new dimension. - */ - virtual void Resize( SCSIZE nC, SCSIZE nR) override; - - virtual void Resize(SCSIZE nC, SCSIZE nR, double fVal) override; - - /** Clone the matrix and extend it to the new size. nNewCols and nNewRows - MUST be at least of the size of the original matrix. */ - virtual ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const override; - - virtual void SetErrorInterpreter( ScInterpreter* p) override; - virtual void GetDimensions( SCSIZE& rC, SCSIZE& rR) const override; - virtual SCSIZE GetElementCount() const override; - virtual bool ValidColRow( SCSIZE nC, SCSIZE nR) const override; - - /** For a row vector or column vector, if the position does not point into - the vector but is a valid column or row offset it is adapted such that - it points to an element to be replicated, same column row 0 for a row - vector, same row column 0 for a column vector. Else, for a 2D matrix, - returns false. - */ - virtual bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const override; - - /** Checks if the matrix position is within the matrix. If it is not, for a - row vector or column vector the position is adapted such that it points - to an element to be replicated, same column row 0 for a row vector, - same row column 0 for a column vector. Else, for a 2D matrix and - position not within matrix, returns false. - */ - virtual bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const override; - - virtual void PutDouble( double fVal, SCSIZE nC, SCSIZE nR) override; - virtual void PutDouble( double fVal, SCSIZE nIndex) override; - virtual void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) override; - - virtual void PutString( const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) override; - virtual void PutString( const svl::SharedString& rStr, SCSIZE nIndex) override; - virtual void PutString( const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) override; - - virtual void PutEmpty( SCSIZE nC, SCSIZE nR) override; - - /// Jump sal_False without path - virtual void PutEmptyPath( 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; - - /** Put a column vector of doubles, starting at row nR, must fit into dimensions. */ - virtual void PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) override; - - /** Put a column vector of strings, starting at row nR, must fit into dimensions. */ - virtual void PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) override; + EmptyOpFunction aEmptyFunc) const ; - /** Put a column vector of empties, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) override; - - /** Put a column vector of empty results, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) override; - - /** Put a column vector of empty paths, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) override; - - /** May be used before obtaining the double value of an element to avoid - passing its NAN around. - @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 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; - /// @return 0.0 if empty or empty path, else value or DoubleError. - virtual double GetDouble( SCSIZE nIndex) const override; - /// @return value or DoubleError or string converted to value. - virtual double GetDoubleWithStringConversion( SCSIZE nC, SCSIZE nR ) const override; - - /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nC, SCSIZE nR) const override; - /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nIndex) const override; - - /** @returns the matrix element's string if one is present, otherwise the - numerical value formatted as string, or in case of an error the error - string is returned; an empty string for empty, a "FALSE" string for - empty path. */ - virtual svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const override; - - /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate - /// an empty string! - virtual ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const override; - - /** @return <TRUE/> if string or any empty, empty cell, empty result, empty - path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nIndex ) const override; - - /** @return <TRUE/> if string or any empty, empty cell, empty result, empty - path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty or empty cell or empty result, not empty path. - virtual bool IsEmpty( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty cell, not empty or empty result or empty path. - virtual bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty result, not empty or empty cell or empty path. - virtual bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty path, not empty or empty cell or empty result. - virtual bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nIndex ) const override; - - /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if value or boolean or empty or empty path. - virtual bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if boolean. - virtual bool IsBoolean( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties - virtual bool IsNumeric() const override; - - virtual void MatTrans( ScMatrix& mRes) const override; - virtual void MatCopy ( ScMatrix& mRes) const override; - - // Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values - virtual void CompareEqual() override; - virtual void CompareNotEqual() override; - virtual void CompareLess() override; - virtual void CompareGreater() override; - virtual void CompareLessEqual() override; - virtual void CompareGreaterEqual() override; - - virtual double And() const override; // logical AND of all matrix values, or NAN - virtual double Or() const override; // logical OR of all matrix values, or NAN - virtual double Xor() const override; // logical XOR of all matrix values, or NAN - - virtual IterateResult Sum(bool bTextAsZero) const override; - virtual IterateResult SumSquare(bool bTextAsZero) const override; - virtual IterateResult Product(bool bTextAsZero) const override; - virtual size_t Count(bool bCountStrings, bool bCountErrors) const override; - virtual size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const override; - virtual size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const override; - - virtual double GetMaxValue( bool bTextAsZero ) const override; - virtual double GetMinValue( bool bTextAsZero ) const override; - virtual double GetGcd() const override; - virtual double GetLcm() const override; - - virtual ScMatrixRef CompareMatrix( - sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const override; - - /** - * Convert the content of matrix into a linear array of numeric values. - * String elements are mapped to NaN's and empty elements are mapped to - * either NaN or zero values. - * - * @param bEmptyAsZero if true empty elements are mapped to zero values, - * otherwise they become NaN values. - */ - virtual void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const override; - virtual void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const override; - - virtual void NotOp(ScMatrix& rMat) override; - virtual void NegOp(ScMatrix& rMat) override; - virtual void AddOp(double fVal, ScMatrix& rMat) override; - virtual void SubOp(bool bFlag, double fVal, ScMatrix& rMat) override; - virtual void MulOp(double fVal, ScMatrix& rMat) override; - virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) override; - virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) override; - - virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override; - - virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, - DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc, - EmptyOpFunction aEmptyFunc) const override; - ScFullMatrix& operator+= ( const ScFullMatrix& r ); + void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, + SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) ; - virtual void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, - SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) override; + ScMatrix& operator+= ( const ScMatrix& r ); #if DEBUG_MATRIX - virtual void Dump() const override; + void Dump() const; #endif }; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 32ac67b0e44f..aae265dacd9d 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1753,7 +1753,7 @@ void Test::testMatrix() ScMatrixRef pMat, pMat2; // First, test the zero matrix type. - pMat = new ScFullMatrix(0, 0, 0.0); + pMat = new ScMatrix(0, 0, 0.0); SCSIZE nC, nR; pMat->GetDimensions(nC, nR); CPPUNIT_ASSERT_MESSAGE("matrix is not empty", nC == 0 && nR == 0); @@ -1776,7 +1776,7 @@ void Test::testMatrix() pMat->And() && pMat->Or()); // Test the AND and OR evaluations. - pMat = new ScFullMatrix(2, 2, 0.0); + pMat = new ScMatrix(2, 2, 0.0); // Only some of the elements are non-zero. pMat->PutBoolean(true, 0, 0); @@ -1791,7 +1791,7 @@ void Test::testMatrix() CPPUNIT_ASSERT_MESSAGE("incorrect AND result", pMat->And()); // Now test the empty matrix type. - pMat = new ScFullMatrix(10, 20); + pMat = new ScMatrix(10, 20); pMat->GetDimensions(nC, nR); CPPUNIT_ASSERT_MESSAGE("matrix size is not as expected", nC == 10 && nR == 20); checkMatrixElements<AllEmptyMatrix>(*pMat); @@ -1803,7 +1803,7 @@ void Test::testMatrix() checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat); // Test resizing. - pMat = new ScFullMatrix(0, 0); + pMat = new ScMatrix(0, 0); pMat->Resize(2, 2, 1.5); pMat->PutEmpty(1, 1); @@ -1813,7 +1813,7 @@ void Test::testMatrix() CPPUNIT_ASSERT_MESSAGE("PutEmpty() call failed.", pMat->IsEmpty(1, 1)); // Max and min values. - pMat = new ScFullMatrix(2, 2, 0.0); + pMat = new ScMatrix(2, 2, 0.0); pMat->PutDouble(-10, 0, 0); pMat->PutDouble(-12, 0, 1); pMat->PutDouble(-8, 1, 0); @@ -1825,7 +1825,7 @@ void Test::testMatrix() CPPUNIT_ASSERT_EQUAL(-8.0, pMat->GetMaxValue(false)); // ignore text. pMat->PutBoolean(true, 0, 0); CPPUNIT_ASSERT_EQUAL(1.0, pMat->GetMaxValue(false)); - pMat = new ScFullMatrix(2, 2, 10.0); + pMat = new ScMatrix(2, 2, 10.0); pMat->PutBoolean(false, 0, 0); pMat->PutDouble(12.5, 1, 1); CPPUNIT_ASSERT_EQUAL(0.0, pMat->GetMinValue(false)); @@ -1833,7 +1833,7 @@ void Test::testMatrix() // Convert matrix into a linear double array. String elements become NaN // and empty elements become 0. - pMat = new ScFullMatrix(3, 3); + pMat = new ScMatrix(3, 3); pMat->PutDouble(2.5, 0, 0); pMat->PutDouble(1.2, 0, 1); pMat->PutString(rPool.intern("A"), 1, 1); @@ -1858,7 +1858,7 @@ void Test::testMatrix() } } - pMat2 = new ScFullMatrix(3, 3, 10.0); + pMat2 = new ScMatrix(3, 3, 10.0); pMat2->PutString(rPool.intern("B"), 1, 0); pMat2->MergeDoubleArray(aDoubles, ScMatrix::Mul); diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 8457035c784a..d0b977c315dd 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2321,7 +2321,7 @@ formula::FormulaTokenRef ScTable::ResolveStaticReference( SCCOL nCol1, SCROW nRo else nMaxCol = nCol2; - ScMatrixRef pMat(new ScFullMatrix(nCol2-nCol1+1, nRow2-nRow1+1, 0.0)); + ScMatrixRef pMat(new ScMatrix(nCol2-nCol1+1, nRow2-nRow1+1, 0.0)); for (SCCOL nCol = nCol1; nCol <= nMaxCol; ++nCol) { if (!aCol[nCol].ResolveStaticReference(*pMat, nCol2-nCol1, nRow1, nRow2)) diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 4b4bf814fd21..88929c870564 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -698,7 +698,7 @@ bool ScValidationData::GetSelectionFromFormula( // is stored as a single value. // Use an interim matrix to create the TypedStrData below. - xMatRef = new ScFullMatrix(1, 1, 0.0); + xMatRef = new ScMatrix(1, 1, 0.0); FormulaError nErrCode = aValidationSrc.GetErrCode(); if (nErrCode != FormulaError::NONE) diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 2f1a9372aaf9..c729dd3b9c13 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -1547,7 +1547,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes ) } if ( nMaxColCount && nRowCount ) { - xMatrix = new ScFullMatrix( + xMatrix = new ScMatrix( static_cast<SCSIZE>(nMaxColCount), static_cast<SCSIZE>(nRowCount), 0.0); for (long nRow=0; nRow<nRowCount; nRow++) @@ -1588,7 +1588,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes ) } if ( nMaxColCount && nRowCount ) { - xMatrix = new ScFullMatrix( + xMatrix = new ScMatrix( static_cast<SCSIZE>(nMaxColCount), static_cast<SCSIZE>(nRowCount), 0.0); for (long nRow=0; nRow<nRowCount; nRow++) @@ -1629,7 +1629,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes ) } if ( nMaxColCount && nRowCount ) { - xMatrix = new ScFullMatrix( + xMatrix = new ScMatrix( static_cast<SCSIZE>(nMaxColCount), static_cast<SCSIZE>(nRowCount), 0.0); for (long nRow=0; nRow<nRowCount; nRow++) diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx index 539d6317eca8..06bc7c2b9700 100644 --- a/sc/source/core/tool/ddelink.cxx +++ b/sc/source/core/tool/ddelink.cxx @@ -90,7 +90,7 @@ ScDdeLink::ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& r bool bHasValue; rStream.ReadCharAsBool( bHasValue ); if ( bHasValue ) - pResult = new ScFullMatrix(0, 0); + pResult = new ScMatrix(0, 0); if (rHdr.BytesLeft()) // new in 388b and the 364w (RealTime Client) version rStream.ReadUChar( nMode ); @@ -156,7 +156,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged( else // split data { // always newly re-create matrix, so that bIsString doesn't get mixed up - pResult = new ScFullMatrix(nCols, nRows, 0.0); + pResult = new ScMatrix(nCols, nRows, 0.0); SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); svl::SharedStringPool& rPool = pDoc->GetSharedStringPool(); diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index ef514ed8a728..076451d571e5 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -285,9 +285,9 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty) { ScMatrixRef pMat; if (bEmpty) - pMat = new ScFullMatrix(nC, nR); + pMat = new ScMatrix(nC, nR); else - pMat = new ScFullMatrix(nC, nR, 0.0); + pMat = new ScMatrix(nC, nR, 0.0); pMat->SetErrorInterpreter( this); // A temporary matrix is mutable and ScMatrix::CloneIfConst() returns the diff --git a/sc/source/core/tool/jumpmatrix.cxx b/sc/source/core/tool/jumpmatrix.cxx index 244a77f6d83a..f3eb438cb940 100644 --- a/sc/source/core/tool/jumpmatrix.cxx +++ b/sc/source/core/tool/jumpmatrix.cxx @@ -29,7 +29,7 @@ const SCSIZE kBufferThreshold = 128; ScJumpMatrix::ScJumpMatrix( OpCode eOp, SCSIZE nColsP, SCSIZE nRowsP ) : mvJump(nColsP * nRowsP) - , pMat(new ScFullMatrix(nColsP, nRowsP)) + , pMat(new ScMatrix(nColsP, nRowsP)) , nCols(nColsP) , nRows(nRowsP) , nCurCol(0) diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx index 32bc09e5109c..33c90d9c67df 100644 --- a/sc/source/core/tool/rangeseq.cxx +++ b/sc/source/core/tool/rangeseq.cxx @@ -372,7 +372,7 @@ ScMatrixRef ScSequenceToMatrix::CreateMixedMatrix( const css::uno::Any & rAny ) if ( nMaxColCount && nRowCount ) { OUString aUStr; - xMatrix = new ScFullMatrix( + xMatrix = new ScMatrix( static_cast<SCSIZE>(nMaxColCount), static_cast<SCSIZE>(nRowCount), 0.0); SCSIZE nCols, nRows; diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index d9b500d1146d..4442c815a0fe 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -318,16 +318,16 @@ public: ScMatrixRef CompareMatrix( sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const; void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero ) const; - void MergeDoubleArray( std::vector<double>& rArray, ScFullMatrix::Op eOp ) const; + void MergeDoubleArray( std::vector<double>& rArray, ScMatrix::Op eOp ) const; void AddValues( const ScMatrixImpl& rMat ); template<typename T> void ApplyOperation(T aOp, ScMatrixImpl& rMat); void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, - const std::pair<size_t, size_t>& rEndPos, const ScFullMatrix::DoubleOpFunction& aDoubleFunc, - const ScFullMatrix::BoolOpFunction& aBoolFunc, const ScFullMatrix::StringOpFunction& aStringFunc, - const ScFullMatrix::EmptyOpFunction& aEmptyFunc) const; + const std::pair<size_t, size_t>& rEndPos, const ScMatrix::DoubleOpFunction& aDoubleFunc, + const ScMatrix::BoolOpFunction& aBoolFunc, const ScMatrix::StringOpFunction& aStringFunc, + const ScMatrix::EmptyOpFunction& aEmptyFunc) const; template<typename T> std::vector<ScMatrix::IterateResult> ApplyCollectOperation(const std::vector<std::unique_ptr<T>>& aOp); @@ -2158,7 +2158,7 @@ ScMatrixRef ScMatrixImpl::CompareMatrix( if (nSize != rResVal.size()) ScMatrixRef(); - return ScMatrixRef(new ScFullMatrix(aSize.column, aSize.row, rResVal)); + return ScMatrixRef(new ScMatrix(aSize.column, aSize.row, rResVal)); } } @@ -2170,7 +2170,7 @@ ScMatrixRef ScMatrixImpl::CompareMatrix( if (nSize != rResVal.size()) ScMatrixRef(); - return ScMatrixRef(new ScFullMatrix(aSize.column, aSize.row, rResVal)); + return ScMatrixRef(new ScMatrix(aSize.column, aSize.row, rResVal)); } void ScMatrixImpl::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero ) const @@ -2181,7 +2181,7 @@ void ScMatrixImpl::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZer aFunc.swap(rArray); } -void ScMatrixImpl::MergeDoubleArray( std::vector<double>& rArray, ScFullMatrix::Op eOp ) const +void ScMatrixImpl::MergeDoubleArray( std::vector<double>& rArray, ScMatrix::Op eOp ) const { MatrixImplType::size_pair_type aSize = maMat.size(); size_t nSize = aSize.row*aSize.column; @@ -2190,7 +2190,7 @@ void ScMatrixImpl::MergeDoubleArray( std::vector<double>& rArray, ScFullMatrix:: switch (eOp) { - case ScFullMatrix::Mul: + case ScMatrix::Mul: { MergeDoubleArrayFunc<ArrayMul> aFunc(rArray); maMat.walk(std::move(aFunc)); @@ -2509,10 +2509,10 @@ namespace { struct ElementBlock { ElementBlock(size_t nRowSize, - ScFullMatrix::DoubleOpFunction const & aDoubleFunc, - ScFullMatrix::BoolOpFunction const & aBoolFunc, - ScFullMatrix::StringOpFunction const & aStringFunc, - ScFullMatrix::EmptyOpFunction const & aEmptyFunc): + ScMatrix::DoubleOpFunction const & aDoubleFunc, + ScMatrix::BoolOpFunction const & aBoolFunc, + ScMatrix::StringOpFunction const & aStringFunc, + ScMatrix::EmptyOpFunction const & aEmptyFunc): mnRowSize(nRowSize), mnRowPos(0), mnColPos(0), @@ -2527,10 +2527,10 @@ struct ElementBlock size_t mnRowPos; size_t mnColPos; - ScFullMatrix::DoubleOpFunction maDoubleFunc; - ScFullMatrix::BoolOpFunction maBoolFunc; - ScFullMatrix::StringOpFunction maStringFunc; - ScFullMatrix::EmptyOpFunction maEmptyFunc; + ScMatrix::DoubleOpFunction maDoubleFunc; + ScMatrix::BoolOpFunction maBoolFunc; + ScMatrix::StringOpFunction maStringFunc; + ScMatrix::EmptyOpFunction maEmptyFunc; }; class WalkElementBlockOperation @@ -2945,8 +2945,8 @@ bool ScMatrix::IsSizeAllocatable( SCSIZE nC, SCSIZE nR ) return true; } -ScFullMatrix::ScFullMatrix( SCSIZE nC, SCSIZE nR) : - ScMatrix() +ScMatrix::ScMatrix( SCSIZE nC, SCSIZE nR) : + nRefCnt(0), mbCloneIfConst(true) { if (ScMatrix::IsSizeAllocatable( nC, nR)) pImpl.reset( new ScMatrixImpl( nC, nR)); @@ -2955,8 +2955,8 @@ ScFullMatrix::ScFullMatrix( SCSIZE nC, SCSIZE nR) : pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( FormulaError::MatrixSize))); } -ScFullMatrix::ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) : - ScMatrix() +ScMatrix::ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) : + nRefCnt(0), mbCloneIfConst(true) { if (ScMatrix::IsSizeAllocatable( nC, nR)) pImpl.reset( new ScMatrixImpl( nC, nR, fInitVal)); @@ -2965,8 +2965,8 @@ ScFullMatrix::ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) : pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( FormulaError::MatrixSize))); } -ScFullMatrix::ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ) : - ScMatrix() +ScMatrix::ScMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ) : + nRefCnt(0), mbCloneIfConst(true) { if (ScMatrix::IsSizeAllocatable( nC, nR)) pImpl.reset( new ScMatrixImpl( nC, nR, rInitVals)); @@ -2975,15 +2975,15 @@ ScFullMatrix::ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rIn pImpl.reset( new ScMatrixImpl( 1,1, CreateDoubleError( FormulaError::MatrixSize))); } -ScFullMatrix::~ScFullMatrix() +ScMatrix::~ScMatrix() { } -ScMatrix* ScFullMatrix::Clone() const +ScMatrix* ScMatrix::Clone() const { SCSIZE nC, nR; pImpl->GetDimensions(nC, nR); - ScMatrix* pScMat = new ScFullMatrix(nC, nR); + ScMatrix* pScMat = new ScMatrix(nC, nR); MatCopy(*pScMat); pScMat->SetErrorInterpreter(pImpl->GetErrorInterpreter()); // TODO: really? return pScMat; @@ -3004,353 +3004,347 @@ void ScMatrix::SetImmutable() const mbCloneIfConst = true; } -void ScFullMatrix::Resize( SCSIZE nC, SCSIZE nR) +void ScMatrix::Resize( SCSIZE nC, SCSIZE nR) { pImpl->Resize(nC, nR); } -void ScFullMatrix::Resize(SCSIZE nC, SCSIZE nR, double fVal) +void ScMatrix::Resize(SCSIZE nC, SCSIZE nR, double fVal) { pImpl->Resize(nC, nR, fVal); } -ScMatrix* ScFullMatrix::CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const +ScMatrix* ScMatrix::CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const { - ScMatrix* pScMat = new ScFullMatrix(nNewCols, nNewRows); + ScMatrix* pScMat = new ScMatrix(nNewCols, nNewRows); MatCopy(*pScMat); pScMat->SetErrorInterpreter(pImpl->GetErrorInterpreter()); return pScMat; } -void ScFullMatrix::SetErrorInterpreter( ScInterpreter* p) +void ScMatrix::SetErrorInterpreter( ScInterpreter* p) { pImpl->SetErrorInterpreter(p); } -void ScFullMatrix::GetDimensions( SCSIZE& rC, SCSIZE& rR) const +void ScMatrix::GetDimensions( SCSIZE& rC, SCSIZE& rR) const { pImpl->GetDimensions(rC, rR); } -SCSIZE ScFullMatrix::GetElementCount() const +SCSIZE ScMatrix::GetElementCount() const { return pImpl->GetElementCount(); } -bool ScFullMatrix::ValidColRow( SCSIZE nC, SCSIZE nR) const +bool ScMatrix::ValidColRow( SCSIZE nC, SCSIZE nR) const { return pImpl->ValidColRow(nC, nR); } -bool ScFullMatrix::ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const +bool ScMatrix::ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const { return pImpl->ValidColRowReplicated(rC, rR); } -bool ScFullMatrix::ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const +bool ScMatrix::ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const { return ValidColRow( rC, rR) || ValidColRowReplicated( rC, rR); } -void ScFullMatrix::PutDouble(double fVal, SCSIZE nC, SCSIZE nR) +void ScMatrix::PutDouble(double fVal, SCSIZE nC, SCSIZE nR) { pImpl->PutDouble(fVal, nC, nR); } -void ScFullMatrix::PutDouble( double fVal, SCSIZE nIndex) +void ScMatrix::PutDouble( double fVal, SCSIZE nIndex) { pImpl->PutDouble(fVal, nIndex); } -void ScFullMatrix::PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) +void ScMatrix::PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) { pImpl->PutDouble(pArray, nLen, nC, nR); } -void ScFullMatrix::PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) +void ScMatrix::PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) { pImpl->PutString(rStr, nC, nR); } -void ScFullMatrix::PutString(const svl::SharedString& rStr, SCSIZE nIndex) +void ScMatrix::PutString(const svl::SharedString& rStr, SCSIZE nIndex) { pImpl->PutString(rStr, nIndex); } -void ScFullMatrix::PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) +void ScMatrix::PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) { pImpl->PutString(pArray, nLen, nC, nR); } -void ScFullMatrix::PutEmpty(SCSIZE nC, SCSIZE nR) +void ScMatrix::PutEmpty(SCSIZE nC, SCSIZE nR) { pImpl->PutEmpty(nC, nR); } -void ScFullMatrix::PutEmptyPath(SCSIZE nC, SCSIZE nR) +void ScMatrix::PutEmptyPath(SCSIZE nC, SCSIZE nR) { pImpl->PutEmptyPath(nC, nR); } -void ScFullMatrix::PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) +void ScMatrix::PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) { pImpl->PutError(nErrorCode, nC, nR); } -void ScFullMatrix::PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR) +void ScMatrix::PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR) { pImpl->PutBoolean(bVal, nC, nR); } -FormulaError ScFullMatrix::GetError( SCSIZE nC, SCSIZE nR) const +FormulaError ScMatrix::GetError( SCSIZE nC, SCSIZE nR) const { return pImpl->GetError(nC, nR); } -double ScFullMatrix::GetDouble(SCSIZE nC, SCSIZE nR) const +double ScMatrix::GetDouble(SCSIZE nC, SCSIZE nR) const { return pImpl->GetDouble(nC, nR); } -double ScFullMatrix::GetDouble( SCSIZE nIndex) const +double ScMatrix::GetDouble( SCSIZE nIndex) const { return pImpl->GetDouble(nIndex); } -double ScFullMatrix::GetDoubleWithStringConversion(SCSIZE nC, SCSIZE nR) const +double ScMatrix::GetDoubleWithStringConversion(SCSIZE nC, SCSIZE nR) const { return pImpl->GetDoubleWithStringConversion(nC, nR); } -svl::SharedString ScFullMatrix::GetString(SCSIZE nC, SCSIZE nR) const +svl::SharedString ScMatrix::GetString(SCSIZE nC, SCSIZE nR) const { return pImpl->GetString(nC, nR); } -svl::SharedString ScFullMatrix::GetString( SCSIZE nIndex) const +svl::SharedString ScMatrix::GetString( SCSIZE nIndex) const { return pImpl->GetString(nIndex); } -svl::SharedString ScFullMatrix::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const +svl::SharedString ScMatrix::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const { return pImpl->GetString(rFormatter, nC, nR); } -ScMatrixValue ScFullMatrix::Get(SCSIZE nC, SCSIZE nR) const +ScMatrixValue ScMatrix::Get(SCSIZE nC, SCSIZE nR) const { return pImpl->Get(nC, nR); } -bool ScFullMatrix::IsStringOrEmpty( SCSIZE nIndex ) const +bool ScMatrix::IsStringOrEmpty( SCSIZE nIndex ) const { return pImpl->IsStringOrEmpty(nIndex); } -bool ScFullMatrix::IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsStringOrEmpty(nC, nR); } -bool ScFullMatrix::IsEmpty( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsEmpty( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsEmpty(nC, nR); } -bool ScFullMatrix::IsEmptyCell( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsEmptyCell( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsEmptyCell(nC, nR); } -bool ScFullMatrix::IsEmptyResult( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsEmptyResult( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsEmptyResult(nC, nR); } -bool ScFullMatrix::IsEmptyPath( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsEmptyPath( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsEmptyPath(nC, nR); } -bool ScFullMatrix::IsValue( SCSIZE nIndex ) const +bool ScMatrix::IsValue( SCSIZE nIndex ) const { return pImpl->IsValue(nIndex); } -bool ScFullMatrix::IsValue( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsValue( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsValue(nC, nR); } -bool ScFullMatrix::IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsValueOrEmpty(nC, nR); } -bool ScFullMatrix::IsBoolean( SCSIZE nC, SCSIZE nR ) const +bool ScMatrix::IsBoolean( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsBoolean(nC, nR); } -bool ScFullMatrix::IsNumeric() const +bool ScMatrix::IsNumeric() const { return pImpl->IsNumeric(); } -void ScFullMatrix::MatCopy(ScMatrix& mRes) const +void ScMatrix::MatCopy(ScMatrix& mRes) const { - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&mRes); - assert(pMatrix); - pImpl->MatCopy(*pMatrix->pImpl); + pImpl->MatCopy(*mRes.pImpl); } -void ScFullMatrix::MatTrans(ScMatrix& mRes) const +void ScMatrix::MatTrans(ScMatrix& mRes) const { - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&mRes); - assert(pMatrix); - pImpl->MatTrans(*pMatrix->pImpl); + pImpl->MatTrans(*mRes.pImpl); } -void ScFullMatrix::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) +void ScMatrix::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) { pImpl->FillDouble(fVal, nC1, nR1, nC2, nR2); } -void ScFullMatrix::PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) +void ScMatrix::PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) { pImpl->PutDoubleVector(rVec, nC, nR); } -void ScFullMatrix::PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) +void ScMatrix::PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) { pImpl->PutStringVector(rVec, nC, nR); } -void ScFullMatrix::PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) +void ScMatrix::PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) { pImpl->PutEmptyVector(nCount, nC, nR); } -void ScFullMatrix::PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) +void ScMatrix::PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) { pImpl->PutEmptyResultVector(nCount, nC, nR); } -void ScFullMatrix::PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) +void ScMatrix::PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) { pImpl->PutEmptyPathVector(nCount, nC, nR); } -void ScFullMatrix::CompareEqual() +void ScMatrix::CompareEqual() { pImpl->CompareEqual(); } -void ScFullMatrix::CompareNotEqual() +void ScMatrix::CompareNotEqual() { pImpl->CompareNotEqual(); } -void ScFullMatrix::CompareLess() +void ScMatrix::CompareLess() { pImpl->CompareLess(); } -void ScFullMatrix::CompareGreater() +void ScMatrix::CompareGreater() { pImpl->CompareGreater(); } -void ScFullMatrix::CompareLessEqual() +void ScMatrix::CompareLessEqual() { pImpl->CompareLessEqual(); } -void ScFullMatrix::CompareGreaterEqual() +void ScMatrix::CompareGreaterEqual() { pImpl->CompareGreaterEqual(); } -double ScFullMatrix::And() const +double ScMatrix::And() const { return pImpl->And(); } -double ScFullMatrix::Or() const +double ScMatrix::Or() const { return pImpl->Or(); } -double ScFullMatrix::Xor() const +double ScMatrix::Xor() const { return pImpl->Xor(); } -ScMatrix::IterateResult ScFullMatrix::Sum(bool bTextAsZero) const +ScMatrix::IterateResult ScMatrix::Sum(bool bTextAsZero) const { return pImpl->Sum(bTextAsZero); } -ScMatrix::IterateResult ScFullMatrix::SumSquare(bool bTextAsZero) const +ScMatrix::IterateResult ScMatrix::SumSquare(bool bTextAsZero) const { return pImpl->SumSquare(bTextAsZero); } -ScMatrix::IterateResult ScFullMatrix::Product(bool bTextAsZero) const +ScMatrix::IterateResult ScMatrix::Product(bool bTextAsZero) const { return pImpl->Product(bTextAsZero); } -size_t ScFullMatrix::Count(bool bCountStrings, bool bCountErrors) const +size_t ScMatrix::Count(bool bCountStrings, bool bCountErrors) const { return pImpl->Count(bCountStrings, bCountErrors); } -size_t ScFullMatrix::MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const +size_t ScMatrix::MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const { return pImpl->MatchDoubleInColumns(fValue, nCol1, nCol2); } -size_t ScFullMatrix::MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const +size_t ScMatrix::MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const { return pImpl->MatchStringInColumns(rStr, nCol1, nCol2); } -double ScFullMatrix::GetMaxValue( bool bTextAsZero ) const +double ScMatrix::GetMaxValue( bool bTextAsZero ) const { return pImpl->GetMaxValue(bTextAsZero); } -double ScFullMatrix::GetMinValue( bool bTextAsZero ) const +double ScMatrix::GetMinValue( bool bTextAsZero ) const { return pImpl->GetMinValue(bTextAsZero); } -double ScFullMatrix::GetGcd() const +double ScMatrix::GetGcd() const { return pImpl->GetGcd(); } -double ScFullMatrix::GetLcm() const +double ScMatrix::GetLcm() const { return pImpl->GetLcm(); } -ScMatrixRef ScFullMatrix::CompareMatrix( +ScMatrixRef ScMatrix::CompareMatrix( sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const { return pImpl->CompareMatrix(rComp, nMatPos, pOptions); } -void ScFullMatrix::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero ) const +void ScMatrix::GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero ) const { pImpl->GetDoubleArray(rArray, bEmptyAsZero); } -void ScFullMatrix::MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const +void ScMatrix::MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const { pImpl->MergeDoubleArray(rArray, eOp); } @@ -3447,138 +3441,108 @@ public: } -void ScFullMatrix::NotOp( ScMatrix& rMat) +void ScMatrix::NotOp( ScMatrix& rMat) { auto not_ = [](double a, double){return double(a == 0.0);}; matop::MatOp<decltype(not_), double> aOp(not_, pImpl->GetErrorInterpreter()); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } -void ScFullMatrix::NegOp( ScMatrix& rMat) +void ScMatrix::NegOp( ScMatrix& rMat) { auto neg_ = [](double a, double){return -a;}; matop::MatOp<decltype(neg_), double> aOp(neg_, pImpl->GetErrorInterpreter()); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } -void ScFullMatrix::AddOp( double fVal, ScMatrix& rMat) +void ScMatrix::AddOp( double fVal, ScMatrix& rMat) { auto add_ = [](double a, double b){return a + b;}; matop::MatOp<decltype(add_)> aOp(add_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } -void ScFullMatrix::SubOp( bool bFlag, double fVal, ScMatrix& rMat) +void ScMatrix::SubOp( bool bFlag, double fVal, ScMatrix& rMat) { if (bFlag) { auto sub_ = [](double a, double b){return b - a;}; matop::MatOp<decltype(sub_)> aOp(sub_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } else { auto sub_ = [](double a, double b){return a - b;}; matop::MatOp<decltype(sub_)> aOp(sub_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } } -void ScFullMatrix::MulOp( double fVal, ScMatrix& rMat) +void ScMatrix::MulOp( double fVal, ScMatrix& rMat) { auto mul_ = [](double a, double b){return a * b;}; matop::MatOp<decltype(mul_)> aOp(mul_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } -void ScFullMatrix::DivOp( bool bFlag, double fVal, ScMatrix& rMat) +void ScMatrix::DivOp( bool bFlag, double fVal, ScMatrix& rMat) { if (bFlag) { auto div_ = [](double a, double b){return sc::div(b, a);}; matop::MatOp<decltype(div_)> aOp(div_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } else { auto div_ = [](double a, double b){return sc::div(a, b);}; matop::MatOp<decltype(div_)> aOp(div_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } } -void ScFullMatrix::PowOp( bool bFlag, double fVal, ScMatrix& rMat) +void ScMatrix::PowOp( bool bFlag, double fVal, ScMatrix& rMat) { if (bFlag) { auto pow_ = [](double a, double b){return pow(b, a);}; matop::MatOp<decltype(pow_)> aOp(pow_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } else { auto pow_ = [](double a, double b){return pow(a, b);}; matop::MatOp<decltype(pow_)> aOp(pow_, pImpl->GetErrorInterpreter(), fVal); - // FIXME - ScFullMatrix* pMatrix = dynamic_cast<ScFullMatrix*>(&rMat); - assert(pMatrix); - pImpl->ApplyOperation(aOp, *pMatrix->pImpl); + pImpl->ApplyOperation(aOp, *rMat.pImpl); } } -void ScFullMatrix::ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, +void ScMatrix::ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc, EmptyOpFunction aEmptyFunc) const { pImpl->ExecuteOperation(rStartPos, rEndPos, aDoubleFunc, aBoolFunc, aStringFunc, aEmptyFunc); } -std::vector<ScMatrix::IterateResult> ScFullMatrix::Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) +std::vector<ScMatrix::IterateResult> ScMatrix::Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) { return pImpl->ApplyCollectOperation(aOp); } -ScFullMatrix& ScFullMatrix::operator+= ( const ScFullMatrix& r ) +ScMatrix& ScMatrix::operator+= ( const ScMatrix& r ) { pImpl->AddValues(*r.pImpl); return *this; } #if DEBUG_MATRIX -void ScFullMatrix::Dump() const +void ScMatrix::Dump() const { pImpl->Dump(); } #endif -void ScFullMatrix::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, +void ScMatrix::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) { pImpl->MatConcat(nMaxCol, nMaxRow, xMat1, xMat2, rFormatter, rPool); diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 618a39879a0a..11160a4fe7eb 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -2097,7 +2097,7 @@ FormulaToken* ScTokenArray::MergeArray( ) return nullptr; int nSign = 1; - ScMatrix* pArray = new ScFullMatrix(nCol, nRow, 0.0); + ScMatrix* pArray = new ScMatrix(nCol, nRow, 0.0); for ( i = nStart, nCol = 0, nRow = 0 ; i < nLen ; i++ ) { t = pCode[i]; diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx index df9de77baeee..f28705fd755a 100644 --- a/sc/source/filter/excel/tokstack.cxx +++ b/sc/source/filter/excel/tokstack.cxx @@ -595,7 +595,7 @@ const TokenId TokenPool::StoreMatrix() pElement[ nElementCurrent ] = nP_MatrixCurrent; pType[ nElementCurrent ] = T_Matrix; - ScMatrix* pM = new ScFullMatrix( 0, 0 ); + ScMatrix* pM = new ScMatrix( 0, 0 ); pM->IncRef( ); ppP_Matrix[ nP_MatrixCurrent ] = pM; diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index b8e138490140..2da87f235a8a 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -861,7 +861,7 @@ ScMatrixRef XclImpCachedMatrix::CreateScMatrix( svl::SharedStringPool& rPool ) c OSL_ENSURE( mnScCols * mnScRows == maValueList.size(), "XclImpCachedMatrix::CreateScMatrix - element count mismatch" ); if( mnScCols && mnScRows && static_cast< sal_uLong >( mnScCols * mnScRows ) <= maValueList.size() ) { - xScMatrix = new ScFullMatrix(mnScCols, mnScRows, 0.0); + xScMatrix = new ScMatrix(mnScCols, mnScRows, 0.0); XclImpValueList::const_iterator itValue = maValueList.begin(); for( SCSIZE nScRow = 0; nScRow < mnScRows; ++nScRow ) { diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 10e393dbb8d3..f7960c40e3c2 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -272,7 +272,7 @@ sal_uInt16 XclImpTabInfo::GetCurrentIndex( sal_uInt16 nCreatedId, sal_uInt16 nMa // External names ============================================================= XclImpExtName::MOper::MOper(svl::SharedStringPool& rPool, XclImpStream& rStrm) : - mxCached(new ScFullMatrix(0,0)) + mxCached(new ScMatrix(0,0)) { SCSIZE nLastCol = rStrm.ReaduInt8(); SCSIZE nLastRow = rStrm.ReaduInt16(); diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx index 71536362d02e..980f3005a90a 100644 --- a/sc/source/filter/inc/xihelper.hxx +++ b/sc/source/filter/inc/xihelper.hxx @@ -337,7 +337,7 @@ public: explicit XclImpCachedMatrix( XclImpStream& rStrm ); ~XclImpCachedMatrix(); - /** Creates a new ScFullMatrix object and fills it with the contained values. */ + /** Creates a new ScMatrix object and fills it with the contained values. */ ScMatrixRef CreateScMatrix( svl::SharedStringPool& rPool ) const; private: diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx index db1c04d4edf8..b87e33eab516 100644 --- a/sc/source/filter/xml/XMLDDELinksContext.cxx +++ b/sc/source/filter/xml/XMLDDELinksContext.cxx @@ -149,7 +149,7 @@ void SAL_CALL ScXMLDDELinkContext::endFastElement( sal_Int32 /*nElement*/ ) OSL_ENSURE( static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size(), "ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either"); } - ScMatrixRef pMatrix = new ScFullMatrix(static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows), 0.0); + ScMatrixRef pMatrix = new ScMatrix(static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows), 0.0); sal_Int32 nCol(0); sal_Int32 nRow(-1); sal_Int32 nIndex(0); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index d3e98f4f25c7..da250fbafe02 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1438,7 +1438,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos ) ScFormulaCell* pFCell = rXMLImport.GetDocument()->GetFormulaCell(rCellPos); if (pFCell) { - ScMatrixRef pMat(new ScFullMatrix(nMatrixCols, nMatrixRows)); + ScMatrixRef pMat(new ScMatrix(nMatrixCols, nMatrixRows)); if (bFormulaTextResult && maStringValue) { if (!IsPossibleErrorString()) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index f274fd5d657a..94b582556564 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -609,7 +609,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( SCSIZE nMatrixColumns = static_cast<SCSIZE>(nDataCol2-nDataCol1+1); SCSIZE nMatrixRows = static_cast<SCSIZE>(nDataRow2-nDataRow1+1); - ScMatrixRef xMat = new ScFullMatrix( nMatrixColumns, nMatrixRows); + ScMatrixRef xMat = new ScMatrix( nMatrixColumns, nMatrixRows); // Needed in shrink and fill. vector<SCROW> aRows; @@ -657,7 +657,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( { nMatrixColumns = static_cast<SCSIZE>(nMaxCol-nMinCol+1); nMatrixRows = static_cast<SCSIZE>(nDataRow2-nDataRow1+1); - xMat = new ScFullMatrix( nMatrixColumns, nMatrixRows); + xMat = new ScMatrix( nMatrixColumns, nMatrixRows); xMat->GetDimensions( nMatCols, nMatRows); if (nMatCols == nMatrixColumns && nMatRows == nMatrixRows) { @@ -846,19 +846,19 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa pMat->GetDimensions( nMatCols, nMatRows); if (nMatCols > static_cast<SCSIZE>(nCol2 - nCol1) && nMatRows > static_cast<SCSIZE>(nRow2 - nRow1)) { - ScFullMatrix::DoubleOpFunction aDoubleFunc = [=](size_t row, size_t col, double val) -> void + ScMatrix::DoubleOpFunction aDoubleFunc = [=](size_t row, size_t col, double val) -> void { pTabData->setCell(col + nCol1, row + nRow1, new formula::FormulaDoubleToken(val), 0, false); }; - ScFullMatrix::BoolOpFunction aBoolFunc = [=](size_t row, size_t col, bool val) -> void + ScMatrix::BoolOpFunction aBoolFunc = [=](size_t row, size_t col, bool val) -> void { pTabData->setCell(col + nCol1, row + nRow1, new formula::FormulaDoubleToken(val ? 1.0 : 0.0), 0, false); }; - ScFullMatrix::StringOpFunction aStringFunc = [=](size_t row, size_t col, svl::SharedString val) -> void + ScMatrix::StringOpFunction aStringFunc = [=](size_t row, size_t col, svl::SharedString val) -> void { pTabData->setCell(col + nCol1, row + nRow1, new formula::FormulaStringToken(val), 0, false); }; - ScFullMatrix::EmptyOpFunction aEmptyFunc = [=](size_t /*row*/, size_t /*col*/) -> void + ScMatrix::EmptyOpFunction aEmptyFunc = [=](size_t /*row*/, size_t /*col*/) -> void { // Nothing. Empty cell. }; @@ -1597,7 +1597,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray( SCSIZE nMatrixColumns = static_cast<SCSIZE>(nCol2-nCol1+1); SCSIZE nMatrixRows = static_cast<SCSIZE>(nRow2-nRow1+1); - ScMatrixRef xMat = new ScFullMatrix( nMatrixColumns, nMatrixRows); + ScMatrixRef xMat = new ScMatrix( nMatrixColumns, nMatrixRows); // Check if size could be allocated and if not skip the fill, there's // one error element instead. But retry first with the actual data area @@ -1620,7 +1620,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray( { nMatrixColumns = static_cast<SCSIZE>(nDataCol2-nDataCol1+1); nMatrixRows = static_cast<SCSIZE>(nDataRow2-nDataRow1+1); - xMat = new ScFullMatrix( nMatrixColumns, nMatrixRows); + xMat = new ScMatrix( nMatrixColumns, nMatrixRows); xMat->GetDimensions( nMatCols, nMatRows); if (nMatCols == nMatrixColumns && nMatRows == nMatrixRows) pSrcDoc->FillMatrix(*xMat, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, &pHostDoc->GetSharedStringPool()); @@ -1653,7 +1653,7 @@ static std::unique_ptr<ScTokenArray> lcl_fillEmptyMatrix(const ScRange& rRange) { SCSIZE nC = static_cast<SCSIZE>(rRange.aEnd.Col()-rRange.aStart.Col()+1); SCSIZE nR = static_cast<SCSIZE>(rRange.aEnd.Row()-rRange.aStart.Row()+1); - ScMatrixRef xMat = new ScFullMatrix(nC, nR); + ScMatrixRef xMat = new ScMatrix(nC, nR); ScMatrixToken aToken(xMat); unique_ptr<ScTokenArray> pArray(new ScTokenArray); |