[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - android/Bootstrap android/experimental desktop/source
Jan Holesovsky
kendy at collabora.com
Thu Mar 12 10:18:39 PDT 2015
android/Bootstrap/src/org/libreoffice/kit/Document.java | 6 +++++
android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java | 9 ++++---
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 5 +++-
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 5 ++++
android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java | 2 -
android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java | 8 ++----
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java | 7 +++++
desktop/source/lib/lokandroid.cxx | 12 ++++++++++
8 files changed, 43 insertions(+), 11 deletions(-)
New commits:
commit 7ebeee8a198bec160cc3e7cbd9e0db870dc9e3ea
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 12 18:16:51 2015 +0100
android: Make the Bold button actually work - switches to typing in bold.
Change-Id: I48da0f3cc918bda1cdb396b4ea72a82eddafb9a8
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java
index 0e0dd59..5d97656 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/Document.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java
@@ -133,6 +133,12 @@ public class Document {
public native void postMouseEvent(int type, int x, int y, int count);
/**
+ * Post a .uno: command to LOK
+ * @param command - the command, like ".uno:Bold"
+ */
+ public native void postUnoCommand(String command);
+
+ /**
* Change text selection.
* @param type - text selection type
* @param x - x coordinate
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
index c162c22..4413a63 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
@@ -24,14 +24,15 @@ public class LOEvent implements Comparable<LOEvent> {
public static final int SWIPE_RIGHT = 11;
public static final int SWIPE_LEFT = 12;
public static final int NAVIGATION_CLICK = 13;
+ public static final int UNO_COMMAND = 14;
public final int mType;
public int mPriority = 0;
- public String mTypeString;
+ private String mTypeString;
public ThumbnailCreator.ThumbnailCreationTask mTask;
public int mPartIndex;
- public String mFilename;
+ public String mString;
public ComposedTileLayer mComposedTileLayer;
public String mTouchType;
public PointF mDocumentCoordinate;
@@ -51,8 +52,8 @@ public class LOEvent implements Comparable<LOEvent> {
public LOEvent(int type, String filename) {
mType = type;
- mTypeString = "Filename";
- mFilename = filename;
+ mTypeString = "String";
+ mString = filename;
}
public LOEvent(int type, int partIndex) {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index ea7cc31..12e4899 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -178,7 +178,7 @@ public class LOKitThread extends Thread {
private void processEvent(LOEvent event) {
switch (event.mType) {
case LOEvent.LOAD:
- loadDocument(event.mFilename);
+ loadDocument(event.mString);
break;
case LOEvent.CLOSE:
closeDocument();
@@ -216,6 +216,9 @@ public class LOKitThread extends Thread {
case LOEvent.NAVIGATION_CLICK:
mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.NONE);
break;
+ case LOEvent.UNO_COMMAND:
+ mTileProvider.postUnoCommand(event.mString);
+ break;
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index eb8522c..9bab22b 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -359,6 +359,11 @@ public class LOKitTileProvider implements TileProvider {
mouseButton(Document.MOUSE_BUTTON_UP, documentCoordinate, numberOfClicks);
}
+ @Override
+ public void postUnoCommand(String command) {
+ mDocument.postUnoCommand(command);
+ }
+
private void setTextSelection(int type, PointF documentCoordinate) {
int x = (int) pixelToTwip(documentCoordinate.x, mDPI);
int y = (int) pixelToTwip(documentCoordinate.y, mDPI);
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index c0e4810..e1af1e2 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -77,7 +77,7 @@ public class LibreOfficeMainActivity extends ActionBarActivity {
int id = item.getItemId();
switch (id) {
case R.id.action_bold:
- Toast.makeText(this,"set text to bold", Toast.LENGTH_LONG).show();
+ LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Bold"));
return true;
case R.id.action_about:
mAbout.showAbout();
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
index 9ec55ad..c30c1bb 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
@@ -91,32 +91,30 @@ public class MockTileProvider implements TileProvider {
@Override
public void sendKeyEvent(KeyEvent keyEvent) {
-
}
@Override
public void mouseButtonDown(PointF documentCoordinate, int numberOfClicks) {
-
}
@Override
public void mouseButtonUp(PointF documentCoordinate, int numberOfClicks) {
+ }
+ @Override
+ public void postUnoCommand(String command) {
}
@Override
public void setTextSelectionStart(PointF documentCoordinate) {
-
}
@Override
public void setTextSelectionEnd(PointF documentCoordinate) {
-
}
@Override
public void setTextSelectionReset(PointF documentCoordinate) {
-
}
@Override
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
index 128344f..1b34be0 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
@@ -99,6 +99,13 @@ public interface TileProvider {
*/
void mouseButtonUp(PointF documentCoordinate, int numberOfClicks);
+ /**
+ * Post a UNO command to LOK.
+ *
+ * @param command - the .uno: command, like ".uno:Bold"
+ */
+ void postUnoCommand(String command);
+
void setTextSelectionStart(PointF documentCoordinate);
void setTextSelectionEnd(PointF documentCoordinate);
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index b4d0e98..c23fd3f 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -284,6 +284,18 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postMou
pDocument->pClass->postMouseEvent(pDocument, type, x, y, count);
}
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postUnoCommand
+ (JNIEnv* pEnv, jobject aObject, jstring command)
+{
+ LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
+
+ const char* pCommand = pEnv->GetStringUTFChars(command, NULL);
+
+ pDocument->pClass->postUnoCommand(pDocument, pCommand);
+
+ pEnv->ReleaseStringUTFChars(command, pCommand);
+}
+
extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setTextSelection
(JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y)
{
More information about the Libreoffice-commits
mailing list