[Libreoffice-commits] .: 3 commits - sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 30 17:33:22 PDT 2012


 sc/inc/dpcachetable.hxx              |    9 ++-
 sc/source/core/data/dpcachetable.cxx |  103 +++++++++++++++++++++++------------
 sc/source/core/data/dpitemdata.cxx   |    2 
 3 files changed, 80 insertions(+), 34 deletions(-)

New commits:
commit ad39f5eca2603377baa3b7452218c99daad93ec2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Oct 30 20:31:48 2012 -0400

    dump() method for ScDPCacheTable (for debugging only).
    
    Change-Id: I3d4a4dd5efa64d1506562f976d88599c084b25ab

diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index c55ec26..84edf6a 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -33,6 +33,7 @@
 #include "osl/mutex.hxx"
 #include "global.hxx"
 #include "dpitemdata.hxx"
+#include "dpmacros.hxx"
 
 #include <vector>
 #include <boost/unordered_set.hpp>
@@ -55,6 +56,8 @@ struct ScQueryParam;
  */
 class SC_DLLPUBLIC ScDPCacheTable
 {
+    typedef mdds::flat_segment_tree<SCROW, bool> RowFlagType;
+
 public:
     /** interface class used for filtering of rows. */
     class FilterBase
@@ -155,6 +158,11 @@ public:
     bool empty() const;
     bool hasCache() const;
 
+#if DEBUG_PIVOT_TABLE
+    void dumpRowFlag(const RowFlagType& rFlag) const;
+    void dump() const;
+#endif
+
 private:
     ScDPCacheTable();
     ScDPCacheTable(const ScDPCacheTable&);
@@ -168,7 +176,6 @@ private:
     bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const;
 
 private:
-    typedef mdds::flat_segment_tree<SCROW, bool> RowFlagType;
 
     /** unique field entires for each field (column). */
     ::std::vector< ::std::vector<SCROW> > maFieldEntries;
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 9cadf1c..01fab13 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -431,4 +431,41 @@ const ScDPCache* ScDPCacheTable::getCache() const
     return mpCache;
 }
 
+#if DEBUG_PIVOT_TABLE
+#include <iostream>
+using std::cout;
+using std::endl;
+
+void ScDPCacheTable::dumpRowFlag(const RowFlagType& rFlag) const
+{
+    RowFlagType::const_iterator it = rFlag.begin(), itEnd = rFlag.end();
+    bool bShow = it->second;
+    SCROW nRow1 = it->first;
+    for (++it; it != itEnd; ++it)
+    {
+        SCROW nRow2 = it->first;
+        cout << "  * range " << nRow1 << "-" << nRow2 << ": " << (bShow ? "on" : "off") << endl;
+        bShow = it->second;
+        nRow1 = nRow2;
+    }
+}
+
+void ScDPCacheTable::dump() const
+{
+    cout << "--- pivot cache filter dump" << endl;
+
+    // Flat segment tree always has at least 2 nodes.
+    cout << endl;
+    cout << "* show by filter" << endl;
+    dumpRowFlag(maShowByFilter);
+
+    cout << endl;
+    cout << "* show by page dimensions" << endl;
+    dumpRowFlag(maShowByPage);
+
+    cout << "---" << endl;
+}
+
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit beebcb6b671702952c4bc0fb9794345142a6452c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Oct 30 19:31:18 2012 -0400

    Somehow the indentation was messed up in this method.
    
    It was using a 3-space indentation as opposed to 4.
    
    Change-Id: Idfb0e455c5d0afcad0a8b943dee9fd2679e6209d

diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 14f4e8e..9cadf1c 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -209,41 +209,41 @@ void ScDPCacheTable::fillTable(
 
 void ScDPCacheTable::fillTable()
 {
-   SCROW nRowCount = getRowSize();
-   SCCOL nColCount = getColSize();
-   if (nRowCount <= 0 || nColCount <= 0)
+    SCROW nRowCount = getRowSize();
+    SCCOL nColCount = getColSize();
+    if (nRowCount <= 0 || nColCount <= 0)
         return;
 
-   maShowByFilter.clear();
-   maShowByPage.clear();
-   maShowByFilter.insert_front(0, nRowCount, true);
-
-   // Initialize field entries container.
-   maFieldEntries.clear();
-   maFieldEntries.reserve(nColCount);
-
-   // Data rows
-   for (SCCOL nCol = 0; nCol < nColCount; ++nCol)
-   {
-       maFieldEntries.push_back( vector<SCROW>() );
-       SCROW nMemCount = getCache()->GetDimMemberCount( nCol );
-       if (!nMemCount)
-           continue;
-
-       std::vector<SCROW> aAdded(nMemCount, -1);
-
-       for (SCROW nRow = 0; nRow < nRowCount; ++nRow)
-       {
-           SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, false);
-           SCROW nOrder = getOrder(nCol, nIndex);
-           aAdded[nOrder] = nIndex;
-       }
-       for (SCROW nRow = 0; nRow < nMemCount; ++nRow)
-       {
-           if (aAdded[nRow] != -1)
-               maFieldEntries.back().push_back(aAdded[nRow]);
-       }
-   }
+    maShowByFilter.clear();
+    maShowByPage.clear();
+    maShowByFilter.insert_front(0, nRowCount, true);
+
+    // Initialize field entries container.
+    maFieldEntries.clear();
+    maFieldEntries.reserve(nColCount);
+
+    // Data rows
+    for (SCCOL nCol = 0; nCol < nColCount; ++nCol)
+    {
+        maFieldEntries.push_back( vector<SCROW>() );
+        SCROW nMemCount = getCache()->GetDimMemberCount( nCol );
+        if (!nMemCount)
+            continue;
+
+        std::vector<SCROW> aAdded(nMemCount, -1);
+
+        for (SCROW nRow = 0; nRow < nRowCount; ++nRow)
+        {
+            SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, false);
+            SCROW nOrder = getOrder(nCol, nIndex);
+            aAdded[nOrder] = nIndex;
+        }
+        for (SCROW nRow = 0; nRow < nMemCount; ++nRow)
+        {
+            if (aAdded[nRow] != -1)
+                maFieldEntries.back().push_back(aAdded[nRow]);
+        }
+    }
 }
 
 bool ScDPCacheTable::isRowActive(sal_Int32 nRow, sal_Int32* pLastRow) const
commit 15b69ac3e3c91e3f3637960f5c11bdbe9ab42de3
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Oct 30 19:27:48 2012 -0400

    Fix the build with DEBUG_PIVOT_TABLE=1.
    
    Change-Id: Ibbf3ac3174d609feabc4cac590cf86b07ebbbab8

diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx
index c3a163c..ba87d66 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -293,6 +293,8 @@ sal_uInt8 ScDPItemData::GetCellType() const
 }
 
 #if DEBUG_PIVOT_TABLE
+#include <cstdio>
+
 void ScDPItemData::Dump(const char* msg) const
 {
     printf("--- (%s)\n", msg);


More information about the Libreoffice-commits mailing list