summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/sheet/DataPilotField.idl32
-rw-r--r--offapi/com/sun/star/sheet/DataPilotSourceDimension.idl6
-rw-r--r--offapi/com/sun/star/sheet/DataPilotSourceLevel.idl7
-rw-r--r--offapi/com/sun/star/sheet/GeneralFunction2.idl111
-rw-r--r--sc/inc/dapiuno.hxx13
-rw-r--r--sc/inc/dpobject.hxx2
-rw-r--r--sc/inc/dpoutput.hxx1
-rw-r--r--sc/inc/dpsave.hxx4
-rw-r--r--sc/inc/dptabsrc.hxx7
-rw-r--r--sc/inc/dputil.hxx1
-rw-r--r--sc/inc/unonames.hxx4
-rw-r--r--sc/qa/extras/check_data_pilot_field.cxx4
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx18
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx4
-rw-r--r--sc/source/core/data/dpobject.cxx64
-rw-r--r--sc/source/core/data/dpoutput.cxx40
-rw-r--r--sc/source/core/data/dpsave.cxx15
-rw-r--r--sc/source/core/data/dptabres.cxx13
-rw-r--r--sc/source/core/data/dptabsrc.cxx66
-rw-r--r--sc/source/core/data/dputil.cxx30
-rw-r--r--sc/source/core/tool/interpr2.cxx2
-rw-r--r--sc/source/filter/xml/XMLConverter.cxx70
-rw-r--r--sc/source/filter/xml/XMLConverter.hxx7
-rw-r--r--sc/source/filter/xml/XMLExportDataPilot.cxx10
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx5
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx150
-rw-r--r--sc/source/ui/unoobj/datauno.cxx6
28 files changed, 489 insertions, 204 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index b5657f7f4ae1..c53b2d938392 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3409,6 +3409,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/sheet,\
FunctionArgument \
FunctionCategory \
GeneralFunction \
+ GeneralFunction2 \
GoalResult \
IconSetFormatEntry \
IconSetType \
diff --git a/offapi/com/sun/star/sheet/DataPilotField.idl b/offapi/com/sun/star/sheet/DataPilotField.idl
index edc84ae67ddf..b9f6b2b5c8d2 100644
--- a/offapi/com/sun/star/sheet/DataPilotField.idl
+++ b/offapi/com/sun/star/sheet/DataPilotField.idl
@@ -98,7 +98,6 @@ published service DataPilotField
*/
[property, optional] sequence<GeneralFunction> Subtotals;
-
/** specifies the selected page which is used to filter the data pilot.
*/
[property, optional] string SelectedPage;
@@ -175,6 +174,37 @@ published service DataPilotField
/** specifies whether to show this field also if it is empty or not.
*/
[property, optional] boolean ShowEmpty;
+
+ /** specifies the function used to calculate results for this field.
+
+ <p>For column and row fields, this is the function for subtotals
+ (GeneralFunction2::NONE means no subtotals).
+ For data fields, this is the function shown in the data pilot
+ table.</p>
+
+ @since LibreOffice 5.3
+ */
+
+ [property, optional] short Function2;
+
+ /** specifies the functions used to calculate subtotals for this field.
+
+ <p>This property is supported by column and row fields only.</p>
+
+ <p>An empty sequence means no subtotals. The same effect can be
+ achieved by setting the property #Function2 to the
+ value GeneralFunction::NONE. If the length of the
+ sequence is greater then 1, then the sequence MUST NOT contain one of
+ the values GeneralFunction2::NONE or
+ GeneralFunction2::AUTO.</p>
+
+ <p>The order of the functions in this sequence is reflected in the
+ DataPilot table. Multiple entries of the same function are ignored
+ when setting the property.</p>
+
+ @since LibreOffice 5.3
+ */
+ [property, optional] sequence<short> Subtotals2;
};
diff --git a/offapi/com/sun/star/sheet/DataPilotSourceDimension.idl b/offapi/com/sun/star/sheet/DataPilotSourceDimension.idl
index 2309d172e9ef..5ef61f5083eb 100644
--- a/offapi/com/sun/star/sheet/DataPilotSourceDimension.idl
+++ b/offapi/com/sun/star/sheet/DataPilotSourceDimension.idl
@@ -122,6 +122,12 @@ service DataPilotSourceDimension
*/
[readonly, property, optional] long Flags;
+
+ /** specifies how data are aggregated.
+ @since LibreOffice 5.3
+ */
+ [property, optional] short Function2;
+
};
diff --git a/offapi/com/sun/star/sheet/DataPilotSourceLevel.idl b/offapi/com/sun/star/sheet/DataPilotSourceLevel.idl
index d7fb274fd80f..2485de51778a 100644
--- a/offapi/com/sun/star/sheet/DataPilotSourceLevel.idl
+++ b/offapi/com/sun/star/sheet/DataPilotSourceLevel.idl
@@ -70,6 +70,13 @@ service DataPilotSourceLevel
*/
[property] boolean ShowEmpty;
+
+ /** specifies the subtotals that are inserted for the level.
+
+ <p>The subtotals are calculated with the members of this level.</p>
+ @since LibreOffice 5.3
+ */
+ [property, optional] sequence< short > SubTotals2;
};
diff --git a/offapi/com/sun/star/sheet/GeneralFunction2.idl b/offapi/com/sun/star/sheet/GeneralFunction2.idl
new file mode 100644
index 000000000000..926f7b174d73
--- /dev/null
+++ b/offapi/com/sun/star/sheet/GeneralFunction2.idl
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __com_sun_star_sheet_GeneralFunction2_idl__
+#define __com_sun_star_sheet_GeneralFunction2_idl__
+
+
+module com { module sun { module star { module sheet {
+
+
+/** used to specify a function to be calculated from values.
+ @since LibreOffice 5.3
+ */
+published constants GeneralFunction2
+{
+
+ /** nothing is calculated.
+ */
+ const short NONE = 0;
+
+
+ /** function is determined automatically.
+
+ <p>If the values are all numerical, SUM is used, otherwise COUNT.</p>
+ */
+ const short AUTO = 1;
+
+
+ /** sum of all numerical values is calculated.
+ */
+ const short SUM = 2;
+
+
+ /** all values, including non-numerical values, are counted.
+ */
+ const short COUNT = 3;
+
+
+ /** average of all numerical values is calculated.
+ */
+ const short AVERAGE = 4;
+
+
+ /** maximum value of all numerical values is calculated.
+ */
+ const short MAX = 5;
+
+
+ /** minimum value of all numerical values is calculated.
+ */
+ const short MIN = 6;
+
+
+ /** product of all numerical values is calculated.
+ */
+ const short PRODUCT = 7;
+
+
+ /** numerical values are counted.
+ */
+ const short COUNTNUMS = 8;
+
+
+ /** standard deviation is calculated based on a sample.
+ */
+ const short STDEV = 9;
+
+
+ /** standard deviation is calculated based on the entire population.
+ */
+ const short STDEVP = 10;
+
+
+ /** variance is calculated based on a sample.
+ */
+ const short VAR = 11;
+
+
+ /** variance is calculated based on the entire population.
+ */
+ const short VARP = 12;
+
+ /**
+ * median of all numerical values is calculated.
+ * @since LibreOffice 5.3
+ */
+ const short MEDIAN = 13;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index 915d9d90d40e..c8f7e88a72a1 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -41,7 +41,6 @@
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <com/sun/star/sheet/DataPilotFieldReference.hpp>
#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
#include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
#include <com/sun/star/sheet/XDataPilotField.hpp>
@@ -70,8 +69,8 @@ class ScDataPilotItemObj;
class ScDataPilotConversion
{
public:
- static css::sheet::GeneralFunction FirstFunc( PivotFunc nBits );
- static PivotFunc FunctionBit( css::sheet::GeneralFunction eFunc );
+ static sal_Int16 FirstFunc( PivotFunc nBits );
+ static PivotFunc FunctionBit( sal_Int16 eFunc );
static void FillGroupInfo(
css::sheet::DataPilotFieldGroupInfo& rInfo,
@@ -551,10 +550,10 @@ public:
// only called from property-functions:
css::sheet::DataPilotFieldOrientation getOrientation() const;
void setOrientation(css::sheet::DataPilotFieldOrientation Orientation);
- css::sheet::GeneralFunction getFunction() const;
- void setFunction(css::sheet::GeneralFunction Function);
- css::uno::Sequence< css::sheet::GeneralFunction > getSubtotals() const;
- void setSubtotals(const css::uno::Sequence< css::sheet::GeneralFunction >& rFunctions);
+ sal_Int16 getFunction() const;
+ void setFunction(sal_Int16 Function);
+ css::uno::Sequence< sal_Int16 > getSubtotals() const;
+ void setSubtotals(const css::uno::Sequence< sal_Int16 >& rFunctions);
void setCurrentPage(const OUString& sPage);
void setUseCurrentPage(bool bUse);
const css::sheet::DataPilotFieldAutoShowInfo* getAutoShowInfo();
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index befd3233f1a1..2f144c5c7786 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -186,7 +186,7 @@ public:
bool ParseFilters(
OUString& rDataFieldName,
std::vector<css::sheet::DataPilotFieldFilter>& rFilters,
- std::vector<css::sheet::GeneralFunction>& rFilterFuncs,
+ std::vector<sal_Int16>& rFilterFuncs,
const OUString& rFilterList );
void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx
index 78bd6a6b1006..9f9fdcf308a5 100644
--- a/sc/inc/dpoutput.hxx
+++ b/sc/inc/dpoutput.hxx
@@ -23,7 +23,6 @@
#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
#include <com/sun/star/sheet/DataResult.hpp>
#include <com/sun/star/sheet/MemberResult.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
#include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
#include "global.hxx"
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index a264ce77b535..663bcb2d724d 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -98,13 +98,13 @@ private:
bool bIsDataLayout;
bool bDupFlag;
sal_uInt16 nOrientation;
- sal_uInt16 nFunction; // enum GeneralFunction, for data dimensions
+ sal_uInt16 nFunction; // GeneralFunction2, for data dimensions
long nUsedHierarchy;
sal_uInt16 nShowEmptyMode; //! at level
bool bRepeatItemLabels; //! at level
bool bSubTotalDefault; //! at level
long nSubTotalCount;
- sal_uInt16* pSubTotalFuncs; // enum GeneralFunction
+ sal_uInt16* pSubTotalFuncs; // GeneralFunction2
css::sheet::DataPilotFieldReference* pReferenceValue;
css::sheet::DataPilotFieldSortInfo* pSortInfo; // (level)
css::sheet::DataPilotFieldAutoShowInfo* pAutoShowInfo; // (level)
diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index 3fca6ce07cc7..48c0714e915a 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -28,7 +28,6 @@
#include <com/sun/star/sheet/XDataPilotResults.hpp>
#include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
#include <com/sun/star/sheet/MemberResult.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
@@ -307,7 +306,7 @@ class ScDPDimension : public cppu::WeakImplHelper<
ScDPSource* pSource;
long nDim; // dimension index (== column ID)
rtl::Reference<ScDPHierarchies> mxHierarchies;
- sal_uInt16 nFunction; // enum GeneralFunction
+ sal_uInt16 nFunction; // enum GeneralFunction2
OUString aName; // if empty, take from source
std::unique_ptr<OUString> mpLayoutName;
std::unique_ptr<OUString> mpSubtotalName;
@@ -538,7 +537,7 @@ private:
long nHier;
long nLev;
rtl::Reference<ScDPMembers> mxMembers;
- css::uno::Sequence<css::sheet::GeneralFunction> aSubTotals;
+ css::uno::Sequence<sal_Int16> aSubTotals;
css::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings
css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings
css::sheet::DataPilotFieldLayoutInfo aLayoutInfo; // stored user settings
@@ -614,7 +613,7 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
throw(css::uno::RuntimeException, std::exception) override;
- css::uno::Sequence<css::sheet::GeneralFunction> getSubTotals() const;
+ css::uno::Sequence<sal_Int16> getSubTotals() const;
bool getShowEmpty() const { return bShowEmpty;}
bool getRepeatItemLabels() const { return bRepeatItemLabels; }
diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx
index 29c7036e0d0e..525e67363c9a 100644
--- a/sc/inc/dputil.hxx
+++ b/sc/inc/dputil.hxx
@@ -51,6 +51,7 @@ public:
static OUString getDisplayedMeasureName(const OUString& rName, ScSubTotalFunc eFunc);
static ScSubTotalFunc toSubTotalFunc(css::sheet::GeneralFunction eGenFunc);
+ static ScSubTotalFunc toSubTotalFunc(sal_Int16 eGenFunc);
};
#endif
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index e7ff39cbf595..469183d18b78 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -249,7 +249,9 @@
// data pilot field
#define SC_UNONAME_FUNCTION "Function"
+#define SC_UNONAME_FUNCTION2 "Function2"
#define SC_UNONAME_SUBTOTALS "Subtotals"
+#define SC_UNONAME_SUBTOTALS2 "Subtotals2"
#define SC_UNONAME_SELPAGE "SelectedPage"
#define SC_UNONAME_USESELPAGE "UseSelectedPage"
#define SC_UNONAME_HASREFERENCE "HasReference"
@@ -582,9 +584,11 @@
#define SC_UNO_DP_ORIENTATION "Orientation"
#define SC_UNO_DP_POSITION "Position"
#define SC_UNO_DP_FUNCTION "Function"
+#define SC_UNO_DP_FUNCTION2 "Function2"
#define SC_UNO_DP_USEDHIERARCHY "UsedHierarchy"
#define SC_UNO_DP_FILTER "Filter"
#define SC_UNO_DP_SUBTOTAL "SubTotals"
+#define SC_UNO_DP_SUBTOTAL2 "SubTotals2"
#define SC_UNO_DP_SHOWEMPTY "ShowEmpty"
#define SC_UNO_DP_REPEATITEMLABELS "RepeatItemLabels"
#define SC_UNO_DP_ISVISIBLE "IsVisible"
diff --git a/sc/qa/extras/check_data_pilot_field.cxx b/sc/qa/extras/check_data_pilot_field.cxx
index 24c7ffb90f9a..e4013727015a 100644
--- a/sc/qa/extras/check_data_pilot_field.cxx
+++ b/sc/qa/extras/check_data_pilot_field.cxx
@@ -69,7 +69,9 @@ private:
bool CheckDataPilotField::isPropertyIgnored(const OUString& rName)
{
return rName == "Function"
- || rName == "Subtotals";
+ || rName == "Subtotals"
+ || rName == "Function2"
+ || rName == "Subtotals2";
}
CheckDataPilotField::CheckDataPilotField()
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 9b2441ab17fe..ab80b095db55 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -67,7 +67,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/table/BorderLineStyle.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/awt/XBitmap.hpp>
@@ -2787,7 +2787,7 @@ void ScExportTest::testPivotTableXLSX()
}
const ScDPSaveDimension* pDim = aDims[0];
- if (pDim->GetFunction() != sheet::GeneralFunction_SUM)
+ if (pDim->GetFunction() != sheet::GeneralFunction2::SUM)
{
cerr << "Data field should have SUM function." << endl;
return false;
@@ -2894,13 +2894,13 @@ void ScExportTest::testPivotTableTwoDataFieldsXLSX()
return false;
}
- if (aDims[0]->GetFunction() != sheet::GeneralFunction_SUM)
+ if (aDims[0]->GetFunction() != sheet::GeneralFunction2::SUM)
{
cerr << "First data field should be SUM." << endl;
return false;
}
- if (aDims[1]->GetFunction() != sheet::GeneralFunction_COUNT)
+ if (aDims[1]->GetFunction() != sheet::GeneralFunction2::COUNT)
{
cerr << "First data field should be COUNT." << endl;
return false;
@@ -2968,16 +2968,9 @@ void ScExportTest::testPivotTableMedian()
std::vector<ScDPSaveDimension const *>::size_type(1), aDims.size());
const ScDPSaveDimension* pDim = aDims.back();
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Function for the data field should be MEDIAN.",
- sal_uInt16(sheet::GeneralFunction_MEDIAN), pDim->GetFunction());
-#else
- CPPUNIT_ASSERT_EQUAL_MESSAGE(
- "Function for the data field should be MEDIAN.",
- sal_uInt16(sheet::GeneralFunction_NONE), pDim->GetFunction());
-#endif
+ sal_uInt16(sheet::GeneralFunction2::MEDIAN), pDim->GetFunction());
xDocSh2->DoClose();
}
@@ -3669,7 +3662,6 @@ void ScExportTest::testHeaderImage()
OUString aURL;
xStyle->getPropertyValue("HeaderBackGraphicURL") >>= aURL;
CPPUNIT_ASSERT(aURL.startsWith("vnd.sun.star.GraphicObject:"));
-
xDocSh->DoClose();
}
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index e2858a700b28..3b5efca85439 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -81,7 +81,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -1876,7 +1876,7 @@ void ScFiltersTest::testPivotTableBasicODS()
const ScDPSaveDimension* pDim = aDims.back();
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Function for the data field should be COUNT.",
- sal_uInt16(sheet::GeneralFunction_COUNT), pDim->GetFunction());
+ sal_uInt16(sheet::GeneralFunction2::COUNT), pDim->GetFunction());
xDocSh->DoClose();
}
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 22d8744e0d23..3e1813c69968 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -49,7 +49,7 @@
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
-#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
#include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
@@ -1335,7 +1335,7 @@ public:
if (pLayoutName && ScGlobal::pCharClass->uppercase(*pLayoutName) == maName)
return true;
- sheet::GeneralFunction eGenFunc = static_cast<sheet::GeneralFunction>(pDim->GetFunction());
+ sal_Int16 eGenFunc = pDim->GetFunction();
ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(eGenFunc);
OUString aSrcName = ScDPUtil::getSourceDimensionName(pDim->GetName());
OUString aFuncName = ScDPUtil::getDisplayedMeasureName(aSrcName, eFunc);
@@ -1491,29 +1491,29 @@ bool dequote( const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos,
struct ScGetPivotDataFunctionEntry
{
const sal_Char* pName;
- sheet::GeneralFunction eFunc;
+ sal_Int16 eFunc;
};
-bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sheet::GeneralFunction& rFunc )
+bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndPos, sal_Int16& rFunc )
{
static const ScGetPivotDataFunctionEntry aFunctions[] =
{
// our names
- { "Sum", sheet::GeneralFunction_SUM },
- { "Count", sheet::GeneralFunction_COUNT },
- { "Average", sheet::GeneralFunction_AVERAGE },
- { "Max", sheet::GeneralFunction_MAX },
- { "Min", sheet::GeneralFunction_MIN },
- { "Product", sheet::GeneralFunction_PRODUCT },
- { "CountNums", sheet::GeneralFunction_COUNTNUMS },
- { "StDev", sheet::GeneralFunction_STDEV },
- { "StDevp", sheet::GeneralFunction_STDEVP },
- { "Var", sheet::GeneralFunction_VAR },
- { "VarP", sheet::GeneralFunction_VARP },
+ { "Sum", sheet::GeneralFunction2::SUM },
+ { "Count", sheet::GeneralFunction2::COUNT },
+ { "Average", sheet::GeneralFunction2::AVERAGE },
+ { "Max", sheet::GeneralFunction2::MAX },
+ { "Min", sheet::GeneralFunction2::MIN },
+ { "Product", sheet::GeneralFunction2::PRODUCT },
+ { "CountNums", sheet::GeneralFunction2::COUNTNUMS },
+ { "StDev", sheet::GeneralFunction2::STDEV },
+ { "StDevp", sheet::GeneralFunction2::STDEVP },
+ { "Var", sheet::GeneralFunction2::VAR },
+ { "VarP", sheet::GeneralFunction2::VARP },
// compatibility names
- { "Count Nums", sheet::GeneralFunction_COUNTNUMS },
- { "StdDev", sheet::GeneralFunction_STDEV },
- { "StdDevp", sheet::GeneralFunction_STDEVP }
+ { "Count Nums", sheet::GeneralFunction2::COUNTNUMS },
+ { "StdDev", sheet::GeneralFunction2::STDEV },
+ { "StdDevp", sheet::GeneralFunction2::STDEVP }
};
const sal_Int32 nListLen = rList.getLength();
@@ -1558,7 +1558,7 @@ bool parseFunction( const OUString& rList, sal_Int32 nStartPos, sal_Int32& rEndP
return bFound;
}
-bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBracket, sheet::GeneralFunction* pFunc,
+bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBracket, sal_Int16* pFunc,
OUString& rDequoted )
{
sal_Int32 nMatchList = 0;
@@ -1663,7 +1663,7 @@ bool extractAtStart( const OUString& rList, sal_Int32& rMatched, bool bAllowBrac
bool isAtStart(
const OUString& rList, const OUString& rSearch, sal_Int32& rMatched,
- bool bAllowBracket, sheet::GeneralFunction* pFunc )
+ bool bAllowBracket, sal_Int16* pFunc )
{
sal_Int32 nMatchList = 0;
sal_Int32 nMatchSearch = 0;
@@ -1714,7 +1714,7 @@ bool isAtStart(
bool ScDPObject::ParseFilters(
OUString& rDataFieldName,
std::vector<sheet::DataPilotFieldFilter>& rFilters,
- std::vector<sheet::GeneralFunction>& rFilterFuncs, const OUString& rFilterList )
+ std::vector<sal_Int16>& rFilterFuncs, const OUString& rFilterList )
{
// parse the string rFilterList into parameters for GetPivotData
@@ -1868,8 +1868,8 @@ bool ScDPObject::ParseFilters(
OUString aFoundName;
OUString aFoundValueName;
OUString aFoundValue;
- sheet::GeneralFunction eFunc = sheet::GeneralFunction_NONE;
- sheet::GeneralFunction eFoundFunc = sheet::GeneralFunction_NONE;
+ sal_Int16 eFunc = sheet::GeneralFunction2::NONE;
+ sal_Int16 eFoundFunc = sheet::GeneralFunction2::NONE;
OUString aQueryValueName;
const bool bHasQuery = extractAtStart( aRemaining, nMatched, false, &eFunc, aQueryValueName);
@@ -2118,16 +2118,16 @@ static PivotFunc lcl_FirstSubTotal( const uno::Reference<beans::XPropertySet>& x
uno::Any aSubAny;
try
{
- aSubAny = xLevProp->getPropertyValue( SC_UNO_DP_SUBTOTAL );
+ aSubAny = xLevProp->getPropertyValue( SC_UNO_DP_SUBTOTAL2 );
}
catch(uno::Exception&)
{
}
- uno::Sequence<sheet::GeneralFunction> aSeq;
+ uno::Sequence<sal_Int16> aSeq;
if ( aSubAny >>= aSeq )
{
PivotFunc nMask = PivotFunc::NONE;
- const sheet::GeneralFunction* pArray = aSeq.getConstArray();
+ const sal_Int16* pArray = aSeq.getConstArray();
long nCount = aSeq.getLength();
for (long i=0; i<nCount; i++)
nMask |= ScDataPilotConversion::FunctionBit(pArray[i]);
@@ -2195,13 +2195,13 @@ void lcl_FillOldFields( ScPivotFieldVector& rFields,
PivotFunc nMask = PivotFunc::NONE;
if ( nOrient == sheet::DataPilotFieldOrientation_DATA )
{
- sheet::GeneralFunction eFunc = (sheet::GeneralFunction)ScUnoHelpFunctions::GetEnumProperty(
- xDimProp, SC_UNO_DP_FUNCTION,
- sheet::GeneralFunction_NONE );
- if ( eFunc == sheet::GeneralFunction_AUTO )
+ sal_Int16 eFunc = (sal_Int16)ScUnoHelpFunctions::GetEnumProperty(
+ xDimProp, SC_UNO_DP_FUNCTION2,
+ sheet::GeneralFunction2::NONE );
+ if ( eFunc == sheet::GeneralFunction2::AUTO )
{
//TODO: test for numeric data
- eFunc = sheet::GeneralFunction_SUM;
+ eFunc = sheet::GeneralFunction2::SUM;
}
nMask = ScDataPilotConversion::FunctionBit(eFunc);
}
@@ -2683,7 +2683,7 @@ void ScDPObject::ConvertOrientation(
bFirst = std::none_of(itrBeg, itr, FindByOriginalDim(nCol));
}
- sheet::GeneralFunction eFunc = ScDataPilotConversion::FirstFunc(rField.nFuncMask);
+ sal_Int16 eFunc = ScDataPilotConversion::FirstFunc(rField.nFuncMask);
if (!bFirst)
pDim = rSaveData.DuplicateDimension(pDim->GetName());
pDim->SetOrientation(nOrient);
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 1bd6a62a5379..1fd2c3f81bd9 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/sheet/MemberResultFlags.hpp>
#include <com/sun/star/sheet/DataResultFlags.hpp>
#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <vector>
@@ -1538,28 +1539,25 @@ bool ScDPOutput::GetDataResultPositionData(vector<sheet::DataPilotFieldFilter>&
namespace {
-OUString lcl_GetDataFieldName( const OUString& rSourceName, sheet::GeneralFunction eFunc )
+OUString lcl_GetDataFieldName( const OUString& rSourceName, sal_Int16 eFunc )
{
sal_uInt16 nStrId = 0;
switch ( eFunc )
{
- case sheet::GeneralFunction_SUM: nStrId = STR_FUN_TEXT_SUM; break;
- case sheet::GeneralFunction_COUNT:
- case sheet::GeneralFunction_COUNTNUMS: nStrId = STR_FUN_TEXT_COUNT; break;
- case sheet::GeneralFunction_AVERAGE: nStrId = STR_FUN_TEXT_AVG; break;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- case sheet::GeneralFunction_MEDIAN: nStrId = STR_FUN_TEXT_MEDIAN; break;
-#endif
- case sheet::GeneralFunction_MAX: nStrId = STR_FUN_TEXT_MAX; break;
- case sheet::GeneralFunction_MIN: nStrId = STR_FUN_TEXT_MIN; break;
- case sheet::GeneralFunction_PRODUCT: nStrId = STR_FUN_TEXT_PRODUCT; break;
- case sheet::GeneralFunction_STDEV:
- case sheet::GeneralFunction_STDEVP: nStrId = STR_FUN_TEXT_STDDEV; break;
- case sheet::GeneralFunction_VAR:
- case sheet::GeneralFunction_VARP: nStrId = STR_FUN_TEXT_VAR; break;
- case sheet::GeneralFunction_NONE:
- case sheet::GeneralFunction_AUTO: break;
+ case sheet::GeneralFunction2::SUM: nStrId = STR_FUN_TEXT_SUM; break;
+ case sheet::GeneralFunction2::COUNT:
+ case sheet::GeneralFunction2::COUNTNUMS: nStrId = STR_FUN_TEXT_COUNT; break;
+ case sheet::GeneralFunction2::AVERAGE: nStrId = STR_FUN_TEXT_AVG; break;
+ case sheet::GeneralFunction2::MEDIAN: nStrId = STR_FUN_TEXT_MEDIAN; break;
+ case sheet::GeneralFunction2::MAX: nStrId = STR_FUN_TEXT_MAX; break;
+ case sheet::GeneralFunction2::MIN: nStrId = STR_FUN_TEXT_MIN; break;
+ case sheet::GeneralFunction2::PRODUCT: nStrId = STR_FUN_TEXT_PRODUCT; break;
+ case sheet::GeneralFunction2::STDEV:
+ case sheet::GeneralFunction2::STDEVP: nStrId = STR_FUN_TEXT_STDDEV; break;
+ case sheet::GeneralFunction2::VAR:
+ case sheet::GeneralFunction2::VARP: nStrId = STR_FUN_TEXT_VAR; break;
+ case sheet::GeneralFunction2::NONE:
+ case sheet::GeneralFunction2::AUTO: break;
default:
{
assert(false);
@@ -1590,9 +1588,9 @@ void ScDPOutput::GetDataDimensionNames(
// Generate "given name" the same way as in dptabres.
//TODO: Should use a stored name when available
- sheet::GeneralFunction eFunc = (sheet::GeneralFunction)ScUnoHelpFunctions::GetEnumProperty(
- xDimProp, SC_UNO_DP_FUNCTION,
- sheet::GeneralFunction_NONE );
+ sal_Int16 eFunc = (sal_Int16)ScUnoHelpFunctions::GetEnumProperty(
+ xDimProp, SC_UNO_DP_FUNCTION2,
+ sheet::GeneralFunction2::NONE );
rGivenName = lcl_GetDataFieldName( rSourceName, eFunc );
}
}
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index a3fae76e23d7..54f98850c2de 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -33,6 +33,7 @@
#include <comphelper/stl_types.hxx>
#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
@@ -194,7 +195,7 @@ ScDPSaveDimension::ScDPSaveDimension(const OUString& rName, bool bDataLayout) :
bIsDataLayout( bDataLayout ),
bDupFlag( false ),
nOrientation( sheet::DataPilotFieldOrientation_HIDDEN ),
- nFunction( sheet::GeneralFunction_AUTO ),
+ nFunction( sheet::GeneralFunction2::AUTO ),
nUsedHierarchy( -1 ),
nShowEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
bRepeatItemLabels( false ),
@@ -563,8 +564,8 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
sheet::DataPilotFieldOrientation eOrient = (sheet::DataPilotFieldOrientation)nOrientation;
xDimProp->setPropertyValue( SC_UNO_DP_ORIENTATION, uno::Any(eOrient) );
- sheet::GeneralFunction eFunc = (sheet::GeneralFunction)nFunction;
- xDimProp->setPropertyValue( SC_UNO_DP_FUNCTION, uno::Any(eFunc) );
+ sal_Int16 eFunc = static_cast<sal_Int16>(nFunction);
+ xDimProp->setPropertyValue( SC_UNO_DP_FUNCTION2, uno::Any(eFunc) );
if ( nUsedHierarchy >= 0 )
{
@@ -629,11 +630,11 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
if ( !pSubTotalFuncs )
nSubTotalCount = 0;
- uno::Sequence<sheet::GeneralFunction> aSeq(nSubTotalCount);
- sheet::GeneralFunction* pArray = aSeq.getArray();
+ uno::Sequence<sal_Int16> aSeq(nSubTotalCount);
+ sal_Int16* pArray = aSeq.getArray();
for (long i=0; i<nSubTotalCount; i++)
- pArray[i] = (sheet::GeneralFunction)pSubTotalFuncs[i];
- xLevProp->setPropertyValue( SC_UNO_DP_SUBTOTAL, uno::Any(aSeq) );
+ pArray[i] = static_cast<sal_Int16>(pSubTotalFuncs[i]);
+ xLevProp->setPropertyValue( SC_UNO_DP_SUBTOTAL2, uno::Any(aSeq) );
}
if ( nShowEmptyMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xLevProp,
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 6747347a1c67..c20c2a94160d 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp>
#include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
using namespace com::sun::star;
using ::std::vector;
@@ -729,9 +730,9 @@ static ScSubTotalFunc lcl_GetForceFunc( const ScDPLevel* pLevel, long nFuncNo )
{
//TODO: direct access via ScDPLevel
- uno::Sequence<sheet::GeneralFunction> aSeq = pLevel->getSubTotals();
+ uno::Sequence<sal_Int16> aSeq = pLevel->getSubTotals();
long nSequence = aSeq.getLength();
- if ( nSequence && aSeq[0] != sheet::GeneralFunction_AUTO )
+ if ( nSequence && aSeq[0] != sheet::GeneralFunction2::AUTO )
{
// For manual subtotals, "automatic" is added as first function.
// ScDPResultMember::GetSubTotalCount adds to the count, here NONE has to be
@@ -742,8 +743,8 @@ static ScSubTotalFunc lcl_GetForceFunc( const ScDPLevel* pLevel, long nFuncNo )
if ( nFuncNo >= 0 && nFuncNo < nSequence )
{
- sheet::GeneralFunction eUser = aSeq.getConstArray()[nFuncNo];
- if (eUser != sheet::GeneralFunction_AUTO)
+ sal_Int16 eUser = aSeq.getConstArray()[nFuncNo];
+ if (eUser != sheet::GeneralFunction2::AUTO)
eRet = ScDPUtil::toSubTotalFunc(eUser);
}
}
@@ -1237,9 +1238,9 @@ long ScDPResultMember::GetSubTotalCount( long* pUserSubStart ) const
{
//TODO: direct access via ScDPLevel
- uno::Sequence<sheet::GeneralFunction> aSeq = pParentLevel->getSubTotals();
+ uno::Sequence<sal_Int16> aSeq = pParentLevel->getSubTotals();
long nSequence = aSeq.getLength();
- if ( nSequence && aSeq[0] != sheet::GeneralFunction_AUTO )
+ if ( nSequence && aSeq[0] != sheet::GeneralFunction2::AUTO )
{
// For manual subtotals, always add "automatic" as first function
// (used for calculation, but not for display, needed for sorting, see lcl_GetForceFunc)
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index cc024ac56cfa..8285aa11b187 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -54,6 +54,7 @@
#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <comphelper/string.hxx>
#include <unotools/collatorwrapper.hxx>
@@ -798,11 +799,11 @@ void ScDPSource::CreateRes_Impl()
// Get function for each data field.
long nDimIndex = *it;
ScDPDimension* pDim = GetDimensionsObject()->getByIndex(nDimIndex);
- sheet::GeneralFunction eUser = (sheet::GeneralFunction)pDim->getFunction();
- if (eUser == sheet::GeneralFunction_AUTO)
+ sal_Int16 eUser = static_cast<sal_Int16>(pDim->getFunction());
+ if (eUser == sheet::GeneralFunction2::AUTO)
{
//TODO: test for numeric data
- eUser = sheet::GeneralFunction_SUM;
+ eUser = sheet::GeneralFunction2::SUM;
}
// Map UNO's enum to internal enum ScSubTotalFunc.
@@ -1465,6 +1466,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPDimension::getPropertySetIn
{ OUString(SC_UNO_DP_FILTER), 0, cppu::UnoType<uno::Sequence<sheet::TableFilterField>>::get(), 0, 0 },
{ OUString(SC_UNO_DP_FLAGS), 0, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY, 0 },
{ OUString(SC_UNO_DP_FUNCTION), 0, cppu::UnoType<sheet::GeneralFunction>::get(), 0, 0 },
+ { OUString(SC_UNO_DP_FUNCTION2), 0, cppu::UnoType<sal_Int16>::get(), 0, 0 },
{ OUString(SC_UNO_DP_ISDATALAYOUT), 0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::READONLY, 0 },
{ OUString(SC_UNO_DP_NUMBERFO), 0, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY, 0 },
{ OUString(SC_UNO_DP_ORIENTATION), 0, cppu::UnoType<sheet::DataPilotFieldOrientation>::get(), 0, 0 },
@@ -1504,6 +1506,12 @@ void SAL_CALL ScDPDimension::setPropertyValue( const OUString& aPropertyName, co
if (aValue >>= eEnum)
setFunction( sal::static_int_cast<sal_uInt16>(eEnum) );
}
+ else if ( aPropertyName == SC_UNO_DP_FUNCTION2 )
+ {
+ sal_Int16 eEnum;
+ if (aValue >>= eEnum)
+ setFunction( eEnum );
+ }
else if ( aPropertyName == SC_UNO_DP_REFVALUE )
aValue >>= aReferenceValue;
else if ( aPropertyName == SC_UNO_DP_FILTER )
@@ -1578,7 +1586,21 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName
}
else if ( aPropertyName == SC_UNO_DP_FUNCTION )
{
- sheet::GeneralFunction eVal = (sheet::GeneralFunction)getFunction();
+ sheet::GeneralFunction eVal;
+ sal_Int16 nVal = getFunction();
+ if (nVal == sheet::GeneralFunction2::MEDIAN)
+ {
+ eVal = sheet::GeneralFunction_NONE;
+ }
+ else
+ {
+ eVal = static_cast<sheet::GeneralFunction>(getFunction());
+ }
+ aRet <<= eVal;
+ }
+ else if ( aPropertyName == SC_UNO_DP_FUNCTION2 )
+ {
+ sal_Int16 eVal = getFunction();
aRet <<= eVal;
}
else if ( aPropertyName == SC_UNO_DP_REFVALUE )
@@ -1588,9 +1610,9 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName
else if ( aPropertyName == SC_UNO_DP_NUMBERFO )
{
sal_Int32 nFormat = 0;
- sheet::GeneralFunction eFunc = (sheet::GeneralFunction)getFunction();
+ sal_Int16 eFunc = getFunction();
// #i63745# don't use source format for "count"
- if ( eFunc != sheet::GeneralFunction_COUNT && eFunc != sheet::GeneralFunction_COUNTNUMS )
+ if ( eFunc != sheet::GeneralFunction2::COUNT && eFunc != sheet::GeneralFunction2::COUNTNUMS )
nFormat = pSource->GetData()->GetNumberFormat( ( nSourceDim >= 0 ) ? nSourceDim : nDim );
switch ( aReferenceValue.ReferenceType )
@@ -2125,13 +2147,13 @@ void SAL_CALL ScDPLevel::setName( const OUString& /* rNewName */ ) throw(uno::Ru
OSL_FAIL("not implemented"); //TODO: exception?
}
-uno::Sequence<sheet::GeneralFunction> ScDPLevel::getSubTotals() const
+uno::Sequence<sal_Int16> ScDPLevel::getSubTotals() const
{
//TODO: separate functions for settings and evaluation?
long nSrcDim = pSource->GetSourceDim( nDim );
if ( !pSource->SubTotalAllowed( nSrcDim ) )
- return uno::Sequence<sheet::GeneralFunction>(0);
+ return uno::Sequence<sal_Int16>(0);
return aSubTotals;
}
@@ -2152,6 +2174,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPLevel::getPropertySetInfo()
{ OUString(SC_UNO_DP_REPEATITEMLABELS), 0, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString(SC_UNO_DP_SORTING), 0, cppu::UnoType<sheet::DataPilotFieldSortInfo>::get(), 0, 0 },
{ OUString(SC_UNO_DP_SUBTOTAL), 0, cppu::UnoType<uno::Sequence<sheet::GeneralFunction>>::get(), 0, 0 },
+ { OUString(SC_UNO_DP_SUBTOTAL2), 0, cppu::UnoType<uno::Sequence<sal_Int16>>::get(), 0, 0 },
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
static uno::Reference<beans::XPropertySetInfo> aRef =
@@ -2169,6 +2192,16 @@ void SAL_CALL ScDPLevel::setPropertyValue( const OUString& aPropertyName, const
else if ( aPropertyName == SC_UNO_DP_REPEATITEMLABELS )
bRepeatItemLabels = lcl_GetBoolFromAny(aValue);
else if ( aPropertyName == SC_UNO_DP_SUBTOTAL )
+ {
+ uno::Sequence<sheet::GeneralFunction> aSeq;
+ aValue >>= aSeq;
+ aSubTotals.realloc(aSeq.getLength());
+ for (sal_Int32 nIndex = 0; nIndex < aSeq.getLength(); nIndex++)
+ {
+ aSubTotals[nIndex] = static_cast<sal_Int16>(aSeq[nIndex]);
+ }
+ }
+ else if ( aPropertyName == SC_UNO_DP_SUBTOTAL2 )
aValue >>= aSubTotals;
else if ( aPropertyName == SC_UNO_DP_SORTING )
aValue >>= aSortInfo;
@@ -2193,7 +2226,22 @@ uno::Any SAL_CALL ScDPLevel::getPropertyValue( const OUString& aPropertyName )
aRet <<= bRepeatItemLabels;
else if ( aPropertyName == SC_UNO_DP_SUBTOTAL )
{
- uno::Sequence<sheet::GeneralFunction> aSeq = getSubTotals(); //TODO: avoid extra copy?
+ uno::Sequence<sal_Int16> aSeq = getSubTotals();
+ uno::Sequence<sheet::GeneralFunction> aNewSeq;
+ aNewSeq.realloc(aSeq.getLength());
+ for (sal_Int32 nIndex = 0; nIndex < aSeq.getLength(); nIndex++)
+ {
+ if (aSeq[nIndex] == sheet::GeneralFunction2::MEDIAN)
+ aNewSeq[nIndex] = sheet::GeneralFunction_NONE;
+ else
+ aNewSeq[nIndex] = static_cast<sheet::GeneralFunction>(aSeq[nIndex]);
+ }
+
+ aRet <<= aNewSeq;
+ }
+ else if ( aPropertyName == SC_UNO_DP_SUBTOTAL2 )
+ {
+ uno::Sequence<sal_Int16> aSeq = getSubTotals(); //TODO: avoid extra copy?
aRet <<= aSeq;
}
else if ( aPropertyName == SC_UNO_DP_SORTING )
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index d64a5a8dbf67..c2c4e46b02ec 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
#include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
using namespace com::sun::star;
@@ -410,10 +411,6 @@ ScSubTotalFunc ScDPUtil::toSubTotalFunc(css::sheet::GeneralFunction eGenFunc)
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;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- case sheet::GeneralFunction_MEDIAN: eSubTotal = SUBTOTAL_FUNC_MED; break;
-#endif
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;
@@ -429,4 +426,29 @@ ScSubTotalFunc ScDPUtil::toSubTotalFunc(css::sheet::GeneralFunction eGenFunc)
return eSubTotal;
}
+ScSubTotalFunc ScDPUtil::toSubTotalFunc(sal_Int16 eGenFunc)
+{
+ ScSubTotalFunc eSubTotal = SUBTOTAL_FUNC_NONE;
+ switch (eGenFunc)
+ {
+ case sheet::GeneralFunction2::NONE: eSubTotal = SUBTOTAL_FUNC_NONE; break;
+ case sheet::GeneralFunction2::SUM: eSubTotal = SUBTOTAL_FUNC_SUM; break;
+ case sheet::GeneralFunction2::COUNT: eSubTotal = SUBTOTAL_FUNC_CNT2; break;
+ case sheet::GeneralFunction2::AVERAGE: eSubTotal = SUBTOTAL_FUNC_AVE; break;
+ case sheet::GeneralFunction2::MEDIAN: eSubTotal = SUBTOTAL_FUNC_MED; break;
+ case sheet::GeneralFunction2::MAX: eSubTotal = SUBTOTAL_FUNC_MAX; break;
+ case sheet::GeneralFunction2::MIN: eSubTotal = SUBTOTAL_FUNC_MIN; break;
+ case sheet::GeneralFunction2::PRODUCT: eSubTotal = SUBTOTAL_FUNC_PROD; break;
+ case sheet::GeneralFunction2::COUNTNUMS: eSubTotal = SUBTOTAL_FUNC_CNT; break;
+ case sheet::GeneralFunction2::STDEV: eSubTotal = SUBTOTAL_FUNC_STD; break;
+ case sheet::GeneralFunction2::STDEVP: eSubTotal = SUBTOTAL_FUNC_STDP; break;
+ case sheet::GeneralFunction2::VAR: eSubTotal = SUBTOTAL_FUNC_VAR; break;
+ case sheet::GeneralFunction2::VARP: eSubTotal = SUBTOTAL_FUNC_VARP; break;
+ case sheet::GeneralFunction2::AUTO: eSubTotal = SUBTOTAL_FUNC_NONE; break;
+ default:
+ assert(false);
+ }
+ return eSubTotal;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 090e49255c82..0e4245cd74a2 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -3657,7 +3657,7 @@ void ScInterpreter::ScGetPivotData()
if (bOldSyntax)
{
OUString aFilterStr = aDataFieldName;
- std::vector<sheet::GeneralFunction> aFilterFuncs;
+ std::vector<sal_Int16> aFilterFuncs;
if (!pDPObj->ParseFilters(aDataFieldName, aFilters, aFilterFuncs, aFilterStr))
{
PushError(FormulaError::NoRef);
diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx
index 3c1688036ad9..2437a6e49444 100644
--- a/sc/source/filter/xml/XMLConverter.cxx
+++ b/sc/source/filter/xml/XMLConverter.cxx
@@ -19,6 +19,7 @@
#include "XMLConverter.hxx"
#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <tools/datetime.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmltoken.hxx>
@@ -56,11 +57,6 @@ sheet::GeneralFunction ScXMLConverter::GetFunctionFromString( const OUString& sF
return sheet::GeneralFunction_PRODUCT;
if( IsXMLToken(sFunction, XML_AVERAGE ) )
return sheet::GeneralFunction_AVERAGE;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- if( IsXMLToken(sFunction, XML_MEDIAN ) )
- return sheet::GeneralFunction_MEDIAN;
-#endif
if( IsXMLToken(sFunction, XML_MAX ) )
return sheet::GeneralFunction_MAX;
if( IsXMLToken(sFunction, XML_MIN ) )
@@ -76,6 +72,37 @@ sheet::GeneralFunction ScXMLConverter::GetFunctionFromString( const OUString& sF
return sheet::GeneralFunction_NONE;
}
+sal_Int16 ScXMLConverter::GetFunctionFromString2( const OUString& sFunction )
+{
+ if( IsXMLToken(sFunction, XML_SUM ) )
+ return sheet::GeneralFunction2::SUM;
+ if( IsXMLToken(sFunction, XML_AUTO ) )
+ return sheet::GeneralFunction2::AUTO;
+ if( IsXMLToken(sFunction, XML_COUNT ) )
+ return sheet::GeneralFunction2::COUNT;
+ if( IsXMLToken(sFunction, XML_COUNTNUMS ) )
+ return sheet::GeneralFunction2::COUNTNUMS;
+ if( IsXMLToken(sFunction, XML_PRODUCT ) )
+ return sheet::GeneralFunction2::PRODUCT;
+ if( IsXMLToken(sFunction, XML_AVERAGE ) )
+ return sheet::GeneralFunction2::AVERAGE;
+ if( IsXMLToken(sFunction, XML_MEDIAN ) )
+ return sheet::GeneralFunction2::MEDIAN;
+ if( IsXMLToken(sFunction, XML_MAX ) )
+ return sheet::GeneralFunction2::MAX;
+ if( IsXMLToken(sFunction, XML_MIN ) )
+ return sheet::GeneralFunction2::MIN;
+ if( IsXMLToken(sFunction, XML_STDEV ) )
+ return sheet::GeneralFunction2::STDEV;
+ if( IsXMLToken(sFunction, XML_STDEVP ) )
+ return sheet::GeneralFunction2::STDEVP;
+ if( IsXMLToken(sFunction, XML_VAR ) )
+ return sheet::GeneralFunction2::VAR;
+ if( IsXMLToken(sFunction, XML_VARP ) )
+ return sheet::GeneralFunction2::VARP;
+ return sheet::GeneralFunction2::NONE;
+}
+
ScSubTotalFunc ScXMLConverter::GetSubTotalFuncFromString( const OUString& sFunction )
{
if( IsXMLToken(sFunction, XML_SUM ) )
@@ -107,28 +134,25 @@ ScSubTotalFunc ScXMLConverter::GetSubTotalFuncFromString( const OUString& sFunct
void ScXMLConverter::GetStringFromFunction(
OUString& rString,
- const sheet::GeneralFunction eFunction )
+ sal_Int16 eFunction )
{
OUString sFuncStr;
switch( eFunction )
{
- case sheet::GeneralFunction_AUTO: sFuncStr = GetXMLToken( XML_AUTO ); break;
- case sheet::GeneralFunction_AVERAGE: sFuncStr = GetXMLToken( XML_AVERAGE ); break;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- case sheet::GeneralFunction_MEDIAN: sFuncStr = GetXMLToken( XML_MEDIAN ); break;
-#endif
- case sheet::GeneralFunction_COUNT: sFuncStr = GetXMLToken( XML_COUNT ); break;
- case sheet::GeneralFunction_COUNTNUMS: sFuncStr = GetXMLToken( XML_COUNTNUMS ); break;
- case sheet::GeneralFunction_MAX: sFuncStr = GetXMLToken( XML_MAX ); break;
- case sheet::GeneralFunction_MIN: sFuncStr = GetXMLToken( XML_MIN ); break;
- case sheet::GeneralFunction_NONE: sFuncStr = GetXMLToken( XML_NONE ); break;
- case sheet::GeneralFunction_PRODUCT: sFuncStr = GetXMLToken( XML_PRODUCT ); break;
- case sheet::GeneralFunction_STDEV: sFuncStr = GetXMLToken( XML_STDEV ); break;
- case sheet::GeneralFunction_STDEVP: sFuncStr = GetXMLToken( XML_STDEVP ); break;
- case sheet::GeneralFunction_SUM: sFuncStr = GetXMLToken( XML_SUM ); break;
- case sheet::GeneralFunction_VAR: sFuncStr = GetXMLToken( XML_VAR ); break;
- case sheet::GeneralFunction_VARP: sFuncStr = GetXMLToken( XML_VARP ); break;
+ case sheet::GeneralFunction2::AUTO: sFuncStr = GetXMLToken( XML_AUTO ); break;
+ case sheet::GeneralFunction2::AVERAGE: sFuncStr = GetXMLToken( XML_AVERAGE ); break;
+ case sheet::GeneralFunction2::MEDIAN: sFuncStr = GetXMLToken( XML_MEDIAN ); break;
+ case sheet::GeneralFunction2::COUNT: sFuncStr = GetXMLToken( XML_COUNT ); break;
+ case sheet::GeneralFunction2::COUNTNUMS: sFuncStr = GetXMLToken( XML_COUNTNUMS ); break;
+ case sheet::GeneralFunction2::MAX: sFuncStr = GetXMLToken( XML_MAX ); break;
+ case sheet::GeneralFunction2::MIN: sFuncStr = GetXMLToken( XML_MIN ); break;
+ case sheet::GeneralFunction2::NONE: sFuncStr = GetXMLToken( XML_NONE ); break;
+ case sheet::GeneralFunction2::PRODUCT: sFuncStr = GetXMLToken( XML_PRODUCT ); break;
+ case sheet::GeneralFunction2::STDEV: sFuncStr = GetXMLToken( XML_STDEV ); break;
+ case sheet::GeneralFunction2::STDEVP: sFuncStr = GetXMLToken( XML_STDEVP ); break;
+ case sheet::GeneralFunction2::SUM: sFuncStr = GetXMLToken( XML_SUM ); break;
+ case sheet::GeneralFunction2::VAR: sFuncStr = GetXMLToken( XML_VAR ); break;
+ case sheet::GeneralFunction2::VARP: sFuncStr = GetXMLToken( XML_VARP ); break;
default:
{
assert(false);
diff --git a/sc/source/filter/xml/XMLConverter.hxx b/sc/source/filter/xml/XMLConverter.hxx
index 8c8ffe542865..41535c357136 100644
--- a/sc/source/filter/xml/XMLConverter.hxx
+++ b/sc/source/filter/xml/XMLConverter.hxx
@@ -47,13 +47,16 @@ public:
static css::sheet::GeneralFunction
GetFunctionFromString(
const OUString& rString );
+ static sal_Int16 GetFunctionFromString2(
+ const OUString& rString );
+
static ScSubTotalFunc GetSubTotalFuncFromString(
const OUString& rString );
-// EXPORT: GeneralFunction / ScSubTotalFunc
+// EXPORT: GeneralFunctio2 / ScSubTotalFunc
static void GetStringFromFunction(
OUString& rString,
- const css::sheet::GeneralFunction eFunction );
+ const sal_Int16 eFunction );
static void GetStringFromFunction(
OUString& rString,
const ScSubTotalFunc eFunction );
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index aa461163755a..b16aa0a03143 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
using namespace com::sun::star;
using namespace xmloff::token;
@@ -431,8 +432,6 @@ void ScXMLExportDataPilot::WriteLayoutInfo(ScDPSaveDimension* pDim)
void ScXMLExportDataPilot::WriteSubTotals(ScDPSaveDimension* pDim)
{
- using sheet::GeneralFunction;
-
sal_Int32 nSubTotalCount = pDim->GetSubTotalsCount();
const OUString* pLayoutName = nullptr;
if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012)
@@ -446,10 +445,10 @@ void ScXMLExportDataPilot::WriteSubTotals(ScDPSaveDimension* pDim)
for (sal_Int32 nSubTotal = 0; nSubTotal < nSubTotalCount; nSubTotal++)
{
OUString sFunction;
- GeneralFunction nFunc = static_cast<GeneralFunction>(pDim->GetSubTotalFunc(nSubTotal));
+ sal_Int16 nFunc = static_cast<sal_Int16>(pDim->GetSubTotalFunc(nSubTotal));
ScXMLConverter::GetStringFromFunction( sFunction, nFunc);
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sFunction);
- if (pLayoutName && nFunc == sheet::GeneralFunction_AUTO)
+ if (pLayoutName && nFunc == sheet::GeneralFunction2::AUTO)
rExport.AddAttribute(XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, *pLayoutName);
SvXMLElementExport aElemST(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, true, true);
}
@@ -699,8 +698,7 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim
::sax::Converter::convertNumber(sBuffer, pDim->GetUsedHierarchy());
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, sBuffer.makeStringAndClear());
}
- ScXMLConverter::GetStringFromFunction( sValueStr,
- (sheet::GeneralFunction) pDim->GetFunction() );
+ ScXMLConverter::GetStringFromFunction( sValueStr, static_cast<sal_Int16>(pDim->GetFunction()) );
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sValueStr);
if (eOrientation == sheet::DataPilotFieldOrientation_PAGE)
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 19b84729c4d4..cc39b95ce0aa 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -994,7 +994,7 @@ ScXMLDataPilotFieldContext::ScXMLDataPilotFieldContext( ScXMLImport& rImport,
break;
case XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION :
{
- nFunction = (sal_Int16) ScXMLConverter::GetFunctionFromString( sValue );
+ nFunction = ScXMLConverter::GetFunctionFromString2( sValue );
}
break;
case XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION :
@@ -1522,8 +1522,7 @@ ScXMLDataPilotSubTotalContext::ScXMLDataPilotSubTotalContext( ScXMLImport& rImpo
{
case XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_FUNCTION :
{
- pDataPilotSubTotals->AddFunction( sal::static_int_cast<sal_Int16>(
- ScXMLConverter::GetFunctionFromString( sValue ) ) );
+ pDataPilotSubTotals->AddFunction( ScXMLConverter::GetFunctionFromString2( sValue ) );
}
break;
case XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME:
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index a09053b4d865..dca44793609e 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
#include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
+#include <com/sun/star/sheet/GeneralFunction2.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/sequence.hxx>
@@ -115,6 +116,7 @@ const SfxItemPropertyMapEntry* lcl_GetDataPilotFieldMap()
{
{OUString(SC_UNONAME_AUTOSHOW), 0, cppu::UnoType<DataPilotFieldAutoShowInfo>::get(), MAYBEVOID, 0 },
{OUString(SC_UNONAME_FUNCTION), 0, cppu::UnoType<GeneralFunction>::get(), 0, 0 },
+ {OUString(SC_UNONAME_FUNCTION2), 0, cppu::UnoType<sal_Int16>::get(), 0, 0 },
{OUString(SC_UNONAME_GROUPINFO), 0, cppu::UnoType<DataPilotFieldGroupInfo>::get(), MAYBEVOID, 0 },
{OUString(SC_UNONAME_HASAUTOSHOW), 0, cppu::UnoType<bool>::get(), 0, 0 },
{OUString(SC_UNONAME_HASLAYOUTINFO),0, cppu::UnoType<bool>::get(), 0, 0 },
@@ -129,6 +131,7 @@ const SfxItemPropertyMapEntry* lcl_GetDataPilotFieldMap()
{OUString(SC_UNONAME_REPEATITEMLABELS), 0, cppu::UnoType<bool>::get(), 0, 0 },
{OUString(SC_UNONAME_SORTINFO), 0, cppu::UnoType<DataPilotFieldSortInfo>::get(), MAYBEVOID, 0 },
{OUString(SC_UNONAME_SUBTOTALS), 0, cppu::UnoType<Sequence<GeneralFunction>>::get(), 0, 0 },
+ {OUString(SC_UNONAME_SUBTOTALS2), 0, cppu::UnoType<Sequence<sal_Int16>>::get(), 0, 0 },
{OUString(SC_UNONAME_USESELPAGE), 0, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
@@ -179,48 +182,42 @@ SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupItemObj, "ScDataPilotFieldGroupItem
// name that is used in the API for the data layout field
#define SC_DATALAYOUT_NAME "Data"
-GeneralFunction ScDataPilotConversion::FirstFunc( PivotFunc nBits )
-{
- if ( nBits & PivotFunc::Sum ) return GeneralFunction_SUM;
- if ( nBits & PivotFunc::Count ) return GeneralFunction_COUNT;
- if ( nBits & PivotFunc::Average ) return GeneralFunction_AVERAGE;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- if ( nBits & PivotFunc::Median ) return GeneralFunction_MEDIAN;
-#endif
- if ( nBits & PivotFunc::Max ) return GeneralFunction_MAX;
- if ( nBits & PivotFunc::Min ) return GeneralFunction_MIN;
- if ( nBits & PivotFunc::Product ) return GeneralFunction_PRODUCT;
- if ( nBits & PivotFunc::CountNum ) return GeneralFunction_COUNTNUMS;
- if ( nBits & PivotFunc::StdDev ) return GeneralFunction_STDEV;
- if ( nBits & PivotFunc::StdDevP ) return GeneralFunction_STDEVP;
- if ( nBits & PivotFunc::StdVar ) return GeneralFunction_VAR;
- if ( nBits & PivotFunc::StdVarP ) return GeneralFunction_VARP;
- if ( nBits & PivotFunc::Auto ) return GeneralFunction_AUTO;
- return GeneralFunction_NONE;
-}
-
-PivotFunc ScDataPilotConversion::FunctionBit( GeneralFunction eFunc )
+sal_Int16 ScDataPilotConversion::FirstFunc( PivotFunc nBits )
+{
+ if ( nBits & PivotFunc::Sum ) return GeneralFunction2::SUM;
+ if ( nBits & PivotFunc::Count ) return GeneralFunction2::COUNT;
+ if ( nBits & PivotFunc::Average ) return GeneralFunction2::AVERAGE;
+ if ( nBits & PivotFunc::Median ) return GeneralFunction2::MEDIAN;
+ if ( nBits & PivotFunc::Max ) return GeneralFunction2::MAX;
+ if ( nBits & PivotFunc::Min ) return GeneralFunction2::MIN;
+ if ( nBits & PivotFunc::Product ) return GeneralFunction2::PRODUCT;
+ if ( nBits & PivotFunc::CountNum ) return GeneralFunction2::COUNTNUMS;
+ if ( nBits & PivotFunc::StdDev ) return GeneralFunction2::STDEV;
+ if ( nBits & PivotFunc::StdDevP ) return GeneralFunction2::STDEVP;
+ if ( nBits & PivotFunc::StdVar ) return GeneralFunction2::VAR;
+ if ( nBits & PivotFunc::StdVarP ) return GeneralFunction2::VARP;
+ if ( nBits & PivotFunc::Auto ) return GeneralFunction2::AUTO;
+ return GeneralFunction2::NONE;
+}
+
+PivotFunc ScDataPilotConversion::FunctionBit( sal_Int16 eFunc )
{
PivotFunc nRet = PivotFunc::NONE; // 0
switch (eFunc)
{
- case GeneralFunction_SUM: nRet = PivotFunc::Sum; break;
- case GeneralFunction_COUNT: nRet = PivotFunc::Count; break;
- case GeneralFunction_AVERAGE: nRet = PivotFunc::Average; break;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- case GeneralFunction_MEDIAN: nRet = PivotFunc::Median; break;
-#endif
- case GeneralFunction_MAX: nRet = PivotFunc::Max; break;
- case GeneralFunction_MIN: nRet = PivotFunc::Min; break;
- case GeneralFunction_PRODUCT: nRet = PivotFunc::Product; break;
- case GeneralFunction_COUNTNUMS: nRet = PivotFunc::CountNum; break;
- case GeneralFunction_STDEV: nRet = PivotFunc::StdDev; break;
- case GeneralFunction_STDEVP: nRet = PivotFunc::StdDevP; break;
- case GeneralFunction_VAR: nRet = PivotFunc::StdVar; break;
- case GeneralFunction_VARP: nRet = PivotFunc::StdVarP; break;
- case GeneralFunction_AUTO: nRet = PivotFunc::Auto; break;
+ case GeneralFunction2::SUM: nRet = PivotFunc::Sum; break;
+ case GeneralFunction2::COUNT: nRet = PivotFunc::Count; break;
+ case GeneralFunction2::AVERAGE: nRet = PivotFunc::Average; break;
+ case GeneralFunction2::MEDIAN: nRet = PivotFunc::Median; break;
+ case GeneralFunction2::MAX: nRet = PivotFunc::Max; break;
+ case GeneralFunction2::MIN: nRet = PivotFunc::Min; break;
+ case GeneralFunction2::PRODUCT: nRet = PivotFunc::Product; break;
+ case GeneralFunction2::COUNTNUMS: nRet = PivotFunc::CountNum; break;
+ case GeneralFunction2::STDEV: nRet = PivotFunc::StdDev; break;
+ case GeneralFunction2::STDEVP: nRet = PivotFunc::StdDevP; break;
+ case GeneralFunction2::VAR: nRet = PivotFunc::StdVar; break;
+ case GeneralFunction2::VARP: nRet = PivotFunc::StdVarP; break;
+ case GeneralFunction2::AUTO: nRet = PivotFunc::Auto; break;
default:
{
assert(false);
@@ -1868,11 +1865,30 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa
// #i109350# use GetEnumFromAny because it also allows sal_Int32
GeneralFunction eFunction = (GeneralFunction)
ScUnoHelpFunctions::GetEnumFromAny( aValue );
+ setFunction( static_cast<sal_Int16> (eFunction) );
+ }
+ else if ( aPropertyName == SC_UNONAME_FUNCTION2 )
+ {
+ sal_Int16 eFunction = (sal_Int16) ScUnoHelpFunctions::GetEnumFromAny( aValue );
setFunction( eFunction );
}
else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
{
- Sequence< GeneralFunction > aSubtotals;
+ Sequence< sal_Int16 > aSubTotals;
+ uno::Sequence<sheet::GeneralFunction> aSeq;
+ if( aValue >>= aSeq)
+ {
+ aSubTotals.realloc(aSeq.getLength());
+ for (sal_Int32 nIndex = 0; nIndex < aSeq.getLength(); nIndex++)
+ {
+ aSubTotals[nIndex] = static_cast<sal_Int16>(aSeq[nIndex]);
+ }
+ setSubtotals( aSubTotals );
+ }
+ }
+ else if ( aPropertyName == SC_UNONAME_SUBTOTALS2 )
+ {
+ Sequence< sal_Int16 > aSubtotals;
if( aValue >>= aSubtotals )
setSubtotals( aSubtotals );
}
@@ -1966,9 +1982,39 @@ Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyNam
Any aRet;
if ( aPropertyName == SC_UNONAME_FUNCTION )
+ {
+ sheet::GeneralFunction eVal;
+ sal_Int16 nFunction = getFunction();
+ if (nFunction == sheet::GeneralFunction2::MEDIAN)
+ {
+ eVal = sheet::GeneralFunction_NONE;
+ }
+ else
+ {
+ eVal = static_cast<sheet::GeneralFunction>(nFunction);
+ }
+ aRet <<= eVal;
+ }
+ else if ( aPropertyName == SC_UNONAME_FUNCTION2 )
aRet <<= getFunction();
else if ( aPropertyName == SC_UNONAME_SUBTOTALS )
+ {
+ uno::Sequence<sal_Int16> aSeq = getSubtotals();
+ uno::Sequence<sheet::GeneralFunction> aNewSeq;
+ aNewSeq.realloc(aSeq.getLength());
+ for (sal_Int32 nIndex = 0; nIndex < aSeq.getLength(); nIndex++)
+ {
+ if (aSeq[nIndex] == sheet::GeneralFunction2::MEDIAN)
+ aNewSeq[nIndex] = sheet::GeneralFunction_NONE;
+ else
+ aNewSeq[nIndex] = static_cast<sheet::GeneralFunction>(aSeq[nIndex]);
+ }
+ aRet <<= aNewSeq;
+ }
+ else if ( aPropertyName == SC_UNONAME_SUBTOTALS2 )
+ {
aRet <<= getSubtotals();
+ }
else if ( aPropertyName == SC_UNONAME_ORIENT )
aRet <<= getOrientation();
else if ( aPropertyName == SC_UNONAME_SELPAGE )
@@ -2098,10 +2144,10 @@ void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
}
}
-GeneralFunction ScDataPilotFieldObj::getFunction() const
+sal_Int16 ScDataPilotFieldObj::getFunction() const
{
SolarMutexGuard aGuard;
- GeneralFunction eRet = GeneralFunction_NONE;
+ sal_Int16 eRet = GeneralFunction2::NONE;
if( ScDPSaveDimension* pDim = GetDPDimension() )
{
if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
@@ -2109,16 +2155,16 @@ GeneralFunction ScDataPilotFieldObj::getFunction() const
// for non-data fields, property Function is the subtotals
long nSubCount = pDim->GetSubTotalsCount();
if ( nSubCount > 0 )
- eRet = (GeneralFunction)pDim->GetSubTotalFunc(0); // always use the first one
+ eRet = static_cast<sal_Int16>(pDim->GetSubTotalFunc(0)); // always use the first one
// else keep NONE
}
else
- eRet = (GeneralFunction)pDim->GetFunction();
+ eRet = static_cast<sal_Int16>(pDim->GetFunction());
}
return eRet;
}
-void ScDataPilotFieldObj::setFunction(GeneralFunction eNewFunc)
+void ScDataPilotFieldObj::setFunction(sal_Int16 eNewFunc)
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
@@ -2127,7 +2173,7 @@ void ScDataPilotFieldObj::setFunction(GeneralFunction eNewFunc)
if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
{
// for non-data fields, property Function is the subtotals
- if ( eNewFunc == GeneralFunction_NONE )
+ if ( eNewFunc == GeneralFunction2::NONE )
pDim->SetSubTotals( 0, nullptr );
else
{
@@ -2141,10 +2187,10 @@ void ScDataPilotFieldObj::setFunction(GeneralFunction eNewFunc)
}
}
-Sequence< GeneralFunction > ScDataPilotFieldObj::getSubtotals() const
+Sequence< sal_Int16 > ScDataPilotFieldObj::getSubtotals() const
{
SolarMutexGuard aGuard;
- Sequence< GeneralFunction > aRet;
+ Sequence< sal_Int16 > aRet;
if( ScDPSaveDimension* pDim = GetDPDimension() )
{
if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA )
@@ -2155,14 +2201,14 @@ Sequence< GeneralFunction > ScDataPilotFieldObj::getSubtotals() const
{
aRet.realloc( nCount );
for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
- aRet[ nIdx ] = (GeneralFunction)pDim->GetSubTotalFunc( nIdx );
+ aRet[ nIdx ] = static_cast<sal_Int16>(pDim->GetSubTotalFunc( nIdx ));
}
}
}
return aRet;
}
-void ScDataPilotFieldObj::setSubtotals( const Sequence< GeneralFunction >& rSubtotals )
+void ScDataPilotFieldObj::setSubtotals( const Sequence< sal_Int16 >& rSubtotals )
{
SolarMutexGuard aGuard;
ScDPObject* pDPObj = nullptr;
@@ -2174,7 +2220,7 @@ void ScDataPilotFieldObj::setSubtotals( const Sequence< GeneralFunction >& rSubt
if( nCount == 1 )
{
// count 1: all values are allowed (including NONE and AUTO)
- if( rSubtotals[ 0 ] == GeneralFunction_NONE )
+ if( rSubtotals[ 0 ] == GeneralFunction2::NONE )
pDim->SetSubTotals( 0, nullptr );
else
{
@@ -2188,8 +2234,8 @@ void ScDataPilotFieldObj::setSubtotals( const Sequence< GeneralFunction >& rSubt
::std::vector< sal_uInt16 > aSubt;
for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
{
- GeneralFunction eFunc = rSubtotals[ nIdx ];
- if( (eFunc != GeneralFunction_NONE) && (eFunc != GeneralFunction_AUTO) )
+ sal_Int16 eFunc = rSubtotals[ nIdx ];
+ if( (eFunc != GeneralFunction2::NONE) && (eFunc != GeneralFunction2::AUTO) )
{
// do not insert functions twice
sal_uInt16 nFunc = static_cast< sal_uInt16 >( eFunc );
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 63c5a864c7cb..718af054bfcb 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -144,12 +144,6 @@ sheet::GeneralFunction ScDataUnoConversion::SubTotalToGeneral( ScSubTotalFunc e
case SUBTOTAL_FUNC_AVE: eGeneral = sheet::GeneralFunction_AVERAGE; break;
case SUBTOTAL_FUNC_CNT: eGeneral = sheet::GeneralFunction_COUNTNUMS; break;
case SUBTOTAL_FUNC_CNT2: eGeneral = sheet::GeneralFunction_COUNT; break;
-#if 0
-// disabled because of css::sheet::GeneralFunction API incompatibility
- case SUBTOTAL_FUNC_MED: eGeneral = sheet::GeneralFunction_MEDIAN; break;
-#else
- case SUBTOTAL_FUNC_MED: eGeneral = sheet::GeneralFunction_NONE; break;
-#endif
case SUBTOTAL_FUNC_MAX: eGeneral = sheet::GeneralFunction_MAX; break;
case SUBTOTAL_FUNC_MIN: eGeneral = sheet::GeneralFunction_MIN; break;
case SUBTOTAL_FUNC_PROD: eGeneral = sheet::GeneralFunction_PRODUCT; break;