diff options
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 80 |
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)) { |