From 2b660f0bd0867bdd89f611e7ee60362b11be1874 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 17 Oct 2019 22:07:36 +0100 Subject: [PATCH] sc: rowcol: tdf#50916 chip away at some more call sites. Change-Id: Ia56c712deaaef5581a7f3f544843b44fc5c485da Reviewed-on: https://gerrit.libreoffice.org/81000 Tested-by: Jenkins Reviewed-by: Michael Meeks --- sc/source/ui/inc/viewdata.hxx | 2 ++ sc/source/ui/view/printfun.cxx | 22 +++++++++++----------- sc/source/ui/view/select.cxx | 4 ++-- sc/source/ui/view/spelleng.cxx | 4 ++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index b288b6c05dbd..52da7fba5c5b 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -393,6 +393,8 @@ public: void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; } SCTAB GetTabNo() const { return nTabNo; } + SCCOL MaxCol() const { return pDoc->MaxCol(); } + SCROW MaxRow() const { return pDoc->MaxRow(); } ScSplitPos GetActivePart() const { return pThisTab->eWhichActive; } SCCOL GetPosX( ScHSplitPos eWhich ) const; SCROW GetPosY( ScVSplitPos eWhich ) const; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 352012b093fa..d117a2250ab7 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -499,10 +499,10 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr if (nY2>nY1) --nY2; } - if (nX1 > MAXCOL) nX1 = MAXCOL; - if (nX2 > MAXCOL) nX2 = MAXCOL; - if (nY1 > MAXROW) nY1 = MAXROW; - if (nY2 > MAXROW) nY2 = MAXROW; + if (nX1 > pDoc->MaxCol()) nX1 = pDoc->MaxCol(); + if (nX2 > pDoc->MaxCol()) nX2 = pDoc->MaxCol(); + if (nY1 > pDoc->MaxRow()) nY1 = pDoc->MaxRow(); + if (nY2 > pDoc->MaxRow()) nY2 = pDoc->MaxRow(); long nDevSizeX = aRect.Right()-aRect.Left()+1; long nDevSizeY = aRect.Bottom()-aRect.Top()+1; @@ -695,8 +695,8 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew ) else { bool bFound = true; - bChangeCol = ( nStartCol == 0 && nEndCol == MAXCOL ); - bChangeRow = ( nStartRow == 0 && nEndRow == MAXROW ); + bChangeCol = ( nStartCol == 0 && nEndCol == pDoc->MaxCol() ); + bChangeRow = ( nStartRow == 0 && nEndRow == pDoc->MaxRow() ); bool bForcedChangeRow = false; // #i53558# Crop entire column of old row limit to real print area with @@ -747,10 +747,10 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew ) // changing nEndCol } - if ( nEndCol < MAXCOL && pDoc->HasAttrib( + if ( nEndCol < pDoc->MaxCol() && pDoc->HasAttrib( nEndCol,nStartRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HasAttrFlags::ShadowRight ) ) ++nEndCol; - if ( nEndRow < MAXROW && pDoc->HasAttrib( + if ( nEndRow < pDoc->MaxRow() && pDoc->HasAttrib( nStartCol,nEndRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HasAttrFlags::ShadowDown ) ) ++nEndRow; @@ -2422,7 +2422,7 @@ bool ScPrintFunc::UpdatePages() // set breaks ResetBreaks(nTab); - pDocShell->PostPaint(0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid); + pDocShell->PostPaint(0,0,nTab,pDoc->MaxCol(),pDoc->MaxRow(),nTab, PaintPartFlags::Grid); } return true; @@ -3068,9 +3068,9 @@ void PrintPageRanges::calculate(ScDocument* pDoc, pDoc->SetPageSize(nPrintTab, rDocSize); // #i123672# use dynamic mem to react on size changes - if (m_aPageEndX.size() < MAXCOL+1) + if (m_aPageEndX.size() < static_cast(pDoc->MaxCol()) + 1) { - m_aPageEndX.resize(MAXCOL+1, SCCOL()); + m_aPageEndX.resize(pDoc->MaxCol()+1, SCCOL()); } if (bPrintArea) diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 617d5232867e..489ea67cfeda 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -805,12 +805,12 @@ void ScHeaderFunctionSet::CreateAnchor() if (bColumn) { pView->InitBlockMode( static_cast(nCursorPos), 0, pViewData->GetTabNo(), true, true ); - pView->MarkCursor( static_cast(nCursorPos), MAXROW, pViewData->GetTabNo() ); + pView->MarkCursor( static_cast(nCursorPos), pViewData->MaxRow(), pViewData->GetTabNo() ); } else { pView->InitBlockMode( 0, nCursorPos, pViewData->GetTabNo(), true, false, true ); - pView->MarkCursor( MAXCOL, nCursorPos, pViewData->GetTabNo() ); + pView->MarkCursor( pViewData->MaxCol(), nCursorPos, pViewData->GetTabNo() ); } bAnchor = true; } diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index f0682b918e44..cc08e761e601 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -153,7 +153,7 @@ bool ScConversionEngineBase::FindNextConversionCell() bLoop = false; mbFinished = true; } - else if( nNewCol > MAXCOL ) + else if( nNewCol > mrDoc.MaxCol() ) { // no more cells in the sheet - try to restart at top of sheet @@ -167,7 +167,7 @@ bool ScConversionEngineBase::FindNextConversionCell() else if( ShowTableWrapDialog() ) { // conversion started anywhere but in cell A1, user wants to restart - nNewRow = MAXROW + 2; + nNewRow = mrDoc.MaxRow() + 2; mbWrappedInTable = true; } else -- 2.11.4.GIT