tdf#118117 sc pivottable: STR_PIVOT_DATA is an existing name too
This fixes a LO 6.0 regression from
commit a078328e91ab9cbd78a92608c1abdc2c57ff9ac5
I looked for existing unit test examples using
assert (rLabel != ScResId(STR_PIVOT_DATA));
but found nothing.
I don't see the need for a unit test here.
The whole pivot table is messed up if you duplicate
a label, so why bother testing. It just is not
as bad now as it was before.
Change-Id: I59cc73becf91f766a29d2007c2d67685ffa2a65c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130751
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
(cherry picked from commit b7f654a406b704f469d1df424d83a3d98ae46432)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130784
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index d544fb8..dba2b7a 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -356,9 +356,11 @@ void normalizeAddLabel(const OUString& rLabel, std::vector<OUString>& rLabels, L
std::vector<OUString> normalizeLabels(const std::vector<InitColumnData>& rColData)
{
std::vector<OUString> aLabels(1u, ScResId(STR_PIVOT_DATA));
std::vector<OUString> aLabels;
aLabels.reserve(rColData.size() + 1);
LabelSet aExistingNames;
normalizeAddLabel(ScResId(STR_PIVOT_DATA), aLabels, aExistingNames);
for (const InitColumnData& rCol : rColData)
normalizeAddLabel(rCol.maLabel, aLabels, aExistingNames);
@@ -368,10 +370,11 @@ std::vector<OUString> normalizeLabels(const std::vector<InitColumnData>& rColDat
std::vector<OUString> normalizeLabels(const ScDPCache::DBConnector& rDB, const sal_Int32 nLabelCount)
{
std::vector<OUString> aLabels(1u, ScResId(STR_PIVOT_DATA));
std::vector<OUString> aLabels;
aLabels.reserve(nLabelCount + 1);
LabelSet aExistingNames;
normalizeAddLabel(ScResId(STR_PIVOT_DATA), aLabels, aExistingNames);
for (sal_Int32 nCol = 0; nCol < nLabelCount; ++nCol)
{