30 mnRow1(nRow1), mnRow2(nRow2) {}
54 mpImpl->maCells.resize(nLen);
55 mpImpl->maCellTextAttrs.resize(nLen);
69 std::vector<BlockPos> aBlocksToSwap;
72 for (
const auto& rCell :
mpImpl->maCells)
78 aPos.mnStart = rCell.position;
79 aPos.mnEnd = aPos.mnStart + rCell.size - 1;
80 aBlocksToSwap.push_back(aPos);
84 for (
const auto& rBlock : aBlocksToSwap)
86 rCol.
maCells.swap(rBlock.mnStart, rBlock.mnEnd,
mpImpl->maCells, rBlock.mnStart);
93 mpImpl->maCells.resize(rVals.size());
94 mpImpl->maCells.set(0, rVals.begin(), rVals.end());
97 std::vector<CellTextAttr> aDefaults(rVals.size(),
CellTextAttr());
98 mpImpl->maCellTextAttrs.resize(rVals.size());
99 mpImpl->maCellTextAttrs.set(0, aDefaults.begin(), aDefaults.end());
104 std::vector<ScFormulaCell*> aCopyVals(rVals.size());
106 for (
const auto* pCell : rVals)
108 aCopyVals[nIdx] = pCell->Clone();
112 mpImpl->maCells.resize(aCopyVals.size());
113 mpImpl->maCells.set(0, aCopyVals.begin(), aCopyVals.end());
116 std::vector<CellTextAttr> aDefaults(rVals.size(),
CellTextAttr());
117 mpImpl->maCellTextAttrs.resize(rVals.size());
118 mpImpl->maCellTextAttrs.set(0, aDefaults.begin(), aDefaults.end());
124 return mpImpl->maCells.size();
130 mpImpl->maCells.resize(nSize);
131 mpImpl->maCellTextAttrs.clear();
132 mpImpl->maCellTextAttrs.resize(nSize);
157 std::vector<CellValueSpan> aRet;
158 for (
const auto& rCell :
mpImpl->maCells)
163 size_t nRow1 = rCell.position;
164 size_t nRow2 = nRow1 + rCell.size - 1;
165 aRet.emplace_back(nRow1, nRow2);
177 assert(rSrc.size() +
static_cast<size_t>(nRow) <= rDest.size());
179 SCROW nCurRow = nRow;
180 CellStoreType::iterator itPos = rDest.begin();
182 for (
const auto& rBlk : rSrc)
188 numeric_block::const_iterator it = numeric_block::begin(*rBlk.data);
189 numeric_block::const_iterator itEnd = numeric_block::end(*rBlk.data);
190 itPos = rDest.set(itPos, nCurRow, it, itEnd);
195 string_block::const_iterator it = string_block::begin(*rBlk.data);
196 string_block::const_iterator itEnd = string_block::end(*rBlk.data);
197 itPos = rDest.set(itPos, nCurRow, it, itEnd);
202 edittext_block::const_iterator it = edittext_block::begin(*rBlk.data);
203 edittext_block::const_iterator itEnd = edittext_block::end(*rBlk.data);
204 std::vector<EditTextObject*> aVals;
205 aVals.reserve(rBlk.size);
206 for (; it != itEnd; ++it)
209 aVals.push_back(p->
Clone().release());
211 itPos = rDest.set(itPos, nCurRow, aVals.begin(), aVals.end());
216 formula_block::const_iterator it = formula_block::begin(*rBlk.data);
217 formula_block::const_iterator itEnd = formula_block::end(*rBlk.data);
218 std::vector<ScFormulaCell*> aVals;
219 aVals.reserve(rBlk.size);
220 for (; it != itEnd; ++it)
223 aVals.push_back(p->
Clone());
225 itPos = rDest.set(itPos, nCurRow, aVals.begin(), aVals.end());
229 itPos = rDest.set_empty(itPos, nCurRow, nCurRow+rBlk.size-1);
232 nCurRow += rBlk.size;
242 assert(rSrc.size() +
static_cast<size_t>(nRow) <= rDest.size());
244 SCROW nCurRow = nRow;
245 CellTextAttrStoreType::iterator itPos = rDest.begin();
247 for (
const auto& rBlk : rSrc)
253 celltextattr_block::const_iterator it = celltextattr_block::begin(*rBlk.data);
254 celltextattr_block::const_iterator itEnd = celltextattr_block::end(*rBlk.data);
255 itPos = rDest.set(itPos, nCurRow, it, itEnd);
259 itPos = rDest.set_empty(itPos, nCurRow, nCurRow+rBlk.size-1);
262 nCurRow += rBlk.size;
266 typedef std::vector<std::unique_ptr<CellValues>>
TableType;
279 for (
size_t nTab = 0; nTab < nTabs; ++nTab)
281 m_Tables.push_back(std::make_unique<TableType>());
282 std::unique_ptr<TableType>& rTab2 = m_Tables.back();
283 for (
size_t nCol = 0; nCol < nCols; ++nCol)
284 rTab2->push_back(std::make_unique<CellValues>());
296 size_t nTabOffset = nTab - maRange.
aStart.
Tab();
297 if (nTabOffset >= m_Tables.size())
299 std::unique_ptr<TableType>& rTab2 = m_Tables[nTab-maRange.
aStart.
Tab()];
300 size_t nColOffset = nCol - maRange.
aStart.
Col();
301 if (nColOffset >= rTab2->size())
303 return &rTab2.get()[0][nColOffset].get()[0];
311 mpImpl(new
Impl(rRange)) {}
328 pCol->
swap(rColValue);
342 std::vector<CellValueSpan> aRet;
CellTextAttrStoreType maCellTextAttrs
void swap(SCTAB nTab, SCCOL nCol, CellValues &rColValue)
Swap the entire column.
const mdds::mtv::element_t element_type_celltextattr
CellTextAttrStoreType::iterator miAttrPos
Think of this as a mini-ScColumn like storage that only stores cell values in a column.
CellValueSpan(SCROW nRow1, SCROW nRow2)
Stores cell values for multiple tables.
void transferFrom(ScColumn &rCol, SCROW nRow, size_t nLen)
Transfer values from specified column.
mdds::multi_type_vector< CellFunc, CellStoreEvent > CellStoreType
void copyCellTextAttrsTo(ScColumn &rCol, SCROW nRow) const
const mdds::mtv::element_t element_type_formula
Impl(const ScRange &rRange)
std::vector< std::unique_ptr< CellValues > > TableType
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
CellValues * getCellValues(SCTAB nTab, SCCOL nCol)
sc::CellStoreType maCells
const CellValuesImpl & operator=(const CellValuesImpl &)=delete
void swapNonEmpty(ScColumn &rCol)
void setValue(size_t nRow, double fVal)
void assign(const std::vector< double > &rVals)
void copyCellsTo(ScColumn &rCol, SCROW nRow) const
sc::CellTextAttrStoreType maCellTextAttrs
std::vector< CellValueSpan > getNonEmptySpans() const
const mdds::mtv::element_t element_type_empty
const mdds::mtv::element_t element_type_numeric
Mapped standard element types (for convenience).
const ScRange & getRange() const
CellStoreType::iterator miCellPos
std::unique_ptr< Impl > mpImpl
std::unique_ptr< CellValuesImpl > mpImpl
std::vector< CellValueSpan > getNonEmptySpans(SCTAB nTab, SCCOL nCol) const
void copyTo(ScColumn &rCol, SCROW nRow) const
std::vector< std::unique_ptr< TableType > > TablesType
const mdds::mtv::element_t element_type_edittext
std::unique_ptr< EditTextObject > Clone() const
const mdds::mtv::element_t element_type_string
mdds::multi_type_vector< CTAttrFunc > CellTextAttrStoreType
void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn &rCol)
Swap non-empty blocks with the column storage.