summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-04-02 23:31:20 +0200
committerEike Rathke <erack@redhat.com>2015-04-02 23:36:21 +0200
commita6376855d773282ab680c36002b3037cb0a4a9b1 (patch)
treeebf8f1297708ff9c9685875eafcd9ece3b7c7d5d
parentf9e38cbd3afdf0c8b2ebef0c4995e2443eac4d9a (diff)
empty element evaluates to 0, tdf#89387 tdf#42481 related
Change-Id: Ie3c8663319fe5f9b7aad2e063743a372c0b317ce
-rw-r--r--sc/source/core/tool/scmatrix.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 905413c57e66..400c260fde99 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -2082,7 +2082,8 @@ public:
if (maOp.useFunctionForEmpty())
{
std::vector<char> aVec(node.size);
- MatrixIteratorWrapper<std::vector<char>, T, typename T::empty_value_type> aFunc(aVec.begin(), aVec.end(), maOp);
+ MatrixIteratorWrapper<std::vector<char>, T, typename T::number_value_type>
+ aFunc(aVec.begin(), aVec.end(), maOp);
pos = mrMat.set(pos, aFunc.begin(), aFunc.end());
}
}
@@ -2543,7 +2544,7 @@ struct COp {};
template <typename T>
struct COp<T, svl::SharedString>
{
- svl::SharedString operator()(char, T /*aOp*/, const svl::SharedString& rString) const
+ svl::SharedString operator()(char, T /*aOp*/, double /*a*/, double /*b*/, const svl::SharedString& rString) const
{
return rString;
}
@@ -2552,14 +2553,17 @@ struct COp<T, svl::SharedString>
template <typename T>
struct COp<T, double>
{
- double operator()(char, T aOp, const svl::SharedString& /*rString*/) const
+ double operator()(char, T aOp, double a, double b, const svl::SharedString& /*rString*/) const
{
- return aOp(double{}, double{});
+ return aOp( a, b);
}
};
/** A template for operations where operands are supposed to be numeric.
- A non-numeric operand leads to an errNoValue DoubleError.
+ A non-numeric (string) operand leads to an errNoValue DoubleError.
+ An empty operand evaluates to 0.
+ XXX: semantically TEmptyRes and types other than number_value_type are
+ unused, but this template could serve as a basis for future enhancements.
*/
template<typename TOp, typename TEmptyRes=double, typename TRet=double>
struct MatOp
@@ -2598,7 +2602,7 @@ public:
TEmptyRes operator()(char) const
{
- return maCOp(char{}, maOp, maString);
+ return maCOp(char{}, maOp, 0, mfVal, maString);
}
bool useFunctionForEmpty() const