sc/source/core/data/dpcache.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit b7f654a406b704f469d1df424d83a3d98ae46432 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Tue Mar 1 08:54:25 2022 +0200 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Mar 2 06:12:02 2022 +0100 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 <jl...@mail.com> diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 0f3778eb40a6..52109c673bd3 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) {