From 5782dc181fe32c4b38dc8595adf7ac99bea2bce8 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 10 Oct 2019 21:46:59 +0100 Subject: sc: rowcol: migrate some viewdata. The ScViewData is able to not have a document for a time, curious to allow a model-free view, but there it is. Change-Id: I402fa5f814f3cc674b733353c5d3fa2de1970e23 Reviewed-on: https://gerrit.libreoffice.org/80631 Tested-by: Jenkins Reviewed-by: Michael Meeks --- sc/source/ui/view/tabview5.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sc/source/ui/view/tabview5.cxx') diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 9d611736f1bb..22afcdb908cd 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -106,10 +106,10 @@ void ScTabView::Init() explicitly because the parent frame window is already RTL disabled. */ pTabControl->EnableRTL( AllSettings::GetLayoutRTL() ); - InitScrollBar( *aHScrollLeft, MAXCOL+1 ); - InitScrollBar( *aHScrollRight, MAXCOL+1 ); - InitScrollBar( *aVScrollTop, MAXROW+1 ); - InitScrollBar( *aVScrollBottom, MAXROW+1 ); + InitScrollBar( *aHScrollLeft, aViewData.GetDocument()->MaxCol()+1 ); + InitScrollBar( *aHScrollRight, aViewData.GetDocument()->MaxCol()+1 ); + InitScrollBar( *aVScrollTop, aViewData.GetDocument()->MaxRow()+1 ); + InitScrollBar( *aVScrollBottom, aViewData.GetDocument()->MaxRow()+1 ); /* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc. is now handled correctly at the respective places. */ @@ -320,7 +320,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) ScDocShell* pDocSh = GetViewData().GetDocShell(); ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation( pDocSh->GetModel()) : nullptr; - if (pModelObj) + if (pModelObj && GetViewData().GetDocument()) { Size aDocSize = pModelObj->getDocumentSize(); std::stringstream ss; @@ -585,7 +585,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect ) long nLinesX=0, nLinesY=0; // columns/rows - scroll at least nScrollX/Y if (nScrollX > 0) - while (nScrollX > 0 && nPosX < MAXCOL) + while (nScrollX > 0 && nPosX < pDoc->MaxCol()) { nScrollX -= static_cast( pDoc->GetColWidth(nPosX, nTab) * nPPTX ); ++nPosX; @@ -600,7 +600,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect ) } if (nScrollY > 0) - while (nScrollY > 0 && nPosY < MAXROW) + while (nScrollY > 0 && nPosY < pDoc->MaxRow()) { nScrollY -= static_cast( pDoc->GetRowHeight(nPosY, nTab) * nPPTY ); ++nPosY; -- cgit