summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-05-10 10:50:13 +0200
committerJan Holesovsky <kendy@collabora.com>2016-05-10 11:52:23 +0200
commitfd5ae1f201a894c5b15d52f3cab57ef15c9eb5b9 (patch)
tree5e8a86febe4c183b58b94ec6f9923f2c3949ddda /sc
parenteff0aa51c98a40163f2106f45a5627d038a10f6e (diff)
sc lok: Move the handling of the area back to GetTiledRenderingArea().
Change-Id: I4dbfc090ab43065c719f83b5355cd9832ee4d1e3
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/source/core/data/documen2.cxx31
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
-rw-r--r--sc/source/ui/view/gridwin4.cxx4
-rw-r--r--sc/source/ui/view/tabview.cxx2
5 files changed, 32 insertions, 13 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 272d2eb1b3a0..f5bcd9a46cf6 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1159,7 +1159,7 @@ public:
void InvalidateTableArea();
/// Return the number of colums / 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 e0058ec63cdf..6940762c8c11 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"
@@ -706,9 +707,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 0f919eaf4038..67bdb092a0be 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, true));
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 6185a8827f80..c4d7da116910 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1615,9 +1615,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 ac1f571555c6..c7cf4cbbba02 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2318,8 +2318,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;