From 23a0ee3c01c3588472e1c19605909d6b9401253c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 26 Jan 2016 15:35:42 +0100 Subject: libreofficekit: password interaction optional and off by default Add setOptionalFeatures() function that clients must call during initialization, and enum LibreOfficeKitOptionalFeatures. Change-Id: I73035193c87033052921c3aad94fdc057fe81111 Reviewed-on: https://gerrit.libreoffice.org/21809 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky --- include/LibreOfficeKit/LibreOfficeKit.h | 4 ++++ include/LibreOfficeKit/LibreOfficeKit.hxx | 10 ++++++++++ include/LibreOfficeKit/LibreOfficeKitEnums.h | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) (limited to 'include') diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 5a20ec5e47a1..ee9ac1aca646 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -15,6 +15,7 @@ #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY // the unstable API needs C99's bool #include +#include #endif #include @@ -65,6 +66,9 @@ struct _LibreOfficeKitClass /// @see lok::Office::getFilterTypes(). char* (*getFilterTypes) (LibreOfficeKit* pThis); + /// @see lok::Office::setOptionalFeatures(). + void (*setOptionalFeatures)(LibreOfficeKit* pThis, uint64_t features); + /// @see lok::Office::setDocumentPassword(). void (*setDocumentPassword) (LibreOfficeKit* pThis, char const* pURL, diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 57066c69c18c..31328914e239 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -461,6 +461,16 @@ public: return mpThis->pClass->getFilterTypes(mpThis); } + /** + * Set bitmask of optional features supported by the client. + * + * @see LibreOfficeKitOptionalFeatures + */ + void setOptionalFeatures(uint64_t features) + { + return mpThis->pClass->setOptionalFeatures(mpThis, features); + } + /** * Set password required for loading or editing a document. * diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 395b2b761891..b615bd94f9d1 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -40,6 +40,32 @@ typedef enum } LibreOfficeKitTileMode; +/** 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. + * + * @see lok::Office::setOptionalFeatures(). + */ +typedef enum +{ + /** + * Handle LOK_CALLBACK_DOCUMENT_PASSWORD by prompting the user + * for a password. + * + * @see lok::Office::setDocumentPassword(). + */ + LOK_FEATURE_DOCUMENT_PASSWORD = (1ULL << 0), + + /** + * Handle LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY by prompting the user + * for a password. + * + * @see lok::Office::setDocumentPassword(). + */ + LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY = (1ULL << 1), +} +LibreOfficeKitOptionalFeatures; + typedef enum { /** -- cgit