diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-28 13:33:08 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-04-28 22:58:18 +0000 |
commit | bfc8a79c957dd65dc7e42c47c4fc6de61443fa29 (patch) | |
tree | 101487e5ec9e45ba18d5a9819117c6d5a977c6da /sc | |
parent | 473e10aa5e1e3c6a4854dec9ff2ea522be283799 (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.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 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: |