summaryrefslogtreecommitdiff
path: root/sfx2
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-30 12:42:29 +0100
commit14e306efae35f01fa63237ce005ad4067ca16909 (patch)
treea4b541ce34dc97f7c71dc8779ebdfc1703828ff6 /sfx2
parent16e4049f480698c3e1308a3711238a89f91b5c13 (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. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87681 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 82196472291c4ccbcacb5c2513d1961ba9460cdf) Change-Id: I26f6466085baf613850b5861e368f22cad7c1d26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87708 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokcharthelper.cxx5
-rw-r--r--sfx2/source/view/lokhelper.cxx18
2 files changed, 13 insertions, 10 deletions
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx
index 9d3db7a58c03..903e4727eb62 100644
--- a/sfx2/source/view/lokcharthelper.cxx
+++ b/sfx2/source/view/lokcharthelper.cxx
@@ -290,9 +290,10 @@ bool LokChartHelper::postMouseEvent(int nType, int nX, int nY,
// chart window expects pixels, but the conversion factor
// can depend on the client zoom
Point aPos(nChartWinX * fScaleX, nChartWinY * fScaleY);
- SfxLokHelper::postMouseEventAsync(pChartWindow, nType, aPos, nCount,
- MouseEventModifiers::SIMPLECLICK,
+
+ LokMouseEventData aMouseEventData(nType, aPos, nCount, MouseEventModifiers::SIMPLECLICK,
nButtons, nModifier);
+ SfxLokHelper::postMouseEventAsync(pChartWindow, aMouseEventData);
return true;
}
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index f478b667f407..1ba7d96268d9 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -522,13 +522,10 @@ void SfxLokHelper::postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow,
postEventAsync(pLOKEv);
}
-void SfxLokHelper::postMouseEventAsync(const VclPtr<vcl::Window> &xWindow,
- int nType, const Point &rPos,
- int nCount, MouseEventModifiers aModifiers,
- int nButtons, int nModifier)
+void SfxLokHelper::postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, LokMouseEventData const & rLokMouseEventData)
{
LOKAsyncEventData* pLOKEv = new LOKAsyncEventData;
- switch (nType)
+ switch (rLokMouseEventData.mnType)
{
case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
pLOKEv->mnEvent = VclEventId::WindowMouseButtonDown;
@@ -544,10 +541,15 @@ void SfxLokHelper::postMouseEventAsync(const VclPtr<vcl::Window> &xWindow,
}
// no reason - just always true so far.
- assert (aModifiers == MouseEventModifiers::SIMPLECLICK);
+ assert (rLokMouseEventData.meModifiers == MouseEventModifiers::SIMPLECLICK);
- pLOKEv->maMouseEvent = MouseEvent(rPos, nCount,
- aModifiers, nButtons, nModifier);
+ pLOKEv->maMouseEvent = MouseEvent(rLokMouseEventData.maPosition, rLokMouseEventData.mnCount,
+ rLokMouseEventData.meModifiers, rLokMouseEventData.mnButtons,
+ rLokMouseEventData.mnModifier);
+ if (rLokMouseEventData.maLogicPosition)
+ {
+ pLOKEv->maMouseEvent.setLogicPosition(*rLokMouseEventData.maLogicPosition);
+ }
pLOKEv->mpWindow = xWindow;
postEventAsync(pLOKEv);
}