diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-01-29 12:44:30 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-01-29 14:48:38 +0100 |
commit | 82196472291c4ccbcacb5c2513d1961ba9460cdf (patch) | |
tree | e9043eb2c871867e2d21f9988371eb5bbb6d26fb /include/sfx2/lokhelper.hxx | |
parent | ce1d8e20a708ed031f2336770a41fbe501fe8225 (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 'include/sfx2/lokhelper.hxx')
-rw-r--r-- | include/sfx2/lokhelper.hxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 53c6010f2a74..3689b0086b58 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -17,6 +17,27 @@ #include <sfx2/viewsh.hxx> #include <cstddef> #include <rtl/string.hxx> +#include <o3tl/optional.hxx> + +struct SFX2_DLLPUBLIC LokMouseEventData +{ + int mnType; + Point maPosition; + int mnCount; + MouseEventModifiers meModifiers; + int mnButtons; + int mnModifier; + o3tl::optional<Point> maLogicPosition; + + LokMouseEventData(int nType, Point aPosition, int nCount, MouseEventModifiers eModifiers, int nButtons, int nModifier) + : mnType(nType) + , maPosition(aPosition) + , mnCount(nCount) + , meModifiers(eModifiers) + , mnButtons(nButtons) + , mnModifier(nModifier) + {} +}; class SFX2_DLLPUBLIC SfxLokHelper { @@ -72,10 +93,7 @@ public: int nType, const OUString &rText); /// Helper for posting async mouse event - static void postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, - int nType, const Point &rPos, - int nCount, MouseEventModifiers aModifiers, - int nButtons, int nModifier); + static void postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, LokMouseEventData const & rLokMouseEventData); /// A special value to signify 'infinity'. /// This value is chosen such that sal_Int32 will not overflow when manipulated. |