From dbde7f6ab8106649cf7e153bda07c50753f2dad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Thu, 22 Jan 2015 14:44:37 +0900 Subject: [PATCH] android: add postMouseEvent to LOKit JNI interface Change-Id: I652a0c365c4a1413226cdd4dc7910e65ac2a5285 --- .../Bootstrap/src/org/libreoffice/kit/Document.java | 12 ++++++++++++ desktop/source/lib/lokandroid.cxx | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 4c791cb2f2fc..3cd9b0e2c758 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -26,6 +26,10 @@ public class Document { public static final int DOCTYPE_DRAWING = 3; public static final int DOCTYPE_OTHER = 4; + public static final int MOUSE_BUTTON_DOWN = 0; + public static final int MOUSE_BUTTON_UP = 1; + public static final int MOUSE_MOVE = 2; + private final ByteBuffer handle; private MessageCallback messageCallback = null; @@ -85,6 +89,14 @@ public class Document { public native void initializeForRendering(); + /** + * Post a mouse event to LOK + * @param type - mouse event type + * @param x - x coordinate + * @param y - y coordinate + */ + public native void postMouseEvent(int type, int x, int y); + /** * Callback to retrieve messages from LOK */ diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx index 02902222ef7b..9ea51078c30f 100644 --- a/desktop/source/lib/lokandroid.cxx +++ b/desktop/source/lib/lokandroid.cxx @@ -277,6 +277,13 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs return result; } +extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postMouseEvent + (JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y) +{ + LibreOfficeKitDocument* pDocument = getHandle(pEnv, aObject); + pDocument->pClass->postMouseEvent(pDocument, type, x, y); +} + /* DirectBufferAllocator */ extern "C" SAL_JNI_EXPORT jobject JNICALL Java_org_libreoffice_kit_DirectBufferAllocator_allocateDirectBufferNative