summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-18 23:10:49 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-19 00:30:13 -0400
commita210575baa5bc72dc0392eeb20b2da58b6cf14ae (patch)
tree70c9a024174b80e95fc420d43da9b75f6d5796c9
parent2bc52ff76deccee1cab1808108b5e4b25c1cc644 (diff)
Handle the old syntax for GETPIVOTDATA.
The old syntax is Calc only (not Excel), and is specified in ODF 1.2. Change-Id: I9551d408ae136d3567375e905b1273103a8f616a
-rw-r--r--sc/source/core/tool/interpr2.cxx80
1 files changed, 50 insertions, 30 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 91d791f6e0f0..7a2df402ee8a 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))
{