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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 5 12:56:53 UTC 2021


 sc/inc/columnspanset.hxx        |    4 +++-
 sc/source/core/data/bcaslot.cxx |   13 +++++--------
 sc/source/core/inc/bcaslot.hxx  |    2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit dbae39115963f63be1befe407ff9ed8c1c4a9b62
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Sep 4 20:55:29 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Sep 5 14:56:21 2021 +0200

    no need to allocate ColumnSpanSet with unique_ptr
    
    Change-Id: If3aaa2a4bc556dad41f56054890dc07f96d42dda
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121651
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index a5fed2d3f25a..926f0520e8a1 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -85,7 +85,9 @@ public:
 
     ColumnSpanSet();
     ColumnSpanSet(const ColumnSpanSet&) = delete;
-    const ColumnSpanSet& operator=(const ColumnSpanSet&) = delete;
+    ColumnSpanSet& operator=(const ColumnSpanSet&) = delete;
+    ColumnSpanSet(ColumnSpanSet&&) = default;
+    ColumnSpanSet& operator=(ColumnSpanSet&&) = default;
     ~ColumnSpanSet();
 
     void set(const ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCROW nRow, bool bVal);
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index bbca9dda93ae..9a9940445b7a 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -1077,12 +1077,11 @@ void ScBroadcastAreaSlotMachine::InsertBulkGroupArea( ScBroadcastArea* pArea, co
     if (it == m_BulkGroupAreas.end() || m_BulkGroupAreas.key_comp()(pArea, it->first))
     {
         // Insert a new one.
-        it = m_BulkGroupAreas.insert(it, std::make_pair(pArea, std::make_unique<sc::ColumnSpanSet>()));
+        it = m_BulkGroupAreas.insert(it, std::make_pair(pArea, sc::ColumnSpanSet()));
     }
 
-    sc::ColumnSpanSet *const pSet = it->second.get();
-    assert(pSet);
-    pSet->set(*pDoc, rRange, true);
+    sc::ColumnSpanSet& rSet = it->second;
+    rSet.set(*pDoc, rRange, true);
 }
 
 bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( SfxHintId nHintId )
@@ -1093,7 +1092,7 @@ bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( SfxHintId nHintId )
     sc::BulkDataHint aHint( *pDoc, nHintId);
 
     bool bBroadcasted = false;
-    for (const auto& [pArea, rxSpans] : m_BulkGroupAreas)
+    for (const auto& [pArea, rSpans] : m_BulkGroupAreas)
     {
         assert(pArea);
         SvtBroadcaster& rBC = pArea->GetBroadcaster();
@@ -1105,9 +1104,7 @@ bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( SfxHintId nHintId )
         }
         else
         {
-            const sc::ColumnSpanSet *const pSpans = rxSpans.get();
-            assert(pSpans);
-            aHint.setSpans(pSpans);
+            aHint.setSpans(&rSpans);
             rBC.Broadcast(aHint);
             bBroadcasted = true;
         }
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index 2c85229b1feb..56d49e698835 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -245,7 +245,7 @@ public:
 class  ScBroadcastAreaSlotMachine
 {
 private:
-    typedef std::map<ScBroadcastArea*, std::unique_ptr<sc::ColumnSpanSet>> BulkGroupAreasType;
+    typedef std::map<ScBroadcastArea*, sc::ColumnSpanSet> BulkGroupAreasType;
 
     /**
         Slot offset arrangement of columns and rows, once per sheet.


More information about the Libreoffice-commits mailing list