diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-05-10 10:50:13 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-05-10 12:05:49 +0200 |
commit | 5ab5c19b13bfb35eaf84e8ea5863b30d47cb515a (patch) | |
tree | 565f5f6ff62914c0a0027d3050ad031cd95db2e3 /sc/source | |
parent | e9c3dfaa9ee1096a520f527e9a99c7edcf3f34cf (diff) |
sc lok: Move the handling of the area back to GetTiledRenderingArea().
Change-Id: I4dbfc090ab43065c719f83b5355cd9832ee4d1e3
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/documen2.cxx | 31 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 2 |
4 files changed, 31 insertions, 12 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a56a0a3b65bf..77be2ded3879 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 7aeb40cb9761..064c8b699533 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 da1c843ef789..3da00b52b669 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 420e892f174d..e4671f6da2ed 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; |