sc/inc/document.hxx | 2 +- sc/source/core/data/documen2.cxx | 31 +++++++++++++++++++++++++++++-- sc/source/ui/unoobj/docuno.cxx | 6 +----- sc/source/ui/view/gridwin4.cxx | 4 +--- sc/source/ui/view/tabview.cxx | 2 -- sc/source/ui/view/tabview3.cxx | 11 ++++++----- 6 files changed, 38 insertions(+), 18 deletions(-)
New commits: commit 6928136177a4caebfdc01d5f0c1106fa8e1683fa Author: Jan Holesovsky <ke...@collabora.com> Date: Tue May 10 11:49:41 2016 +0200 sc lok: Extend the spreadsheet area when we are "close enough" to the end. We can tweak later what the "close enough" means - for the moment it is 10 columns and 25 rows. Change-Id: I92127a71aa6683c03692e96b9e0da7827942c94b diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index a2ac002..9315d95 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -302,16 +302,17 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (comphelper::LibreOfficeKit::isActive()) { - if ( nPosX > aViewData.GetMaxTiledCol() || nPosY > aViewData.GetMaxTiledRow() ) + if (nPosX > aViewData.GetMaxTiledCol() - 10 || nPosY > aViewData.GetMaxTiledRow() - 25) { - aViewData.SetMaxTiledCol( std::max( nPosX, aViewData.GetMaxTiledCol() ) ); - aViewData.SetMaxTiledRow( std::max( nPosY, aViewData.GetMaxTiledRow() ) ); + if (nPosX > aViewData.GetMaxTiledCol() - 10) + aViewData.SetMaxTiledCol(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10); + + if (nPosY > aViewData.GetMaxTiledRow() - 25) + aViewData.SetMaxTiledRow(std::max(nPosY, aViewData.GetMaxTiledRow()) + 25); ScDocShell* pDocSh = aViewData.GetDocShell(); if (pDocSh) - { pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - } } } } commit 5ab5c19b13bfb35eaf84e8ea5863b30d47cb515a Author: Jan Holesovsky <ke...@collabora.com> Date: Tue May 10 10:50:13 2016 +0200 sc lok: Move the handling of the area back to GetTiledRenderingArea(). Change-Id: I4dbfc090ab43065c719f83b5355cd9832ee4d1e3 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 05b93f3..2120405 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1289,7 +1289,7 @@ public: void InvalidateTableArea(); /// Return the number of columns / rows that should be visible for the tiled rendering. - SC_DLLPUBLIC bool GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const; + SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const; SC_DLLPUBLIC bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a56a0a3..77be2de 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -84,6 +84,7 @@ #include "externalrefmgr.hxx" #include "appoptio.hxx" #include "scmod.hxx" +#include "../../ui/inc/viewdata.hxx" #include "../../ui/inc/viewutil.hxx" #include "tabprotection.hxx" #include "formulaparserpool.hxx" @@ -697,9 +698,35 @@ bool ScDocument::GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) return false; } -bool ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const +void ScDocument::GetTiledRenderingArea(SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow) const { - return GetPrintArea(nTab, rEndCol, rEndRow, false); + bool bHasPrintArea = GetPrintArea(nTab, rEndCol, rEndRow, false); + + // we need some reasonable minimal document size + ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) + { + if (!bHasPrintArea) + { + rEndCol = 20; + rEndRow = 50; + } + else + { + rEndCol += 20; + rEndRow += 50; + } + } + else if (!bHasPrintArea) + { + rEndCol = pViewData->GetMaxTiledCol(); + rEndRow = pViewData->GetMaxTiledRow(); + } + else + { + rEndCol = std::max(rEndCol, pViewData->GetMaxTiledCol()); + rEndRow = std::max(rEndRow, pViewData->GetMaxTiledRow()); + } } bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress ) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 7aeb40c..064c8b6 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -543,11 +543,7 @@ Size ScModelObj::getDocumentSize() SCROW nEndRow = 0; const ScDocument& rDoc = pDocShell->GetDocument(); - if (!rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow)) - return aSize; - - nEndCol = std::max(nEndCol, pViewData->GetMaxTiledCol()); - nEndRow = std::max(nEndRow, pViewData->GetMaxTiledRow()); + rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow); // convert to twips aSize.setWidth(rDoc.GetColWidth(0, nEndCol, nTab)); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index da1c843..3da00b5 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1625,9 +1625,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { SCCOL nMaxTiledCol; SCROW nMaxTiledRow; - pDoc->GetTiledRenderingArea( nTab, nMaxTiledCol, nMaxTiledRow ); - nMaxTiledCol = std::max(nMaxTiledCol, pViewData->GetMaxTiledCol()); - nMaxTiledRow = std::max(nMaxTiledRow, pViewData->GetMaxTiledRow()); + pDoc->GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow); if (nX2 > nMaxTiledCol) nX2 = nMaxTiledCol; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 420e892..e4671f6 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2312,8 +2312,6 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle) SCCOL nEndCol = 0; SCROW nEndRow = 0; pDoc->GetTiledRenderingArea(aViewData.GetTabNo(), nEndCol, nEndRow); - nEndCol = std::max(nEndCol, aViewData.GetMaxTiledCol()); - nEndRow = std::max(nEndRow, aViewData.GetMaxTiledRow()); boost::property_tree::ptree aRows; long nTotal = 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits