13#include <document.hxx>
28class ColumnNonEmptyRangesScanner
34 mrRanges(rRanges), mbVal(bVal) {}
36 void operator() (
const sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
41 size_t nRow = node.position + nOffset;
42 size_t nEndRow = nRow + nDataSize;
43 mrRanges.insert_back(nRow, nEndRow, mbVal);
54 maSpans(nStart, nEnd+1, bInit), miPos(maSpans.
begin()) {}
57 maSpans(rOther.maSpans), miPos(maSpans.
begin()) {}
80 rTab[nCol].emplace(0, rDoc.
MaxRow(),
false);
119 for (
const auto& rSpan : aSpans)
120 set(rDoc, nTab, nCol, rSpan.mnRow1, rSpan.mnRow2, bVal);
129 if (nCol1 > nCol2 || nRow1 > nRow2)
137 for (
SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
143 if( nRow1 > pTab->
aCol[nCol].GetLastDataPos())
146 ColumnNonEmptyRangesScanner aScanner(rCol.
maSpans, bVal);
147 ParseBlock(rSrcCells.begin(), rSrcCells, aScanner, nRow1, nRow2);
154 for (
size_t nTab = 0; nTab <
maTables.size(); ++nTab)
164 for (
SCCOL nCol = 0; nCol < static_cast<SCCOL>(rTab.size()); ++nCol)
173 ColumnSpansType::const_iterator it = rCol.
maSpans.begin(), itEnd = rCol.
maSpans.end();
176 bool bVal = it->second;
177 for (++it; it != itEnd; ++it)
191 for (
size_t nTab = 0; nTab <
maTables.size(); ++nTab)
201 for (
SCCOL nCol = 0; nCol < static_cast<SCCOL>(rTab.size()); ++nCol)
211 ColumnSpansType::const_iterator it = rCol.
maSpans.begin(), itEnd = rCol.
maSpans.end();
214 bool bVal = it->second;
215 for (++it; it != itEnd; ++it)
218 ac.
execute(nRow1, nRow2, bVal);
229class NonEmptyRangesScanner
235 void operator() (
const sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
240 size_t nRow = node.position + nOffset;
241 size_t nEndRow = nRow + nDataSize;
242 mrRanges.insert_back(nRow, nEndRow,
true);
249 : mrSheetLimits(rSheetLimits),
250 maSpans(0, rSheetLimits.GetMaxRowCount(), false) {}
256 for (
const auto& rCell : rCells)
258 SCROW nEndRow = nCurRow + rCell.size;
260 maSpans.insert_back(nCurRow, nEndRow,
true);
271 NonEmptyRangesScanner aScanner(
maSpans);
281 NonEmptyRangesScanner aScanner(
maSpans);
292 scan(aRanges, nTab, nCol);
297 for (
size_t i = 0,
n = rRanges.
size();
i <
n; ++
i)
299 const ScRange & rRange = rRanges[
i];
313 maSpans.insert_back(nRow1, nRow2+1, bVal);
318 std::vector<SCROW> aRows;
322 for (
const auto& rRange : aRanges)
324 for (
SCROW nRow = rRange.mnRow1; nRow <= rRange.mnRow2; ++nRow)
325 aRows.push_back(nRow);
345 ColumnSpansType::const_iterator it =
maSpans.begin();
bool ValidTab(SCTAB nTab)
sc::CellStoreType maCells
SCROW GetLastDataPos() const
bool ValidRow(SCROW nRow) const
SC_DLLPUBLIC ScTable * FetchTable(SCTAB nTab)
SC_DLLPUBLIC SCROW MaxRow() const
bool ValidCol(SCCOL nCol) const
bool ValidColRow(SCCOL nCol, SCROW nRow) const
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
ScRangeList GetMarkedRangesForTab(SCTAB nTab) const
Get marked ranges with sheet-tab set to nTab.
bool GetTableSelect(SCTAB nTab) const
SCCOL GetAllocatedColumnsCount() const
SCCOL ClampToAllocatedColumns(SCCOL nCol) const
virtual void startColumn(SCTAB nTab, SCCOL nCol)
virtual void execute(const ScAddress &rPos, SCROW nLength, bool bVal)=0
virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal)=0
virtual ~ColumnAction()=0
virtual void startColumn(ScColumn *pCol)=0
mdds::flat_segment_tree< SCROW, bool > ColumnSpansType
void scan(const ScDocument &rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal)
Scan specified range in a specified sheet and mark all non-empty cells with specified boolean value.
ColumnType & getColumn(const ScDocument &rDoc, SCTAB nTab, SCCOL nCol)
std::vector< std::optional< ColumnType > > TableType
std::vector< TableType > maTables
void executeAction(ScDocument &rDoc, Action &ac) const
void executeColumnAction(ScDocument &rDoc, ColumnAction &ac) const
void set(const ScDocument &rDoc, SCTAB nTab, SCCOL nCol, SCROW nRow, bool bVal)
void executeColumnAction(ScDocument &rDoc, sc::ColumnSpanSet::ColumnAction &ac) const
Keep track of spans in a single column only.
void scan(const ScColumn &rColumn)
Scan an entire column and tag all non-empty cell positions.
ScSheetLimits const & mrSheetLimits
SingleColumnSpanSet(ScSheetLimits const &)
void swap(SingleColumnSpanSet &r)
std::vector< RowSpan > SpansType
void getSpans(SpansType &rSpans) const
void getRows(std::vector< SCROW > &rRows) const
bool empty() const
Whether there isn't any row tagged.
void set(SCROW nRow1, SCROW nRow2, bool bVal)
mdds::flat_segment_tree< SCROW, bool > ColumnSpansType
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
enumrange< T >::Iterator begin(enumrange< T >)
CAUTION! The following defines must be in the same namespace as the respective type.
StoreT::const_iterator ParseBlock(const typename StoreT::const_iterator &itPos, const StoreT &rStore, Func &rFunc, typename StoreT::size_type nStart, typename StoreT::size_type nEnd)
Generic algorithm to parse blocks of multi_type_vector either partially or fully.
mdds::mtv::soa::multi_type_vector< CellStoreTraits > CellStoreType
Cell container.
const mdds::mtv::element_t element_type_empty
SCROW GetMaxRowCount() const
ColRowSpan(SCCOLROW nStart, SCCOLROW nEnd)
CellStoreType::const_iterator miCellPos
ColumnType(SCROW nStart, SCROW nEnd, bool bInit)
ColumnSpansType::const_iterator miPos
RowSpan(SCROW nRow1, SCROW nRow2)
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW