diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-10-01 15:58:10 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-10-01 19:13:05 -0400 |
commit | 55c30b56ed9bfe44ab2a2a6861aa3d9ad2d16601 (patch) | |
tree | a158fe4ead8597a89ce4db026e56c0a02cab6d15 /sc/source | |
parent | 2135eae2a97c17d89cb47a2074830fd2d7b2226f (diff) |
Dump the stored formula results for debugging.
Change-Id: Ib9edd7e8d61d7a83191e4848fea47b7c9b1b1766
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/column2.cxx | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index d4fa874220fd..3cc09b014f2b 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1578,37 +1578,72 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v if (rNode.type != sc::element_type_formula) return; - cout << " -- formula block" << endl; + cout << " * formula block" << endl; sc::formula_block::const_iterator it = sc::formula_block::begin(*rNode.data); sc::formula_block::const_iterator itEnd = sc::formula_block::end(*rNode.data); for (; it != itEnd; ++it) { - const ScFormulaCell& rCell = **it; - if (!rCell.IsShared()) + const ScFormulaCell* pCell = *it; + if (!pCell->IsShared()) { - cout << " + row " << rCell.aPos.Row() << " not shared" << endl; + cout << " * row " << pCell->aPos.Row() << " not shared" << endl; + printResult(pCell); continue; } - if (rCell.GetSharedTopRow() != rCell.aPos.Row()) + if (pCell->GetSharedTopRow() != pCell->aPos.Row()) { - cout << " + row " << rCell.aPos.Row() << " shared with top row " << rCell.GetSharedTopRow() << " with length " << rCell.GetSharedLength() << endl; + cout << " * row " << pCell->aPos.Row() << " shared with top row " + << pCell->GetSharedTopRow() << " with length " << pCell->GetSharedLength() + << endl; continue; } - SCROW nLen = rCell.GetSharedLength(); - cout << " * group: start=" << rCell.aPos.Row() << ", length=" << nLen << endl; - std::advance(it, nLen-1); + SCROW nLen = pCell->GetSharedLength(); + cout << " * group: start=" << pCell->aPos.Row() << ", length=" << nLen << endl; + printResult(pCell); + + if (nLen > 1) + { + for (SCROW i = 0; i < nLen-1; ++i, ++it) + { + pCell = *it; + printResult(pCell); + } + } } } + + void printResult(const ScFormulaCell* pCell) const + { + sc::FormulaResultValue aRes = pCell->GetResult(); + cout << " * result: "; + switch (aRes.meType) + { + case sc::FormulaResultValue::Value: + cout << aRes.mfValue << " (type: value)"; + break; + case sc::FormulaResultValue::String: + cout << aRes.maString.getString() << " (type: string)"; + break; + case sc::FormulaResultValue::Error: + cout << "error (" << static_cast<int>(aRes.mnError) << ")"; + break; + case sc::FormulaResultValue::Invalid: + cout << "invalid"; + break; + } + + cout << endl; + } }; } void ScColumn::DumpFormulaGroups() const { - cout << "-- formula groups" << endl; + cout << "-- table: " << nTab << "; column: " << nCol << endl; std::for_each(maCells.begin(), maCells.end(), FormulaGroupDumper()); cout << "--" << endl; } |