summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-04-28 13:33:08 -0400
committerAndras Timar <andras.timar@collabora.com>2014-04-30 14:57:00 +0200
commite18c42f5dc5e1a7249380759a1a3bf9b2094123d (patch)
treef30d76953ead31ee291596622c2d787c6057a1d8 /sc
parent96924c504a11e10a2d633781d7c4d4d3fd2d520e (diff)
fdo#77969: Return 0 in case of matrix consisting of all empty elements.
Change-Id: I225d50445d7f84a17c0b9492c17247e4c1c9ef44 (cherry picked from commit 453ea919e70fa9832f11e3ef042bb80cd86892cc) Reviewed-on: https://gerrit.libreoffice.org/9189 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/scmatrix.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index f48de859910f..3b2c42c2bb09 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1236,12 +1236,14 @@ class CalcMaxMinValue : std::unary_function<MatrixImplType::element_block_type,
{
double mfVal;
bool mbTextAsZero;
+ bool mbHasValue;
public:
CalcMaxMinValue( bool bTextAsZero ) :
mfVal(_Op::init()),
- mbTextAsZero(bTextAsZero) {}
+ mbTextAsZero(bTextAsZero),
+ mbHasValue(false) {}
- double getValue() const { return mfVal; }
+ double getValue() const { return mbHasValue ? mfVal : 0.0; }
void operator() (const MatrixImplType::element_block_node_type& node)
{
@@ -1256,6 +1258,8 @@ public:
block_type::const_iterator itEnd = block_type::end(*node.data);
for (; it != itEnd; ++it)
mfVal = _Op::compare(mfVal, *it);
+
+ mbHasValue = true;
}
break;
case mdds::mtm::element_boolean:
@@ -1266,6 +1270,7 @@ public:
block_type::const_iterator itEnd = block_type::end(*node.data);
double fVal = _Op::boolValue(it, itEnd);
mfVal = _Op::compare(mfVal, fVal);
+ mbHasValue = true;
}
break;
case mdds::mtm::element_string:
@@ -1273,7 +1278,10 @@ public:
{
// empty elements are treated as empty strings.
if (mbTextAsZero)
+ {
mfVal = _Op::compare(mfVal, 0.0);
+ mbHasValue = true;
+ }
}
break;
default: