summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-21 10:29:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-21 14:02:03 +0200
commit99cd1d8834bb708afc81c825ff2b7992b7acb37d (patch)
treed2c5579e5967bc4c90d1ff95bd50d588faf2cf21 /sc
parent159b8fb14f3577812819508f4160c37414cce6da (diff)
flatten TableType in ColumnSpanSet
Change-Id: I66c8a1ac022da0f64dc16fdda364da6402d3db30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119307 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/columnspanset.hxx3
-rw-r--r--sc/source/core/data/columnspanset.cxx6
2 files changed, 5 insertions, 4 deletions
diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 547861d1c583..a5fed2d3f25a 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -11,6 +11,7 @@
#include "address.hxx"
+#include <optional>
#include <vector>
#include <mdds/flat_segment_tree.hpp>
@@ -59,7 +60,7 @@ private:
ColumnType(SCROW nStart, SCROW nEnd, bool bInit);
};
- typedef std::vector<std::unique_ptr<ColumnType>> TableType;
+ typedef std::vector<std::optional<ColumnType>> TableType;
std::vector<TableType> maTables;
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index 8d9775e0cbfc..a38ea7fffe35 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -74,7 +74,7 @@ ColumnSpanSet::ColumnType& ColumnSpanSet::getColumn(const ScDocument& rDoc, SCTA
rTab.resize(nCol+1);
if (!rTab[nCol])
- rTab[nCol].reset(new ColumnType(0, rDoc.MaxRow(), /*bInit*/false));
+ rTab[nCol].emplace(0, rDoc.MaxRow(), /*bInit*/false);
return *rTab[nCol];
}
@@ -156,7 +156,7 @@ void ColumnSpanSet::executeAction(Action& ac) const
continue;
ac.startColumn(nTab, nCol);
- ColumnType& rCol = *rTab[nCol];
+ const ColumnType& rCol = *rTab[nCol];
ColumnSpansType::const_iterator it = rCol.maSpans.begin(), itEnd = rCol.maSpans.end();
SCROW nRow1, nRow2;
nRow1 = it->first;
@@ -199,7 +199,7 @@ void ColumnSpanSet::executeColumnAction(ScDocument& rDoc, ColumnAction& ac) cons
ScColumn& rColumn = pTab->aCol[nCol];
ac.startColumn(&rColumn);
- ColumnType& rCol = *rTab[nCol];
+ const ColumnType& rCol = *rTab[nCol];
ColumnSpansType::const_iterator it = rCol.maSpans.begin(), itEnd = rCol.maSpans.end();
SCROW nRow1, nRow2;
nRow1 = it->first;