Blame SOURCES/0264-lok-Introduce-LOK_CALLBACK_UNO_COMMAND_RESULT-callba.patch

135360
From 1c5b0b2f4a2e883f5da3a4afb3cadaf695d58fac Mon Sep 17 00:00:00 2001
135360
From: Jan Holesovsky <kendy@collabora.com>
135360
Date: Tue, 3 Nov 2015 13:20:06 +0100
135360
Subject: [PATCH 264/398] lok: Introduce LOK_CALLBACK_UNO_COMMAND_RESULT
135360
 callback.
135360
135360
Posting of the .uno:Something commands is asynchronous.  To be able to find
135360
out when eg. .uno:Save finished, this commit introduces a callback that fires
135360
when that happens.
135360
135360
To be able to receive such a notification, the appropriate postUnoCommand()
135360
must be called with 'true' as the parameter for bNotifyWhenFinished (defaults
135360
to 'false').
135360
135360
Change-Id: I254939ebc8ea5f309ae39686dcaaeddd5148b0c9
135360
(cherry picked from commit 8c987fababbddb6e4f81b0cd717b59b9a9ff9be0)
135360
---
135360
 comphelper/source/misc/dispatchcommand.cxx         |  9 ++-
135360
 desktop/inc/lib/init.hxx                           |  2 +
135360
 desktop/source/lib/init.cxx                        | 74 ++++++++++++++++++++--
135360
 include/LibreOfficeKit/LibreOfficeKit.h            |  8 ++-
135360
 include/LibreOfficeKit/LibreOfficeKit.hxx          |  4 +-
135360
 include/LibreOfficeKit/LibreOfficeKitEnums.h       | 17 ++++-
135360
 include/LibreOfficeKit/LibreOfficeKitGtk.h         |  4 +-
135360
 include/comphelper/dispatchcommand.hxx             |  5 +-
135360
 .../qa/gtktiledviewer/gtktiledviewer.cxx           | 15 ++++-
135360
 libreofficekit/source/gtk/lokdocview.cxx           | 34 +++++++++-
135360
 libreofficekit/source/gtk/tilebuffer.hxx           |  2 +
135360
 11 files changed, 157 insertions(+), 17 deletions(-)
135360
135360
diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx
135360
index 5de05542dbb4..a5a6dde0885d 100644
135360
--- a/comphelper/source/misc/dispatchcommand.cxx
135360
+++ b/comphelper/source/misc/dispatchcommand.cxx
135360
@@ -23,6 +23,7 @@
135360
 #include <com/sun/star/frame/Desktop.hpp>
135360
 #include <com/sun/star/frame/XDispatch.hpp>
135360
 #include <com/sun/star/frame/XDispatchProvider.hpp>
135360
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
135360
 #include <com/sun/star/util/URL.hpp>
135360
 #include <com/sun/star/util/URLTransformer.hpp>
135360
 
135360
@@ -30,7 +31,7 @@ using namespace css;
135360
 
135360
 namespace comphelper {
135360
 
135360
-bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
135360
+bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments, uno::Reference<css::frame::XDispatchResultListener> aListener)
135360
 {
135360
     // Target where we will execute the .uno: command
135360
     uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
135360
@@ -54,7 +55,11 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence
135360
         return false;
135360
 
135360
     // And do the work...
135360
-    xDisp->dispatch(aCommandURL, rArguments);
135360
+    uno::Reference<frame::XNotifyingDispatch> xNotifyingDisp(xDisp, uno::UNO_QUERY);
135360
+    if (xNotifyingDisp.is())
135360
+        xNotifyingDisp->dispatchWithNotification(aCommandURL, rArguments, aListener);
135360
+    else
135360
+        xNotifyingDisp->dispatch(aCommandURL, rArguments);
135360
 
135360
     return true;
135360
 }
135360
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
135360
index d3a42fb10bde..4f878d26c007 100644
135360
--- a/desktop/inc/lib/init.hxx
135360
+++ b/desktop/inc/lib/init.hxx
135360
@@ -20,6 +20,8 @@ namespace desktop {
135360
     {
135360
         uno::Reference<css::lang::XComponent> mxComponent;
135360
         std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass;
135360
+        LibreOfficeKitCallback mpCallback;
135360
+        void *mpCallbackData;
135360
 
135360
         explicit LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent);
135360
         ~LibLODocument_Impl();
135360
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
135360
index 98747ea62e3a..9ba26c414d8c 100644
135360
--- a/desktop/source/lib/init.cxx
135360
+++ b/desktop/source/lib/init.cxx
135360
@@ -35,6 +35,8 @@
135360
 #include <com/sun/star/beans/XPropertySet.hpp>
135360
 #include <com/sun/star/container/XNameAccess.hpp>
135360
 #include <com/sun/star/frame/Desktop.hpp>
135360
+#include <com/sun/star/frame/DispatchResultEvent.hpp>
135360
+#include <com/sun/star/frame/DispatchResultState.hpp>
135360
 #include <com/sun/star/frame/XStorable.hpp>
135360
 #include <com/sun/star/lang/Locale.hpp>
135360
 #include <com/sun/star/lang/XComponent.hpp>
135360
@@ -240,7 +242,8 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis,
135360
                                 int nModifier);
135360
 static void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
135360
                                const char* pCommand,
135360
-                               const char* pArguments);
135360
+                               const char* pArguments,
135360
+                               bool bNotifyWhenFinished);
135360
 static void doc_setTextSelection (LibreOfficeKitDocument* pThis,
135360
                                   int nType,
135360
                                   int nX,
135360
@@ -883,9 +886,14 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis)
135360
 }
135360
 
135360
 static void doc_registerCallback(LibreOfficeKitDocument* pThis,
135360
-                                LibreOfficeKitCallback pCallback,
135360
-                                void* pData)
135360
+                                 LibreOfficeKitCallback pCallback,
135360
+                                 void* pData)
135360
 {
135360
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
135360
+
135360
+    pDocument->mpCallback = pCallback;
135360
+    pDocument->mpCallbackData = pData;
135360
+
135360
     if (comphelper::LibreOfficeKit::isViewCallback())
135360
     {
135360
         if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell())
135360
@@ -950,13 +958,69 @@ static void jsonToPropertyValues(const char* pJSON, uno::Sequence
135360
     rPropertyValues = comphelper::containerToSequence(aArguments);
135360
 }
135360
 
135360
-static void doc_postUnoCommand(LibreOfficeKitDocument* /*pThis*/, const char* pCommand, const char* pArguments)
135360
+/** Class to react on finishing of a dispatched command.
135360
+
135360
+    This will call a LOK_COMMAND_FINISHED callback when postUnoCommand was
135360
+    called with the parameter requesting the notification.
135360
+
135360
+    @see LibreOfficeKitCallbackType::LOK_CALLBACK_UNO_COMMAND_RESULT.
135360
+*/
135360
+class DispatchResultListener : public cppu::WeakImplHelper<css::frame::XDispatchResultListener>
135360
+{
135360
+    OString maCommand;                 ///< Command for which this is the result.
135360
+    LibreOfficeKitCallback mpCallback; ///< Callback to call.
135360
+    void* mpCallbackData;              ///< The callback's data.
135360
+
135360
+public:
135360
+    DispatchResultListener(const char* pCommand, LibreOfficeKitCallback pCallback, void* pCallbackData)
135360
+        : maCommand(pCommand)
135360
+        , mpCallback(pCallback)
135360
+        , mpCallbackData(pCallbackData)
135360
+    {
135360
+        assert(mpCallback);
135360
+    }
135360
+
135360
+    virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& rEvent) throw(css::uno::RuntimeException, std::exception) override
135360
+    {
135360
+        boost::property_tree::ptree aTree;
135360
+        aTree.put("commandName", maCommand.getStr());
135360
+
135360
+        if (rEvent.State != frame::DispatchResultState::DONTKNOW)
135360
+        {
135360
+            bool bSuccess = (rEvent.State == frame::DispatchResultState::SUCCESS);
135360
+            aTree.put("success", bSuccess);
135360
+        }
135360
+
135360
+        // TODO UNO Any rEvent.Result -> JSON
135360
+        // aTree.put("result": "...");
135360
+
135360
+        std::stringstream aStream;
135360
+        boost::property_tree::write_json(aStream, aTree);
135360
+        mpCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, strdup(aStream.str().c_str()), mpCallbackData);
135360
+    }
135360
+
135360
+    virtual void SAL_CALL disposing(const css::lang::EventObject&) throw (css::uno::RuntimeException, std::exception) override {}
135360
+};
135360
+
135360
+static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished)
135360
 {
135360
     OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8);
135360
 
135360
     uno::Sequence<beans::PropertyValue> aPropertyValues;
135360
     jsonToPropertyValues(pArguments, aPropertyValues);
135360
-    if (!comphelper::dispatchCommand(aCommand, aPropertyValues))
135360
+    bool bResult = false;
135360
+
135360
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
135360
+
135360
+    if (bNotifyWhenFinished && pDocument->mpCallback)
135360
+    {
135360
+        bResult = comphelper::dispatchCommand(aCommand, aPropertyValues,
135360
+                new DispatchResultListener(pCommand, pDocument->mpCallback, pDocument->mpCallbackData));
135360
+    }
135360
+    else
135360
+        bResult = comphelper::dispatchCommand(aCommand, aPropertyValues);
135360
+
135360
+    if (!bResult)
135360
     {
135360
         gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command";
135360
     }
135360
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
135360
index d83717b4a809..c887f5f64b8a 100644
135360
--- a/include/LibreOfficeKit/LibreOfficeKit.h
135360
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
135360
@@ -12,6 +12,11 @@
135360
 
135360
 #include <stddef.h>
135360
 
135360
+#ifdef LOK_USE_UNSTABLE_API
135360
+// the unstable API needs C99's bool
135360
+#include <stdbool.h>
135360
+#endif
135360
+
135360
 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
135360
 
135360
 #ifdef __cplusplus
135360
@@ -144,7 +149,8 @@ struct _LibreOfficeKitDocumentClass
135360
     /// @see lok::Document::postUnoCommand
135360
     void (*postUnoCommand) (LibreOfficeKitDocument* pThis,
135360
                             const char* pCommand,
135360
-                            const char* pArguments);
135360
+                            const char* pArguments,
135360
+                            bool bNotifyWhenFinished);
135360
 
135360
     /// @see lok::Document::setTextSelection
135360
     void (*setTextSelection) (LibreOfficeKitDocument* pThis,
135360
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
135360
index 6673cd731eb7..c51339fa3ba8 100644
135360
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
135360
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
135360
@@ -220,9 +220,9 @@ public:
135360
      * @param pCommand uno command to be posted to the document, like ".uno:Bold"
135360
      * @param pArguments arguments of the uno command.
135360
      */
135360
-    inline void postUnoCommand(const char* pCommand, const char* pArguments = 0)
135360
+    inline void postUnoCommand(const char* pCommand, const char* pArguments = 0, bool bNotifyWhenFinished = false)
135360
     {
135360
-        mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments);
135360
+        mpDoc->pClass->postUnoCommand(mpDoc, pCommand, pArguments, bNotifyWhenFinished);
135360
     }
135360
 
135360
     /**
135360
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
135360
index 459da5d196f4..86d9e6bfd873 100644
135360
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
135360
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
135360
@@ -180,7 +180,22 @@ typedef enum
135360
      * - searchResultSelection is an array of part-number and rectangle list
135360
      *   pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format.
135360
      */
135360
-    LOK_CALLBACK_SEARCH_RESULT_SELECTION
135360
+    LOK_CALLBACK_SEARCH_RESULT_SELECTION,
135360
+
135360
+    /**
135360
+     * Result of the UNO command execution when bNotifyWhenFinished was set
135360
+     * to 'true' during the postUnoCommand() call.
135360
+     *
135360
+     * The result returns a success / failure state, and potentially
135360
+     * additional data:
135360
+     *
135360
+     * {
135360
+     *     "commandName": "...",    // the command for which this is the result
135360
+     *     "success": true/false,   // when the result is "don't know", this is missing
135360
+     *     // TODO "result": "..."  // UNO Any converted to JSON (not implemented yet)
135360
+     * }
135360
+     */
135360
+    LOK_CALLBACK_UNO_COMMAND_RESULT
135360
 }
135360
 LibreOfficeKitCallbackType;
135360
 
135360
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
index 81f42105d374..32cb66963220 100644
135360
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
135360
@@ -184,12 +184,14 @@ gboolean                       lok_doc_view_get_edit               (LOKDocView*
135360
  * @pDocView: the #LOKDocView instance
135360
  * @pCommand: the command to issue to LO core
135360
  * @pArguments: the arguments to the given command
135360
+ * @bNotifyWhenFinished: normally false, but it may be useful for eg. .uno:Save
135360
  *
135360
  * Posts the .uno: command to the LibreOfficeKit.
135360
  */
135360
 void                           lok_doc_view_post_command           (LOKDocView* pDocView,
135360
                                                                     const gchar* pCommand,
135360
-                                                                    const gchar* pArguments);
135360
+                                                                    const gchar* pArguments,
135360
+                                                                    gboolean bNotifyWhenFinished);
135360
 
135360
 /**
135360
  * lok_doc_view_pixel_to_twip:
135360
diff --git a/include/comphelper/dispatchcommand.hxx b/include/comphelper/dispatchcommand.hxx
135360
index 58aa0b940f4e..7b76bd5a0310 100644
135360
--- a/include/comphelper/dispatchcommand.hxx
135360
+++ b/include/comphelper/dispatchcommand.hxx
135360
@@ -14,6 +14,7 @@
135360
 #include <rtl/ustring.hxx>
135360
 #include <com/sun/star/uno/Sequence.hxx>
135360
 #include <com/sun/star/beans/PropertyValue.hpp>
135360
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
135360
 
135360
 namespace comphelper
135360
 {
135360
@@ -24,7 +25,9 @@ namespace comphelper
135360
 
135360
     @return true on success.
135360
 */
135360
-COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArguments);
135360
+COMPHELPER_DLLPUBLIC bool dispatchCommand(const OUString& rCommand,
135360
+        const css::uno::Sequence<css::beans::PropertyValue>& rArguments,
135360
+        css::uno::Reference<css::frame::XDispatchResultListener> aListener = css::uno::Reference<css::frame::XDispatchResultListener>());
135360
 
135360
 }
135360
 
135360
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
135360
index 795fb4ed7ff7..96a69fcf64f8 100644
135360
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
135360
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
135360
@@ -595,7 +595,7 @@ static void doSearch(GtkWidget* pButton, bool bBackwards)
135360
     std::stringstream aStream;
135360
     boost::property_tree::write_json(aStream, aTree);
135360
 
135360
-    lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str());
135360
+    lok_doc_view_post_command(pLOKDocView, ".uno:ExecuteSearch", aStream.str().c_str(), false);
135360
 }
135360
 
135360
 /// Click handler for the search next button.
135360
@@ -671,6 +671,12 @@ static void signalCommand(LOKDocView* pLOKDocView, char* pPayload, gpointer /*pD
135360
     }
135360
 }
135360
 
135360
+/// LOKDocView command finished -> just write it to the console, not that useful for the viewer.
135360
+static void signalCommandResult(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer /*pData*/)
135360
+{
135360
+    fprintf(stderr, "Command finished: %s\n", pPayload);
135360
+}
135360
+
135360
 static void loadChanged(LOKDocView* /*pLOKDocView*/, gdouble fValue, gpointer pData)
135360
 {
135360
     GtkWidget* pProgressBar = GTK_WIDGET (pData);
135360
@@ -773,7 +779,11 @@ static void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
135360
         GtkToolItem* pItem = GTK_TOOL_ITEM(pWidget);
135360
         const std::string& rString = rWindow.m_aToolItemCommandNames[pItem];
135360
         g_info("toggleToolItem: lok_doc_view_post_command('%s')", rString.c_str());
135360
-        lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0);
135360
+
135360
+        // notify about the finished Save
135360
+        gboolean bNotify = (rString == ".uno:Save");
135360
+
135360
+        lok_doc_view_post_command(pLOKDocView, rString.c_str(), 0, bNotify);
135360
     }
135360
 }
135360
 
135360
@@ -1171,6 +1181,7 @@ static void setupDocView(GtkWidget* pDocView)
135360
 #endif
135360
     g_signal_connect(pDocView, "edit-changed", G_CALLBACK(signalEdit), NULL);
135360
     g_signal_connect(pDocView, "command-changed", G_CALLBACK(signalCommand), NULL);
135360
+    g_signal_connect(pDocView, "command-result", G_CALLBACK(signalCommandResult), NULL);
135360
     g_signal_connect(pDocView, "search-not-found", G_CALLBACK(signalSearch), NULL);
135360
     g_signal_connect(pDocView, "search-result-count", G_CALLBACK(signalSearchResultCount), NULL);
135360
     g_signal_connect(pDocView, "part-changed", G_CALLBACK(signalPart), NULL);
135360
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
135360
index 49d5ecc54f65..bcb1d136b749 100644
135360
--- a/libreofficekit/source/gtk/lokdocview.cxx
135360
+++ b/libreofficekit/source/gtk/lokdocview.cxx
135360
@@ -180,6 +180,7 @@ enum
135360
     HYPERLINK_CLICKED,
135360
     CURSOR_CHANGED,
135360
     SEARCH_RESULT_COUNT,
135360
+    COMMAND_RESULT,
135360
 
135360
     LAST_SIGNAL
135360
 };
135360
@@ -461,6 +462,11 @@ static void searchResultCount(LOKDocView* pDocView, const std::string& rString)
135360
     g_signal_emit(pDocView, doc_view_signals[SEARCH_RESULT_COUNT], 0, rString.c_str());
135360
 }
135360
 
135360
+static void commandResult(LOKDocView* pDocView, const std::string& rString)
135360
+{
135360
+    g_signal_emit(pDocView, doc_view_signals[COMMAND_RESULT], 0, rString.c_str());
135360
+}
135360
+
135360
 static void
135360
 setPart(LOKDocView* pDocView, const std::string& rString)
135360
 {
135360
@@ -752,6 +758,11 @@ callback (gpointer pData)
135360
         searchResultCount(pDocView, std::to_string(nCount));
135360
     }
135360
     break;
135360
+    case LOK_CALLBACK_UNO_COMMAND_RESULT:
135360
+    {
135360
+        commandResult(pDocView, pCallback->m_aPayload);
135360
+    }
135360
+    break;
135360
     default:
135360
         g_assert(false);
135360
         break;
135360
@@ -1520,7 +1531,7 @@ postCommandInThread (gpointer data)
135360
     std::stringstream ss;
135360
     ss << "lok::Document::postUnoCommand(" << pLOEvent->m_pCommand << ", " << pLOEvent->m_pArguments << ")";
135360
     g_info(ss.str().c_str());
135360
-    priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments);
135360
+    priv->m_pDocument->pClass->postUnoCommand(priv->m_pDocument, pLOEvent->m_pCommand, pLOEvent->m_pArguments, pLOEvent->m_bNotifyWhenFinished);
135360
 }
135360
 
135360
 static void
135360
@@ -2077,6 +2088,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
135360
                      G_TYPE_NONE, 4,
135360
                      G_TYPE_INT, G_TYPE_INT,
135360
                      G_TYPE_INT, G_TYPE_INT);
135360
+
135360
     /**
135360
      * LOKDocView::search-result-count:
135360
      * @pDocView: the #LOKDocView on which the signal is emitted
135360
@@ -2092,6 +2104,22 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
135360
                      G_TYPE_NONE, 1,
135360
                      G_TYPE_STRING);
135360
 
135360
+    /**
135360
+     * LOKDocView::command-result:
135360
+     * @pDocView: the #LOKDocView on which the signal is emitted
135360
+     * @aCommand: JSON containing the info about the command that finished,
135360
+     * and its success status.
135360
+     */
135360
+    doc_view_signals[COMMAND_RESULT] =
135360
+        g_signal_new("command-result",
135360
+                     G_TYPE_FROM_CLASS(pGObjectClass),
135360
+                     G_SIGNAL_RUN_FIRST,
135360
+                     0,
135360
+                     NULL, NULL,
135360
+                     g_cclosure_marshal_VOID__STRING,
135360
+                     G_TYPE_NONE, 1,
135360
+                     G_TYPE_STRING);
135360
+
135360
 }
135360
 
135360
 SAL_DLLPUBLIC_EXPORT GtkWidget*
135360
@@ -2326,7 +2354,8 @@ lok_doc_view_get_edit (LOKDocView* pDocView)
135360
 SAL_DLLPUBLIC_EXPORT void
135360
 lok_doc_view_post_command (LOKDocView* pDocView,
135360
                            const gchar* pCommand,
135360
-                           const gchar* pArguments)
135360
+                           const gchar* pArguments,
135360
+                           gboolean bNotifyWhenFinished)
135360
 {
135360
     LOKDocViewPrivate& priv = getPrivate(pDocView);
135360
     GTask* task = g_task_new(pDocView, NULL, NULL, NULL);
135360
@@ -2334,6 +2363,7 @@ lok_doc_view_post_command (LOKDocView* pDocView,
135360
     GError* error = NULL;
135360
     pLOEvent->m_pCommand = pCommand;
135360
     pLOEvent->m_pArguments  = g_strdup(pArguments);
135360
+    pLOEvent->m_bNotifyWhenFinished = bNotifyWhenFinished;
135360
 
135360
     g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
135360
     g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), &error);
135360
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
135360
index 5e1ea1a27049..8a8569eeb306 100644
135360
--- a/libreofficekit/source/gtk/tilebuffer.hxx
135360
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
135360
@@ -171,6 +171,7 @@ struct LOEvent
135360
     ///@{
135360
     const gchar* m_pCommand;
135360
     gchar* m_pArguments;
135360
+    gboolean m_bNotifyWhenFinished;
135360
     ///@}
135360
 
135360
     /// @name open_document parameter
135360
@@ -223,6 +224,7 @@ struct LOEvent
135360
         : m_nType(type)
135360
         , m_pCommand(0)
135360
         , m_pArguments(0)
135360
+        , m_bNotifyWhenFinished(false)
135360
         , m_pPath(0)
135360
         , m_bEdit(false)
135360
         , m_nPartMode(0)
135360
-- 
135360
2.12.0
135360