diff options
author | Ximeng Zu <uznomis@yahoo.com> | 2017-07-26 11:15:26 -0500 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-08-27 20:12:52 +0200 |
commit | 43f5161991cffedabb280a6e4e388c5bcbac4f96 (patch) | |
tree | 2dda51149a9174dc1e7de414f89b1cba96ef5a36 /android/Bootstrap | |
parent | c4bc3822298a663c31c676648262c223c1be4ab6 (diff) |
[Android Viewer] Password support
Added password support for documents.
Change-Id: Ifd9cf86894ddaf2fd5ad97510d2ac1b5850611ad
Reviewed-on: https://gerrit.libreoffice.org/40458
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'android/Bootstrap')
-rw-r--r-- | android/Bootstrap/src/org/libreoffice/kit/Document.java | 9 | ||||
-rw-r--r-- | android/Bootstrap/src/org/libreoffice/kit/Office.java | 36 |
2 files changed, 45 insertions, 0 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 8278532c6381..6a1f402970ea 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -119,6 +119,15 @@ public class Document { public static final int KEYBOARD_MODIFIER_MOD2 = 0x4000; public static final int KEYBOARD_MODIFIER_MOD3 = 0x8000; + /** Optional features of LibreOfficeKit, in particular callbacks that block + * LibreOfficeKit until the corresponding reply is received, which would + * deadlock if the client does not support the feature. + */ + public static final long LOK_FEATURE_DOCUMENT_PASSWORD = 1; + public static final long LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY = (1 << 1); + public static final long LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK = (1 << 2); + public static final long LOK_FEATURE_NO_TILED_ANNOTATIONS = (1 << 3); + private final ByteBuffer handle; private MessageCallback messageCallback = null; diff --git a/android/Bootstrap/src/org/libreoffice/kit/Office.java b/android/Bootstrap/src/org/libreoffice/kit/Office.java index 8c616d0e9ce2..25c838ffb2e4 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Office.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Office.java @@ -13,11 +13,18 @@ import java.nio.ByteBuffer; public class Office { private ByteBuffer handle; + private MessageCallback messageCallback = null; public Office(ByteBuffer handle) { this.handle = handle; + bindMessageCallback(); } + /** + * Bind the signal callback in LOK. + */ + private native void bindMessageCallback(); + public native String getError(); private native ByteBuffer documentLoadNative(String url); @@ -33,4 +40,33 @@ public class Office { public native void destroy(); public native void destroyAndExit(); + public native void setDocumentPassword(String url, String pwd); + public native void setOptionalFeatures(long options); + + public void setMessageCallback(MessageCallback messageCallback) { + this.messageCallback = messageCallback; + } + + /** + * Callback triggered through JNI to indicate that a new signal + * from LibreOfficeKit was retrieved. + */ + private void messageRetrievedLOKit(int signalNumber, String payload) { + if (messageCallback != null) { + messageCallback.messageRetrieved(signalNumber, payload); + } + + } + + /** + * Callback to retrieve messages from LOK + */ + public interface MessageCallback { + /** + * Invoked when a message is retrieved from LOK + * @param signalNumber - signal type / number + * @param payload - retrieved for the signal + */ + void messageRetrieved(int signalNumber, String payload); + } } |