From f5e330abbf3d8cd9625b29fcc228a742b35aa657 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Wed, 1 Jun 2016 14:24:12 -0400 Subject: sc lok: Limit number of row with LOK to 1000 rows. Change-Id: Ic7fe2dec012efb8ba180feb4d3df6f4bfbf6c38a --- sc/inc/address.hxx | 2 ++ sc/source/ui/view/gridwin.cxx | 11 +++++++++++ sc/source/ui/view/tabview3.cxx | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 7afbfa1d7571..05f62b4d7110 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -70,6 +70,8 @@ const SCROW MAXROW = MAXROWCOUNT - 1; const SCCOL MAXCOL = MAXCOLCOUNT - 1; const SCTAB MAXTAB = MAXTABCOUNT - 1; const SCCOLROW MAXCOLROW = MAXROW; +// Maximun tiled rendering values +const SCROW MAXTILEDROW = 1000; // Limit the initial tab count to prevent users to set the count too high, // which could cause the memory usage of blank documents to exceed the // available system memory. diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 2aca621c5878..66c05b54f52d 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -141,6 +141,7 @@ #include #include +#include #include #include @@ -1834,6 +1835,16 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); SCTAB nTab = pViewData->GetTabNo(); + // FIXME: this is to limit the number of rows handled in the Online + // to 1000; this will be removed again when the performance + // bottlenecks are sorted out + if ( comphelper::LibreOfficeKit::isActive() && nPosY > MAXTILEDROW - 1 ) + { + nButtonDown = 0; + nMouseStatus = SC_GM_NONE; + return; + } + // Auto filter / pivot table / data select popup. This shouldn't activate the part. if ( !bDouble && !bFormulaMode && rMEvt.IsLeft() ) diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 98bdecf322f5..653e47578539 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -333,6 +333,12 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) // DeactivateIP only for MarkListHasChanged + // FIXME: this is to limit the number of rows handled in the Online + // to 1000; this will be removed again when the performance + // bottlenecks are sorted out + if (comphelper::LibreOfficeKit::isActive()) + nPosY = std::min(nPosY, MAXTILEDROW); + if ( nPosX != nOldX || nPosY != nOldY || bNew ) { ScTabViewShell* pViewShell = aViewData.GetViewShell(); @@ -362,10 +368,10 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) aOldSize = pModelObj->getDocumentSize(); if (nPosX > aViewData.GetMaxTiledCol() - 10) - aViewData.SetMaxTiledCol(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10); + aViewData.SetMaxTiledCol(std::min(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10, MAXCOL)); if (nPosY > aViewData.GetMaxTiledRow() - 25) - aViewData.SetMaxTiledRow(std::max(nPosY, aViewData.GetMaxTiledRow()) + 25); + aViewData.SetMaxTiledRow(std::min(std::max(nPosY, aViewData.GetMaxTiledRow()) + 25, MAXTILEDROW)); Size aNewSize(0, 0); if (pModelObj) @@ -1121,6 +1127,12 @@ void ScTabView::MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode, if (nCurX > MAXCOL) nCurX = MAXCOL; if (nCurY > MAXROW) nCurY = MAXROW; + // FIXME: this is to limit the number of rows handled in the Online + // to 1000; this will be removed again when the performance + // bottlenecks are sorted out + if (comphelper::LibreOfficeKit::isActive()) + nCurY = std::min(nCurY, MAXTILEDROW); + HideAllCursors(); // switch of active now in AlignToCursor -- cgit