diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-11-16 17:40:27 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-11-16 18:59:27 +0100 |
commit | 9fdf1cd68e3cfe2ee64ed4092b75b15b2eea33dd (patch) | |
tree | 63c172d2f821a401e31507096b10264bd1dc5b7b /sfx2 | |
parent | 6e277447c765b9199077e4e0e9df2c2704039548 (diff) |
lok: handle mouse/keyboard events in Math embedded in Impress/Draw
Since Impress/Draw use mm100, we need to convert object area that
SfxInPlaceClient provides, which is in parent units, into twips.
TODO: how would taking the units from object shell with Calc, given
that it does not call SetMapUnit in ScDocShell ctor?
Change-Id: I8de2088a3e0e7f9070d6c3c234b40038b6e00f15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142777
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 2d4cde2f75d4aaa3a69fdd65ee7584eb15d20275)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142692
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/lokstarmathhelper.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sfx2/source/view/lokstarmathhelper.cxx b/sfx2/source/view/lokstarmathhelper.cxx index a1ee4c2ccacb..d9c559746ba2 100644 --- a/sfx2/source/view/lokstarmathhelper.cxx +++ b/sfx2/source/view/lokstarmathhelper.cxx @@ -12,10 +12,12 @@ #include <sfx2/ipclient.hxx> #include <sfx2/lokcomponenthelpers.hxx> #include <sfx2/lokhelper.hxx> +#include <sfx2/objsh.hxx> #include <comphelper/dispatchcommand.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/fract.hxx> +#include <tools/UnitConversion.hxx> #include <vcl/layout.hxx> #include <vcl/window.hxx> @@ -135,7 +137,18 @@ const SfxViewShell* LokStarMathHelper::GetSmViewShell() tools::Rectangle LokStarMathHelper::GetBoundingBox() const { - return mpIPClient ? mpIPClient->GetObjArea() : tools::Rectangle{}; + if (mpIPClient) + { + tools::Rectangle r(mpIPClient->GetObjArea()); + if (SfxObjectShell* pObjShell = const_cast<SfxViewShell*>(mpViewShell)->GetObjectShell()) + { + const o3tl::Length unit = MapToO3tlLength(pObjShell->GetMapUnit()); + if (unit != o3tl::Length::twip && unit != o3tl::Length::invalid) + r = o3tl::convert(r, unit, o3tl::Length::twip); + } + return r; + } + return {}; } bool LokStarMathHelper::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, |