[Libreoffice-commits] core.git: sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Nov 11 23:01:39 UTC 2016
sc/source/core/data/column2.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 0af30952982767543cddd0b1ce643cb8d5c253a2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Nov 11 17:59:48 2016 -0500
Dump the formula string here which is also useful.
Change-Id: I604fbb41fc41319bbb17a5aef0994c8e0adc838a
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index b013569..b3f12f9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -46,6 +46,7 @@
#include "progress.hxx"
#include "scmatrix.hxx"
#include <rowheightcontext.hxx>
+#include <tokenstringcontext.hxx>
#include <editeng/eeitem.hxx>
@@ -1568,6 +1569,10 @@ namespace {
struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, void>
{
+ const ScDocument* mpDoc;
+
+ FormulaGroupDumper( const ScDocument* pDoc ) : mpDoc(pDoc) {}
+
void operator() (const sc::CellStoreType::value_type& rNode) const
{
if (rNode.type != sc::element_type_formula)
@@ -1597,6 +1602,7 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v
SCROW nLen = pCell->GetSharedLength();
cout << " * group: start=" << pCell->aPos.Row() << ", length=" << nLen << endl;
+ printFormula(pCell);
printResult(pCell);
if (nLen > 1)
@@ -1610,6 +1616,13 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v
}
}
+ void printFormula(const ScFormulaCell* pCell) const
+ {
+ sc::TokenStringContext aCxt(mpDoc, mpDoc->GetGrammar());
+ OUString aFormula = pCell->GetCode()->CreateString(aCxt, pCell->aPos);
+ cout << " * formula: " << aFormula << endl;
+ }
+
void printResult(const ScFormulaCell* pCell) const
{
sc::FormulaResultValue aRes = pCell->GetResult();
@@ -1639,7 +1652,7 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v
void ScColumn::DumpFormulaGroups() const
{
cout << "-- table: " << nTab << "; column: " << nCol << endl;
- std::for_each(maCells.begin(), maCells.end(), FormulaGroupDumper());
+ std::for_each(maCells.begin(), maCells.end(), FormulaGroupDumper(pDocument));
cout << "--" << endl;
}
#endif
More information about the Libreoffice-commits
mailing list