[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - 2 commits - bundled/include kit/ChildSession.cpp loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 13 07:43:17 UTC 2019


 bundled/include/LibreOfficeKit/LibreOfficeKit.h      |    2 -
 bundled/include/LibreOfficeKit/LibreOfficeKit.hxx    |    4 +--
 bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |    3 +-
 kit/ChildSession.cpp                                 |   17 ++++++++++++-
 loleaflet/src/control/Control.LokDialog.js           |   24 +++++++++++++++++++
 5 files changed, 45 insertions(+), 5 deletions(-)

New commits:
commit e4b8d9d794aaba5a88cf687b5c1c547428064dbd
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Apr 18 18:22:18 2019 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Jun 13 09:42:54 2019 +0200

    wsd: allow paste content to tunneled dialog
    
    Change-Id: I32fabaa533a0e9d853226b329d2d8b1c489dd776
    Reviewed-on: https://gerrit.libreoffice.org/70960
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/71370
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index fe1b25bc3..133f73875 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -288,7 +288,7 @@ struct _LibreOfficeKitDocumentClass
                          const int width, const int height);
 
     /// @see lok::Document::postWindow().
-    void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction);
+    void (*postWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId, int nAction, const char* pData);
 
     /// @see lok::Document::postWindowKeyEvent().
     void (*postWindowKeyEvent) (LibreOfficeKitDocument* pThis,
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
index 72824be0f..a72275ed1 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -188,9 +188,9 @@ public:
      *
      * @param nWindowid
      */
-    void postWindow(unsigned nWindowId, int nAction)
+    void postWindow(unsigned nWindowId, int nAction, const char* pData)
     {
-        return mpDoc->pClass->postWindow(mpDoc, nWindowId, nAction);
+        return mpDoc->pClass->postWindow(mpDoc, nWindowId, nAction, pData);
     }
 
     /**
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 1d55ce858..b82e28d93 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -42,7 +42,8 @@ LibreOfficeKitTileMode;
 
 typedef enum
 {
-    LOK_WINDOW_CLOSE
+    LOK_WINDOW_CLOSE,
+    LOK_WINDOW_PASTE
 }
 LibreOfficeKitWindowAction;
 
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 662b0a664..9617a96b7 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1311,7 +1311,22 @@ bool ChildSession::sendWindowCommand(const char* /*buffer*/, int /*length*/, con
     getLOKitDocument()->setView(_viewId);
 
     if (tokens.size() > 2 && tokens[2] == "close")
-        getLOKitDocument()->postWindow(winId, LOK_WINDOW_CLOSE);
+        getLOKitDocument()->postWindow(winId, LOK_WINDOW_CLOSE, nullptr);
+    else if (tokens.size() > 3 && tokens[2] == "paste")
+    {
+        std::string data;
+        try
+        {
+            URI::decode(tokens[3], data);
+        }
+        catch (Poco::SyntaxException& exc)
+        {
+            sendTextFrame("error: cmd=windowcommand kind=syntax");
+            return false;
+        }
+
+        getLOKitDocument()->postWindow(winId, LOK_WINDOW_PASTE, data.c_str());
+    }
 
     return true;
 }
commit dfd6c8f2661651a6a3419d8525aa1331d83f0e44
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Apr 18 18:26:33 2019 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Jun 13 09:42:40 2019 +0200

    loleaflet: add 'paste' event listener to dialog
    
    Change-Id: I2ec69117683e4dd75722b1873a373ee6b7ec7782
    Reviewed-on: https://gerrit.libreoffice.org/70961
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/71371
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index c7917d8cb..56f0404d0 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -451,6 +451,30 @@ L.Control.LokDialog = L.Control.extend({
 			              // Keep map active while user is playing with window.
 			              this._map.lastActiveTime = Date.now();
 		              }, this);
+		L.DomEvent.on(dlgInput, 'paste', function(e) {
+			var clipboardData = e.clipboardData || window.clipboardData;
+			var data, blob;
+
+			L.DomEvent.preventDefault(e);
+			if (clipboardData) {
+				data = clipboardData.getData('text/plain') || clipboardData.getData('Text');
+				if (data) {
+					var cmd = {
+						MimeType: {
+							type: 'string',
+							value: 'mimetype=text/plain;charset=utf-8'
+						},
+						Data: {
+							type: '[]byte',
+							value: data
+						}
+					};
+
+					blob = new Blob(['windowcommand ' + id + ' paste ', encodeURIComponent(JSON.stringify(cmd))]);
+					this._map._socket.sendMessage(blob);
+				}
+			}
+		}, this);
 		L.DomEvent.on(dlgInput, 'contextmenu', function() {
 			return false;
 		});


More information about the Libreoffice-commits mailing list