summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-11 22:00:54 -0400
committerMichael Meeks <michael.meeks@suse.com>2013-07-12 10:47:36 +0000
commitb4f35c69bfe56c1de0507e151dd8895563983723 (patch)
tree30d106b63c2aa3661f3f1fefaf123e5bc707a9b2 /sc/source/ui
parent311fb8b75053c22ae5d5a5726c760489edaebe8c (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>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx55
-rw-r--r--sc/source/ui/unoobj/datauno.cxx37
2 files changed, 6 insertions, 86 deletions
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 3a8f7cd2f271..a3f5bdbfdbc1 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -122,6 +122,7 @@
#include "formulaiter.hxx"
#include "tokenarray.hxx"
#include "stylehelper.hxx"
+#include "dputil.hxx"
#include <list>
#include <boost/scoped_ptr.hpp>
@@ -933,58 +934,6 @@ static sal_Bool lcl_WholeSheet( const ScRangeList& rRanges )
return false;
}
-//------------------------------------------------------------------------
-
-static ScSubTotalFunc lcl_SummaryToSubTotal( sheet::GeneralFunction eSummary )
-{
- ScSubTotalFunc eSubTotal;
- switch (eSummary)
- {
- 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_NONE:
- case sheet::GeneralFunction_AUTO:
- default:
- eSubTotal = SUBTOTAL_FUNC_NONE;
- break;
- }
- return eSubTotal;
-}
-
-//------------------------------------------------------------------------
-
namespace {
template<typename BorderLineType>
const ::editeng::SvxBorderLine* lcl_getBorderLine(
@@ -1877,7 +1826,7 @@ double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunct
ScAddress aDummy; // wenn nicht Marked, ignoriert wegen Negative
double fVal;
- ScSubTotalFunc eFunc = lcl_SummaryToSubTotal( nFunction );
+ ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(nFunction);
ScDocument* pDoc = pDocShell->GetDocument();
if ( !pDoc->GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
{
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 079e97b5c002..d3e2cfb3eb1a 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -48,6 +48,7 @@
#include "attrib.hxx"
#include "dpshttab.hxx"
#include "queryentry.hxx"
+#include "dputil.hxx"
#include <comphelper/extract.hxx>
#include <comphelper/servicehelper.hxx>
@@ -134,34 +135,6 @@ SC_SIMPLE_SERVICE_INFO( ScFilterDescriptorBase, "ScFilterDescriptorBase", "com.s
SC_SIMPLE_SERVICE_INFO( ScSubTotalDescriptorBase, "ScSubTotalDescriptorBase", "com.sun.star.sheet.SubTotalDescriptor" )
SC_SIMPLE_SERVICE_INFO( ScSubTotalFieldObj, "ScSubTotalFieldObj", "com.sun.star.sheet.SubTotalField" )
-
-//------------------------------------------------------------------------
-
-ScSubTotalFunc ScDataUnoConversion::GeneralToSubTotal( sheet::GeneralFunction eSummary )
-{
- ScSubTotalFunc eSubTotal;
- switch (eSummary)
- {
- 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:
- OSL_FAIL("GeneralToSubTotal: falscher enum");
- eSubTotal = SUBTOTAL_FUNC_NONE;
- }
- return eSubTotal;
-}
-
sheet::GeneralFunction ScDataUnoConversion::SubTotalToGeneral( ScSubTotalFunc eSubTotal )
{
sheet::GeneralFunction eGeneral;
@@ -569,8 +542,7 @@ void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns(
for (SCCOL i=0; i<nCount; i++)
{
aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column);
- aParam.pFunctions[nPos][i] =
- ScDataUnoConversion::GeneralToSubTotal( pAry[i].Function );
+ aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc(pAry[i].Function);
}
}
else
@@ -651,8 +623,7 @@ void SAL_CALL ScSubTotalDescriptorBase::addNew(
for (SCCOL i=0; i<nCount; i++)
{
aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column);
- aParam.pFunctions[nPos][i] =
- ScDataUnoConversion::GeneralToSubTotal( pAry[i].Function );
+ aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc(pAry[i].Function);
}
}
else
@@ -919,7 +890,7 @@ void SAL_CALL ScConsolidationDescriptor::setFunction( sheet::GeneralFunction nFu
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- aParam.eFunction = ScDataUnoConversion::GeneralToSubTotal(nFunction);
+ aParam.eFunction = ScDPUtil::toSubTotalFunc(nFunction);
}
uno::Sequence<table::CellRangeAddress> SAL_CALL ScConsolidationDescriptor::getSources()