diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-01-25 12:29:16 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-25 12:31:39 +0100 |
commit | 2b63e576a5cf06f4af877d63403ad7955ac71b72 (patch) | |
tree | 228f05257af1a116e65ba4040ce606489526c512 /include | |
parent | f3f305b6a5f515fbff35b3b551a953307be47216 (diff) |
libreofficekit: ask for password when loading encrypted documents
Change-Id: I3b3b0c0e64965280c24842b0cf70a21b8abb4dfb
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 5 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 24 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 19 |
3 files changed, 47 insertions, 1 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 663f62034945..5a20ec5e47a1 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -64,6 +64,11 @@ struct _LibreOfficeKitClass /// @see lok::Office::getFilterTypes(). char* (*getFilterTypes) (LibreOfficeKit* pThis); + + /// @see lok::Office::setDocumentPassword(). + void (*setDocumentPassword) (LibreOfficeKit* pThis, + char const* pURL, + char const* pPassword); #endif }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index ee2b27e92aff..57066c69c18c 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -460,6 +460,30 @@ public: { return mpThis->pClass->getFilterTypes(mpThis); } + + /** + * Set password required for loading or editing a document. + * + * Loading the document is blocked until the password is provided. + * + * @param pURL the URL of the document, as sent to the callback + * @param pPassword the password, nullptr indicates no password + * + * In response to LOK_CALLBACK_DOCUMENT_PASSWORD, a vaild password + * will continue loading the document, an invalid password will + * result in another LOK_CALLBACK_DOCUMENT_PASSWORD request, + * and a NULL password will abort loading the document. + * + * In response to LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, a vaild + * password will continue loading the document, an invalid password will + * result in another LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY request, + * and a NULL password will continue loading the document in read-only + * mode. + */ + inline void setDocumentPassword(char const* pURL, char const* pPassword) + { + mpThis->pClass->setDocumentPassword(mpThis, pURL, pPassword); + } #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 5509166c14e3..395b2b761891 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -221,7 +221,24 @@ typedef enum /** * The text content of the formula bar in Calc. */ - LOK_CALLBACK_CELL_FORMULA + LOK_CALLBACK_CELL_FORMULA, + + /** + * Loading a document requires a password. + * + * Loading the document is blocked until the password is provided via + * lok::Office::setDocumentPassword(). The document cannot be loaded + * without the password. + */ + LOK_CALLBACK_DOCUMENT_PASSWORD, + + /** + * Editing a document requires a password. + * + * Loading the document is blocked until the password is provided via + * lok::Office::setDocumentPassword(). + */ + LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY, } LibreOfficeKitCallbackType; |