diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-28 13:33:08 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-28 13:45:47 -0400 |
commit | 453ea919e70fa9832f11e3ef042bb80cd86892cc (patch) | |
tree | 9d45f9c457551131bb893b59d0ec446624cf5d93 | |
parent | a4a5f67008a931508a9d963f6b95db9cb9d45aef (diff) |
fdo#77969: Return 0 in case of matrix consisting of all empty elements.
Change-Id: I225d50445d7f84a17c0b9492c17247e4c1c9ef44
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 32da95ae205f..f21baeda9ed7 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -1235,12 +1235,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) { @@ -1255,6 +1257,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: @@ -1265,6 +1269,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: @@ -1272,7 +1277,10 @@ public: { // empty elements are treated as empty strings. if (mbTextAsZero) + { mfVal = _Op::compare(mfVal, 0.0); + mbHasValue = true; + } } break; default: |