[Libreoffice-commits] core.git: sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Fri Feb 15 19:10:31 PST 2013


 sc/inc/dpmacros.hxx                     |    6 ++
 sc/inc/dptabres.hxx                     |    9 ++++
 sc/inc/dptabsrc.hxx                     |    4 +
 sc/source/core/data/dpfilteredcache.cxx |    1 
 sc/source/core/data/dpgroup.cxx         |    1 
 sc/source/core/data/dpitemdata.cxx      |    1 
 sc/source/core/data/dpnumgroupinfo.cxx  |    1 
 sc/source/core/data/dptabres.cxx        |   67 ++++++++++++++++++++++++++++++++
 sc/source/core/data/dptabsrc.cxx        |   10 ++++
 sc/source/core/data/pivot2.cxx          |    1 
 sc/source/ui/dbgui/fieldwnd.cxx         |    1 
 11 files changed, 96 insertions(+), 6 deletions(-)

New commits:
commit 7c936145f75812cf651ae57c7f364b0103d5f4db
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Feb 15 22:11:04 2013 -0500

    Add a quick way to dump the content of pivot table result tree.
    
    This is to be used for debugging.
    
    Change-Id: Ie5a5ebd66a701937ab806e2370ded85ba557de5b

diff --git a/sc/inc/dpmacros.hxx b/sc/inc/dpmacros.hxx
index 906a0da..79aafaf 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 70c2b14..90a7f36 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 1aefebc..06ed2f0 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 e361753..0df7789 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 614b5b5..483677b 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 1e0bb3c..4c04106 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 2634933..114bbd9 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 c21c5c1..1aa542c 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 7fdf75c..db21a6b 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 eedf727..d4156bb 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 dce0015..46579d2 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


More information about the Libreoffice-commits mailing list