summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-26 14:30:08 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-11 09:39:15 +0200
commit05dfc5de62eb2fc52e533134c153742190eac7e0 (patch)
treeaaa8e411e294447828359e7c1bc74d7b51411882 /sc
parent554c888341210feeebccdaa2f281996c8c8b9d66 (diff)
Take into account drawing layer for data area size.
The drawing layer could potentially have items that are outwith the data area, but we probably want to have them included for tiled rendering. Change-Id: I958c4fa29491cdb0fd80392dfcfa033306f2b76c
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/gridwin4.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index ce64e505531a..f74ef67c39d8 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -29,6 +29,7 @@
#include <sfx2/printer.hxx>
#include <vcl/settings.hxx>
+#include <svx/svdpage.hxx>
#include <svx/svdview.hxx>
#include "tabvwsh.hxx"
@@ -395,17 +396,32 @@ Size ScGridWindow::GetDataAreaSize()
SCTAB nTab = pViewData->GetTabNo();
+ // Actual data area
pDoc->ShrinkToDataArea( nTab,
nStartCol, nStartRow, nEndCol, nEndRow );
+ // Drawing layer area -- is completely independent of the data area.
+ ScTabViewShell* pTabViewShell = pViewData->GetViewShell();
+ SdrView* pDrawView = pTabViewShell->GetSdrView();
+ SdrPageView* pPageView = pDrawView->GetSdrPageView();
+ SdrPage* pPage = pPageView->GetPage();
+ Rectangle aDrawDataArea = pPage->GetAllObjBoundRect();
+ // Draw layer works in 100th mm, whereas we're working with TWIPs.
+ aDrawDataArea.SetPos( aDrawDataArea.TopLeft() * 1440 / 2540 );
+ aDrawDataArea.SetSize( Size( aDrawDataArea.GetSize().Width() * 1440 / 2540,
+ aDrawDataArea.GetSize().Height() * 1440 / 2540 ) );
+
+ // We specifically keep iterating until we have covered both the
+ // data area AND the drawing layer area. We also make sure that
+ // we return an area corresponding to a whole number of cells.
long nX = 0;
- for ( SCCOL i = 0; i <= nEndCol; i++ )
+ for ( SCCOL i = 0; i <= nEndCol || nX < aDrawDataArea.Right(); i++ )
{
nX += pDoc->GetColWidth( i, nTab );
}
long nY = 0;
- for ( SCROW i = 0; i <= nEndRow; i++ )
+ for ( SCROW i = 0; i <= nEndRow || nY < aDrawDataArea.Bottom(); i++ )
{
nY += pDoc->GetRowHeight( i, nTab );
}