summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-06-30 23:30:03 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-07-01 09:12:14 +0200
commitca61fdcac919f799b5273c24932adc0cbd8300e2 (patch)
tree5bd5b3e8bf98c264ac09319e19d5efdbcc4c05aa /android
parent3799a6f3a8b08585cd29a52de89ce0a76c99cef4 (diff)
libreofficekit JNI for Android
Change-Id: Ia905c20fb4ee9b126d65fd3c8e3c1f54649abe1a
Diffstat (limited to 'android')
-rw-r--r--android/Bootstrap/src/org/libreoffice/kit/Document.java57
-rw-r--r--android/Bootstrap/src/org/libreoffice/kit/Office.java34
2 files changed, 91 insertions, 0 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java
new file mode 100644
index 000000000000..2670b9ebc65b
--- /dev/null
+++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java
@@ -0,0 +1,57 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+package org.libreoffice.kit;
+
+import java.nio.ByteBuffer;
+
+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 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);
+ }
+
+ 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);
+ }
+
+ 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
new file mode 100644
index 000000000000..abd98c775e0a
--- /dev/null
+++ b/android/Bootstrap/src/org/libreoffice/kit/Office.java
@@ -0,0 +1,34 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+package org.libreoffice.kit;
+
+import android.util.Log;
+
+public class Office {
+
+ private long handle;
+
+ public Office(long handle) {
+ this.handle = handle;
+ }
+
+ public native String getErrorNative();
+
+ private native long documentLoadNative(String url);
+
+ public Document documentLoad(String url) {
+ long handle = documentLoadNative(url);
+ Document document = null;
+ if (handle > 0) {
+ document = new Document(handle);
+ }
+ return document;
+ }
+}