31 : aRowSel(rSheetLimits), mrSheetLimits(rSheetLimits)
45 aRowSel = std::move(rOther.aRowSel);
74 SCROW nRow1 = -1, nRow2 = -1, nRow3 = -1, nRow4 = -1;
79 if ( aResult1 || aResult2 )
81 if ( aResult1 && aResult2 )
83 if ( ( nRow2 + 1 ) < nRow3 )
85 if ( ( nRow4 + 1 ) < nRow1 )
88 auto aRows = std::minmax( { nRow1, nRow2, nRow3, nRow4 } );
89 rStartRow = aRows.first;
90 rEndRow = aRows.second;
120 if ( !bHasMarks1 && !bHasMarks2 )
123 if ( bHasMarks1 && bHasMarks2 )
130 bool bRet = aMultiIter.
GetRangeData( nStartRow, aRowRange );
131 return bRet && aRowRange.
mbValue && aRowRange.
mnRow2 >= nEndRow;
144 if ( bCol1Exists || bCol2Exists )
146 if ( bCol1Exists && bCol2Exists )
148 else if ( bCol1Exists )
159 if( nMinCol > nLastCol )
170 SCCOL nCol = nLastCol - 1;
184 if ( nRow1 == nRow2 )
192 return ( bUp ? nRow2 : nRow1 );
213 if ( aIter.HasMarks() )
214 aIter.SetMarkArea( nStartRow, nEndRow,
false );
223 SCROW nBeg, nLast = nEndRow;
256 for (
SCCOL nColIter = nEndCol; nColIter >= nStartCol; --nColIter )
267 if (rList.
size() == 0)
271 auto aNewList = rList;
272 std::sort(aNewList.begin(), aNewList.end(),
275 return lhs.aStart.Row() < rhs.aStart.Row();
281 for (
const ScRange& rRange : aNewList)
283 SCCOL nStartCol = rRange.aStart.Col();
284 SCROW nStartRow = rRange.aStart.Row();
285 SCCOL nEndCol = rRange.aEnd.Col();
286 SCROW nEndRow = rRange.aEnd.Row();
287 assert( nEndRow >= nStartRow &&
"this method assumes the input data has ranges with endrow>=startrow");
288 assert( nEndCol >= nStartCol &&
"this method assumes the input data has ranges with endcol>=startcol");
293 for (
SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
295 auto & rMarkEntries = aMarkEntriesPerCol[nCol];
296 int nEntries = rMarkEntries.size();
297 if (nEntries > 1 && nStartRow >= rMarkEntries[nEntries-2].nRow+1
298 && nStartRow <= rMarkEntries[nEntries-1].nRow+1)
301 rMarkEntries.back().nRow = std::max(nEndRow, rMarkEntries.back().nRow);
307 rMarkEntries.emplace_back(
ScMarkEntry{nStartRow-1,
false});
308 rMarkEntries.emplace_back(
ScMarkEntry{nEndRow,
true});
311 nMaxCol = std::max(nMaxCol, nEndCol);
316 for (
SCCOL nCol = 0; nCol<=nMaxCol; ++nCol)
317 if (!aMarkEntriesPerCol[nCol].empty())
331 return ( nLast >= nEndRow );
339 while( aMultiIter.
Next( nTop, nBottom ) )
349 if ( aPair.HasMarks() )
366 for (
SCCOL nSearchPos = nStartCol; nSearchPos < nEndPos; ++nSearchPos)
373 SCCOL nDestCol = nCol;
374 if (nDestCol >= nStartCol)
376 nDestCol += nColOffset;
398 rNewCol.Intersect(rPrevPos);
408 aPair.Shift(nStartRow, nRowOffset);
420 aMarkArrayIter(nullptr),
427 if (bHasMarks1 && bHasMarks2)
434 while ( aMarkIter.
Next( nTop, nBottom ) )
441 while ( aMarkIter.
Next( nTop, nBottom ) )
461 if ( bRet && !aRowRange.
mbValue )
469 rBottom = aRowRange.
mnRow2;
481 return pRowSegs->getRangeData( nRow, rRowRange);
void PutInOrder(T &nStart, T &nEnd)
bool Next(SCROW &rTop, SCROW &rBottom)
void reset(const ScMarkArray *pNewArray)
This is a rather odd datastructure.
SCROW GetNextMarked(SCROW nRow, bool bUp) const
Including current row, may return -1 if bUp and not found.
bool IsAllMarked(SCROW nStartRow, SCROW nEndRow) const
void Shift(SCROW nStartRow, tools::Long nOffset)
SCROW GetMarkEnd(SCROW nRow, bool bUp) const
void Reset(bool bMarked=false, SCSIZE nNeeded=1)
void SetMarkArea(SCROW nStartRow, SCROW nEndRow, bool bMarked)
bool GetMark(SCROW nRow) const
bool HasOneMark(SCROW &rStartRow, SCROW &rEndRow) const
bool GetRangeData(SCROW nRow, ScFlatBoolRowSegments::RangeData &rRowRange) const
Only to be used by ScMultiSel::IsAllMarked() or otherwise sure that a segment tree is actually used.
std::unique_ptr< ScFlatBoolRowSegments > pRowSegs
ScMarkArrayIter aMarkArrayIter
bool Next(SCROW &rTop, SCROW &rBottom)
ScMultiSelIter(const ScMultiSel &rMultiSel, SCCOL nCol)
bool GetMark(SCCOL nCol, SCROW nRow) const
bool HasOneMark(SCCOL nCol, SCROW &rStartRow, SCROW &rEndRow) const
bool IsAllMarked(SCCOL nCol, SCROW nStartRow, SCROW nEndRow) const
ScMultiSel & operator=(const ScMultiSel &rMultiSel)
const ScSheetLimits & mrSheetLimits
ScMarkArray GetMarkArray(SCCOL nCol) const
bool IsRowMarked(SCROW nRow) const
const ScMarkArray * GetMultiSelArray(SCCOL nCol) const
std::vector< ScMarkArray > aMultiSelContainer
SCCOL GetStartOfEqualColumns(SCCOL nLastCol, SCCOL nMinCol=0) const
void ShiftRows(SCROW nStartRow, sal_Int32 nRowOffset)
SCCOL GetMultiSelectionCount() const
ScMultiSel(ScSheetLimits const &)
void Set(ScRangeList const &)
optimised init-from-range-list.
void MarkAllCols(SCROW nStartRow, SCROW nEndRow)
void ShiftCols(SCCOL nStartCol, sal_Int32 nColOffset)
bool HasMarks(SCCOL nCol) const
bool HasEqualRowsMarked(SCCOL nCol1, SCCOL nCol2) const
bool IsRowRangeMarked(SCROW nStartRow, SCROW nEndRow) const
void SetMarkArea(SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow, bool bMark)
SCROW GetNextMarked(SCCOL nCol, SCROW nRow, bool bUp) const
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
SCROW GetMaxRowCount() const
const SCROW mnMaxRow
Maximum addressable column.