diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scmatrix.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index db863cc66a1a..f54028db74e8 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -29,6 +29,7 @@ #include <svl/sharedstring.hxx> #include <functional> +#include <memory> #include <utility> #include <vector> #include <boost/intrusive_ptr.hpp> @@ -398,6 +399,8 @@ public: void DivOp(bool bFlag, double fVal, ScMatrix& rMat); void PowOp(bool bFlag, double fVal, ScMatrix& rMat); + std::vector<ScMatrix::IterateResult> Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp); + ScMatrix& operator+= ( const ScMatrix& r ); #if DEBUG_MATRIX diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 207e45149bf5..f178db4a7ff9 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -301,6 +301,9 @@ public: template<typename T> void ApplyOperation(T aOp, ScMatrixImpl& rMat); + template<typename T> + std::vector<ScMatrix::IterateResult> ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp); + #if DEBUG_MATRIX void Dump() const; #endif @@ -2164,7 +2167,16 @@ void ScMatrixImpl::ApplyOperation(T aOp, ScMatrixImpl& rMat) maMat.walk(aFunc); } +template<typename T> +std::vector<ScMatrix::IterateResult> ScMatrixImpl::ApplyCollectOperation(bool bTextAsZero, const std::vector<std::unique_ptr<T>>& aOp) +{ + WalkElementBlocksMultipleValues<T> aFunc(bTextAsZero, aOp); + maMat.walk(aFunc); + return aFunc.getResult(); +} + #if DEBUG_MATRIX + void ScMatrixImpl::Dump() const { cout << "-- matrix content" << endl; @@ -2751,6 +2763,11 @@ void ScMatrix::PowOp( bool bFlag, double fVal, ScMatrix& rMat) } } +std::vector<ScMatrix::IterateResult> ScMatrix::Collect(bool bTextAsZero, const std::vector<std::unique_ptr<sc::op::Op>>& aOp) +{ + return pImpl->ApplyCollectOperation(bTextAsZero, aOp); +} + ScMatrix& ScMatrix::operator+= ( const ScMatrix& r ) { pImpl->AddValues(*r.pImpl); |