summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-02-29 23:51:26 +0900
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-03-07 12:12:19 +0100
commit2bf9246a0388c1d3002f4fa90ba759d7d119cdbf (patch)
tree281d7fb62565e9a2ce43e8a298151a2dae841c5e
parentfa8351c50bd8f14830a461c09805e43c6fdb065d (diff)
tdf#83720 Pivot Table: Data field should always at last place
In the pivot table dialog we should always put the "Data" field to the last place or the cell formats won't be shown correct in the pivot table. Change-Id: If4befe4fff1e6f04d9b709615a1955e3b5f4b4cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164161 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 78065e3798439dd790d1be5ac5c219477285c888) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164126 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 45af29a4f1a4..672de9559c4e 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -67,6 +67,9 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector
std::unique_ptr<weld::TreeIter> xEachEntry(mxControl->make_iterator());
if (!mxControl->get_iter_first(*xEachEntry))
return;
+
+ std::optional<ScPivotField> oDataField;
+
do
{
ScItemValue* pItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xEachEntry));
@@ -78,8 +81,15 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector
aField.nFuncMask = rFunctionData.mnFuncMask;
aField.mnDupCount = rFunctionData.mnDupCount;
aField.maFieldRef = rFunctionData.maFieldRef;
- rVector.push_back(aField);
+
+ if (aField.nCol == PIVOT_DATA_FIELD)
+ oDataField = aField;
+ else
+ rVector.push_back(aField);
} while (mxControl->iter_next(*xEachEntry));
+
+ if (oDataField)
+ rVector.push_back(*oDataField);
}
void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(weld::TreeView& /*pSource*/, int /*nTarget*/)