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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 21 10:19:51 UTC 2021


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

New commits:
commit 794be42bcc89460371d950f1c2922801dcb431f9
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 21 10:26:32 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 21 12:19:13 2021 +0200

    flatten maTables in ColumnSpanSet
    
    Change-Id: Ic32e0aa40cd678a7b0b28a7a6d7478250b3b7b3e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119306
    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 d889a4da67e4..547861d1c583 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -61,7 +61,7 @@ private:
 
     typedef std::vector<std::unique_ptr<ColumnType>> TableType;
 
-    std::vector<std::unique_ptr<TableType>> maTables;
+    std::vector<TableType> maTables;
 
     ColumnType& getColumn(const ScDocument& rDoc, SCTAB nTab, SCCOL nCol);
 
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index b400cd651c5a..8d9775e0cbfc 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -69,10 +69,7 @@ ColumnSpanSet::ColumnType& ColumnSpanSet::getColumn(const ScDocument& rDoc, SCTA
     if (o3tl::make_unsigned(nTab) >= maTables.size())
         maTables.resize(nTab+1);
 
-    if (!maTables[nTab])
-        maTables[nTab].reset(new TableType);
-
-    TableType& rTab = *maTables[nTab];
+    TableType& rTab = maTables[nTab];
     if (o3tl::make_unsigned(nCol) >= rTab.size())
         rTab.resize(nCol+1);
 
@@ -149,10 +146,10 @@ void ColumnSpanSet::executeAction(Action& ac) const
 {
     for (size_t nTab = 0; nTab < maTables.size(); ++nTab)
     {
-        if (!maTables[nTab])
+        if (maTables[nTab].empty())
             continue;
 
-        const TableType& rTab = *maTables[nTab];
+        const TableType& rTab = maTables[nTab];
         for (size_t nCol = 0; nCol < rTab.size(); ++nCol)
         {
             if (!rTab[nCol])
@@ -180,10 +177,10 @@ void ColumnSpanSet::executeColumnAction(ScDocument& rDoc, ColumnAction& ac) cons
 {
     for (size_t nTab = 0; nTab < maTables.size(); ++nTab)
     {
-        if (!maTables[nTab])
+        if (maTables[nTab].empty())
             continue;
 
-        const TableType& rTab = *maTables[nTab];
+        const TableType& rTab = maTables[nTab];
         for (SCCOL nCol = 0; nCol < static_cast<SCCOL>(rTab.size()); ++nCol)
         {
             if (!rTab[nCol])


More information about the Libreoffice-commits mailing list