summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-03-25 18:23:36 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-03-27 11:33:53 +0900
commit00151d9a31446f5e9b529cacb5bd0e0c469df32e (patch)
tree083565bee7dd01a6198569ef0dddec42915fd111 /desktop/source/lib/init.cxx
parent92801ccc4958d103e5fa336bc6169a99d4393dba (diff)
tdf#124146 support posting of gesture event for LOKit
Reviewed-on: https://gerrit.libreoffice.org/69657 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 4a68361d578fe3bf313f80d8e186079bd34b2300) Change-Id: I51845f2e41dbcbe1ae6cb0a18cf9f42d5549968b
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r--desktop/source/lib/init.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ee34831af726..1d21b994289d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -103,6 +103,7 @@
#include <svx/svxids.hrc>
#include <svx/ucsubset.hxx>
#include <vcl/vclevent.hxx>
+#include <vcl/GestureEvent.hxx>
#include <vcl/svapp.hxx>
#include <unotools/resmgr.hxx>
#include <tools/fract.hxx>
@@ -740,6 +741,12 @@ static void doc_postWindowMouseEvent (LibreOfficeKitDocument* pThis,
int nCount,
int nButtons,
int nModifier);
+static void doc_postWindowGestureEvent(LibreOfficeKitDocument* pThis,
+ unsigned nLOKWindowId,
+ const char* pType,
+ int nX,
+ int nY,
+ int nOffset);
static void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
const char* pCommand,
const char* pArguments,
@@ -873,6 +880,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getSignatureState = doc_getSignatureState;
m_pDocumentClass->renderShapeSelection = doc_renderShapeSelection;
+ m_pDocumentClass->postWindowGestureEvent = doc_postWindowGestureEvent;
m_pDocumentClass->createViewWithOptions = doc_createViewWithOptions;
@@ -3053,6 +3061,43 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
}
}
+static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, const char* pType, int nX, int nY, int nOffset)
+{
+ SolarMutexGuard aGuard;
+ if (gImpl)
+ gImpl->maLastExceptionMsg.clear();
+
+ VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId);
+ if (!pWindow)
+ {
+ gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found.";
+ return;
+ }
+
+ OString aType(pType);
+ GestureEventType eEventType = GestureEventType::PanningUpdate;
+
+ if (aType == "panBegin")
+ eEventType = GestureEventType::PanningBegin;
+ else if (aType == "panEnd")
+ eEventType = GestureEventType::PanningEnd;
+
+ GestureEvent aEvent {
+ sal_Int32(nX),
+ sal_Int32(nY),
+ eEventType,
+ sal_Int32(nOffset),
+ PanningOrientation::Vertical,
+ };
+
+ if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
+ {
+ pDialog->EnableInput();
+ }
+
+ Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, &aEvent);
+}
+
static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY)
{
SolarMutexGuard aGuard;