diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-11-01 15:40:43 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-11-06 01:19:28 +0100 |
commit | 05b72d7dc26080b2e97cbe76d08478926b20947e (patch) | |
tree | 37190571d5b1e3067654cf48da63a0c231561e77 /sc/source/ui/view/viewdata.cxx | |
parent | 56b11c503cbc4a42b604821a8701408d59a7f744 (diff) |
sc lok: cope with non 100% zoom better.
Do the tile rendering and alignment ourselves. More work required
to get cleaner conversion between view and document twips (view
twips being rounded to produce nice round pixel sizes when
re-converted).
Change-Id: I51edb186cfd2dc434005cc074f4ed8de19c85cb3
Reviewed-on: https://gerrit.libreoffice.org/82092
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/ui/view/viewdata.cxx')
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0eb317ff1eca..97dbaacfac2a 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -280,11 +280,13 @@ long ScPositionHelper::computePosition(index_type nIndex, const std::function<lo return nTotalPixels; } -ScBoundsProvider::ScBoundsProvider(ScDocument* pD, SCTAB nT, bool bColHeader) - : pDoc(pD) +ScBoundsProvider::ScBoundsProvider(const ScViewData &rView, SCTAB nT, bool bColHeader) + : pDoc(rView.GetDocument()) , nTab(nT) , bColumnHeader(bColHeader) - , MAX_INDEX(bColHeader ? pD->MaxCol() : MAXTILEDROW) + , MAX_INDEX(bColHeader ? pDoc->MaxCol() : MAXTILEDROW) + , mfPPTX(rView.GetPPTX()) + , mfPPTY(rView.GetPPTY()) , nFirstIndex(-1) , nSecondIndex(-1) , nFirstPositionPx(-1) @@ -322,7 +324,7 @@ void ScBoundsProvider::GetEndIndexAndPosition(SCROW& nIndex, long& nPosition) co long ScBoundsProvider::GetSize(index_type nIndex) const { const sal_uInt16 nSize = bColumnHeader ? pDoc->GetColWidth(nIndex, nTab) : pDoc->GetRowHeight(nIndex, nTab); - return ScViewData::ToPixel(nSize, 1.0 / TWIPS_PER_PIXEL); + return ScViewData::ToPixel(nSize, bColumnHeader ? mfPPTX : mfPPTY); } void ScBoundsProvider::GetIndexAndPos(index_type nNearestIndex, long nNearestPosition, @@ -1372,10 +1374,9 @@ void ScViewData::SetMaxTiledCol( SCCOL nNewMaxCol ) nNewMaxCol = pDoc->MaxCol(); const SCTAB nTab = GetTabNo(); - ScDocument* pThisDoc = pDoc; - auto GetColWidthPx = [pThisDoc, nTab](SCCOL nCol) { - const sal_uInt16 nSize = pThisDoc->GetColWidth(nCol, nTab); - const long nSizePx = ScViewData::ToPixel(nSize, 1.0 / TWIPS_PER_PIXEL); + auto GetColWidthPx = [this, nTab](SCCOL nCol) { + const sal_uInt16 nSize = this->pDoc->GetColWidth(nCol, nTab); + const long nSizePx = ScViewData::ToPixel(nSize, nPPTX); return nSizePx; }; @@ -1398,10 +1399,9 @@ void ScViewData::SetMaxTiledRow( SCROW nNewMaxRow ) nNewMaxRow = MAXTILEDROW; const SCTAB nTab = GetTabNo(); - ScDocument* pThisDoc = pDoc; - auto GetRowHeightPx = [pThisDoc, nTab](SCROW nRow) { - const sal_uInt16 nSize = pThisDoc->GetRowHeight(nRow, nTab); - const long nSizePx = ScViewData::ToPixel(nSize, 1.0 / TWIPS_PER_PIXEL); + auto GetRowHeightPx = [this, nTab](SCROW nRow) { + const sal_uInt16 nSize = this->pDoc->GetRowHeight(nRow, nTab); + const long nSizePx = ScViewData::ToPixel(nSize, nPPTY); return nSizePx; }; |