diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-11-03 13:20:06 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-11-03 13:25:23 +0100 |
commit | 8c987fababbddb6e4f81b0cd717b59b9a9ff9be0 (patch) | |
tree | 269bb73e21a8afebd8ea916d1280d8f858a571bc /include/LibreOfficeKit | |
parent | c0f37892a24b202c0a28836ed1046c90c7631e03 (diff) |
lok: Introduce LOK_CALLBACK_UNO_COMMAND_RESULT callback.
Posting of the .uno:Something commands is asynchronous. To be able to find
out when eg. .uno:Save finished, this commit introduces a callback that fires
when that happens.
To be able to receive such a notification, the appropriate postUnoCommand()
must be called with 'true' as the parameter for bNotifyWhenFinished (defaults
to 'false').
Change-Id: I254939ebc8ea5f309ae39686dcaaeddd5148b0c9
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 8 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 4 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 17 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitGtk.h | 4 |
4 files changed, 28 insertions, 5 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index d83717b4a809..c887f5f64b8a 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -12,6 +12,11 @@ #include <stddef.h> +#ifdef LOK_USE_UNSTABLE_API +// the unstable API needs C99's bool +#include <stdbool.h> +#endif + #include <LibreOfficeKit/LibreOfficeKitTypes.h> #ifdef __cplusplus @@ -144,7 +149,8 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::postUnoCommand void (*postUnoCommand) (LibreOfficeKitDocument* pThis, const char* pCommand, - const char* pArguments); + const char* pArguments, + bool bNotifyWhenFinished); /// @see lok::Document::setTextSelection void (*setTextSelection) (LibreOfficeKitDocument* pThis, diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index ac95131633f4..315889ad8e53 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -220,9 +220,9 @@ public: * @param pCommand uno command to be posted to the document, like ".uno:Bold" * @param pArguments arguments of the uno command. */ - inline void postUnoCommand(const char* pCommand, const char* pArguments = 0) + inline void postUnoCommand(const char* pCommand, const char* pArguments = 0, bool bNotifyWhenFinished = false) { - mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments); + mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished); } /** diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 459da5d196f4..86d9e6bfd873 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -180,7 +180,22 @@ typedef enum * - searchResultSelection is an array of part-number and rectangle list * pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format. */ - LOK_CALLBACK_SEARCH_RESULT_SELECTION + LOK_CALLBACK_SEARCH_RESULT_SELECTION, + + /** + * Result of the UNO command execution when bNotifyWhenFinished was set + * to 'true' during the postUnoCommand() call. + * + * The result returns a success / failure state, and potentially + * additional data: + * + * { + * "commandName": "...", // the command for which this is the result + * "success": true/false, // when the result is "don't know", this is missing + * // TODO "result": "..." // UNO Any converted to JSON (not implemented yet) + * } + */ + LOK_CALLBACK_UNO_COMMAND_RESULT } LibreOfficeKitCallbackType; diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h index 81f42105d374..32cb66963220 100644 --- a/include/LibreOfficeKit/LibreOfficeKitGtk.h +++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h @@ -184,12 +184,14 @@ gboolean lok_doc_view_get_edit (LOKDocView* * @pDocView: the #LOKDocView instance * @pCommand: the command to issue to LO core * @pArguments: the arguments to the given command + * @bNotifyWhenFinished: normally false, but it may be useful for eg. .uno:Save * * Posts the .uno: command to the LibreOfficeKit. */ void lok_doc_view_post_command (LOKDocView* pDocView, const gchar* pCommand, - const gchar* pArguments); + const gchar* pArguments, + gboolean bNotifyWhenFinished); /** * lok_doc_view_pixel_to_twip: |