[Libreoffice-commits] core.git: Branch 'feature/pivot-table-result-tree' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Thu Apr 18 08:17:43 PDT 2013


 sc/inc/dpresfilter.hxx              |   15 +++++++++++++++
 sc/source/core/data/dpresfilter.cxx |    5 +++++
 sc/source/core/data/dptabsrc.cxx    |    2 ++
 3 files changed, 22 insertions(+)

New commits:
commit 11d60209a4f18d901c282e3de3540798a8d11916
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Apr 18 11:19:01 2013 -0400

    Add some more notes to make it easier to pick up on this for my next visit.
    
    Looks like I have to put this on the shelf once again...
    
    Change-Id: I6288d019170278e484befaac3ee57cea24a69c0e

diff --git a/sc/inc/dpresfilter.hxx b/sc/inc/dpresfilter.hxx
index db32f6e..05bcdcb 100644
--- a/sc/inc/dpresfilter.hxx
+++ b/sc/inc/dpresfilter.hxx
@@ -32,6 +32,20 @@ struct ScDPResultFilter
     ScDPResultFilter(const OUString& rDimName, bool bDataLayout);
 };
 
+/**
+ * This class maintains pivot table calculation result in a tree structure
+ * which represents the logical structure of pivot table result layout as
+ * presented in the sheet.
+ *
+ * <p>The root node has two child nodes if the pivot table consists of both
+ * column and row dimensions. The first child stores the result tree that is
+ * first filtered by row dimensions then by column dimensions. The second
+ * child stores the result tree that is filtered by column dimensions only
+ * (for column grand totals).</p>
+ *
+ * <p>If the pivot table layout only consists of either column or row
+ * dimensions, the root node only has one child node.</p>
+ */
 class ScDPResultFilterSet : boost::noncopyable
 {
     struct MemberNode;
@@ -74,6 +88,7 @@ class ScDPResultFilterSet : boost::noncopyable
 #endif
     };
 
+    OUString maPrimaryDimName;
     MemberNode* mpRoot;
 
 public:
diff --git a/sc/source/core/data/dpresfilter.cxx b/sc/source/core/data/dpresfilter.cxx
index b08cc4a..0ae8c94 100644
--- a/sc/source/core/data/dpresfilter.cxx
+++ b/sc/source/core/data/dpresfilter.cxx
@@ -95,6 +95,9 @@ void ScDPResultFilterSet::add(
         if (filter.mbDataLayout)
             continue;
 
+        if (maPrimaryDimName.isEmpty())
+            maPrimaryDimName = filter.maDimName;
+
         printf("%s: ", rtl::OUStringToOString(filter.maDimName, RTL_TEXTENCODING_UTF8).getStr());
         if (filter.maValue.IsValue())
             printf("%g ", filter.maValue.GetValue());
@@ -144,12 +147,14 @@ void ScDPResultFilterSet::add(
 
 void ScDPResultFilterSet::swap(ScDPResultFilterSet& rOther)
 {
+    std::swap(maPrimaryDimName, rOther.maPrimaryDimName);
     std::swap<MemberNode*>(mpRoot, rOther.mpRoot);
 }
 
 #if DEBUG_PIVOT_TABLE
 void ScDPResultFilterSet::dump() const
 {
+    cout << "primary dimension name: " << maPrimaryDimName << endl;
     mpRoot->dump(0);
 }
 #endif
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 058a029..b7a1c51 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -469,6 +469,8 @@ uno::Sequence<uno::Any> ScDPSource::getFilteredResults(
 
     // Sort filters by order of appearance. Row fields come before column fields.
 
+    // TODO: maResFilterSet maintains the result tree, so we can probably
+    // extract the field sort order from there somehow.
 
     return uno::Sequence<uno::Any>();
 }


More information about the Libreoffice-commits mailing list