summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-11-16 23:01:10 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-16 22:15:19 +0100
commita81e957f5026373f3935390c786c21416fc74fcc (patch)
treea6852bb6c2c8c99e6f848217588c0944dcb3dcd9 /sfx2
parent7060192b6facd92cadb5bb084052903f2695d67d (diff)
lok: handle mouse/keyboard events in Math embedded in Calc
And extract the identical code used in all components into static SfxLokHelper methods. Change-Id: I6556b1b996936835ecfc0d59e2c1dd1ef6380db2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142793 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index b6b5a7895744..7b10b7e6b7ad 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -11,6 +11,7 @@
#include <string_view>
+#include <sfx2/lokcomponenthelpers.hxx>
#include <sfx2/lokhelper.hxx>
#include <com/sun/star/frame/Desktop.hpp>
@@ -910,4 +911,43 @@ void SfxLokHelper::notifyMediaUpdate(boost::property_tree::ptree& json)
SfxLokHelper::notifyAllViews(LOK_CALLBACK_MEDIA_SHAPE, str.c_str());
}
+bool SfxLokHelper::testInPlaceComponentMouseEventHit(SfxViewShell* pViewShell, int nType, int nX,
+ int nY, int nCount, int nButtons,
+ int nModifier, double fScaleX, double fScaleY,
+ bool bNegativeX)
+{
+ // In LOK RTL mode draw/svx operates in negative X coordinates
+ // But the coordinates from client is always positive, so negate nX.
+ if (bNegativeX)
+ nX = -nX;
+
+ // check if the user hit a chart/math object which is being edited by this view
+ if (LokChartHelper aChartHelper(pViewShell, bNegativeX);
+ aChartHelper.postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier, fScaleX, fScaleY))
+ return true;
+
+ if (LokStarMathHelper aMathHelper(pViewShell);
+ aMathHelper.postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier, fScaleX, fScaleY))
+ return true;
+
+ // check if the user hit a chart which is being edited by someone else
+ // and, if so, skip current mouse event
+ if (nType != LOK_MOUSEEVENT_MOUSEMOVE)
+ {
+ if (LokChartHelper::HitAny({nX, nY}, bNegativeX))
+ return true;
+ }
+
+ return false;
+}
+
+VclPtr<vcl::Window> SfxLokHelper::getInPlaceDocWindow(SfxViewShell* pViewShell)
+{
+ if (VclPtr<vcl::Window> pWindow = LokChartHelper(pViewShell).GetWindow())
+ return pWindow;
+ if (VclPtr<vcl::Window> pWindow = LokStarMathHelper(pViewShell).GetWidgetWindow())
+ return pWindow;
+ return {};
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */