diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-15 22:11:04 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-15 22:12:24 -0500 |
commit | 7c936145f75812cf651ae57c7f364b0103d5f4db (patch) | |
tree | 28a76785644c05bdf40ef4e9d65f4072f2497c27 /sc | |
parent | b491b5e0c0599446e3853eb0e0021d20c36e88f8 (diff) |
Add a quick way to dump the content of pivot table result tree.
This is to be used for debugging.
Change-Id: Ie5a5ebd66a701937ab806e2370ded85ba557de5b
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dpmacros.hxx | 6 | ||||
-rw-r--r-- | sc/inc/dptabres.hxx | 9 | ||||
-rw-r--r-- | sc/inc/dptabsrc.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dpfilteredcache.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dpgroup.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dpitemdata.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dpnumgroupinfo.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dptabres.cxx | 67 | ||||
-rw-r--r-- | sc/source/core/data/dptabsrc.cxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/pivot2.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/dbgui/fieldwnd.cxx | 1 |
11 files changed, 96 insertions, 6 deletions
diff --git a/sc/inc/dpmacros.hxx b/sc/inc/dpmacros.hxx index 906a0da2d415..79aafafe0f6d 100644 --- a/sc/inc/dpmacros.hxx +++ b/sc/inc/dpmacros.hxx @@ -31,6 +31,12 @@ #define DEBUG_PIVOT_TABLE 0 +#if DEBUG_PIVOT_TABLE +#include <iostream> +#include <string> +#include <cstdio> +#endif + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index 70c2b1460eb7..90a7f3690acf 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -188,6 +188,10 @@ public: const ScDPAggData* GetExistingChild() const { return pChild; } ScDPAggData* GetChild(); + +#if DEBUG_PIVOT_TABLE + void Dump(int nIndent) const; +#endif }; // @@ -416,6 +420,8 @@ public: #if DEBUG_PIVOT_TABLE void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; + + void Dump(int nIndent) const; #endif //! this will be removed! @@ -483,6 +489,7 @@ public: #if DEBUG_PIVOT_TABLE void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; + void Dump(int nIndent) const; #endif //! this will be removed! @@ -579,6 +586,7 @@ public: #if DEBUG_PIVOT_TABLE void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; + void Dump(int nIndent) const; #endif // for ScDPDataDimension::InitFrom @@ -641,6 +649,7 @@ public: #if DEBUG_PIVOT_TABLE void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const; + void Dump(int nIndent) const; #endif long GetMemberCount() const; diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 1aefebc69523..06ed2f0fc3b5 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -262,6 +262,10 @@ public: throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + +#if DEBUG_PIVOT_TABLE + void DumpResults() const; +#endif }; class ScDPDimensions : public cppu::WeakImplHelper2< diff --git a/sc/source/core/data/dpfilteredcache.cxx b/sc/source/core/data/dpfilteredcache.cxx index e361753f1b60..0df77891f40e 100644 --- a/sc/source/core/data/dpfilteredcache.cxx +++ b/sc/source/core/data/dpfilteredcache.cxx @@ -417,7 +417,6 @@ const ScDPCache* ScDPFilteredCache::getCache() const } #if DEBUG_PIVOT_TABLE -#include <iostream> using std::cout; using std::endl; diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index 614b5b5bd11f..483677b71b1e 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -1004,7 +1004,6 @@ long ScDPGroupTableData::Compare(long nDim, long nDataId1, long nDataId2) } #if DEBUG_PIVOT_TABLE -#include <iostream> using std::cout; using std::endl; diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx index 1e0bb3cb2485..4c04106f20eb 100644 --- a/sc/source/core/data/dpitemdata.cxx +++ b/sc/source/core/data/dpitemdata.cxx @@ -285,7 +285,6 @@ ScDPValue::Type ScDPItemData::GetCellType() const } #if DEBUG_PIVOT_TABLE -#include <cstdio> void ScDPItemData::Dump(const char* msg) const { diff --git a/sc/source/core/data/dpnumgroupinfo.cxx b/sc/source/core/data/dpnumgroupinfo.cxx index 26349333a549..114bbd9252fa 100644 --- a/sc/source/core/data/dpnumgroupinfo.cxx +++ b/sc/source/core/data/dpnumgroupinfo.cxx @@ -46,7 +46,6 @@ ScDPNumGroupInfo::ScDPNumGroupInfo(const ScDPNumGroupInfo& r) : mfEnd(r.mfEnd), mfStep(r.mfStep) {} #if DEBUG_PIVOT_TABLE -#include <iostream> using std::cout; using std::endl; diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index c21c5c1cb2be..1aa542c34f84 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -640,6 +640,20 @@ void ScDPAggData::Reset() pChild = NULL; } +#if DEBUG_PIVOT_TABLE +void ScDPAggData::Dump(int nIndent) const +{ + std::string aIndent(nIndent*2, ' '); + std::cout << aIndent << "* "; + if (IsCalculated()) + std::cout << GetResult(); + else + std::cout << "not calculated"; + + std::cout << " [val=" << fVal << "; aux=" << fAux << "; count=" << nCount << "]" << std::endl; +} +#endif + // ----------------------------------------------------------------------- ScDPRowTotals::ScDPRowTotals() : @@ -1738,6 +1752,25 @@ void ScDPResultMember::DumpState( const ScDPResultMember* pRefMember, ScDocument lcl_Indent( pDoc, nStartRow, rPos ); } + +void ScDPResultMember::Dump(int nIndent) const +{ + std::string aIndent(nIndent*2, ' '); + std::cout << aIndent << "-- result member '" << GetName() << "'" << std::endl; + + std::cout << aIndent << " column totals" << std::endl; + for (const ScDPAggData* p = &aColTotal; p; p = p->GetExistingChild()) + p->Dump(nIndent+1); + + if (pChildDimension) + pChildDimension->Dump(nIndent+1); + + if (pDataRoot) + { + std::cout << aIndent << " data root" << std::endl; + pDataRoot->Dump(nIndent+1); + } +} #endif ScDPAggData* ScDPResultMember::GetColTotal( long nMeasure ) const @@ -2578,6 +2611,18 @@ void ScDPDataMember::DumpState( const ScDPResultMember* pRefMember, ScDocument* lcl_Indent( pDoc, nStartRow, rPos ); } + +void ScDPDataMember::Dump(int nIndent) const +{ + std::string aIndent(nIndent*2, ' '); + std::cout << aIndent << "-- data member '" + << (pResultMember ? pResultMember->GetName() : OUString()) << "'" << std::endl; + for (const ScDPAggData* pAgg = &aAggregate; pAgg; pAgg = pAgg->GetExistingChild()) + pAgg->Dump(nIndent+1); + + if (pChildDimension) + pChildDimension->Dump(nIndent+1); +} #endif // ----------------------------------------------------------------------- @@ -3395,6 +3440,18 @@ void ScDPResultDimension::DumpState( const ScDPResultMember* pRefMember, ScDocum lcl_Indent( pDoc, nStartRow, rPos ); } + +void ScDPResultDimension::Dump(int nIndent) const +{ + std::string aIndent(nIndent*2, ' '); + std::cout << aIndent << "-- dimension '" << GetName() << "'" << std::endl; + MemberArray::const_iterator it = maMemberArray.begin(), itEnd = maMemberArray.end(); + for (; it != itEnd; ++it) + { + const ScDPResultMember* p = *it; + p->Dump(nIndent+1); + } +} #endif long ScDPResultDimension::GetMemberCount() const @@ -3758,6 +3815,16 @@ void ScDPDataDimension::DumpState( const ScDPResultDimension* pRefDim, ScDocumen lcl_Indent( pDoc, nStartRow, rPos ); } + +void ScDPDataDimension::Dump(int nIndent) const +{ + std::string aIndent(nIndent*2, ' '); + std::cout << aIndent << "-- data dimension '" + << (pResultDimension ? pResultDimension->GetName() : OUString()) << "'" << std::endl; + ScDPDataMembers::const_iterator it = maMembers.begin(), itEnd = maMembers.end(); + for (; it != itEnd; ++it) + (*it)->Dump(nIndent+1); +} #endif long ScDPDataDimension::GetMemberCount() const diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 7fdf75cf5550..db21a6be4f0e 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -1171,6 +1171,16 @@ uno::Any SAL_CALL ScDPSource::getPropertyValue( const rtl::OUString& aPropertyNa return aRet; } +#if DEBUG_PIVOT_TABLE +void ScDPSource::DumpResults() const +{ + std::cout << "+++++ column root" << std::endl; + pColResRoot->Dump(1); + std::cout << "+++++ row root" << std::endl; + pRowResRoot->Dump(1); +} +#endif + SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDPSource ) // ----------------------------------------------------------------------- diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx index eedf727065d1..d4156bb8a054 100644 --- a/sc/source/core/data/pivot2.cxx +++ b/sc/source/core/data/pivot2.cxx @@ -39,7 +39,6 @@ #include "stlsheet.hxx" #if DEBUG_PIVOT_TABLE -#include <iostream> using std::cout; using std::endl; #endif diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx index dce0015bfda7..46579d2c54b6 100644 --- a/sc/source/ui/dbgui/fieldwnd.cxx +++ b/sc/source/ui/dbgui/fieldwnd.cxx @@ -62,7 +62,6 @@ const size_t PIVOTFIELD_INVALID = static_cast< size_t >(-1); const size_t INVALID_INDEX = static_cast<size_t>(-1); #if DEBUG_PIVOT_TABLE -#include <iostream> using std::cout; using std::endl; #endif |