sc/source/core/data/column2.cxx | 55 ++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 10 deletions(-)
New commits: commit 55c30b56ed9bfe44ab2a2a6861aa3d9ad2d16601 Author: Kohei Yoshida <[email protected]> Date: Sat Oct 1 15:58:10 2016 -0400 Dump the stored formula results for debugging. Change-Id: Ib9edd7e8d61d7a83191e4848fea47b7c9b1b1766 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index d4fa874..3cc09b0 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; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
