summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2017-05-08 19:21:08 -0400
committerKohei Yoshida <libreoffice@kohei.us>2017-05-09 02:04:45 +0200
commit9d320ec4d818f86e58a15fd46248026502b1cc94 (patch)
tree538a6e64090ac2bc44c5a27c04096c265ca53bdb /sc/source
parent835b1efd2d6564333b869d637060b3c6bbd17a17 (diff)
Avoid adding unnecessary overhead to formula calculation.
Instead, hide the overhead within the logger code which is disabled in the release build. Change-Id: Ie80c2a1725476d96d3e5551cf0303ecb5d73b47e Reviewed-on: https://gerrit.libreoffice.org/37409 Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/formulacell.cxx7
-rw-r--r--sc/source/core/tool/formulalogger.cxx13
2 files changed, 13 insertions, 7 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index d1058fe4a7cb..04c19257ae17 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4088,12 +4088,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
if (GetWeight() < ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize)
{
mxGroup->meCalcState = sc::GroupCalcDisabled;
- std::ostringstream os;
- os << "group length below minimum threshold ("
- << GetWeight()
- << " < " << ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize
- << ")";
- aScope.addMessage(OUString::createFromAscii(os.str().data()));
+ aScope.addGroupSizeThreasholdMessage(*this);
return false;
}
diff --git a/sc/source/core/tool/formulalogger.cxx b/sc/source/core/tool/formulalogger.cxx
index 7c70d4c730f9..ffa29ecd06a4 100644
--- a/sc/source/core/tool/formulalogger.cxx
+++ b/sc/source/core/tool/formulalogger.cxx
@@ -5,13 +5,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <memory>
#include <formulalogger.hxx>
#include <formulacell.hxx>
#include <tokenarray.hxx>
#include <document.hxx>
#include <tokenstringcontext.hxx>
#include <address.hxx>
+#include <interpre.hxx>
#include <osl/file.hxx>
#include <o3tl/make_unique.hxx>
@@ -214,6 +214,17 @@ void FormulaLogger::GroupScope::addRefMessage(
mpImpl->maMessages.push_back(aBuf.makeStringAndClear());
}
+void FormulaLogger::GroupScope::addGroupSizeThreasholdMessage( const ScFormulaCell& rCell )
+{
+ OUStringBuffer aBuf;
+ aBuf.append("group length below minimum threshold (");
+ aBuf.append(rCell.GetWeight());
+ aBuf.append(" < ");
+ aBuf.append(ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize);
+ aBuf.append(")");
+ mpImpl->maMessages.push_back(aBuf.makeStringAndClear());
+}
+
void FormulaLogger::GroupScope::setCalcComplete()
{
mpImpl->mbCalcComplete = true;