diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-10 11:59:50 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-10 18:45:22 -0500 |
commit | a3880da7f1d799c7c7735528efdf6fee8c5a4f4e (patch) | |
tree | b390a506424d55ebb4bbebb5dcc08fc8de6e2e38 /sc/source/core/data | |
parent | 8fb8a39eb2c27bb5bc38601469969230f7f90c13 (diff) |
Allow dumping of internal states of pivot table objects for debugging.
Change-Id: I5021ef61d9238da352e13bdd81a2f3607d0fb4aa
(cherry picked from commit 8f6e3118f57276a458b82482b0d277dee327413e)
Diffstat (limited to 'sc/source/core/data')
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 28 | ||||
-rw-r--r-- | sc/source/core/data/dpsave.cxx | 83 |
2 files changed, 111 insertions, 0 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index e8b384c4184f..5162d3b0eede 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -3640,6 +3640,34 @@ bool ScDPCollection::HasTable( const ScRange& rRange ) const maTables.begin(), maTables.end(), FindIntersectingTable(rRange)) != maTables.end(); } +#if DEBUG_PIVOT_TABLE + +namespace { + +struct DumpTable : std::unary_function<ScDPObject, void> +{ + void operator() (const ScDPObject& rObj) const + { + cout << "-- '" << rObj.GetName() << "'" << endl; + ScDPSaveData* pSaveData = rObj.GetSaveData(); + if (!pSaveData) + return; + + pSaveData->Dump(); + + cout << endl; // blank line + } +}; + +} + +void ScDPCollection::DumpTables() const +{ + std::for_each(maTables.begin(), maTables.end(), DumpTable()); +} + +#endif + void ScDPCollection::RemoveCache(const ScDPCache* pCache) { if (maSheetCaches.remove(pCache)) diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index 457262296641..c0328ce1fe42 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -164,6 +164,30 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb } } +#if DEBUG_PIVOT_TABLE + +void ScDPSaveMember::Dump(int nIndent) const +{ + std::string aIndent(nIndent*4, ' '); + cout << aIndent << "* member name: '" << aName << "'" << endl; + + cout << aIndent << " + layout name: "; + if (mpLayoutName) + cout << "'" << *mpLayoutName << "'"; + else + cout << "(none)"; + cout << endl; + + cout << aIndent << " + visibility: "; + if (nVisibleMode == SC_DPSAVEMODE_DONTKNOW) + cout << "(unknown)"; + else + cout << (nVisibleMode ? "visible" : "hidden"); + cout << endl; +} + +#endif + ScDPSaveDimension::ScDPSaveDimension(const OUString& rName, bool bDataLayout) : aName( rName ), mpLayoutName(NULL), @@ -702,6 +726,51 @@ void ScDPSaveDimension::RemoveObsoleteMembers(const MemberSetType& rMembers) maMemberList.swap(aNew); } +#if DEBUG_PIVOT_TABLE + +void ScDPSaveDimension::Dump(int nIndent) const +{ + static const char* pOrientNames[] = { "hidden", "column", "row", "page", "data" }; + std::string aIndent(nIndent*4, ' '); + + cout << aIndent << "* dimension name: '" << aName << "'" << endl; + + cout << aIndent << " + orientation: "; + if (nOrientation <= 4) + cout << pOrientNames[nOrientation]; + else + cout << "(invalid)"; + cout << endl; + + cout << aIndent << " + layout name: "; + if (mpLayoutName) + cout << "'" << *mpLayoutName << "'"; + else + cout << "(none)"; + cout << endl; + + cout << aIndent << " + subtotal name: "; + if (mpSubtotalName) + cout << "'" << *mpSubtotalName << "'"; + else + cout << "(none)"; + cout << endl; + + cout << aIndent << " + is data layout: " << (bIsDataLayout ? "yes" : "no") << endl; + cout << aIndent << " + is duplicate: " << (bDupFlag ? "yes" : "no") << endl; + + MemberList::const_iterator itMem = maMemberList.begin(), itMemEnd = maMemberList.end(); + for (; itMem != itMemEnd; ++itMem) + { + ScDPSaveMember* pMem = *itMem; + pMem->Dump(nIndent+1); + } + + cout << endl; // blank line +} + +#endif + ScDPSaveData::ScDPSaveData() : pDimensionData( NULL ), nColumnGrandMode( SC_DPSAVEMODE_DONTKNOW ), @@ -1354,6 +1423,20 @@ bool ScDPSaveData::HasInvisibleMember(const OUString& rDimName) const return pDim->HasInvisibleMember(); } +#if DEBUG_PIVOT_TABLE + +void ScDPSaveData::Dump() const +{ + DimsType::const_iterator itDim = aDimList.begin(), itDimEnd = aDimList.end(); + for (; itDim != itDimEnd; ++itDim) + { + const ScDPSaveDimension& rDim = *itDim; + rDim.Dump(); + } +} + +#endif + void ScDPSaveData::CheckDuplicateName(ScDPSaveDimension& rDim) { const OUString aName = ScDPUtil::getSourceDimensionName(rDim.GetName()); |