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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 5 13:28:43 UTC 2020


 sc/inc/dpcache.hxx                 |    4 ++--
 sc/inc/dpobject.hxx                |   18 +++++++++---------
 sc/qa/unit/ucalc_pivottable.cxx    |    6 +++---
 sc/source/core/data/dpobject.cxx   |   30 +++++++++++++++---------------
 sc/source/ui/docshell/dbdocfun.cxx |    4 ++--
 sc/source/ui/view/dbfunc3.cxx      |    2 +-
 6 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit a129f3b20bd8e28c931e5318d981daa51af067d3
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Thu Nov 5 12:43:42 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 5 14:28:02 2020 +0100

    std::set->o3tl::sorted_set in ScDPCache
    
    Change-Id: I8d647149545d0b5ff7bb82a8db171b9410ea79b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105337
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index c77ac6e95e44..404ebf2ddaac 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -28,9 +28,9 @@
 
 #include <mdds/flat_segment_tree.hpp>
 #include <tools/long.hxx>
+#include <o3tl/sorted_vector.hxx>
 
 #include <memory>
-#include <set>
 #include <unordered_set>
 #include <vector>
 
@@ -51,7 +51,7 @@ public:
     typedef std::unordered_set<OUString> StringSetType;
     typedef mdds::flat_segment_tree<SCROW, bool> EmptyRowsType;
     typedef std::vector<ScDPItemData> ScDPItemDataVec;
-    typedef std::set<ScDPObject*> ScDPObjectSet;
+    typedef o3tl::sorted_vector<ScDPObject*> ScDPObjectSet;
     typedef std::vector<SCROW> IndexArrayType;
 
     struct SAL_DLLPRIVATE GroupItems
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 81b87eead430..7a2279ee16e0 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -29,9 +29,9 @@
 #include "calcmacros.hxx"
 
 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
+#include <o3tl/sorted_vector.hxx>
 
 #include <memory>
-#include <set>
 #include <vector>
 #include <map>
 
@@ -305,7 +305,7 @@ public:
         SC_DLLPUBLIC ScDPCache* getExistingCache(const ScRange& rRange);
         SC_DLLPUBLIC const ScDPCache* getExistingCache(const ScRange& rRange) const;
 
-        void updateCache(const ScRange& rRange, std::set<ScDPObject*>& rRefs);
+        void updateCache(const ScRange& rRange, o3tl::sorted_vector<ScDPObject*>& rRefs);
         bool remove(const ScDPCache* p);
 
         SC_DLLPUBLIC const std::vector<ScRange>& getAllRanges() const;
@@ -330,7 +330,7 @@ public:
         ScDPCache* getExistingCache(const OUString& rName);
 
         void updateCache(
-            const OUString& rName, const ScRange& rRange, std::set<ScDPObject*>& rRefs);
+            const OUString& rName, const ScRange& rRange, o3tl::sorted_vector<ScDPObject*>& rRefs);
         bool remove(const ScDPCache* p);
     };
 
@@ -376,7 +376,7 @@ public:
 
         void updateCache(
             sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand,
-            std::set<ScDPObject*>& rRefs);
+            o3tl::sorted_vector<ScDPObject*>& rRefs);
         bool remove(const ScDPCache* p);
     };
 
@@ -384,8 +384,8 @@ public:
     ScDPCollection(const ScDPCollection& r);
     ~ScDPCollection();
 
-    const char* ReloadCache(const ScDPObject* pDPObj, std::set<ScDPObject*>& rRefs);
-    bool ReloadGroupsInCache(const ScDPObject* pDPObj, std::set<ScDPObject*>& rRefs);
+    const char* ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs);
+    bool ReloadGroupsInCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs);
     SC_DLLPUBLIC bool GetReferenceGroups(const ScDPObject& rDPObj, const ScDPDimensionSaveData** pGroups) const;
 
     SC_DLLPUBLIC size_t GetCount() const;
@@ -433,11 +433,11 @@ private:
     /** Only to be called from ScDPCache::RemoveReference(). */
     void RemoveCache(const ScDPCache* pCache);
 
-    void GetAllTables(const ScRange& rSrcRange, std::set<ScDPObject*>& rRefs) const;
-    void GetAllTables(const OUString& rSrcName, std::set<ScDPObject*>& rRefs) const;
+    void GetAllTables(const ScRange& rSrcRange, o3tl::sorted_vector<ScDPObject*>& rRefs) const;
+    void GetAllTables(const OUString& rSrcName, o3tl::sorted_vector<ScDPObject*>& rRefs) const;
     void GetAllTables(
         sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand,
-        std::set<ScDPObject*>& rRefs) const;
+        o3tl::sorted_vector<ScDPObject*>& rRefs) const;
 
 private:
     typedef std::vector< std::unique_ptr<ScDPObject> > TablesType;
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index ec9fc79d6a1e..50c21b672a7b 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -180,7 +180,7 @@ ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj)
 {
     // We need to first create group data in the cache, then the group data in
     // the object.
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     bool bSuccess = pDPs->ReloadGroupsInCache(pDPObj, aRefs);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload group data in cache.", bSuccess);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one table linked to this cache.", size_t(1), aRefs.size());
@@ -301,7 +301,7 @@ void Test::testPivotTable()
 
     // This time clear the cache to refresh the data from the source range.
     CPPUNIT_ASSERT_MESSAGE("This datapilot should be based on sheet data.", pDPObj2->IsSheetData());
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     const char* pErrId = pDPs->ReloadCache(pDPObj2, aRefs);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Cache reload failed.", static_cast<const char*>(nullptr), pErrId);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Reloading a cache shouldn't remove any cache.",
@@ -1527,7 +1527,7 @@ void Test::testPivotTableEmptyRows()
     // Modify the source to remove member 'A', then refresh the table.
     m_pDoc->SetString(1, 2, 0, "B");
 
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     const char* pErr = pDPs->ReloadCache(pDPObj, aRefs);
     CPPUNIT_ASSERT_MESSAGE("Failed to reload cache.", !pErr);
     CPPUNIT_ASSERT_MESSAGE("There should only be one pivot table linked to this cache.",
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 52700061b1a2..29f0814006d5 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2884,7 +2884,7 @@ struct FindInvalidRange
     }
 };
 
-void setGroupItemsToCache( ScDPCache& rCache, const std::set<ScDPObject*>& rRefs )
+void setGroupItemsToCache( ScDPCache& rCache, const o3tl::sorted_vector<ScDPObject*>& rRefs )
 {
     // Go through all referencing pivot tables, and re-fill the group dimension info.
     for (const ScDPObject* pObj : rRefs)
@@ -3039,7 +3039,7 @@ void ScDPCollection::SheetCaches::updateReference(
     }
 }
 
-void ScDPCollection::SheetCaches::updateCache(const ScRange& rRange, std::set<ScDPObject*>& rRefs)
+void ScDPCollection::SheetCaches::updateCache(const ScRange& rRange, o3tl::sorted_vector<ScDPObject*>& rRefs)
 {
     RangeIndexType::iterator it = std::find(maRanges.begin(), maRanges.end(), rRange);
     if (it == maRanges.end())
@@ -3063,7 +3063,7 @@ void ScDPCollection::SheetCaches::updateCache(const ScRange& rRange, std::set<Sc
     // Update the cache with new cell values. This will clear all group dimension info.
     rCache.InitFromDoc(mrDoc, rRange);
 
-    std::set<ScDPObject*> aRefs(rCache.GetAllReferences());
+    o3tl::sorted_vector<ScDPObject*> aRefs(rCache.GetAllReferences());
     rRefs.swap(aRefs);
 
     // Make sure to re-populate the group dimension info.
@@ -3126,7 +3126,7 @@ size_t ScDPCollection::NameCaches::size() const
 }
 
 void ScDPCollection::NameCaches::updateCache(
-    const OUString& rName, const ScRange& rRange, std::set<ScDPObject*>& rRefs)
+    const OUString& rName, const ScRange& rRange, o3tl::sorted_vector<ScDPObject*>& rRefs)
 {
     CachesType::iterator const itr = m_Caches.find(rName);
     if (itr == m_Caches.end())
@@ -3139,7 +3139,7 @@ void ScDPCollection::NameCaches::updateCache(
     // Update the cache with new cell values. This will clear all group dimension info.
     rCache.InitFromDoc(mrDoc, rRange);
 
-    std::set<ScDPObject*> aRefs(rCache.GetAllReferences());
+    o3tl::sorted_vector<ScDPObject*> aRefs(rCache.GetAllReferences());
     rRefs.swap(aRefs);
 
     // Make sure to re-populate the group dimension info.
@@ -3275,7 +3275,7 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet(
 
 void ScDPCollection::DBCaches::updateCache(
     sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand,
-    std::set<ScDPObject*>& rRefs)
+    o3tl::sorted_vector<ScDPObject*>& rRefs)
 {
     DBType aType(nSdbType, rDBName, rCommand);
     CachesType::iterator const it = m_Caches.find(aType);
@@ -3309,7 +3309,7 @@ void ScDPCollection::DBCaches::updateCache(
     }
 
     comphelper::disposeComponent(xRowSet);
-    std::set<ScDPObject*> aRefs(rCache.GetAllReferences());
+    o3tl::sorted_vector<ScDPObject*> aRefs(rCache.GetAllReferences());
     aRefs.swap(rRefs);
 
     // Make sure to re-populate the group dimension info.
@@ -3368,7 +3368,7 @@ public:
 
 }
 
-const char* ScDPCollection::ReloadCache(const ScDPObject* pDPObj, std::set<ScDPObject*>& rRefs)
+const char* ScDPCollection::ReloadCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs)
 {
     if (!pDPObj)
         return STR_ERR_DATAPILOTSOURCE;
@@ -3432,7 +3432,7 @@ const char* ScDPCollection::ReloadCache(const ScDPObject* pDPObj, std::set<ScDPO
     return nullptr;
 }
 
-bool ScDPCollection::ReloadGroupsInCache(const ScDPObject* pDPObj, std::set<ScDPObject*>& rRefs)
+bool ScDPCollection::ReloadGroupsInCache(const ScDPObject* pDPObj, o3tl::sorted_vector<ScDPObject*>& rRefs)
 {
     if (!pDPObj)
         return false;
@@ -3844,9 +3844,9 @@ void ScDPCollection::RemoveCache(const ScDPCache* pCache)
         return;
 }
 
-void ScDPCollection::GetAllTables(const ScRange& rSrcRange, std::set<ScDPObject*>& rRefs) const
+void ScDPCollection::GetAllTables(const ScRange& rSrcRange, o3tl::sorted_vector<ScDPObject*>& rRefs) const
 {
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     for (const auto& rxTable : maTables)
     {
         const ScDPObject& rObj = *rxTable;
@@ -3872,9 +3872,9 @@ void ScDPCollection::GetAllTables(const ScRange& rSrcRange, std::set<ScDPObject*
     rRefs.swap(aRefs);
 }
 
-void ScDPCollection::GetAllTables(const OUString& rSrcName, std::set<ScDPObject*>& rRefs) const
+void ScDPCollection::GetAllTables(const OUString& rSrcName, o3tl::sorted_vector<ScDPObject*>& rRefs) const
 {
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     for (const auto& rxTable : maTables)
     {
         const ScDPObject& rObj = *rxTable;
@@ -3902,9 +3902,9 @@ void ScDPCollection::GetAllTables(const OUString& rSrcName, std::set<ScDPObject*
 
 void ScDPCollection::GetAllTables(
     sal_Int32 nSdbType, const OUString& rDBName, const OUString& rCommand,
-    std::set<ScDPObject*>& rRefs) const
+    o3tl::sorted_vector<ScDPObject*>& rRefs) const
 {
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     for (const auto& rxTable : maTables)
     {
         const ScDPObject& rObj = *rxTable;
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index cbd2471ad343..e15282480fc0 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1611,7 +1611,7 @@ void ScDBDocFunc::RefreshPivotTables(const ScDPObject* pDPObj, bool bApi)
     if (!pDPs)
         return;
 
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     const char* pErrId = pDPs->ReloadCache(pDPObj, aRefs);
     if (pErrId)
         return;
@@ -1644,7 +1644,7 @@ void ScDBDocFunc::RefreshPivotTableGroups(ScDPObject* pDPObj)
     }
 
     // Update all linked tables, if this table is part of the cache (ScDPCollection)
-    std::set<ScDPObject*> aRefs;
+    o3tl::sorted_vector<ScDPObject*> aRefs;
     if (!pDPs->ReloadGroupsInCache(pDPObj, aRefs))
         return;
 
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 55b308dfb869..f7a79a173e0f 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1644,7 +1644,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const OUString& rString )
             ScDPCollection* pDPs = rDoc.GetDPCollection();
             if (pDPs)
             {
-                std::set<ScDPObject*> aRefs;
+                o3tl::sorted_vector<ScDPObject*> aRefs;
                 // tdf#111305: Reload groups in cache after modifications.
                 pDPs->ReloadGroupsInCache(pDPObj, aRefs);
             } // pDPs


More information about the Libreoffice-commits mailing list