sc/source/ui/dbgui/PivotLayoutTreeList.cxx |   11 ++++++++---
 sc/source/ui/inc/PivotLayoutTreeList.hxx   |    3 +++
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 0bfa6ddc99710c1e166140f97cf3212348d04d05
Author: Katarina Behrens <katarina.behr...@cib.de>
Date:   Wed Nov 18 14:10:55 2015 +0100

    tdf#93263: Take function mask from ScPivotField
    
    and not from ScDPLabelData (that's what old code used to do as well).
    Afaics ScDPLabelData.mnFuncMask member is never modified as the array
    gets populated in ScDPObject::FillLabelDataForDimension. UI has thus
    only its default value (PIVOT_FUNC_NONE) and so subtotals get reset
    on every change.
    
    ScPivotField however contains the right func mask, so take it from
    there.
    
    Change-Id: I862be121683aac079e788ce535f714ac8cdbcd0b
    Reviewed-on: https://gerrit.libreoffice.org/20041
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 82e5911..a4173e9 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -71,12 +71,15 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
 void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
 {
     Clear();
+    maItemValues.clear();
 
     ScPivotFieldVector::iterator it;
     for (it = rFieldVector.begin(); it != rFieldVector.end(); ++it)
     {
         ScPivotField& rField = *it;
-        ScItemValue* pItemValue = mpParent->GetItem(rField.nCol);
+        OUString aLabel = mpParent->GetItem( rField.nCol )->maName;
+        ScItemValue* pItemValue = new ScItemValue( aLabel, rField.nCol, 
rField.nFuncMask );
+        maItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
         InsertEntry(pItemValue->maName, nullptr, false, TREELIST_APPEND, 
pItemValue);
     }
 }
@@ -98,8 +101,10 @@ void 
ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource,
 
 void ScPivotLayoutTreeList::InsertEntryForItem(ScItemValue* pItemValue, 
sal_uLong nPosition)
 {
-    OUString rName = pItemValue->maName;
-    InsertEntry(rName, nullptr, false, nPosition, pItemValue);
+    ScItemValue *pListItemValue = new ScItemValue(pItemValue);
+    maItemValues.push_back(std::unique_ptr<ScItemValue>(pListItemValue));
+    OUString rName = pListItemValue->maName;
+    InsertEntry(rName, nullptr, false, nPosition, pListItemValue);
 }
 
 void ScPivotLayoutTreeList::KeyInput(const KeyEvent& rKeyEvent)
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx 
b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 2ae1adb..60feb73 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -15,6 +15,9 @@
 
 class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
 {
+private:
+    std::vector<std::unique_ptr<ScItemValue> > maItemValues;
+
 public:
     ScPivotLayoutTreeList(vcl::Window* pParent, WinBits nBits);
     virtual ~ScPivotLayoutTreeList();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to