Kaydet (Commit) 7c936145 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Add a quick way to dump the content of pivot table result tree.

This is to be used for debugging.

Change-Id: Ie5a5ebd66a701937ab806e2370ded85ba557de5b
üst b491b5e0
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
#define DEBUG_PIVOT_TABLE 0 #define DEBUG_PIVOT_TABLE 0
#if DEBUG_PIVOT_TABLE
#include <iostream>
#include <string>
#include <cstdio>
#endif
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -188,6 +188,10 @@ public: ...@@ -188,6 +188,10 @@ public:
const ScDPAggData* GetExistingChild() const { return pChild; } const ScDPAggData* GetExistingChild() const { return pChild; }
ScDPAggData* GetChild(); ScDPAggData* GetChild();
#if DEBUG_PIVOT_TABLE
void Dump(int nIndent) const;
#endif
}; };
// //
...@@ -416,6 +420,8 @@ public: ...@@ -416,6 +420,8 @@ public:
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
void Dump(int nIndent) const;
#endif #endif
//! this will be removed! //! this will be removed!
...@@ -483,6 +489,7 @@ public: ...@@ -483,6 +489,7 @@ public:
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
void Dump(int nIndent) const;
#endif #endif
//! this will be removed! //! this will be removed!
...@@ -579,6 +586,7 @@ public: ...@@ -579,6 +586,7 @@ public:
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const;
void Dump(int nIndent) const;
#endif #endif
// for ScDPDataDimension::InitFrom // for ScDPDataDimension::InitFrom
...@@ -641,6 +649,7 @@ public: ...@@ -641,6 +649,7 @@ public:
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const; void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const;
void Dump(int nIndent) const;
#endif #endif
long GetMemberCount() const; long GetMemberCount() const;
......
...@@ -262,6 +262,10 @@ public: ...@@ -262,6 +262,10 @@ public:
throw(::com::sun::star::uno::RuntimeException); throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(::com::sun::star::uno::RuntimeException); throw(::com::sun::star::uno::RuntimeException);
#if DEBUG_PIVOT_TABLE
void DumpResults() const;
#endif
}; };
class ScDPDimensions : public cppu::WeakImplHelper2< class ScDPDimensions : public cppu::WeakImplHelper2<
......
...@@ -417,7 +417,6 @@ const ScDPCache* ScDPFilteredCache::getCache() const ...@@ -417,7 +417,6 @@ const ScDPCache* ScDPFilteredCache::getCache() const
} }
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
#include <iostream>
using std::cout; using std::cout;
using std::endl; using std::endl;
......
...@@ -1004,7 +1004,6 @@ long ScDPGroupTableData::Compare(long nDim, long nDataId1, long nDataId2) ...@@ -1004,7 +1004,6 @@ long ScDPGroupTableData::Compare(long nDim, long nDataId1, long nDataId2)
} }
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
#include <iostream>
using std::cout; using std::cout;
using std::endl; using std::endl;
......
...@@ -285,7 +285,6 @@ ScDPValue::Type ScDPItemData::GetCellType() const ...@@ -285,7 +285,6 @@ ScDPValue::Type ScDPItemData::GetCellType() const
} }
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
#include <cstdio>
void ScDPItemData::Dump(const char* msg) const void ScDPItemData::Dump(const char* msg) const
{ {
......
...@@ -46,7 +46,6 @@ ScDPNumGroupInfo::ScDPNumGroupInfo(const ScDPNumGroupInfo& r) : ...@@ -46,7 +46,6 @@ ScDPNumGroupInfo::ScDPNumGroupInfo(const ScDPNumGroupInfo& r) :
mfEnd(r.mfEnd), mfStep(r.mfStep) {} mfEnd(r.mfEnd), mfStep(r.mfStep) {}
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
#include <iostream>
using std::cout; using std::cout;
using std::endl; using std::endl;
......
...@@ -640,6 +640,20 @@ void ScDPAggData::Reset() ...@@ -640,6 +640,20 @@ void ScDPAggData::Reset()
pChild = NULL; 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() : ScDPRowTotals::ScDPRowTotals() :
...@@ -1738,6 +1752,25 @@ void ScDPResultMember::DumpState( const ScDPResultMember* pRefMember, ScDocument ...@@ -1738,6 +1752,25 @@ void ScDPResultMember::DumpState( const ScDPResultMember* pRefMember, ScDocument
lcl_Indent( pDoc, nStartRow, rPos ); 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 #endif
ScDPAggData* ScDPResultMember::GetColTotal( long nMeasure ) const ScDPAggData* ScDPResultMember::GetColTotal( long nMeasure ) const
...@@ -2578,6 +2611,18 @@ void ScDPDataMember::DumpState( const ScDPResultMember* pRefMember, ScDocument* ...@@ -2578,6 +2611,18 @@ void ScDPDataMember::DumpState( const ScDPResultMember* pRefMember, ScDocument*
lcl_Indent( pDoc, nStartRow, rPos ); 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 #endif
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -3395,6 +3440,18 @@ void ScDPResultDimension::DumpState( const ScDPResultMember* pRefMember, ScDocum ...@@ -3395,6 +3440,18 @@ void ScDPResultDimension::DumpState( const ScDPResultMember* pRefMember, ScDocum
lcl_Indent( pDoc, nStartRow, rPos ); 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 #endif
long ScDPResultDimension::GetMemberCount() const long ScDPResultDimension::GetMemberCount() const
...@@ -3758,6 +3815,16 @@ void ScDPDataDimension::DumpState( const ScDPResultDimension* pRefDim, ScDocumen ...@@ -3758,6 +3815,16 @@ void ScDPDataDimension::DumpState( const ScDPResultDimension* pRefDim, ScDocumen
lcl_Indent( pDoc, nStartRow, rPos ); 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 #endif
long ScDPDataDimension::GetMemberCount() const long ScDPDataDimension::GetMemberCount() const
......
...@@ -1171,6 +1171,16 @@ uno::Any SAL_CALL ScDPSource::getPropertyValue( const rtl::OUString& aPropertyNa ...@@ -1171,6 +1171,16 @@ uno::Any SAL_CALL ScDPSource::getPropertyValue( const rtl::OUString& aPropertyNa
return aRet; 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 ) SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDPSource )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "stlsheet.hxx" #include "stlsheet.hxx"
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
#include <iostream>
using std::cout; using std::cout;
using std::endl; using std::endl;
#endif #endif
......
...@@ -62,7 +62,6 @@ const size_t PIVOTFIELD_INVALID = static_cast< size_t >(-1); ...@@ -62,7 +62,6 @@ const size_t PIVOTFIELD_INVALID = static_cast< size_t >(-1);
const size_t INVALID_INDEX = static_cast<size_t>(-1); const size_t INVALID_INDEX = static_cast<size_t>(-1);
#if DEBUG_PIVOT_TABLE #if DEBUG_PIVOT_TABLE
#include <iostream>
using std::cout; using std::cout;
using std::endl; using std::endl;
#endif #endif
......
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