summaryrefslogtreecommitdiff
path: root/include/LibreOfficeKit
diff options
context:
space:
mode:
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h9
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx34
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitEnums.h45
3 files changed, 87 insertions, 1 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 5189cca5eb5e..b31e5eef1c01 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -15,6 +15,7 @@
#ifdef LOK_USE_UNSTABLE_API
// the unstable API needs C99's bool
#include <stdbool.h>
+#include <stdint.h>
#endif
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
@@ -62,6 +63,14 @@ 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,
+ char const* pPassword);
#endif
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 5e86101f62af..bc52c5c026d1 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -442,6 +442,40 @@ 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.
+ *
+ * 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 // LOK_USE_UNSTABLE_API
};
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index a0f5e886dcac..5931f7871e50 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
{
/**
@@ -221,7 +247,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;