summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-05-15 06:36:44 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-05-16 09:04:46 +0200
commitca8614fc44e66308b846d01b8c0ab6a63cc93eb9 (patch)
treef675c140fdbf3ba59b14fc2c4cf227b50c6a3914
parentmake SharedString move operator= inline (tdf#126109) (diff)
downloadcore-ca8614fc44e66308b846d01b8c0ab6a63cc93eb9.tar.gz
core-ca8614fc44e66308b846d01b8c0ab6a63cc93eb9.zip
fix GETPIVOTDATA() field name lookup
Field names are case-insensitive, so the lookup was failing if the name wasn't typed in a way that matched exactly as case-sensitive. The A29 field in getpivotdata.fods test was passing only because the fields were typed in the same order as present in the pivot table, and std::sort() was accidentally stable. But reordering the fields in the formula makes it fail, and so does using libc++ with debug mode (which randomizes equal fields in std::sort()). Change-Id: I88d078da435685c3557f24dc5f4a0bfc4d563aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134336 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--sc/qa/unit/data/functions/spreadsheet/fods/getpivotdata.fods14
-rw-r--r--sc/source/core/data/dpobject.cxx6
-rw-r--r--sc/source/core/data/dpsave.cxx3
3 files changed, 17 insertions, 6 deletions
diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/getpivotdata.fods b/sc/qa/unit/data/functions/spreadsheet/fods/getpivotdata.fods
index 7ea70d7b3acf..b392f066bc2b 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/getpivotdata.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/getpivotdata.fods
@@ -7906,9 +7906,17 @@
<table:table-cell table:number-columns-repeated="18"/>
</table:table-row>
<table:table-row table:style-name="ro2">
- <table:table-cell table:number-columns-repeated="2"/>
- <table:table-cell table:style-name="ce14"/>
- <table:table-cell table:number-columns-repeated="6"/>
+ <table:table-cell table:formula="of:=GETPIVOTDATA(&quot;Value&quot;;[.I30];&quot;name&quot;;&quot;mary&quot;;&quot;type&quot;;&quot;f&quot;)
+" office:value-type="float" office:value="34" calcext:value-type="float">
+ <text:p>34</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="34" calcext:value-type="float">
+ <text:p>34</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce13" table:formula="of:=[.A41]=[.B41]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <text:p>TRUE</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="5"/>
<table:table-cell table:style-name="ce21" table:number-columns-repeated="5"/>
<table:table-cell table:number-columns-repeated="8"/>
</table:table-row>
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index efa77beb3377..b74fc5d7dfe5 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1341,11 +1341,13 @@ public:
{
size_t nRank1 = mrDimOrder.size();
size_t nRank2 = mrDimOrder.size();
- ScDPSaveData::DimOrderType::const_iterator it1 = mrDimOrder.find(r1.FieldName);
+ ScDPSaveData::DimOrderType::const_iterator it1 = mrDimOrder.find(
+ ScGlobal::getCharClass().uppercase(r1.FieldName));
if (it1 != mrDimOrder.end())
nRank1 = it1->second;
- ScDPSaveData::DimOrderType::const_iterator it2 = mrDimOrder.find(r2.FieldName);
+ ScDPSaveData::DimOrderType::const_iterator it2 = mrDimOrder.find(
+ ScGlobal::getCharClass().uppercase(r2.FieldName));
if (it2 != mrDimOrder.end())
nRank2 = it2->second;
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index d9bc8d722a8b..0f8bfbf11712 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -30,6 +30,7 @@
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <comphelper/stl_types.hxx>
+#include <unotools/charclass.hxx>
#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
@@ -783,7 +784,7 @@ public:
void operator() (const ScDPSaveDimension* pDim)
{
size_t nRank = mrNames.size();
- mrNames.emplace(pDim->GetName(), nRank);
+ mrNames.emplace(ScGlobal::getCharClass().uppercase(pDim->GetName()), nRank);
}
};