diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-23 23:55:20 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-26 10:27:45 +0100 |
commit | 41e5824de88d9caa62612a8ca7265014635fb3de (patch) | |
tree | ca565a0f556b137af78d8d0d130da04652638cd9 /android/experimental | |
parent | 8fa9f14a77216f3aba23db306fe8c4fc7c42b7df (diff) |
android: add mouseButtonDown(Up) to TileProvider + impl.
Change-Id: I1ca2242d2bc7ee7d2d48a4a5f5bcc6e77edfaa2d
Diffstat (limited to 'android/experimental')
3 files changed, 41 insertions, 1 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 08561d81b68b..1ace50f408d0 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -1,6 +1,7 @@ package org.libreoffice; import android.graphics.Bitmap; +import android.graphics.PointF; import android.graphics.RectF; import android.util.Log; import android.view.KeyEvent; @@ -294,6 +295,21 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback mOffice.postKeyEvent(Office.KEY_PRESS, code); } + private void mouseButton(int type, PointF inDocument) { + int x = (int) pixelToTwip(inDocument.x, mDPI); + int y = (int) pixelToTwip(inDocument.y, mDPI); + mDocument.postMouseEvent(type, x, y); + } + + @Override + public void mouseButtonDown(PointF inDocument) { + mouseButton(Document.MOUSE_BUTTON_DOWN, inDocument); + } + + @Override + public void mouseButtonUp(PointF inDocument) { + mouseButton(Document.MOUSE_BUTTON_UP, inDocument); + } @Override protected void finalize() throws Throwable { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index 15332a7a5d58..f68678af2e2b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -1,6 +1,7 @@ package org.libreoffice; import android.graphics.Bitmap; +import android.graphics.PointF; import android.view.KeyEvent; import org.mozilla.gecko.gfx.BufferedCairoImage; @@ -23,7 +24,7 @@ public class MockTileProvider implements TileProvider { LibreOfficeMainActivity.mAppContext.mMainHandler.post(new Runnable() { @Override public void run() { - LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().add(partView); + LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().add(partView); } }); } @@ -92,6 +93,16 @@ public class MockTileProvider implements TileProvider { } @Override + public void mouseButtonDown(PointF inDocument) { + + } + + @Override + public void mouseButtonUp(PointF inDocument) { + + } + + @Override public void changePart(int partIndex) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index ed9682f39af1..a411879a5bef 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -2,6 +2,7 @@ package org.libreoffice; import android.graphics.Bitmap; +import android.graphics.PointF; import android.graphics.RectF; import android.view.KeyEvent; @@ -67,6 +68,18 @@ public interface TileProvider { void keyPress(KeyEvent keyEvent); /** + * Trigger a mouse button down event. + * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered + */ + void mouseButtonDown(PointF documentCoordinate); + + /** + * Trigger a mouse button up event. + * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered + */ + void mouseButtonUp(PointF documentCoordinate); + + /** * Callback to retrieve invalidation calls */ public interface TileInvalidationCallback { |