diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-03-10 17:44:10 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-16 09:38:02 +0100 |
commit | 1771f21e2b24f111cacdd38b5d10328e230e3569 (patch) | |
tree | 8be168a6e4003fd81cdccf44ff58b4e1cc71a60d /android | |
parent | b6df97c32c6c19570cef0511dd366d9880b2c0d3 (diff) |
android: use LOK_SETTEXTSELECTION_RESET as it is meant to be used
Change-Id: I09f175a09c8b4c9468e2221274b17216b23b76ff
Diffstat (limited to 'android')
5 files changed, 17 insertions, 21 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 07d432993141..9ebfdfc7a7c4 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -44,11 +44,11 @@ public class Document { public static final int CALLBACK_HYPERLINK_CLICKED = 7; /** - * Text selection types + * Set text selection types */ - public static final int TEXT_SELECTION_START = 0; - public static final int TEXT_SELECTION_END = 1; - public static final int TEXT_SELECTION_RESET = 2; + public static final int SET_TEXT_SELECTION_START = 0; + public static final int SET_TEXT_SELECTION_END = 1; + public static final int SET_TEXT_SELECTION_RESET = 2; private final ByteBuffer handle; private MessageCallback messageCallback = null; diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index d3918b2147ba..3d36d935aa09 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -218,8 +218,7 @@ public class LOKitThread extends Thread { private void changeHandlePosition(TextSelectionHandle.HandleType handleType, PointF documentCoordinate) { if (handleType == TextSelectionHandle.HandleType.MIDDLE) { - mTileProvider.mouseButtonDown(documentCoordinate, 1); - mTileProvider.mouseButtonUp(documentCoordinate, 1); + mTileProvider.setTextSelectionReset(documentCoordinate); } else if (handleType == TextSelectionHandle.HandleType.START) { mTileProvider.setTextSelectionStart(documentCoordinate); } else if (handleType == TextSelectionHandle.HandleType.END) { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 3a24120ae64b..eb8522cfcb8d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -2,7 +2,6 @@ package org.libreoffice; import android.graphics.Bitmap; import android.graphics.PointF; -import android.graphics.RectF; import android.util.Log; import android.view.KeyEvent; @@ -10,15 +9,11 @@ import org.libreoffice.kit.DirectBufferAllocator; import org.libreoffice.kit.Document; import org.libreoffice.kit.LibreOfficeKit; import org.libreoffice.kit.Office; -import org.libreoffice.R; -import org.mozilla.gecko.TextSelection; -import org.mozilla.gecko.TextSelectionHandle; import org.mozilla.gecko.gfx.BufferedCairoImage; import org.mozilla.gecko.gfx.CairoImage; import org.mozilla.gecko.gfx.GeckoLayerClient; import org.mozilla.gecko.gfx.IntSize; -import org.mozilla.gecko.gfx.LayerView; import java.nio.ByteBuffer; @@ -364,23 +359,25 @@ public class LOKitTileProvider implements TileProvider { mouseButton(Document.MOUSE_BUTTON_UP, documentCoordinate, numberOfClicks); } - @Override - public void setTextSelectionStart(PointF documentCoordinate) { + private void setTextSelection(int type, PointF documentCoordinate) { int x = (int) pixelToTwip(documentCoordinate.x, mDPI); int y = (int) pixelToTwip(documentCoordinate.y, mDPI); - mDocument.setTextSelection(Document.TEXT_SELECTION_START, x, y); + mDocument.setTextSelection(type, x, y); + } + + @Override + public void setTextSelectionStart(PointF documentCoordinate) { + setTextSelection(Document.SET_TEXT_SELECTION_START, documentCoordinate); } @Override public void setTextSelectionEnd(PointF documentCoordinate) { - int x = (int) pixelToTwip(documentCoordinate.x, mDPI); - int y = (int) pixelToTwip(documentCoordinate.y, mDPI); - mDocument.setTextSelection(Document.TEXT_SELECTION_END, x, y); + setTextSelection(Document.SET_TEXT_SELECTION_END, documentCoordinate); } @Override - public void setTextSelectionReset() { - mDocument.setTextSelection(Document.TEXT_SELECTION_RESET, 0, 0); + public void setTextSelectionReset(PointF documentCoordinate) { + setTextSelection(Document.SET_TEXT_SELECTION_RESET, documentCoordinate); } @Override diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index 8c3403834990..9ec55ad0b24c 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -115,7 +115,7 @@ public class MockTileProvider implements TileProvider { } @Override - public void setTextSelectionReset() { + public void setTextSelectionReset(PointF documentCoordinate) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index 29e64a8fc59a..128344f5fe64 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -103,5 +103,5 @@ public interface TileProvider { void setTextSelectionEnd(PointF documentCoordinate); - void setTextSelectionReset(); + void setTextSelectionReset(PointF documentCoordinate); } |