diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-11 22:00:54 -0400 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-15 11:21:11 +0000 |
commit | 556519f0a1dcc92eab5078dcbaaf2cec4dbaa179 (patch) | |
tree | 660ca6ca75775ce09a743559043809877c53a5ee /sc/source/core/data/dputil.cxx | |
parent | 99cf5f9b1ca3471ee9d9b869127dbfc355418054 (diff) |
fdo#66655: Get GETPIVOTDATA to work again.
1) Compare data field name as it is displayed in the table output.
2) In the result tree, store field member names as strings as displayed
in the table output, instead of as ScDPItemData.
GETPIVOTDATA operates on displayed cell values and do textural comparison.
There is no use storing ScDPItemData which screws up value lookup in
the result tree.
Change-Id: I31bc03a6800f4fadf2ba1180d1958354d43e8a07
Reviewed-on: https://gerrit.libreoffice.org/4853
Reviewed-by: Michael Meeks <michael.meeks@suse.com>
Tested-by: Michael Meeks <michael.meeks@suse.com>
Reviewed-on: https://gerrit.libreoffice.org/4869
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core/data/dputil.cxx')
-rw-r--r-- | sc/source/core/data/dputil.cxx | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 896d13e07012..7ea98c47e12c 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -11,10 +11,10 @@ */ #include "dputil.hxx" -#include "global.hxx" #include "dpitemdata.hxx" #include "dpnumgroupinfo.hxx" #include "globalnames.hxx" +#include "globstr.hrc" #include "comphelper/string.hxx" #include "unotools/localedatawrapper.hxx" @@ -347,4 +347,61 @@ sal_Int32 ScDPUtil::getDatePartValue( return nResult; } +namespace { + +sal_uInt16 nFuncStrIds[12] = { + 0, // SUBTOTAL_FUNC_NONE + STR_FUN_TEXT_AVG, // SUBTOTAL_FUNC_AVE + STR_FUN_TEXT_COUNT, // SUBTOTAL_FUNC_CNT + STR_FUN_TEXT_COUNT, // SUBTOTAL_FUNC_CNT2 + STR_FUN_TEXT_MAX, // SUBTOTAL_FUNC_MAX + STR_FUN_TEXT_MIN, // SUBTOTAL_FUNC_MIN + STR_FUN_TEXT_PRODUCT, // SUBTOTAL_FUNC_PROD + STR_FUN_TEXT_STDDEV, // SUBTOTAL_FUNC_STD + STR_FUN_TEXT_STDDEV, // SUBTOTAL_FUNC_STDP + STR_FUN_TEXT_SUM, // SUBTOTAL_FUNC_SUM + STR_FUN_TEXT_VAR, // SUBTOTAL_FUNC_VAR + STR_FUN_TEXT_VAR // SUBTOTAL_FUNC_VARP +}; + +} + +OUString ScDPUtil::getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc) +{ + OUStringBuffer aRet; + sal_uInt16 nId = nFuncStrIds[eFunc]; + if (nId) + { + aRet.append(ScGlobal::GetRscString(nId)); // function name + aRet.appendAscii(RTL_CONSTASCII_STRINGPARAM(" - ")); + } + aRet.append(rName); // field name + + return aRet.makeStringAndClear(); +} + +ScSubTotalFunc ScDPUtil::toSubTotalFunc(com::sun::star::sheet::GeneralFunction eGenFunc) +{ + ScSubTotalFunc eSubTotal; + switch (eGenFunc) + { + case sheet::GeneralFunction_NONE: eSubTotal = SUBTOTAL_FUNC_NONE; break; + case sheet::GeneralFunction_SUM: eSubTotal = SUBTOTAL_FUNC_SUM; break; + case sheet::GeneralFunction_COUNT: eSubTotal = SUBTOTAL_FUNC_CNT2; break; + case sheet::GeneralFunction_AVERAGE: eSubTotal = SUBTOTAL_FUNC_AVE; break; + case sheet::GeneralFunction_MAX: eSubTotal = SUBTOTAL_FUNC_MAX; break; + case sheet::GeneralFunction_MIN: eSubTotal = SUBTOTAL_FUNC_MIN; break; + case sheet::GeneralFunction_PRODUCT: eSubTotal = SUBTOTAL_FUNC_PROD; break; + case sheet::GeneralFunction_COUNTNUMS: eSubTotal = SUBTOTAL_FUNC_CNT; break; + case sheet::GeneralFunction_STDEV: eSubTotal = SUBTOTAL_FUNC_STD; break; + case sheet::GeneralFunction_STDEVP: eSubTotal = SUBTOTAL_FUNC_STDP; break; + case sheet::GeneralFunction_VAR: eSubTotal = SUBTOTAL_FUNC_VAR; break; + case sheet::GeneralFunction_VARP: eSubTotal = SUBTOTAL_FUNC_VARP; break; + case sheet::GeneralFunction_AUTO: + default: + eSubTotal = SUBTOTAL_FUNC_NONE; + } + return eSubTotal; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |