sc/inc/calcmacros.hxx | 9 ++++++- sc/inc/column.hxx | 2 - sc/inc/document.hxx | 2 - sc/inc/table.hxx | 2 - sc/source/core/data/column2.cxx | 40 +++++++++++++++++++++++++++++----- sc/source/core/data/document.cxx | 2 - sc/source/core/data/table1.cxx | 2 - sc/source/core/tool/sharedformula.cxx | 4 +-- sc/source/ui/inc/gridwin.hxx | 1 sc/source/ui/view/gridwin.cxx | 4 +++ sc/source/ui/view/gridwin_dbgutil.cxx | 11 +++++++++ 11 files changed, 66 insertions(+), 13 deletions(-)
New commits: commit f20df23ad9380d19dfb64b51d943109bd3895efe Author: Kohei Yoshida <[email protected]> Date: Sat Nov 12 17:42:57 2016 -0500 Keep loplugin:staticmethods happy. Change-Id: I2cdf67490d61b2868910e615bfc44d126d207bcb diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index ce496f6..22d911f 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1670,7 +1670,10 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v cout << endl; } #else - void printResult(const ScFormulaCell*) const {} + void printResult(const ScFormulaCell*) const + { + (void) this; /* loplugin:staticmethods */ + } #endif }; commit 633b9f30d0037f91e51e024960155c738c2fadb0 Author: Kohei Yoshida <[email protected]> Date: Sat Nov 12 17:20:30 2016 -0500 Dump the other block types as well. Change-Id: Iff41d4c2065a03865f884b2a8a260ffd83835dc1 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 9c7eb79..ce496f6 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1577,10 +1577,31 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v void operator() (const sc::CellStoreType::value_type& rNode) const { - if (rNode.type != sc::element_type_formula) - return; + switch (rNode.type) + { + case sc::element_type_numeric: + cout << " * numeric block (pos=" << rNode.position << ", length=" << rNode.size << ")" << endl; + break; + case sc::element_type_string: + cout << " * string block (pos=" << rNode.position << ", length=" << rNode.size << ")" << endl; + break; + case sc::element_type_edittext: + cout << " * edit-text block (pos=" << rNode.position << ", length=" << rNode.size << ")" << endl; + break; + case sc::element_type_formula: + dumpFormulaBlock(rNode); + break; + case sc::element_type_empty: + cout << " * empty block (pos=" << rNode.position << ", length=" << rNode.size << ")" << endl; + break; + default: + cout << " * unknown block" << endl; + } + } - cout << " * formula block" << endl; + void dumpFormulaBlock(const sc::CellStoreType::value_type& rNode) const + { + cout << " * formula block (pos=" << rNode.position << ", length=" << rNode.size << ")" << 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); commit 4b57b76b6e0200a1fbbf40b98ff1d05793223287 Author: Kohei Yoshida <[email protected]> Date: Sat Nov 12 17:10:56 2016 -0500 Let's not dump formula results. It could be too verbose. Change-Id: I5f2da92e78bb069f3bb0c9c07bb3eae6d990f810 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 1d63bf6..9c7eb79 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1567,6 +1567,8 @@ void ScColumn::CellStorageModified() namespace { +#define DUMP_FORMULA_RESULTS 0 + struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, void> { const ScDocument* mpDoc; @@ -1620,9 +1622,10 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v { sc::TokenStringContext aCxt(mpDoc, mpDoc->GetGrammar()); OUString aFormula = pCell->GetCode()->CreateString(aCxt, pCell->aPos); - cout << " * formula: " << aFormula << endl; + cout << " * formula: " << aFormula << endl; } +#if DUMP_FORMULA_RESULTS void printResult(const ScFormulaCell* pCell) const { sc::FormulaResultValue aRes = pCell->GetResult(); @@ -1645,6 +1648,9 @@ struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, v cout << endl; } +#else + void printResult(const ScFormulaCell*) const {} +#endif }; } commit 5a8fce7c5607ede6675effe410cbe29e343b6885 Author: Kohei Yoshida <[email protected]> Date: Sat Nov 12 17:00:45 2016 -0500 Ctrl-Shift-F8 to dump the column storage where the cursor is. Enabled only in dbgutil build. Change-Id: I0cd095fb56893122a26b2da6882fca15e516d193 diff --git a/sc/inc/calcmacros.hxx b/sc/inc/calcmacros.hxx index 8810247..d2fc1da 100644 --- a/sc/inc/calcmacros.hxx +++ b/sc/inc/calcmacros.hxx @@ -15,7 +15,14 @@ #define DEBUG_FORMULA_COMPILER 0 #define DEBUG_AREA_BROADCASTER 0 -#if DEBUG_PIVOT_TABLE || DEBUG_COLUMN_STORAGE || DEBUG_FORMULA_COMPILER || DEBUG_AREA_BROADCASTER +#define DUMP_COLUMN_STORAGE 0 + +#ifdef DBG_UTIL +#undef DUMP_COLUMN_STORAGE +#define DUMP_COLUMN_STORAGE 1 +#endif + +#if DEBUG_PIVOT_TABLE || DUMP_COLUMN_STORAGE || DEBUG_COLUMN_STORAGE || DEBUG_FORMULA_COMPILER || DEBUG_AREA_BROADCASTER #include <iostream> #include <string> #include <cstdio> diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 8a1a370..22aaf6a 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -662,7 +662,7 @@ public: void SwapNonEmpty( sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt ); -#if DEBUG_COLUMN_STORAGE +#if DUMP_COLUMN_STORAGE void DumpFormulaGroups() const; #endif diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6caaa52..8b46126 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2280,7 +2280,7 @@ public: const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ); -#if DEBUG_COLUMN_STORAGE +#if DUMP_COLUMN_STORAGE SC_DLLPUBLIC void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const; #endif diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0221fd9..70c42c8 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -965,7 +965,7 @@ public: void finalizeOutlineImport(); -#if DEBUG_COLUMN_STORAGE +#if DUMP_COLUMN_STORAGE void DumpFormulaGroups( SCCOL nCol ) const; #endif diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index b3f12f9..1d63bf6 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1563,7 +1563,7 @@ void ScColumn::CellStorageModified() #endif } -#if DEBUG_COLUMN_STORAGE +#if DUMP_COLUMN_STORAGE namespace { diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3bf5e8a..3116357 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2447,7 +2447,7 @@ void ScDocument::DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const S pTab->DeleteBroadcasters(rBlockPos, rTopPos.Col(), rTopPos.Row(), rTopPos.Row()+nLength-1); } -#if DEBUG_COLUMN_STORAGE +#if DUMP_COLUMN_STORAGE void ScDocument::DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const { const ScTable* pTab = FetchTable(nTab); diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index bf227d3..9df67e8 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2265,7 +2265,7 @@ void ScTable::SetFormulaResults( aCol[nCol].SetFormulaResults(nRow, pResults, nLen); } -#if DEBUG_COLUMN_STORAGE +#if DUMP_COLUMN_STORAGE void ScTable::DumpFormulaGroups( SCCOL nCol ) const { if (!ValidCol(nCol)) diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx index 92c1cda..0a13d15 100644 --- a/sc/source/core/tool/sharedformula.cxx +++ b/sc/source/core/tool/sharedformula.cxx @@ -82,7 +82,7 @@ void SharedFormulaUtil::splitFormulaCellGroup(const CellStoreType::position_type // Apply the lower group object to the lower cells. #if DEBUG_COLUMN_STORAGE - if (xGroup2->mpTopCell->aPos.Row() + xGroup2->mnLength > aPos.first->position + aPos.first->size) + if (xGroup2->mpTopCell->aPos.Row() + size_t(xGroup2->mnLength) > aPos.first->position + aPos.first->size) { cerr << "ScColumn::SplitFormulaCellGroup: Shared formula region goes beyond the formula block. Not good." << endl; cerr.flush(); @@ -294,7 +294,7 @@ void SharedFormulaUtil::unshareFormulaCell(const CellStoreType::position_type& a xGroup2->mbInvariant = xGroup->mbInvariant; xGroup2->mpCode = xGroup->mpCode->Clone(); #if DEBUG_COLUMN_STORAGE - if (xGroup2->mpTopCell->aPos.Row() + xGroup2->mnLength > it->position + it->size) + if (xGroup2->mpTopCell->aPos.Row() + size_t(xGroup2->mnLength) > it->position + it->size) { cerr << "ScColumn::UnshareFormulaCell: Shared formula region goes beyond the formula block. Not good." << endl; cerr.flush(); diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 25e66e0..709b388 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -447,6 +447,7 @@ private: void dumpColumnInformationPixel(); void dumpColumnInformationHmm(); void dumpGraphicInformation(); + void dumpColumnCellStorage(); #endif }; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index ce36e13..3fd2933 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3273,6 +3273,10 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) { dumpCellProperties(); } + else if (rKeyCode.GetCode() == KEY_F8) + { + dumpColumnCellStorage(); + } } #endif diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index 4276283..afd385b 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -112,4 +112,15 @@ void ScGridWindow::dumpGraphicInformation() } } +void ScGridWindow::dumpColumnCellStorage() +{ + // Get the current cursor position. + ScAddress aCurPos = pViewData->GetCurPos(); + ScDocument* pDoc = pViewData->GetDocument(); + + // TODO : Perhaps we should dump the whole structure, not just the formula + // groups. + pDoc->DumpFormulaGroups(aCurPos.Tab(), aCurPos.Col()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
