summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-01-29 12:44:30 +0100
committerTomaž Vajngerl <quikee@gmail.com>2020-01-29 14:48:38 +0100
commit82196472291c4ccbcacb5c2513d1961ba9460cdf (patch)
treee9043eb2c871867e2d21f9988371eb5bbb6d26fb /sc/source
parentce1d8e20a708ed031f2336770a41fbe501fe8225 (diff)
lok: preserve mouse event logic position and use in calc
When clicking in online Calc any of the charts, shapes (and other objects), sometimes the cell underneath is selected instead. The problem is that the object is not correctly recognised to be hit. From lok we get the mouse event position in logic coordinates, which we usually can just use in writer and impress. In calc however we need the coordinates in pixels, so we transform them before sending the mouse event to calc. Still calc also uses common SdrObjects (chart, shapes,...), which operate in logic coordinates. So in case of SdrObject we need to convert the coordniates back from pixel to logic again, which causes problems because conversion doesn't have access to the displaying conditions on an stateless online client. OTOH we already had the correct logic coordinates, and we can just send them along. This is what this change does. It adds an optional maLogicPosition to MouseEvent, which is filled with logic position if those is known. Change-Id: I26f6466085baf613850b5861e368f22cad7c1d26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87681 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx7
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
2 files changed, 9 insertions, 4 deletions
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index caffb9c1410b..bb82aa3459bd 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -78,8 +78,11 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
bIsInDragMode = false; // somewhere it has to be reset (#50033#)
bool bReturn = FuDraw::MouseButtonDown(rMEvt);
-
- aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
+ auto aLogicPosition = rMEvt.getLogicPosition();
+ if (aLogicPosition)
+ aMDPos = *aLogicPosition;
+ else
+ aMDPos = pWindow->PixelToLogic(rMEvt.GetPosPixel());
if ( rMEvt.IsLeft() )
{
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a79540c7a20b..a28f9a2eabae 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -672,9 +672,11 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
// Calc operates in pixels...
const Point aPos(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY());
- SfxLokHelper::postMouseEventAsync(pGridWindow, nType, aPos, nCount,
- MouseEventModifiers::SIMPLECLICK,
+
+ LokMouseEventData aMouseEventData(nType, aPos, nCount, MouseEventModifiers::SIMPLECLICK,
nButtons, nModifier);
+ aMouseEventData.maLogicPosition = Point(convertTwipToMm100(nX), convertTwipToMm100(nY));
+ SfxLokHelper::postMouseEventAsync(pGridWindow, aMouseEventData);
}
void ScModelObj::setTextSelection(int nType, int nX, int nY)