sc/source/core/tool/scmatrix.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit bfc8a79c957dd65dc7e42c47c4fc6de61443fa29 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon Apr 28 13:33:08 2014 -0400 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.mohrh...@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index f48de85..3b2c42c 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: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits