sc/source/core/tool/interpr2.cxx |   80 ++++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 30 deletions(-)

New commits:
commit b49fe02ba4882cc4672bea12c77d8ffa9a9a40f0
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Thu Apr 18 23:10:49 2013 -0400

    Handle the old syntax for GETPIVOTDATA.
    
    The old syntax is Calc only (not Excel), and is specified in ODF 1.2.
    
    Change-Id: I9551d408ae136d3567375e905b1273103a8f616a

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 463b0c5..c0e699b 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -3097,42 +3097,64 @@ void ScInterpreter::ScGetPivotData()
             bOldSyntax = true;
     }
 
+    std::vector<sheet::DataPilotFieldFilter> aFilters;
+    OUString aDataFieldName;
+    ScRange aBlock;
+
     if (bOldSyntax)
     {
-        // TODO: I'll handle this later.
-        PushError(errNoRef);
-        return;
-    }
+        aDataFieldName = GetString();
 
-    // Standard syntax: separate name/value pairs
+        switch (GetStackType())
+        {
+            case svDoubleRef :
+                PopDoubleRef(aBlock);
+            break;
+            case svSingleRef :
+            {
+                ScAddress aAddr;
+                PopSingleRef(aAddr);
+                aBlock = aAddr;
+            }
+            break;
+            default:
+                PushError(errNoRef);
+                return;
+        }
+    }
+    else
+    {
+        // Standard syntax: separate name/value pairs
 
-    sal_uInt16 nFilterCount = nParamCount / 2 - 1;
-    std::vector<sheet::DataPilotFieldFilter> aFilters(nFilterCount);
+        sal_uInt16 nFilterCount = nParamCount / 2 - 1;
+        aFilters.resize(nFilterCount);
 
-    sal_uInt16 i = nFilterCount;
-    while (i-- > 0)
-    {
-        //! should allow numeric constraint values
-        aFilters[i].MatchValue = GetString();
-        aFilters[i].FieldName = GetString();
-    }
+        sal_uInt16 i = nFilterCount;
+        while (i-- > 0)
+        {
+            //! should allow numeric constraint values
+            aFilters[i].MatchValue = GetString();
+            aFilters[i].FieldName = GetString();
+        }
 
-    ScRange aBlock;
-    switch (GetStackType())
-    {
-        case svDoubleRef :
-            PopDoubleRef(aBlock);
-        break;
-        case svSingleRef :
+        switch (GetStackType())
         {
-            ScAddress aAddr;
-            PopSingleRef(aAddr);
-            aBlock = aAddr;
+            case svDoubleRef :
+                PopDoubleRef(aBlock);
+            break;
+            case svSingleRef :
+            {
+                ScAddress aAddr;
+                PopSingleRef(aAddr);
+                aBlock = aAddr;
+            }
+            break;
+            default:
+                PushError(errNoRef);
+                return;
         }
-        break;
-        default:
-            PushError(errNoRef);
-            return;
+
+        aDataFieldName = GetString(); // First parameter is data field name.
     }
 
     // NOTE : MS Excel docs claim to use the 'most recent' which is not
@@ -3145,8 +3167,6 @@ void ScInterpreter::ScGetPivotData()
         return;
     }
 
-    OUString aDataFieldName = GetString(); // First parameter is data field 
name.
-
     double fVal = pDPObj->GetPivotData(aDataFieldName, aFilters);
     if (rtl::math::isNan(fVal))
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to