diff options
author | Justin Luth <justin_luth@sil.org> | 2022-03-01 08:54:25 +0200 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-03-02 06:12:02 +0100 |
commit | b7f654a406b704f469d1df424d83a3d98ae46432 (patch) | |
tree | c87de41243fa63f3225d9ac0f6a1ccd087454355 /sc | |
parent | d1cfe4228316322d0ae9f3b8020036e5140fc32b (diff) |
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>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/dpcache.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
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) { |