[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/LibreOfficeKit sfx2/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 30 07:40:38 UTC 2019


 include/LibreOfficeKit/LibreOfficeKitEnums.h |    8 ++++++++
 sfx2/source/sidebar/Deck.cxx                 |   16 ++++++++++++++++
 2 files changed, 24 insertions(+)

New commits:
commit 11730bf818c2df6b471efbcc6254cca5ad6a6054
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Sep 24 17:29:53 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Sep 30 09:39:57 2019 +0200

    jsdialogs: send JSON to the client
    
    Change-Id: If43a774e1e3a4bff4a8ec862f0091d60477090d4
    Reviewed-on: https://gerrit.libreoffice.org/79695
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index aea463909da3..03c7085b9039 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -703,6 +703,12 @@ typedef enum
      * }
      */
     LOK_CALLBACK_REFERENCE_MARKS = 45,
+
+    /**
+     * Callback related to native dialogs generated in JavaScript from
+     * the description.
+     */
+    LOK_CALLBACK_JSDIALOG = 46,
 }
 LibreOfficeKitCallbackType;
 
@@ -823,6 +829,8 @@ static inline const char* lokCallbackTypeToString(int nType)
         return "LOK_CALLBACK_TABLE_SELECTED";
     case LOK_CALLBACK_REFERENCE_MARKS:
         return "LOK_CALLBACK_REFERENCE_MARKS";
+    case LOK_CALLBACK_JSDIALOG:
+        return "LOK_CALLBACK_JSDIALOG";
     }
 
     assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 15f591fd1e64..f1114982204c 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -38,6 +38,8 @@
 #include <vcl/IDialogRenderable.hxx>
 #include <tools/svborder.hxx>
 #include <sal/log.hxx>
+#include <boost/property_tree/json_parser.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 using namespace css;
 using namespace css::uno;
@@ -179,6 +181,20 @@ bool Deck::EventNotify(NotifyEvent& rEvent)
 void Deck::Resize()
 {
     Window::Resize();
+
+    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
+    {
+        try
+        {
+            std::stringstream aStream;
+            boost::property_tree::write_json(aStream, DumpAsPropertyTree());
+            pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str());
+        }
+        catch(boost::property_tree::json_parser::json_parser_error& rError)
+        {
+            SAL_WARN("sfx.sidebar", rError.message());
+        }
+    }
 }
 
 bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent)


More information about the Libreoffice-commits mailing list