sc/inc/table.hxx | 3 - sc/source/core/data/table1.cxx | 103 +++++++++++++++++++------------------- sc/source/core/data/table2.cxx | 110 ++++++++++++++++++++--------------------- sc/source/core/data/table3.cxx | 16 ++--- sc/source/core/data/table4.cxx | 8 +- sc/source/core/data/table5.cxx | 40 +++++++------- sc/source/core/data/table6.cxx | 18 +++--- sc/source/core/data/table7.cxx | 16 ++--- 8 files changed, 158 insertions(+), 156 deletions(-)
New commits: commit f8641f0106ee45731449966f798957a8dc09cfb6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 12 13:23:06 2019 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Nov 12 15:28:58 2019 +0100 sc: rowcol: tdf#50916 convert core/data/table* Change-Id: I7b1c5f76000a55519785b6612ab1949d47dc53d4 Reviewed-on: https://gerrit.libreoffice.org/82510 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 4126d4640942..823b3f7bafde 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1242,7 +1242,7 @@ private: static constexpr SCROW ROW_NOT_FOUND = -1; public: - explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn); + explicit VisibleDataCellIterator(const ScDocument* pDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn); ~VisibleDataCellIterator(); /** @@ -1270,6 +1270,7 @@ private: SCROW getRow() const { return mnCurRow;} private: + const ScDocument* mpDocument; ScFlatBoolRowSegments& mrRowSegs; ScColumn& mrColumn; ScRefCellValue maCell; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 84c4210775c4..a7f8991c0276 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -273,14 +273,14 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName, { if (bColInfo) { - mpColWidth.reset( new ScCompressedArray<SCCOL, sal_uInt16>( MAXCOL+1, STD_COL_WIDTH ) ); - mpColFlags.reset( new ScBitMaskCompressedArray<SCCOL, CRFlags>( MAXCOL+1, CRFlags::NONE ) ); + mpColWidth.reset( new ScCompressedArray<SCCOL, sal_uInt16>( pDocument->MaxCol()+1, STD_COL_WIDTH ) ); + mpColFlags.reset( new ScBitMaskCompressedArray<SCCOL, CRFlags>( pDocument->MaxCol()+1, CRFlags::NONE ) ); } if (bRowInfo) { mpRowHeights.reset(new ScFlatUInt16RowSegments(ScGlobal::nStdRowHeight)); - pRowFlags.reset(new ScBitMaskCompressedArray<SCROW, CRFlags>( MAXROW, CRFlags::NONE)); + pRowFlags.reset(new ScBitMaskCompressedArray<SCROW, CRFlags>( pDocument->MaxRow(), CRFlags::NONE)); } if ( pDocument->IsDocVisible() ) @@ -296,8 +296,8 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName, if ( pDrawLayer->ScAddPage( nTab ) ) // sal_False (not inserted) during Undo { pDrawLayer->ScRenamePage( nTab, aName ); - sal_uLong const nx = sal_uLong(double(MAXCOL+1) * STD_COL_WIDTH * HMM_PER_TWIPS ); - sal_uLong ny = static_cast<sal_uLong>(double(MAXROW+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS ); + sal_uLong const nx = sal_uLong(double(pDocument->MaxCol()+1) * STD_COL_WIDTH * HMM_PER_TWIPS ); + sal_uLong ny = static_cast<sal_uLong>(double(pDocument->MaxRow()+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS ); pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( nx, ny ), false ); } } @@ -599,7 +599,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const } } - if (nMaxX == MAXCOL) // omit attribute at the right + if (nMaxX == pDocument->MaxCol()) // omit attribute at the right { --nMaxX; while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1]) ) @@ -654,7 +654,7 @@ bool ScTable::GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow, } } - if (nMaxX == MAXCOL) // omit attribute at the right + if (nMaxX == pDocument->MaxCol()) // omit attribute at the right { --nMaxX; while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1], nStartRow, nEndRow) ) @@ -723,7 +723,7 @@ bool ScTable::GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const { bool bFound = false; SCCOL nMinX = aCol.size()-1; - SCROW nMinY = MAXROW; + SCROW nMinY = pDocument->MaxRow(); SCCOL i; for (i=0; i<aCol.size(); i++) // Test attribute @@ -815,7 +815,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S SCROW nStart = rStartRow; SCROW nEnd = rEndRow; if (nStart>0) --nStart; - if (nEnd<MAXROW) ++nEnd; + if (nEnd<pDocument->MaxRow()) ++nEnd; if (rEndCol < (aCol.size()-1)) if (!aCol[rEndCol+1].IsEmptyBlock(nStart,nEnd)) @@ -852,7 +852,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S } } - if (rEndRow < MAXROW) + if (rEndRow < pDocument->MaxRow()) { SCROW nTest = rEndRow+1; bool needExtend = false; @@ -879,7 +879,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S while ( rEndCol > 0 && rStartCol < rEndCol && aCol[rEndCol].IsEmptyBlock(rStartRow,rEndRow) ) --rEndCol; - if ( !bTop && rStartRow < MAXROW && rStartRow < rEndRow ) + if ( !bTop && rStartRow < pDocument->MaxRow() && rStartRow < rEndRow ) { bool bShrink = true; do @@ -889,7 +889,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S bShrink = false; if (bShrink) ++rStartRow; - } while (bShrink && rStartRow < MAXROW && rStartRow < rEndRow); + } while (bShrink && rStartRow < pDocument->MaxRow() && rStartRow < rEndRow); } } @@ -971,9 +971,9 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS rEndCol = aCol.size()-1; o_bShrunk = true; } - if (rEndRow > MAXROW) + if (rEndRow > pDocument->MaxRow()) { - rEndRow = MAXROW; + rEndRow = pDocument->MaxRow(); o_bShrunk = true; } @@ -1173,12 +1173,12 @@ SCCOL ScTable::FindNextVisibleCol( SCCOL nCol, bool bRight ) const if(bHidden) nCol = nEnd +1; - return std::min<SCCOL>(MAXCOL, nCol); + return std::min<SCCOL>(pDocument->MaxCol(), nCol); } else { nCol--; - SCCOL nStart = MAXCOL; + SCCOL nStart = pDocument->MaxCol(); bool bHidden = pDocument->ColHidden(nCol, nTab, &nStart); if(bHidden) nCol = nStart - 1; @@ -1193,9 +1193,9 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo if(bRight) { // If nCol is the last allocated column index, there won't be any content to its right. - // To maintain the original return behaviour, return MAXCOL. + // To maintain the original return behaviour, return pDocument->MaxCol(). if(nCol >= nLastCol) - return MAXCOL; + return pDocument->MaxCol(); do { @@ -1206,9 +1206,9 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo { nCol = nEndCol +1; // Can end search early as there is no data after nLastCol. - // For nCol == nLastCol, it may still have data so don't want to return MAXCOL. + // For nCol == nLastCol, it may still have data so don't want to return pDocument->MaxCol(). if(nCol > nLastCol) - return MAXCOL; + return pDocument->MaxCol(); } if(aCol[nCol].HasVisibleDataAt(nRow)) @@ -1216,11 +1216,11 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo } while(nCol < nLastCol); // Stop search as soon as the last allocated column is searched. - return MAXCOL; + return pDocument->MaxCol(); } else { - // If nCol is in the unallocated range [nLastCol+1, MAXCOL], then move it directly to nLastCol + // If nCol is in the unallocated range [nLastCol+1, pDocument->MaxCol()], then move it directly to nLastCol // as there is no data in the unallocated range. This also makes the search faster and avoids // the need for more range checks in the loop below. if ( nCol > nLastCol ) @@ -1232,7 +1232,7 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo do { nCol--; - SCCOL nStartCol = MAXCOL; + SCCOL nStartCol = pDocument->MaxCol(); bool bHidden = pDocument->ColHidden( nCol, nTab, &nStartCol ); if(bHidden) { @@ -1261,7 +1261,7 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection bool bRight = (eDirection == SC_MOVE_RIGHT); if (bThere) { - if(nNewCol >= MAXCOL && eDirection == SC_MOVE_RIGHT) + if(nNewCol >= pDocument->MaxCol() && eDirection == SC_MOVE_RIGHT) return; else if(nNewCol == 0 && eDirection == SC_MOVE_LEFT) return; @@ -1280,7 +1280,7 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection else bFound = true; } - while(!bFound && nNextCol > 0 && nNextCol < MAXCOL); + while(!bFound && nNextCol > 0 && nNextCol < pDocument->MaxCol()); } else { @@ -1294,8 +1294,8 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection if (nNewCol<0) nNewCol=0; - if (nNewCol>MAXCOL) - nNewCol=MAXCOL; + if (nNewCol>pDocument->MaxCol()) + nNewCol=pDocument->MaxCol(); rCol = nNewCol; } else @@ -1305,9 +1305,9 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection else { // The cell (rCol, rRow) is equivalent to an empty cell (although not allocated). - // Set rRow to 0 or MAXROW depending on eDirection to maintain the behaviour of + // Set rRow to 0 or pDocument->MaxRow() depending on eDirection to maintain the behaviour of // ScColumn::FindDataAreaPos() when the given column is empty. - rRow = ( eDirection == SC_MOVE_DOWN ) ? MAXROW : 0; + rRow = ( eDirection == SC_MOVE_DOWN ) ? pDocument->MaxRow() : 0; } } } @@ -1358,7 +1358,7 @@ bool ScTable::SkipRow( const SCCOL nCol, SCROW& rRow, const SCROW nMovY, if (bSheetProtected && pDocument->HasAttrib( nCol, rRow, nTab, nCol, rRow, nTab, HasAttrFlags::Protected)) { if ( rRow > nUsedY ) - rRow = (bUp ? nUsedY : MAXROW + nMovY); + rRow = (bUp ? nUsedY : pDocument->MaxRow() + nMovY); else rRow += nMovY; @@ -1434,8 +1434,8 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, // visually different from empty") to enable travelling through // protected forms with empty cells and no visual indicator. // 42 might be good enough and not too much... - nEndCol = std::min<SCCOL>( nEndCol+42, MAXCOL); - nEndRow = std::min<SCROW>( nEndRow+42, MAXROW); + nEndCol = std::min<SCCOL>( nEndCol+42, pDocument->MaxCol()); + nEndRow = std::min<SCROW>( nEndRow+42, pDocument->MaxRow()); } else { @@ -1608,10 +1608,10 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa while ( rCol < aCol.size() ) { ScMarkArray aArray( rMark.GetMarkArray( rCol ) ); - while ( rRow <= MAXROW ) + while ( rRow <= pDocument->MaxRow() ) { SCROW nStart = aArray.GetNextMarked( rRow, false ); - if ( nStart <= MAXROW ) + if ( nStart <= pDocument->MaxRow() ) { SCROW nEnd = aArray.GetMarkEnd( nStart, false ); @@ -1627,7 +1627,7 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa if (it == rCells.end()) { // No more block. Move on to the next column. - rRow = MAXROW + 1; + rRow = pDocument->MaxRow() + 1; continue; } } @@ -1642,14 +1642,14 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa rRow = nEnd + 1; // Search for next selected range } else - rRow = MAXROW + 1; // End of column + rRow = pDocument->MaxRow() + 1; // End of column } rRow = 0; ++rCol; // test next column } - // Though searched only the allocated columns, it is equivalent to a search till MAXCOL. - rCol = MAXCOL + 1; + // Though searched only the allocated columns, it is equivalent to a search till pDocument->MaxCol(). + rCol = pDocument->MaxCol() + 1; return false; // Through all columns } @@ -1689,7 +1689,7 @@ void ScTable::UpdateReference( else { i = 0; - iMax = MAXCOL; + iMax = pDocument->MaxCol(); } UpdateRefMode eUpdateRefMode = rCxt.meMode; @@ -1783,7 +1783,7 @@ void ScTable::UpdateReference( { UpdatePageBreaks(nullptr); - pDocument->RepaintRange( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab) ); + pDocument->RepaintRange( ScRange(0,0,nTab,pDocument->MaxCol(),pDocument->MaxRow(),nTab) ); } } @@ -1830,7 +1830,7 @@ void ScTable::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) if (pTabProtection) pTabProtection->updateReference( URM_INSDEL, pDocument, - ScRange( 0, 0, rCxt.mnInsertPos, MAXCOL, MAXROW, MAXTAB), + ScRange( 0, 0, rCxt.mnInsertPos, pDocument->MaxCol(), pDocument->MaxRow(), MAXTAB), 0, 0, rCxt.mnSheets); for (SCCOL i=0; i < aCol.size(); i++) @@ -1859,7 +1859,7 @@ void ScTable::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) if (pTabProtection) pTabProtection->updateReference( URM_INSDEL, pDocument, - ScRange( 0, 0, rCxt.mnDeletePos, MAXCOL, MAXROW, MAXTAB), + ScRange( 0, 0, rCxt.mnDeletePos, pDocument->MaxCol(), pDocument->MaxRow(), MAXTAB), 0, 0, -rCxt.mnSheets); for (SCCOL i = 0; i < aCol.size(); ++i) @@ -1883,7 +1883,7 @@ void ScTable::UpdateMoveTab( if (pTabProtection) pTabProtection->updateReference( URM_REORDER, pDocument, - ScRange( 0, 0, rCxt.mnOldPos, MAXCOL, MAXROW, MAXTAB), + ScRange( 0, 0, rCxt.mnOldPos, pDocument->MaxCol(), pDocument->MaxRow(), MAXTAB), 0, 0, rCxt.mnNewPos - rCxt.mnOldPos); for ( SCCOL i=0; i < aCol.size(); i++ ) @@ -1934,8 +1934,8 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev, // First, mark those columns that we need to skip i.e. hidden and empty columns. ScFlatBoolColSegments aSkipCols; - aSkipCols.setFalse(0, MAXCOL); - for (SCCOL i = 0; i <= MAXCOL; ++i) + aSkipCols.setFalse(0, pDocument->MaxCol()); + for (SCCOL i = 0; i <= pDocument->MaxCol(); ++i) { SCCOL nLastCol = i; if (ColHidden(i, nullptr, &nLastCol)) @@ -1950,7 +1950,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev, { if ( j >= aCol.size() ) { - aSkipCols.setTrue( j, MAXCOL ); + aSkipCols.setTrue( j, pDocument->MaxCol() ); break; } if (aCol[j].GetCellCount() == 0) @@ -1979,7 +1979,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev, for (SCCOL nDataCol = nCol; 0 <= nDataCol && nDataCol >= aColData.mnCol1; --nDataCol) { SCCOL nPrintCol = nDataCol; - VisibleDataCellIterator aIter(*mpHiddenRows, aCol[nDataCol]); + VisibleDataCellIterator aIter(pDocument, *mpHiddenRows, aCol[nDataCol]); ScRefCellValue aCell = aIter.reset(nStartRow); if (aCell.isEmpty()) // No visible cells found in this column. Skip it. @@ -2057,7 +2057,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d } SCCOL nNewCol = rCol; - while (nMissing > 0 && nNewCol < MAXCOL) + while (nMissing > 0 && nNewCol < pDocument->MaxCol()) { auto nNextCol = nNewCol + 1; bool bNextEmpty = true; @@ -2193,7 +2193,8 @@ void ScTable::RestorePrintRanges( const ScPrintSaverTab& rSaveTab ) UpdatePageBreaks(nullptr); } -ScTable::VisibleDataCellIterator::VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn) : +ScTable::VisibleDataCellIterator::VisibleDataCellIterator(const ScDocument* pDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn) : + mpDocument(pDoc), mrRowSegs(rRowSegs), mrColumn(rColumn), mnCurRow(ROW_NOT_FOUND), @@ -2207,7 +2208,7 @@ ScTable::VisibleDataCellIterator::~VisibleDataCellIterator() ScRefCellValue ScTable::VisibleDataCellIterator::reset(SCROW nRow) { - if (nRow > MAXROW) + if (nRow > mpDocument->MaxRow()) { mnCurRow = ROW_NOT_FOUND; return ScRefCellValue(); @@ -2232,7 +2233,7 @@ ScRefCellValue ScTable::VisibleDataCellIterator::reset(SCROW nRow) // the next segment. mnCurRow = aData.mnRow2 + 1; mnUBound = mnCurRow; // get range data on the next iteration. - if (mnCurRow > MAXROW) + if (mnCurRow > mpDocument->MaxRow()) { // Make sure the row doesn't exceed our current limit. mnCurRow = ROW_NOT_FOUND; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 2b300d8e0448..4c36c7b63494 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -132,7 +132,7 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SC { bool bTest = true; - if ( nStartCol==0 && nEndCol==MAXCOL && pOutlineTable ) + if ( nStartCol==0 && nEndCol==pDocument->MaxCol() && pOutlineTable ) bTest = pOutlineTable->TestInsertRow(nSize); for (SCCOL i=nStartCol; (i<=nEndCol) && bTest; i++) @@ -143,7 +143,7 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SC void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) { - if (nStartCol==0 && nEndCol==MAXCOL) + if (nStartCol==0 && nEndCol==pDocument->MaxCol()) { if (mpRowHeights && pRowFlags) { @@ -193,7 +193,7 @@ void ScTable::DeleteRow( const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, bool* pUndoOutline, std::vector<ScAddress>* pGroupPos ) { - if (nStartCol==0 && nEndCol==MAXCOL) + if (nStartCol==0 && nEndCol==pDocument->MaxCol()) { if (pRowFlags) pRowFlags->Remove( nStartRow, nSize); @@ -249,14 +249,14 @@ void ScTable::DeleteRow( bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const { - if ( nSize > static_cast<SCSIZE>(MAXCOL) ) + if ( nSize > static_cast<SCSIZE>(pDocument->MaxCol()) ) return false; - if ( nStartRow==0 && nEndRow==MAXROW && pOutlineTable + if ( nStartRow==0 && nEndRow==pDocument->MaxRow() && pOutlineTable && ! pOutlineTable->TestInsertCol(nSize) ) return false; - auto range = GetColumnsRange( MAXCOL - static_cast<SCCOL>(nSize) + 1, MAXCOL ); + auto range = GetColumnsRange( pDocument->MaxCol() - static_cast<SCCOL>(nSize) + 1, pDocument->MaxCol() ); for (auto it = range.rbegin(); it != range.rend(); ++it ) if (! aCol[*it].TestInsertCol(nStartRow, nEndRow)) return false; @@ -267,13 +267,13 @@ bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) cons void ScTable::InsertCol( const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) { - if (nStartRow==0 && nEndRow==MAXROW) + if (nStartRow==0 && nEndRow==pDocument->MaxRow()) { if (mpColWidth && mpColFlags) { mpColWidth->InsertPreservingSize(nStartCol, nSize, STD_COL_WIDTH); // The inserted columns have the same widths as the columns, which were selected for insert. - for (SCSIZE i=0; i < std::min(MAXCOL-nSize-nStartCol, nSize); ++i) + for (SCSIZE i=0; i < std::min(pDocument->MaxCol()-nSize-nStartCol, nSize); ++i) mpColWidth->SetValue(nStartCol + i, mpColWidth->GetValue(nStartCol+i+nSize)); mpColFlags->InsertPreservingSize(nStartCol, nSize, CRFlags::NONE); } @@ -299,7 +299,7 @@ void ScTable::InsertCol( } } - if ((nStartRow == 0) && (nEndRow == MAXROW)) + if ((nStartRow == 0) && (nEndRow == pDocument->MaxRow())) { for (SCSIZE i=0; i < nSize; i++) for (SCCOL nCol = aCol.size() - 1; nCol > nStartCol; nCol--) @@ -344,11 +344,11 @@ void ScTable::InsertCol( void ScTable::DeleteCol( const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline ) { - if (nStartRow==0 && nEndRow==MAXROW) + if (nStartRow==0 && nEndRow==pDocument->MaxRow()) { if (mpColWidth && mpColFlags) { - assert( nStartCol + nSize <= MAXCOL+1 ); // moving 0 if ==MAXCOL+1 is correct + assert( nStartCol + nSize <= size_t(pDocument->MaxCol()+1) ); // moving 0 if ==pDocument->MaxCol()+1 is correct mpColWidth->RemovePreservingSize(nStartCol, nSize, STD_COL_WIDTH); mpColFlags->RemovePreservingSize(nStartCol, nSize, CRFlags::NONE); } @@ -384,7 +384,7 @@ void ScTable::DeleteCol( for (SCSIZE i = 0; i < nSize; i++) aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, InsertDeleteFlags::ALL, false); - if ((nStartRow == 0) && (nEndRow == MAXROW)) + if ((nStartRow == 0) && (nEndRow == pDocument->MaxRow())) { for (SCSIZE i=0; i < nSize; i++) for (SCCOL nCol = nStartCol; nCol < aCol.size() - 1; nCol++) @@ -412,7 +412,7 @@ void ScTable::DeleteArea( bool bBroadcast, sc::ColumnSpanSet* pBroadcastSpans ) { if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1; - if (nRow2 > MAXROW) nRow2 = MAXROW; + if (nRow2 > pDocument->MaxRow()) nRow2 = pDocument->MaxRow(); if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { { // scope for bulk broadcast @@ -713,10 +713,10 @@ void ScTable::CopyFromClip( sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, ScTable* pTable ) { - if (nCol2 > MAXCOL) - nCol2 = MAXCOL; - if (nRow2 > MAXROW) - nRow2 = MAXROW; + if (nCol2 > pDocument->MaxCol()) + nCol2 = pDocument->MaxCol(); + if (nRow2 > pDocument->MaxRow()) + nRow2 = pDocument->MaxRow(); if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { @@ -739,10 +739,10 @@ void ScTable::CopyFromClip( if ((rCxt.getInsertFlag() & InsertDeleteFlags::ATTRIB) != InsertDeleteFlags::NONE) { - if (nRow1==0 && nRow2==MAXROW && mpColWidth && pTable->mpColWidth) + if (nRow1==0 && nRow2==pDocument->MaxRow() && mpColWidth && pTable->mpColWidth) mpColWidth->CopyFrom(*pTable->mpColWidth, nCol1, nCol2, nCol1 - nDx); - if (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pTable->mpRowHeights && + if (nCol1==0 && nCol2==pDocument->MaxCol() && mpRowHeights && pTable->mpRowHeights && pRowFlags && pTable->pRowFlags) { CopyRowHeight(*pTable, nRow1, nRow2, -nDy); @@ -969,10 +969,10 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (rOldMerge.IsMerged()) rNewSet.Put( ScMergeAttr( std::min( static_cast<SCCOL>(rOldMerge.GetRowMerge()), - static_cast<SCCOL>(MAXCOL+1 - (nAttrRow2-nRow1))), + static_cast<SCCOL>(pDocument->MaxCol()+1 - (nAttrRow2-nRow1))), std::min( static_cast<SCROW>(rOldMerge.GetColMerge()), - static_cast<SCROW>(MAXROW+1 - (nCol-nCol1))))); + static_cast<SCROW>(pDocument->MaxRow()+1 - (nCol-nCol1))))); const ScMergeFlagAttr& rOldFlag = rSet.Get(ATTR_MERGE_FLAG); if (rOldFlag.IsOverlapped()) { @@ -1138,8 +1138,8 @@ void ScTable::SetDirtyFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans ) { if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1; - if (nCol2 > MAXCOL) nCol2 = MAXCOL; - if (nRow2 > MAXROW) nRow2 = MAXROW; + if (nCol2 > pDocument->MaxCol()) nCol2 = pDocument->MaxCol(); + if (nRow2 > pDocument->MaxRow()) nRow2 = pDocument->MaxRow(); if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) for (SCCOL i = nCol1; i <= nCol2; i++) aCol[i].SetDirtyFromClip(nRow1, nRow2, rBroadcastSpans); @@ -1150,8 +1150,8 @@ void ScTable::StartListeningFormulaCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) { if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1; - if (nCol2 > MAXCOL) nCol2 = MAXCOL; - if (nRow2 > MAXROW) nRow2 = MAXROW; + if (nCol2 > pDocument->MaxCol()) nCol2 = pDocument->MaxCol(); + if (nRow2 > pDocument->MaxRow()) nRow2 = pDocument->MaxRow(); if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) for (SCCOL i = nCol1; i <= nCol2; i++) aCol[i].StartListeningFormulaCells(rStartCxt, rEndCxt, nRow1, nRow2); @@ -1202,8 +1202,8 @@ void ScTable::CopyToTable( bool bFlagChange = false; - bool bWidth = (nRow1==0 && nRow2==MAXROW && mpColWidth && pDestTab->mpColWidth); - bool bHeight = (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pDestTab->mpRowHeights); + bool bWidth = (nRow1==0 && nRow2==pDocument->MaxRow() && mpColWidth && pDestTab->mpColWidth); + bool bHeight = (nCol1==0 && nCol2==pDocument->MaxCol() && mpRowHeights && pDestTab->mpRowHeights); if (bWidth || bHeight) { @@ -1221,7 +1221,7 @@ void ScTable::CopyToTable( pDestTab->SetColHidden(i, i, bThisHidden); //TODO: collect changes? if (bHiddenChange && pCharts) - pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab )); + pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, pDocument->MaxRow(), nTab )); if (bChange) bFlagChange = true; @@ -1254,7 +1254,7 @@ void ScTable::CopyToTable( bool bHiddenChanged = pDestTab->SetRowHidden(i, nLastRow, bHidden); if (bHiddenChanged && pCharts) // Hidden flags differ. - pCharts->SetRangeDirty(ScRange(0, i, nTab, MAXCOL, nLastRow, nTab)); + pCharts->SetRangeDirty(ScRange(0, i, nTab, pDocument->MaxCol(), nLastRow, nTab)); if (bHiddenChanged) bFlagChange = true; @@ -1317,15 +1317,15 @@ void ScTable::UndoToTable( { if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { - bool bWidth = (nRow1==0 && nRow2==MAXROW && mpColWidth && pDestTab->mpColWidth); - bool bHeight = (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pDestTab->mpRowHeights); + bool bWidth = (nRow1==0 && nRow2==pDocument->MaxRow() && mpColWidth && pDestTab->mpColWidth); + bool bHeight = (nCol1==0 && nCol2==pDocument->MaxCol() && mpRowHeights && pDestTab->mpRowHeights); for ( SCCOL i = 0; i < aCol.size(); i++) { if ( i >= nCol1 && i <= nCol2 ) aCol[i].UndoToColumn(rCxt, nRow1, nRow2, nFlags, bMarked, pDestTab->aCol[i]); else - aCol[i].CopyToColumn(rCxt, 0, MAXROW, InsertDeleteFlags::FORMULA, false, pDestTab->aCol[i]); + aCol[i].CopyToColumn(rCxt, 0, pDocument->MaxRow(), InsertDeleteFlags::FORMULA, false, pDestTab->aCol[i]); } if (nFlags & InsertDeleteFlags::ATTRIB) @@ -1489,7 +1489,7 @@ SCROW ScTable::GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW return -1; nCol2 = ClampToAllocatedColumns(nCol2); - SCROW nFirst = MAXROW+1; + SCROW nFirst = pDocument->MaxRow()+1; for (SCCOL i = nCol1; i <= nCol2; ++i) { const ScColumn& rCol = aCol[i]; @@ -1504,7 +1504,7 @@ SCROW ScTable::GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW } } - return nFirst == (MAXROW+1) ? -1 : nFirst; + return nFirst == (pDocument->MaxRow()+1) ? -1 : nFirst; } void ScTable::SetEmptyCell( SCCOL nCol, SCROW nRow ) @@ -1734,7 +1734,7 @@ CommentCaptionState ScTable::GetAllNoteCaptionsState(const ScRange& rRange, std: void ScTable::GetUnprotectedCells( ScRangeList& rRangeList ) const { for (auto const & pCol : aCol) - pCol->GetUnprotectedCells(0, MAXROW, rRangeList); + pCol->GetUnprotectedCells(0, pDocument->MaxRow(), rRangeList); } bool ScTable::ContainsNotesInRange( const ScRange& rRange ) const @@ -1770,7 +1770,7 @@ ScRefCellValue ScTable::GetCellValue( SCCOL nCol, SCROW nRow ) const void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const { rCol = 0; - rRow = MAXROW+1; + rRow = pDocument->MaxRow()+1; while (rCol < (aCol.size() - 1) && aCol[rCol].IsEmptyData() ) ++rCol; SCCOL nCol = rCol; @@ -1789,7 +1789,7 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const while (aCol[rCol].IsEmptyData() && (rCol > 0)) rCol--; SCCOL nCol = rCol; - while (nCol >= 0 && rRow < MAXROW) + while (nCol >= 0 && rRow < pDocument->MaxRow()) rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos()); } @@ -2208,7 +2208,7 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC SCROW nY1 = pRowInfo[0].nRowNo; SCROW nY2 = pRowInfo[nArrCount-1].nRowNo; - for (SCCOL nCol : GetColumnsRange(0, MAXCOL)) + for (SCCOL nCol : GetColumnsRange(0, pDocument->MaxCol())) { if (!ColHidden(nCol)) { @@ -2697,7 +2697,7 @@ void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S { PutInOrder(nStartCol, nEndCol); PutInOrder(nStartRow, nEndRow); - if ( nEndCol == MAXCOL ) + if ( nEndCol == pDocument->MaxCol() ) { if ( nStartCol < aCol.size() ) { @@ -2826,7 +2826,7 @@ void ScTable::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRem sc::RowHeightContext aCxt(nPPTX, nPPTY, rZoomX, rZoomY, pDev); SCROW nRow = 0; - while (nRow <= MAXROW) + while (nRow <= pDocument->MaxRow()) { ScFlatBoolRowSegments::RangeData aData; if (!aUsedRows.getRangeData(nRow, aData)) @@ -3132,7 +3132,7 @@ sal_uInt16 ScTable::GetCommonWidth( SCCOL nEndCol ) const if ( !ValidCol(nEndCol) ) { OSL_FAIL("wrong column"); - nEndCol = MAXCOL; + nEndCol = pDocument->MaxCol(); } sal_uInt16 nMaxWidth = 0; @@ -3320,7 +3320,7 @@ void ScTable::ShowCol(SCCOL nCol, bool bShow) ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) - pCharts->SetRangeDirty(ScRange( nCol, 0, nTab, nCol, MAXROW, nTab )); + pCharts->SetRangeDirty(ScRange( nCol, 0, nTab, nCol, pDocument->MaxRow(), nTab )); } } else @@ -3341,7 +3341,7 @@ void ScTable::ShowRow(SCROW nRow, bool bShow) SetRowFiltered(nRow, nRow, false); ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) - pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, MAXCOL, nRow, nTab )); + pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, pDocument->MaxCol(), nRow, nTab )); InvalidatePageBreaks(); } @@ -3364,7 +3364,7 @@ void ScTable::DBShowRow(SCROW nRow, bool bShow) { ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) - pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, MAXCOL, nRow, nTab )); + pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, pDocument->MaxCol(), nRow, nTab )); if (pOutlineTable) UpdateOutlineRow( nRow, nRow, bShow ); @@ -3397,7 +3397,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow) { ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) - pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab )); + pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, pDocument->MaxCol(), nEndRow, nTab )); } nStartRow = nEndRow + 1; @@ -3435,7 +3435,7 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) { ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) - pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab )); + pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, pDocument->MaxCol(), nEndRow, nTab )); InvalidatePageBreaks(); } @@ -3596,7 +3596,7 @@ void ScTable::ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ) while (rX1 > 0 && ColHidden(rX1-1)) --rX1; - while (rX2 < MAXCOL && ColHidden(rX2+1)) + while (rX2 < pDocument->MaxCol() && ColHidden(rX2+1)) ++rX2; // Row-wise expansion @@ -3611,7 +3611,7 @@ void ScTable::ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ) rY1 = nStartRow; } } - if (rY2 < MAXROW) + if (rY2 < pDocument->MaxRow()) { SCROW nEndRow = -1; if (RowHidden(rY2+1, nullptr, &nEndRow) && ValidRow(nEndRow)) @@ -3704,7 +3704,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC // Rows - UsedRowsType aUsed(0, MAXROW+1, false); + UsedRowsType aUsed(0, pDocument->MaxRow()+1, false); for (nCol=nStartCol; nCol<=nEndCol; nCol++) aCol[nCol].FindUsed(nStartRow, nEndRow, aUsed); aUsed.build_tree(); @@ -3845,8 +3845,8 @@ void ScTable::SetDrawPageSize(bool bResetStreamValid, bool bUpdateNoteCaptionPos ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if( pDrawLayer ) { - double fValX = GetColOffset( MAXCOL + 1 ) * HMM_PER_TWIPS; - double fValY = GetRowOffset( MAXROW + 1 ) * HMM_PER_TWIPS; + double fValX = GetColOffset( pDocument->MaxCol() + 1 ) * HMM_PER_TWIPS; + double fValY = GetRowOffset( pDocument->MaxRow() + 1 ) * HMM_PER_TWIPS; const long nMax = ::std::numeric_limits<long>::max(); // #i113884# Avoid int32 overflow with possible negative results than can cause bad effects. // If the draw page size is smaller than all rows, only the bottom of the sheet is affected. @@ -3913,7 +3913,7 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const aRowHeightRange.mnRow2 = -1; aRowHeightRange.mnValue = 0; // silence MSVC C4701 - for (SCROW nRow = 0; nRow <= MAXROW; ++nRow) + for (SCROW nRow = 0; nRow <= pDocument->MaxRow(); ++nRow) { if (!mpHiddenRows->getRangeData(nRow, aData)) // Failed to fetch the range data for whatever reason. @@ -3937,8 +3937,8 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const if (nSum > nHeight) { - if (nRow >= MAXROW) - return MAXROW; + if (nRow >= pDocument->MaxRow()) + return pDocument->MaxRow(); // Find the next visible row. ++nRow; @@ -3951,7 +3951,7 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const // These rows are hidden. nRow = aData.mnRow2 + 1; - return nRow <= MAXROW ? nRow : MAXROW; + return nRow <= pDocument->MaxRow() ? nRow : pDocument->MaxRow(); } } return -1; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index ed0bd17537a5..41a130d65f6c 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1001,7 +1001,7 @@ void ScTable::SortReorderByColumn( sc::CellStoreType& rCells = aCol[nCol].maCells; sc::CellStoreType::position_type aPos = rCells.position(nRow1); sc::SharedFormulaUtil::joinFormulaCellAbove(aPos); - if (nRow2 < MAXROW) + if (nRow2 < pDocument->MaxRow()) { aPos = rCells.position(aPos.first, nRow2+1); sc::SharedFormulaUtil::joinFormulaCellAbove(aPos); @@ -1809,7 +1809,7 @@ public: if (mrTab.HasData(nCol, nRow)) return true; } - for (SCCOL nCol : mrTab.GetColumnsRange(nEndCol + 1, MAXCOL)) + for (SCCOL nCol : mrTab.GetColumnsRange(nEndCol + 1, mrTab.GetDoc().MaxCol())) { if (mrTab.HasData(nCol, nRow)) return true; @@ -1872,7 +1872,7 @@ void ScTable::RemoveSubTotals( ScSubTotalParam& rParam ) std::for_each(aRows.rbegin(), aRows.rend(), [this](const SCROW nRow) { RemoveRowBreak(nRow+1, false, true); - pDocument->DeleteRow(0, nTab, MAXCOL, nTab, nRow, 1); + pDocument->DeleteRow(0, nTab, pDocument->MaxCol(), nTab, nRow, 1); }); rParam.nRow2 -= aRows.size(); @@ -1939,7 +1939,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) sal_uInt16 i; // Remove empty rows at the end - // so that all exceeding (MAXROW) can be found by InsertRow (#35180#) + // so that all exceeding (pDocument->MaxRow()) can be found by InsertRow (#35180#) // If sorted, all empty rows are at the end. SCSIZE nEmpty = GetEmptyLinesInBlock( nStartCol, nStartRow, nEndCol, nEndRow, DIR_BOTTOM ); nEndRow -= nEmpty; @@ -2035,10 +2035,10 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) aRowEntry.nFuncStart = aRowEntry.nSubStartRow; aRowEntry.nFuncEnd = nRow-1; - bSpaceLeft = pDocument->InsertRow( 0, nTab, MAXCOL, nTab, + bSpaceLeft = pDocument->InsertRow( 0, nTab, pDocument->MaxCol(), nTab, aRowEntry.nDestRow, 1 ); DBShowRow( aRowEntry.nDestRow, bBlockVis ); - if ( rParam.bPagebreak && nRow < MAXROW && + if ( rParam.bPagebreak && nRow < pDocument->MaxRow() && aRowEntry.nSubStartRow != nStartRow && nLevel == 0) SetRowBreak(aRowEntry.nSubStartRow, false, true); @@ -2124,7 +2124,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) // increment row nGlobalEndFunc++; - bSpaceLeft = pDocument->InsertRow(0, nTab, MAXCOL, nTab, aRowEntry.nDestRow, 1); + bSpaceLeft = pDocument->InsertRow(0, nTab, pDocument->MaxCol(), nTab, aRowEntry.nDestRow, 1); if (bSpaceLeft) { @@ -3551,7 +3551,7 @@ void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& { assert(!"ScTable::UpdateSelectionFunction - called without anything marked"); aMarkArea.aStart.SetCol(0); - aMarkArea.aEnd.SetCol(MAXCOL); + aMarkArea.aEnd.SetCol(pDocument->MaxCol()); } const SCCOL nStartCol = aMarkArea.aStart.Col(); const SCCOL nEndCol = ClampToAllocatedColumns(aMarkArea.aEnd.Col()); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 15e6cc719c9f..28b085fff466 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -2330,7 +2330,7 @@ void ScTable::UpdateInsertTabAbs(SCTAB nTable) bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel, const ScMarkData& rMark) const { - if (rRow == MAXROW+2) // end of table + if (rRow == pDocument->MaxRow()+2) // end of table { rRow = 0; rCol = 0; @@ -2338,13 +2338,13 @@ bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel, else { rRow++; - if (rRow == MAXROW+1) + if (rRow == pDocument->MaxRow()+1) { rCol++; rRow = 0; } } - if (rCol == MAXCOL+1) + if (rCol == pDocument->MaxCol()+1) return true; for (;;) { @@ -2354,7 +2354,7 @@ bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel, return true; if (aCol[rCol].GetNextSpellingCell(rRow, bInSel, rMark)) return true; - /*else (rRow == MAXROW+1) */ + /*else (rRow == pDocument->MaxRow()+1) */ rCol++; rRow = 0; } diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index f4ecec8880a4..9975d96212c5 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -76,8 +76,8 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) SCCOL nStartCol = 0; SCROW nStartRow = 0; - SCCOL nEndCol = MAXCOL; - SCROW nEndRow = MAXROW; + SCCOL nEndCol = pDocument->MaxCol(); + SCROW nEndRow = pDocument->MaxRow(); if (pUserArea) { nStartCol = pUserArea->aStart.Col(); @@ -92,10 +92,10 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) { // Show nothing, when multiple ranges - for (SCCOL nX : GetColumnsRange(0, MAXCOL)) + for (SCCOL nX : GetColumnsRange(0, pDocument->MaxCol())) RemoveColBreak(nX, true, false); - RemoveRowPageBreaks(0, MAXROW-1); + RemoveRowPageBreaks(0, pDocument->MaxRow()-1); return; } @@ -283,17 +283,17 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) // End: Remove Break - if (nEndCol < MAXCOL) + if (nEndCol < pDocument->MaxCol()) { SetColBreak(nEndCol+1, true, false); // AREABREAK - for (SCCOL nCol : GetColumnsRange(nEndCol + 2, MAXCOL)) + for (SCCOL nCol : GetColumnsRange(nEndCol + 2, pDocument->MaxCol())) RemoveColBreak(nCol, true, false); } - if (nEndRow < MAXROW) + if (nEndRow < pDocument->MaxRow()) { SetRowBreak(nEndRow+1, true, false); // AREABREAK - if (nEndRow+2 <= MAXROW) - RemoveRowPageBreaks(nEndRow+2, MAXROW); + if (nEndRow+2 <= pDocument->MaxRow()) + RemoveRowPageBreaks(nEndRow+2, pDocument->MaxRow()); } mbPageBreaksValid = !pUserArea; // #i116881# the valid flag can only apply to the "no user area" case } @@ -770,7 +770,7 @@ SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol) const SCCOL nCol = static_cast<SCCOL>(nPos); if (ColHidden(nCol)) { - for (SCCOL i = nCol+1; i <= MAXCOL; ++i) + for (SCCOL i = nCol+1; i <= pDocument->MaxCol(); ++i) { if (!ColHidden(i)) return i - 1; @@ -957,22 +957,22 @@ bool ScTable::IsManualRowHeight(SCROW nRow) const namespace { -void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, const ScFlatBoolRowSegments& rRowSegments, +void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegments, const ScFlatBoolRowSegments& rRowSegments, ScBitMaskCompressedArray<SCCOL, CRFlags>* pColFlags, ScBitMaskCompressedArray< SCROW, CRFlags>* pRowFlags, const CRFlags nFlagMask) { using ::sal::static_int_cast; CRFlags nFlagMaskComplement = ~nFlagMask; - pRowFlags->AndValue(0, MAXROW, nFlagMaskComplement); - pColFlags->AndValue(0, MAXCOL+1, nFlagMaskComplement); + pRowFlags->AndValue(0, pDocument->MaxRow(), nFlagMaskComplement); + pColFlags->AndValue(0, pDocument->MaxCol()+1, nFlagMaskComplement); { // row hidden flags. SCROW nRow = 0; ScFlatBoolRowSegments::RangeData aData; - while (nRow <= MAXROW) + while (nRow <= pDocument->MaxRow()) { if (!rRowSegments.getRangeData(nRow, aData)) break; @@ -989,7 +989,7 @@ void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, const ScFlatBoolRowSegme SCCOL nCol = 0; ScFlatBoolColSegments::RangeData aData; - while (nCol <= MAXCOL) + while (nCol <= pDocument->MaxCol()) { if (!rColSegments.getRangeData(nCol, aData)) break; @@ -1009,8 +1009,8 @@ void ScTable::SyncColRowFlags() CRFlags nManualBreakComplement = ~CRFlags::ManualBreak; // Manual breaks. - pRowFlags->AndValue(0, MAXROW, nManualBreakComplement); - mpColFlags->AndValue(0, MAXCOL+1, nManualBreakComplement); + pRowFlags->AndValue(0, pDocument->MaxRow(), nManualBreakComplement); + mpColFlags->AndValue(0, pDocument->MaxCol()+1, nManualBreakComplement); for (const auto& rBreakPos : maRowManualBreaks) pRowFlags->OrValue(rBreakPos, CRFlags::ManualBreak); @@ -1019,8 +1019,8 @@ void ScTable::SyncColRowFlags() mpColFlags->OrValue(rBreakPos, CRFlags::ManualBreak); // Hidden flags. - lcl_syncFlags(*mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Hidden); - lcl_syncFlags(*mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Filtered); + lcl_syncFlags(pDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Hidden); + lcl_syncFlags(pDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Filtered); } void ScTable::SetPageSize( const Size& rSize ) @@ -1200,7 +1200,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p const SCCOL nCol1 = pAdrFrom ? pAdrFrom->Col() : 0; const SCROW nRow1 = pAdrFrom ? pAdrFrom->Row() : 0; const SCCOL nCol2 = pAdrTo ? pAdrTo->Col() : aCol.size() - 1; - const SCROW nRow2 = pAdrTo ? pAdrTo->Row() : MAXROW; + const SCROW nRow2 = pAdrTo ? pAdrTo->Row() : pDocument->MaxRow(); for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) { diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index 4daeb308bfd7..4d099866bf77 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -333,7 +333,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, aCol[ i ].InitBlockPosition( blockPos[ i ] ); if (!bAll && rSearchItem.GetBackward()) { - SCROW nLastNonFilteredRow = MAXROW + 1; + SCROW nLastNonFilteredRow = pDocument->MaxRow() + 1; nCol = std::min(nCol, static_cast<SCCOL>(nLastCol + 1)); nRow = std::min(nRow, static_cast<SCROW>(nLastRow + 1)); if (rSearchItem.GetRowDirection()) @@ -405,7 +405,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, // Not found in this column. Move to the next column. bool bIsEmpty; nRow = nLastRow; - nLastNonFilteredRow = MAXROW + 1; + nLastNonFilteredRow = pDocument->MaxRow() + 1; do { nCol--; @@ -476,7 +476,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, else { if (!aCol[nCol].GetNextDataPos(nRow)) - nRow = MAXROW + 1; + nRow = pDocument->MaxRow() + 1; } } } @@ -627,7 +627,7 @@ bool ScTable::SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& SCROW nNextRow = aCol[nCol].SearchStyle( nRow, pSearchStyle, bBack, bSelect, rMark ); if (!ValidRow(nNextRow)) { - nRow = bBack ? MAXROW : 0; + nRow = bBack ? pDocument->MaxRow() : 0; nCol = sal::static_int_cast<SCCOL>( nCol + nAdd ); } else @@ -669,7 +669,7 @@ bool ScTable::SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& } else // forwards { - nRow = MAXROW+1; + nRow = pDocument->MaxRow()+1; for (i=0; i < aColSize; ++i) if (nNextRows[i]<nRow) { @@ -730,7 +730,7 @@ bool ScTable::SearchAllStyle( bool bFound = true; SCROW nRow = 0; SCROW nEndRow; - while (bFound && nRow <= MAXROW) + while (bFound && nRow <= pDocument->MaxRow()) { bFound = aCol[i].SearchStyleRange( nRow, nEndRow, pSearchStyle, bBack, bSelect, rMark ); if (bFound) @@ -765,7 +765,7 @@ bool ScTable::ReplaceAllStyle( if (pReplaceStyle) { if (pUndoDoc) - pDocument->CopyToDocument(0, 0 ,nTab, MAXCOL,MAXROW,nTab, + pDocument->CopyToDocument(0, 0 ,nTab, pDocument->MaxCol(),pDocument->MaxRow(),nTab, InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &rMark); ApplySelectionStyle( *pReplaceStyle, rMark ); } @@ -955,7 +955,7 @@ bool ScTable::SearchRangeForEmptyCell( if (rSearchItem.GetRowDirection()) { // row direction. - SCROW nLastNonFilteredRow = MAXROW + 1; + SCROW nLastNonFilteredRow = pDocument->MaxRow() + 1; SCROW nBeginRow = std::min(rRange.aEnd.Row(), rRow); for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow) { @@ -982,7 +982,7 @@ bool ScTable::SearchRangeForEmptyCell( SCCOL nBeginCol = std::min(rRange.aEnd.Col(), rCol); for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol) { - SCROW nLastNonFilteredRow = MAXROW + 1; + SCROW nLastNonFilteredRow = pDocument->MaxRow() + 1; SCROW nBeginRow = rRange.aEnd.Row(); if (nCol == rCol && nBeginRow >= rRow) // always start from one cell before the cursor. diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx index 76404c83afa9..29dd2ddc9041 100644 --- a/sc/source/core/data/table7.cxx +++ b/sc/source/core/data/table7.cxx @@ -141,7 +141,7 @@ void ScTable::CopyOneCellFromClip( } } - if (nCol1 == 0 && nCol2 == MAXCOL && mpRowHeights) + if (nCol1 == 0 && nCol2 == pDocument->MaxCol() && mpRowHeights) { mpRowHeights->setValue(nRow1, nRow2, pSrcTab->GetOriginalHeight(nSrcRow)); @@ -344,7 +344,7 @@ bool ScTable::IsEditActionAllowed( if (!IsProtected()) { SCCOL nCol1 = 0, nCol2 = aCol.size() - 1; - SCROW nRow1 = 0, nRow2 = MAXROW; + SCROW nRow1 = 0, nRow2 = pDocument->MaxRow(); switch (eAction) { @@ -384,7 +384,7 @@ bool ScTable::IsEditActionAllowed( case sc::ColRowEditAction::InsertColumnsAfter: { // TODO: improve the matrix range handling for the insert-before action. - if (HasBlockMatrixFragment(nStart, 0, nEnd, MAXROW)) + if (HasBlockMatrixFragment(nStart, 0, nEnd, pDocument->MaxRow())) return false; return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_COLUMNS); @@ -393,7 +393,7 @@ bool ScTable::IsEditActionAllowed( case sc::ColRowEditAction::InsertRowsAfter: { // TODO: improve the matrix range handling for the insert-before action. - if (HasBlockMatrixFragment(0, nStart, MAXCOL, nEnd)) + if (HasBlockMatrixFragment(0, nStart, pDocument->MaxCol(), nEnd)) return false; return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_ROWS); @@ -403,14 +403,14 @@ bool ScTable::IsEditActionAllowed( if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_COLUMNS)) return false; - return !HasAttrib(nStart, 0, nEnd, MAXROW, HasAttrFlags::Protected); + return !HasAttrib(nStart, 0, nEnd, pDocument->MaxRow(), HasAttrFlags::Protected); } case sc::ColRowEditAction::DeleteRows: { if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_ROWS)) return false; - return !HasAttrib(0, nStart, MAXCOL, nEnd, HasAttrFlags::Protected); + return !HasAttrib(0, nStart, pDocument->MaxCol(), nEnd, HasAttrFlags::Protected); } default: ; @@ -456,9 +456,9 @@ void ScTable::finalizeOutlineImport() void ScTable::StoreToCache(SvStream& rStrm) const { SCCOL nStartCol = 0; - SCCOL nEndCol = MAXCOL; + SCCOL nEndCol = pDocument->MaxCol(); SCROW nStartRow = 0; - SCROW nEndRow = MAXROW; + SCROW nEndRow = pDocument->MaxRow(); GetDataArea(nStartCol, nStartRow, nEndCol, nEndRow, false, false); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits