summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/docuno.cxx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-03-29 12:55:12 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2017-10-02 18:44:46 +0200
commitb230f845e794641721254e0a95b006eb3588aa0c (patch)
treea8fce1f2b972d7ccd9745b4448a908603b00862a /sc/source/ui/unoobj/docuno.cxx
parenta789ef3c41443a3aa964bea31e2c8e22552fcdfd (diff)
lok - sc: document size as sum of row heights/col widths in pixel
Grid lines, cursor overlay, row/col headers are all computed by summing up row heights / col widths converted to pixels. On the contrary the document size was converted to pixel only at the end after having summed up heights/widths in twips. All that lead to have a document height/width greater than the position of the last row/col, with the scrolling in online going unplesantly far beyond the last row/column. This patch change the way the document size is computed, so that the spreadsheet height/width matches the position of the last row/column. Moreover it exploits the cache-like structure for row/col positions introduced in a previous commit. Change-Id: Ibb2cc6a7b592e359a0b1202dc9bea1dd4c421354 Reviewed-on: https://gerrit.libreoffice.org/40448 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sc/source/ui/unoobj/docuno.cxx')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 265334a5eef8..ba1508c5195a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -551,7 +551,7 @@ Size ScModelObj::getDocumentSize()
{
Size aSize(10, 10); // minimum size
- const ScViewData* pViewData = ScDocShell::GetViewData();
+ ScViewData* pViewData = ScDocShell::GetViewData();
if (!pViewData)
return aSize;
@@ -562,9 +562,21 @@ Size ScModelObj::getDocumentSize()
rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
- // convert to twips
- aSize.setWidth(rDoc.GetColWidth(0, nEndCol, nTab));
- aSize.setHeight(rDoc.GetRowHeight(0, nEndRow, nTab));
+ pViewData->SetMaxTiledCol(nEndCol);
+ pViewData->SetMaxTiledRow(nEndRow);
+
+ if (pViewData->GetLOKDocWidthPixel() > 0 && pViewData->GetLOKDocHeightPixel() > 0)
+ {
+ // convert to twips
+ aSize.setWidth(pViewData->GetLOKDocWidthPixel() * TWIPS_PER_PIXEL);
+ aSize.setHeight(pViewData->GetLOKDocHeightPixel() * TWIPS_PER_PIXEL);
+ }
+ else
+ {
+ // convert to twips
+ aSize.setWidth(rDoc.GetColWidth(0, nEndCol, nTab));
+ aSize.setHeight(rDoc.GetRowHeight(0, nEndRow, nTab));
+ }
return aSize;
}