[Libreoffice-commits] online.git: 3 commits - loleaflet/dist loleaflet/reference.html loleaflet/src loolwsd/bundled loolwsd/ChildProcessSession.cpp loolwsd/LOKitClient.cpp loolwsd/LOKitHelper.hpp loolwsd/protocol.txt
Jan Holesovsky
kendy at collabora.com
Fri Apr 8 17:15:43 UTC 2016
loleaflet/dist/toolbar/toolbar.js | 4 +
loleaflet/reference.html | 29 +++++++++++
loleaflet/src/layer/tile/TileLayer.js | 10 +++
loolwsd/ChildProcessSession.cpp | 3 +
loolwsd/LOKitClient.cpp | 1
loolwsd/LOKitHelper.hpp | 4 +
loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 23 ++++++++
loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h | 5 -
loolwsd/protocol.txt | 17 ++++++
9 files changed, 92 insertions(+), 4 deletions(-)
New commits:
commit b76140cb7b98383ccc5e008a48403c8f235e968a
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Apr 8 19:13:54 2016 +0200
loleaflet: Trigger locontextmenu event with the context menu structure.
diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 906eb76..b6a5b0e 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -910,6 +910,10 @@ map.on('editlock', function (e) {
}
});
+map.on('locontextmenu', function (e) {
+ // TODO: context menu handling...
+});
+
$(window).resize(function() {
resizeToolbar();
});
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 8cddd3f..c7c5bec 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -1888,6 +1888,12 @@ unexpected behaviour.</h4>
<td>Fired when the state of a command such as .uno:Bold changes.</td>
</tr>
<tr>
+ <td><code><b>locontextmenu</b></code></td>
+ <td><code><a href="#locontextmenu-event">LOContextMenuEvent</a></code></td>
+ <td>Fired when the user's action invoked a context menu (via a
+ right-click). It contains the structure of the menu.</td>
+ </tr>
+ <tr>
<td><code><b>docsize</b></code></td>
<td><code><a href="#docsize-event">DocumentSizeEvent</a></code></td>
<td>Fired when the document size changes.</td>
@@ -2031,6 +2037,29 @@ unexpected behaviour.</h4>
</tr>
</table>
+<h3 id="locontextmenu-event">LOContextMenuEvent</h3>
+
+<table data-id='events'>
+ <tr>
+ <th class="width100">property</th>
+ <th>type</th>
+ <th>description</th>
+ </tr>
+ <tr>
+ <td><code><b>menu</b></code></td>
+ <td><code>String</code></td>
+ <td>List of the menu entries. The structure looks like:<br/>
+<code>
+{ "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
+{ "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
+{ "type": "separator" },
+{ "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
+...
+</code>
+ </td>
+ </tr>
+</table>
+
<h3 id="docsize-event">DocumentSizeEvent</h3>
<table data-id='events'>
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 980f688..afd26f4 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -334,6 +334,9 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.startsWith('editlock')) {
this._onEditLock(textMsg);
}
+ else if (textMsg.startsWith('contextmenu:')) {
+ this._onContextMenuMsg(textMsg);
+ }
},
_onCommandValuesMsg: function (textMsg) {
@@ -632,6 +635,13 @@ L.TileLayer = L.GridLayer.extend({
},
+ _onContextMenuMsg: function (textMsg) {
+ textMsg = textMsg.substring(13);
+ var obj = JSON.parse(textMsg);
+
+ this._map.fire('locontextmenu', obj);
+ },
+
_onTextSelectionMsg: function (textMsg) {
var strTwips = textMsg.match(/\d+/g);
this._selections.clearLayers();
commit 156d52b82eb1a4c00e671bbf88e0d5ce61333609
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Apr 8 19:13:19 2016 +0200
loolwsd: Add handling of contextmenu: command.
diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 8750e18..ec7dc0f 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -193,6 +193,9 @@ public:
" kind=" + object->get("kind").toString() + " code=" + object->get("code").toString());
}
break;
+ case LOK_CALLBACK_CONTEXT_MENU:
+ _session.sendTextFrame("contextmenu: " + rPayload);
+ break;
}
}
diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp
index 63a725d..488644f 100644
--- a/loolwsd/LOKitClient.cpp
+++ b/loolwsd/LOKitClient.cpp
@@ -67,6 +67,7 @@ extern "C"
CASE(DOCUMENT_PASSWORD);
CASE(DOCUMENT_PASSWORD_TO_MODIFY);
CASE(ERROR);
+ CASE(CONTEXT_MENU);
#undef CASE
}
std::cout << " payload: " << pPayload << std::endl;
diff --git a/loolwsd/LOKitHelper.hpp b/loolwsd/LOKitHelper.hpp
index b6756fe..aa4da2c 100644
--- a/loolwsd/LOKitHelper.hpp
+++ b/loolwsd/LOKitHelper.hpp
@@ -86,6 +86,10 @@ namespace LOKitHelper
return "DOCUMENT_PASSWORD";
case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY:
return "DOCUMENT_PASSWORD_TO_MODIFY";
+ case LOK_CALLBACK_ERROR:
+ return "ERROR";
+ case LOK_CALLBACK_CONTEXT_MENU:
+ return "CONTEXT_MENU";
}
return std::to_string(nType);
diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt
index ae92db0..e5950dc 100644
--- a/loolwsd/protocol.txt
+++ b/loolwsd/protocol.txt
@@ -154,6 +154,23 @@ loolserver <major.minor[-patch]>
Security fixes that do not alter the API would bump the minor version number.
Patch: an optional string that is informational.
+contextmenu: <json description of the context menu>
+
+ When the user right-clicks in the document, the content of the context
+ menu is sent back via this callback.
+
+ The structure of the context menu is a JSON, and looks like:
+
+ {
+ "menu": [
+ { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
+ { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
+ { "type": "separator" },
+ { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
+ ...
+ ]
+ }
+
downloadas: jail=<jail directory> dir=<a tmp dir> name=<name> port=<port>
The client should then request http://server:port/jail/dir/name in order to download
commit 756cb642038e2d3c255ac8dbf92efecf86625beb
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Apr 8 16:49:50 2016 +0200
Update LOK headers to the latest ones.
diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 80ed9de..4b8ff35 100644
--- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -289,6 +289,29 @@ typedef enum
* }
*/
LOK_CALLBACK_ERROR,
+
+ /**
+ * Context menu structure
+ *
+ * Returns the structure of context menu. Contains all the separators &
+ * submenus, example of the returned structure:
+ *
+ * {
+ * "menu": [
+ * { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
+ * { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
+ * { "type": "separator" },
+ * { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
+ * ...
+ * ]
+ * }
+ *
+ * The 'command' can additionally have a checkable status, like:
+ *
+ * {"text": "label text3", "type": "command", "command": ".uno:Something3", "checktype": "checkmark|radio|auto", "checked": "true|false"}
+ */
+ LOK_CALLBACK_CONTEXT_MENU,
+
}
LibreOfficeKitCallbackType;
diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
index a1b2ddc..f1e513e 100644
--- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -45,12 +45,9 @@ extern "C"
void *lok_loadlib(const char *pFN)
{
return dlopen(pFN, RTLD_LAZY
-#if defined __clang__ && defined __linux__ \
- && defined ENABLE_RUNTIME_OPTIMIZATIONS
-#if !ENABLE_RUNTIME_OPTIMIZATIONS
+#if defined LOK_LOADLIB_GLOBAL
| RTLD_GLOBAL
#endif
-#endif
);
}
More information about the Libreoffice-commits
mailing list