summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/gridwin.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-12-03 10:55:35 +0000
committerMichael Meeks <michael.meeks@collabora.com>2019-12-04 12:38:10 +0100
commit0b245e26dab8f40693fdb7e8e08e662bdba7590e (patch)
tree90b5e47dd9e7729ed21bb33c973170f355714f20 /sc/source/ui/view/gridwin.cxx
parentfae63aea208990590d98990e332f88b24c2958e7 (diff)
lok: cleanup getCellCursor
Switching the zoom is no longer necessary - we now have a known and fixed zoom per view now (as the core has), that saves some complexity. Change-Id: I14c952ca1e06fae016faa8b6ee07115c56312ed6 Reviewed-on: https://gerrit.libreoffice.org/84372 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/ui/view/gridwin.cxx')
-rw-r--r--sc/source/ui/view/gridwin.cxx54
1 files changed, 3 insertions, 51 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 67eb99627cc4..d634c4a853f8 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5681,68 +5681,20 @@ bool ScGridWindow::InsideVisibleRange( SCCOL nPosX, SCROW nPosY )
return maVisibleRange.isInside(nPosX, nPosY);
}
-// Use the same zoom calculations as in paintTile - this
-// means the client can ensure they can get the correct
-// cursor corresponding to their current tile sizings.
-OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight,
- long nTileWidth, long nTileHeight )
-{
- Fraction zoomX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
- Fraction zoomY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
- return getCellCursor(zoomX, zoomY);
-}
-
-OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) const
+OString ScGridWindow::getCellCursor() const
{
// GridWindow stores a shown cell cursor in mpOOCursors, hence
// we can use that to determine whether we would want to be showing
// one (client-side) for tiled rendering too.
if (!mpOOCursors)
- {
return "EMPTY";
- }
-
- SCCOL nX = pViewData->GetCurX();
- SCROW nY = pViewData->GetCurY();
-
- Fraction defaultZoomX = pViewData->GetZoomX();
- Fraction defaultZoomY = pViewData->GetZoomY();
-
- pViewData->SetZoom(rZoomX, rZoomY, true);
-
- Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true );
- long nSizeXPix;
- long nSizeYPix;
- pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
-
- double fPPTX = pViewData->GetPPTX();
- double fPPTY = pViewData->GetPPTY();
-
- // make it a slim cell cursor, but not empty
- if (nSizeXPix == 0)
- nSizeXPix = 1;
-
- if (nSizeYPix == 0)
- nSizeYPix = 1;
-
- long nPosXTw = rtl::math::round(aScrPos.getX() / fPPTX);
- long nPosYTw = rtl::math::round(aScrPos.getY() / fPPTY);
- // look at Rectangle( const Point& rLT, const Size& rSize ) for the '- 1'
- long nSizeXTw = rtl::math::round(nSizeXPix / fPPTX) - 1;
- long nSizeYTw = rtl::math::round(nSizeYPix / fPPTY) - 1;
-
- std::stringstream ss;
- ss << nPosXTw << ", " << nPosYTw << ", " << nSizeXTw << ", " << nSizeYTw << ", "
- << nX << ", " << nY;
-
- pViewData->SetZoom(defaultZoomX, defaultZoomY, true);
- return ss.str().c_str();
+ return pViewData->describeCellCursor();
}
void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShell) const
{
- OString aCursor = getCellCursor(pViewData->GetZoomX(), pViewData->GetZoomY());
+ OString aCursor = getCellCursor();
ScTabViewShell* pViewShell = pViewData->GetViewShell();
if (pOtherShell)
{