summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorXimeng Zu <uznomis@yahoo.com>2017-07-26 11:15:26 -0500
committerTomaž Vajngerl <quikee@gmail.com>2017-08-27 20:12:52 +0200
commit43f5161991cffedabb280a6e4e388c5bcbac4f96 (patch)
tree2dda51149a9174dc1e7de414f89b1cba96ef5a36 /desktop
parentc4bc3822298a663c31c676648262c223c1be4ab6 (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 'desktop')
-rw-r--r--desktop/source/lib/lokandroid.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index 0f807d061590..3055d38957da 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -85,6 +85,7 @@ struct CallbackData
};
static CallbackData gCallbackData;
+static CallbackData gCallbackDataLOKit;
/**
* Handle retrieved callback
@@ -143,6 +144,45 @@ extern "C" SAL_JNI_EXPORT jobject JNICALL Java_org_libreoffice_kit_Office_docume
return aHandle;
}
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Office_setDocumentPassword
+ (JNIEnv* pEnv, jobject aObject, jstring sUrl, jstring sPassword)
+{
+ LibreOfficeKit* pLibreOfficeKit = getHandle<LibreOfficeKit>(pEnv, aObject);
+
+ char const* pUrl = copyJavaString(pEnv, sUrl);
+ if (sPassword == NULL) {
+ pLibreOfficeKit->pClass->setDocumentPassword(pLibreOfficeKit, pUrl, nullptr);
+ } else {
+ char const* pPassword = copyJavaString(pEnv, sPassword);
+ pLibreOfficeKit->pClass->setDocumentPassword(pLibreOfficeKit, pUrl, pPassword);
+ }
+}
+
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Office_setOptionalFeatures
+ (JNIEnv* pEnv, jobject aObject, jlong options)
+{
+ LibreOfficeKit* pLibreOfficeKit = getHandle<LibreOfficeKit>(pEnv, aObject);
+
+ uint64_t pOptions = (uint64_t)options;
+
+ pLibreOfficeKit->pClass->setOptionalFeatures(pLibreOfficeKit, pOptions);
+}
+
+/** Implementation of org.libreoffice.kit.Office.bindMessageCallback method */
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Office_bindMessageCallback
+ (JNIEnv* pEnv, jobject aObject)
+{
+ LibreOfficeKit* pLibreOfficeKit = getHandle<LibreOfficeKit>(pEnv, aObject);
+
+ gCallbackDataLOKit.aObject = (jobject) pEnv->NewGlobalRef(aObject);
+ jclass aClass = pEnv->GetObjectClass(aObject);
+ gCallbackDataLOKit.aClass = (jclass) pEnv->NewGlobalRef(aClass);
+
+ gCallbackDataLOKit.aJavaCallbackMethod = pEnv->GetMethodID(aClass, "messageRetrievedLOKit", "(ILjava/lang/String;)V");
+
+ pLibreOfficeKit->pClass->registerCallback(pLibreOfficeKit, messageCallback, (void*) &gCallbackDataLOKit);
+}
+
/* Document */
/** Implementation of org.libreoffice.kit.Document.bindMessageCallback method */