[Libreoffice-commits] core.git: android/Bootstrap desktop/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Thu Jul 3 01:51:46 PDT 2014
android/Bootstrap/src/org/libreoffice/kit/Document.java | 38 +++-------------
android/Bootstrap/src/org/libreoffice/kit/Office.java | 8 +--
desktop/source/lib/lokandroid.cxx | 11 +---
3 files changed, 17 insertions(+), 40 deletions(-)
New commits:
commit a3ccf3eab5e9dbba80490e057d6f30c4288ad467
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Jul 3 10:45:14 2014 +0200
lok JNI: no "handle" in funcs & don't wrap some native funcs
Change-Id: If783fecd80a0de05e94c76e23572b567d151bb06
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java
index 367a314..27893d2 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/Document.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java
@@ -15,43 +15,23 @@ public class Document {
private final long handle;
- private native void setPartNative(long handle, int part);
- private native int getNumberOfPartsNative(long handle);
- private native int getDocumentTypeNative(long handle);
- private native void paintTileNative(long handle, ByteBuffer buffer, int canvasWidth, int canvasHeight, int tilePositionX, int tilePositionY, int tileWidth, int tileHeight);
- private native long getDocumentHeightNative(long handle);
- private native long getDocumentWidthNative(long handle);
+ public native void setPart(int part);
+ public native int getNumberOfParts();
+ public native long getDocumentHeight();
+ public native long getDocumentWidth();
+
+ private native int getDocumentTypeNative();
+ private native void paintTileNative(ByteBuffer buffer, int canvasWidth, int canvasHeight, int tilePositionX, int tilePositionY, int tileWidth, int tileHeight);
public Document(long handle) {
this.handle = handle;
}
- public boolean saveAs(String url) {
- return false;
- }
-
public int getDocumentType() {
- return getDocumentTypeNative(handle);
- }
-
- public int getNumberOfParts() {
- return getNumberOfPartsNative(handle);
- }
-
- public void setPart(int part) {
- setPartNative(handle, part);
+ return getDocumentTypeNative();
}
public void paintTile(ByteBuffer buffer, int canvasWidth, int canvasHeight, int tilePositionX, int tilePositionY, int tileWidth, int tileHeight) {
- paintTileNative(handle, buffer, canvasWidth, canvasHeight, tilePositionX, tilePositionY, tileWidth, tileHeight);
- }
-
- public long getDocumentWidth() {
- return getDocumentWidthNative(handle);
+ paintTileNative(buffer, canvasWidth, canvasHeight, tilePositionX, tilePositionY, tileWidth, tileHeight);
}
-
- public long getDocumentHeight() {
- return getDocumentHeightNative(handle);
- }
-
}
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Office.java b/android/Bootstrap/src/org/libreoffice/kit/Office.java
index abd98c7..a680735 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/Office.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/Office.java
@@ -19,15 +19,15 @@ public class Office {
this.handle = handle;
}
- public native String getErrorNative();
+ public native String getError();
private native long documentLoadNative(String url);
public Document documentLoad(String url) {
- long handle = documentLoadNative(url);
+ long documentHandle = documentLoadNative(url);
Document document = null;
- if (handle > 0) {
- document = new Document(handle);
+ if (documentHandle > 0) {
+ document = new Document(documentHandle);
}
return document;
}
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index d796342..981f556 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -19,8 +19,6 @@
#include <LibreOfficeKit/LibreOfficeKit.h>
-// #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "LibreOfficeKit", __VA_ARGS__))
-
/* LibreOfficeKit */
jfieldID getHandleField(JNIEnv* pEnv, jobject aObject)
@@ -70,14 +68,14 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Office_document
}
/* Document */
-extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setPartNative
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_setPart
(JNIEnv* pEnv, jobject aObject, jint aPart)
{
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
pDocument->pClass->setPart(pDocument, aPart);
}
-extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Document_getNumberOfPartsNative
+extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Document_getNumberOfParts
(JNIEnv* pEnv, jobject aObject)
{
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
@@ -99,13 +97,12 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_paintTi
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
unsigned char* buffer = (unsigned char*) pEnv->GetDirectBufferAddress(aByteBuffer);
-// jlong capacity = pEnv->GetDirectBufferCapacity(aByteBuffer);
int nStride = 0;
pDocument->pClass->paintTile(pDocument, buffer, nCanvasWidth, nCanvasHeight, &nStride, nTilePosX, nTilePosY, nTileWidth, nTileHeight);
(void) nStride;
}
-extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Document_getDocumentHeightNative
+extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Document_getDocumentHeight
(JNIEnv* pEnv, jobject aObject)
{
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
@@ -115,7 +112,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Document_getDoc
return nHeight;
}
-extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Document_getDocumentWidthNative
+extern "C" SAL_JNI_EXPORT jlong JNICALL Java_org_libreoffice_kit_Document_getDocumentWidth
(JNIEnv* pEnv, jobject aObject)
{
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
More information about the Libreoffice-commits
mailing list