[Libreoffice-commits] core.git: 3 commits - sc/source

Tamás Zolnai tamas.zolnai at collabora.com
Sat Oct 15 13:10:23 UTC 2016


 sc/source/core/data/dpcache.cxx  |   25 +++++--------------------
 sc/source/core/data/dptabdat.cxx |    1 +
 sc/source/ui/unoobj/dapiuno.cxx  |    1 -
 3 files changed, 6 insertions(+), 21 deletions(-)

New commits:
commit 7125de1cdb4d29cc3763147571808033ee207777
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Fri Oct 14 21:05:45 2016 +0000

    PivotTable: No reason to call GetSource here
    
    GetSource generates internal members related to source data,
    but when this constructor is called we don't have valid
    source data yet.
    
    Change-Id: Ia813740fc425d70e7b294fca287f7afe784201a5

diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 834c3d6..102c020 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1385,7 +1385,6 @@ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) :
     mpDPObject->SetSaveData(aSaveData);
     ScSheetSourceDesc aSheetDesc(pDocSh ? &pDocSh->GetDocument() : nullptr);
     mpDPObject->SetSheetDesc(aSheetDesc);
-    mpDPObject->GetSource();
 }
 
 ScDataPilotDescriptor::~ScDataPilotDescriptor()
commit 6520c8f2f3271c2f36429084a6b0f737f2ad4b88
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Fri Oct 14 21:02:32 2016 +0000

    PivotTable cache: Remove useless mnValueSortIndex
    
    We can use mnOrderIndex to get the same result.
    
    Change-Id: I71f68ebefe08c3664954ecdf6345cca4ed5ccafc

diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 25a500c..49b1d61 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -153,9 +153,8 @@ struct Bucket
     ScDPItemData maValue;
     SCROW mnOrderIndex;
     SCROW mnDataIndex;
-    SCROW mnValueSortIndex;
     Bucket(const ScDPItemData& rValue, SCROW nData) :
-        maValue(rValue), mnOrderIndex(0), mnDataIndex(nData), mnValueSortIndex(0) {}
+        maValue(rValue), mnOrderIndex(0), mnDataIndex(nData) {}
 };
 
 #if DEBUG_PIVOT_TABLE
@@ -167,7 +166,7 @@ struct PrintBucket : std::unary_function<Bucket, void>
 {
     void operator() (const Bucket& v) const
     {
-        cout << "value: " << v.maValue.GetValue() << "  order index: " << v.mnOrderIndex << "  data index: " << v.mnDataIndex << "  value sort index: " << v.mnValueSortIndex << endl;
+        cout << "value: " << v.maValue.GetValue() << "  order index: " << v.mnOrderIndex << "  data index: " << v.mnDataIndex << endl;
     }
 };
 
@@ -181,11 +180,11 @@ struct LessByValue : std::binary_function<Bucket, Bucket, bool>
     }
 };
 
-struct LessByValueSortIndex : std::binary_function<Bucket, Bucket, bool>
+struct LessByOrderIndex : std::binary_function<Bucket, Bucket, bool>
 {
     bool operator() (const Bucket& left, const Bucket& right) const
     {
-        return left.mnValueSortIndex < right.mnValueSortIndex;
+        return left.mnOrderIndex < right.mnOrderIndex;
     }
 };
 
@@ -227,17 +226,6 @@ public:
     }
 };
 
-class TagValueSortOrder : public std::unary_function<Bucket, void>
-{
-    SCROW mnCurIndex;
-public:
-    TagValueSortOrder() : mnCurIndex(0) {}
-    void operator() (Bucket& v)
-    {
-        v.mnValueSortIndex = mnCurIndex++;
-    }
-};
-
 void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
 {
     if (aBuckets.empty())
@@ -246,9 +234,6 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
     // Sort by the value.
     std::sort(aBuckets.begin(), aBuckets.end(), LessByValue());
 
-    // Remember this sort order.
-    std::for_each(aBuckets.begin(), aBuckets.end(), TagValueSortOrder());
-
     {
         // Set order index such that unique values have identical index value.
         SCROW nCurIndex = 0;
@@ -273,7 +258,7 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
     std::for_each(aBuckets.begin(), aBuckets.end(), PushBackOrderIndex(rField.maData));
 
     // Sort by the value again.
-    std::sort(aBuckets.begin(), aBuckets.end(), LessByValueSortIndex());
+    std::sort(aBuckets.begin(), aBuckets.end(), LessByOrderIndex());
 
     // Unique by value.
     std::vector<Bucket>::iterator itUniqueEnd =
commit 57185b9c32b003212c8129480c388f584adc3ca3
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Fri Oct 14 21:00:45 2016 +0000

    Small pivot table performance improvement
    
    Change-Id: Ic57082aaadc4e2ed516c9875a421278e1ce4564a

diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx
index 8061f25..d25a08f 100644
--- a/sc/source/core/data/dptabdat.cxx
+++ b/sc/source/core/data/dptabdat.cxx
@@ -225,6 +225,7 @@ void ScDPTableData::GetItemData(const ScDPFilteredCache& rCacheTable, sal_Int32
                                 const vector<long>& rDims, vector<SCROW>& rItemData)
 {
     sal_Int32 nDimSize = rDims.size();
+    rItemData.reserve(rItemData.size() + nDimSize);
     for (sal_Int32 i = 0; i < nDimSize; ++i)
     {
         long nDim = rDims[i];


More information about the Libreoffice-commits mailing list