31 mnRow1(nRow1), mnRow2(nRow2) {}
55 mpImpl->maCells.resize(nLen);
56 mpImpl->maCellTextAttrs.resize(nLen);
70 std::vector<BlockPos> aBlocksToSwap;
73 for (
const auto& rCell :
mpImpl->maCells)
79 aPos.mnStart = rCell.position;
80 aPos.mnEnd = aPos.mnStart + rCell.size - 1;
81 aBlocksToSwap.push_back(aPos);
85 for (
const auto& rBlock : aBlocksToSwap)
87 rCol.
maCells.swap(rBlock.mnStart, rBlock.mnEnd,
mpImpl->maCells, rBlock.mnStart);
94 mpImpl->maCells.resize(rVals.size());
95 mpImpl->maCells.set(0, rVals.begin(), rVals.end());
98 std::vector<CellTextAttr> aDefaults(rVals.size(),
CellTextAttr());
99 mpImpl->maCellTextAttrs.resize(rVals.size());
100 mpImpl->maCellTextAttrs.set(0, aDefaults.begin(), aDefaults.end());
105 std::vector<ScFormulaCell*> aCopyVals(rVals.size());
107 for (
const auto* pCell : rVals)
109 aCopyVals[nIdx] = pCell->Clone();
113 mpImpl->maCells.resize(aCopyVals.size());
114 mpImpl->maCells.set(0, aCopyVals.begin(), aCopyVals.end());
117 std::vector<CellTextAttr> aDefaults(rVals.size(),
CellTextAttr());
118 mpImpl->maCellTextAttrs.resize(rVals.size());
119 mpImpl->maCellTextAttrs.set(0, aDefaults.begin(), aDefaults.end());
124 assert(
mpImpl->maCells.size() ==
mpImpl->maCellTextAttrs.size());
125 return mpImpl->maCells.size();
131 mpImpl->maCells.resize(nSize);
132 mpImpl->maCellTextAttrs.clear();
133 mpImpl->maCellTextAttrs.resize(nSize);
153 mpImpl->miCellPos =
mpImpl->maCells.set(
mpImpl->miCellPos, nRow, pEditText.release());
164 std::vector<CellValueSpan> aRet;
165 for (
const auto& rCell :
mpImpl->maCells)
170 size_t nRow1 = rCell.position;
171 size_t nRow2 = nRow1 + rCell.size - 1;
172 aRet.emplace_back(nRow1, nRow2);
184 assert(rSrc.size() +
static_cast<size_t>(nRow) <= rDest.size());
186 SCROW nCurRow = nRow;
187 CellStoreType::iterator itPos = rDest.begin();
189 for (
const auto& rBlk : rSrc)
195 numeric_block::const_iterator it = numeric_block::begin(*rBlk.data);
196 numeric_block::const_iterator itEnd = numeric_block::end(*rBlk.data);
197 itPos = rDest.set(itPos, nCurRow, it, itEnd);
202 string_block::const_iterator it = string_block::begin(*rBlk.data);
203 string_block::const_iterator itEnd = string_block::end(*rBlk.data);
204 itPos = rDest.set(itPos, nCurRow, it, itEnd);
209 edittext_block::const_iterator it = edittext_block::begin(*rBlk.data);
210 edittext_block::const_iterator itEnd = edittext_block::end(*rBlk.data);
211 std::vector<EditTextObject*> aVals;
212 aVals.reserve(rBlk.size);
213 for (; it != itEnd; ++it)
216 aVals.push_back(
p->Clone().release());
218 itPos = rDest.set(itPos, nCurRow, aVals.begin(), aVals.end());
223 formula_block::const_iterator it = formula_block::begin(*rBlk.data);
224 formula_block::const_iterator itEnd = formula_block::end(*rBlk.data);
225 std::vector<ScFormulaCell*> aVals;
226 aVals.reserve(rBlk.size);
227 for (; it != itEnd; ++it)
230 aVals.push_back(
p->Clone());
232 itPos = rDest.set(itPos, nCurRow, aVals.begin(), aVals.end());
236 itPos = rDest.set_empty(itPos, nCurRow, nCurRow+rBlk.size-1);
239 nCurRow += rBlk.size;
249 assert(rSrc.size() +
static_cast<size_t>(nRow) <= rDest.size());
251 SCROW nCurRow = nRow;
252 CellTextAttrStoreType::iterator itPos = rDest.begin();
254 for (
const auto& rBlk : rSrc)
260 celltextattr_block::const_iterator it = celltextattr_block::begin(*rBlk.data);
261 celltextattr_block::const_iterator itEnd = celltextattr_block::end(*rBlk.data);
262 itPos = rDest.set(itPos, nCurRow, it, itEnd);
266 itPos = rDest.set_empty(itPos, nCurRow, nCurRow+rBlk.size-1);
269 nCurRow += rBlk.size;
273typedef std::vector<std::unique_ptr<CellValues>>
TableType;
286 for (
size_t nTab = 0; nTab < nTabs; ++nTab)
288 m_Tables.push_back(std::make_unique<TableType>());
289 std::unique_ptr<TableType>& rTab2 =
m_Tables.back();
290 for (
size_t nCol = 0; nCol < nCols; ++nCol)
291 rTab2->push_back(std::make_unique<CellValues>());
308 if (nColOffset >= rTab2->size())
310 return &rTab2.get()[0][nColOffset].get()[0];
318 mpImpl(new
Impl(rRange)) {}
335 pCol->
swap(rColValue);
349 std::vector<CellValueSpan> aRet;
sc::CellTextAttrStoreType maCellTextAttrs
sc::CellStoreType maCells
Think of this as a mini-ScColumn like storage that only stores cell values in a column.
void assign(const std::vector< double > &rVals)
void copyCellTextAttrsTo(ScColumn &rCol, SCROW nRow) const
void transferFrom(ScColumn &rCol, SCROW nRow, size_t nLen)
Transfer values from specified column.
void copyCellsTo(ScColumn &rCol, SCROW nRow) const
std::unique_ptr< CellValuesImpl > mpImpl
std::vector< CellValueSpan > getNonEmptySpans() const
void copyTo(ScColumn &rCol, SCROW nRow) const
void swapNonEmpty(ScColumn &rCol)
void setValue(size_t nRow, double fVal)
Stores cell values for multiple tables.
void swap(SCTAB nTab, SCCOL nCol, CellValues &rColValue)
Swap the entire column.
std::vector< CellValueSpan > getNonEmptySpans(SCTAB nTab, SCCOL nCol) const
const ScRange & getRange() const
void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn &rCol)
Swap non-empty blocks with the column storage.
std::unique_ptr< Impl > mpImpl
CAUTION! The following defines must be in the same namespace as the respective type.
const mdds::mtv::element_t element_type_celltextattr
const mdds::mtv::element_t element_type_edittext
const mdds::mtv::element_t element_type_formula
std::vector< std::unique_ptr< CellValues > > TableType
mdds::mtv::soa::multi_type_vector< CellStoreTraits > CellStoreType
Cell container.
const mdds::mtv::element_t element_type_numeric
Mapped standard element types (for convenience).
mdds::mtv::soa::multi_type_vector< CellTextAttrTraits > CellTextAttrStoreType
Cell text attribute container.
const mdds::mtv::element_t element_type_string
const mdds::mtv::element_t element_type_empty
std::vector< std::unique_ptr< TableType > > TablesType
CellValueSpan(SCROW nRow1, SCROW nRow2)
CellTextAttrStoreType::iterator miAttrPos
CellValuesImpl(const CellValuesImpl &)=delete
const CellValuesImpl & operator=(const CellValuesImpl &)=delete
CellTextAttrStoreType maCellTextAttrs
CellStoreType::iterator miCellPos
CellValues * getCellValues(SCTAB nTab, SCCOL nCol)
Impl(const ScRange &rRange)