Kaydet (Commit) 1968e62d authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Add a convenient way to dump formula group states for a single column.

Useful when debugging.

Change-Id: I4e408ad9a3dc2046557d152fcd067c1b0c5645c0
üst fb604d06
......@@ -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 );
......
......@@ -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
/**
......
......@@ -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
......
......@@ -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.
......
......@@ -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];
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment