summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorƁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-08-08 15:55:56 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-02 05:15:36 +0000
commit69374b8a48f8165b3f9c084a77326f23d4400dc4 (patch)
tree56b24603418443406e538469cef21a470f55057e /sc
parent9f162251c6ef672a2c7178af1463c2b13dd136de (diff)
Add ScMatrix method to collect multiple values
Change-Id: I09b9b1bc62b084824dc0eaffd6ee500de11781fd Reviewed-on: https://gerrit.libreoffice.org/17594 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/scmatrix.hxx3
-rw-r--r--sc/source/core/tool/scmatrix.cxx17
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);