sc/inc/column.hxx | 4 +++ sc/inc/document.hxx | 5 ++++ sc/inc/table.hxx | 5 ++++ sc/source/core/data/column2.cxx | 40 +++++++++++++++++++++++++++++++++++++++ sc/source/core/data/document.cxx | 11 ++++++++++ sc/source/core/data/table1.cxx | 10 +++++++++ 6 files changed, 75 insertions(+)
New commits: commit 96e92dc1677f3884ec6a1ec3b67148c28b24bd24 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 15:49:43 2013 -0400 Add a convenient way to dump formula group states for a single column. Useful when debugging. Change-Id: I4e408ad9a3dc2046557d152fcd067c1b0c5645c0 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 4601ae2..6cc3c4b 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -525,6 +525,10 @@ public: void FormulaCellsUndecided( SCROW nRow1, SCROW nRow2 ); +#if DEBUG_COLUMN_STORAGE + void DumpFormulaGroups() const; +#endif + private: sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 8d942b7..806fb77 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include "typedstrdata.hxx" #include "compressedarray.hxx" +#include "calcmacros.hxx" #include <tools/fract.hxx> #include <tools/gen.hxx> @@ -1984,6 +1985,10 @@ public: */ bool HasBroadcaster( SCTAB nTab, SCCOL nCol ) const; +#if DEBUG_COLUMN_STORAGE + void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const; +#endif + private: // CLOOK-Impl-methods /** diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index bda039f..03060bb 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -32,6 +32,7 @@ #include "types.hxx" #include "cellvalue.hxx" #include "formula/types.hxx" +#include "calcmacros.hxx" #include <set> #include <map> @@ -857,6 +858,10 @@ public: void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen ); +#if DEBUG_COLUMN_STORAGE + void DumpFormulaGroups( SCCOL nCol ) const; +#endif + /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly. 'Replace' replaces at the 'current' position, but in order to achieve diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index a7056d0..ae20e44 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1544,6 +1544,46 @@ void ScColumn::FormulaCellsUndecided( SCROW /*nRow1*/, SCROW /*nRow2*/ ) { } +#if DEBUG_COLUMN_STORAGE + +namespace { + +struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, void> +{ + void operator() (const sc::CellStoreType::value_type& rNode) const + { + if (rNode.type != sc::element_type_formula) + return; + + 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()) + continue; + + if (rCell.GetSharedTopRow() != rCell.aPos.Row()) + continue; + + SCROW nLen = rCell.GetSharedLength(); + cout << " * group: start=" << rCell.aPos.Row() << ", length=" << nLen << endl; + std::advance(it, nLen-1); + } + } +}; + +} + +void ScColumn::DumpFormulaGroups() const +{ + cout << "-- formua groups" << endl; + std::for_each(maCells.begin(), maCells.end(), FormulaGroupDumper()); + cout << "--" << endl; +} +#endif + void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const { rDestCol.maCellTextAttrs.set_empty(nRow1, nRow2); // Empty the destination range first. diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3ce424f..9d3c72f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2266,6 +2266,17 @@ bool ScDocument::HasBroadcaster( SCTAB nTab, SCCOL nCol ) const return pTab->HasBroadcaster(nCol); } +#if DEBUG_COLUMN_STORAGE +void ScDocument::DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const +{ + const ScTable* pTab = FetchTable(nTab); + if (!pTab) + return; + + pTab->DumpFormulaGroups(nCol); +} +#endif + bool ScDocument::TableExists( SCTAB nTab ) const { return ValidTab(nTab) && static_cast<size_t>(nTab) < maTabs.size() && maTabs[nTab]; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index dcd0344..02c8952 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2221,6 +2221,16 @@ void ScTable::SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, aCol[nCol].SetFormulaResults(nRow, pResults, nLen); } +#if DEBUG_COLUMN_STORAGE +void ScTable::DumpFormulaGroups( SCCOL nCol ) const +{ + if (!ValidCol(nCol)) + return; + + aCol[nCol].DumpFormulaGroups(); +} +#endif + const SvtBroadcaster* ScTable::GetBroadcaster( SCCOL nCol, SCROW nRow ) const { if (!ValidColRow(nCol, nRow)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits