[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - kit/KitHelper.hpp loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 18 20:28:33 UTC 2019
kit/KitHelper.hpp | 51 ++++++++++++++++++++++++-----------------
loleaflet/src/control/Parts.js | 1
loleaflet/src/core/Socket.js | 7 +++++
3 files changed, 38 insertions(+), 21 deletions(-)
New commits:
commit 613dd556e2eebac1da00c1484fa3f06f31801b0d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Sep 16 17:32:56 2018 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Oct 18 22:28:13 2019 +0200
wsd: leaflet: status now includes selected parts
Change-Id: I3eeb2fbc52d28047dd0ab7e4318fa44d5c5c0a98
Reviewed-on: https://gerrit.libreoffice.org/69632
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
(cherry picked from commit b3fe7a05d8392d41951865cd2d0fad43dd7625cf)
Reviewed-on: https://gerrit.libreoffice.org/80575
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/kit/KitHelper.hpp b/kit/KitHelper.hpp
index 88d090428..d3a9efd96 100644
--- a/kit/KitHelper.hpp
+++ b/kit/KitHelper.hpp
@@ -159,32 +159,41 @@ namespace LOKitHelper
if (type == LOK_DOCTYPE_SPREADSHEET || type == LOK_DOCTYPE_PRESENTATION)
{
- if (type == LOK_DOCTYPE_SPREADSHEET)
+ std::ostringstream hposs;
+ std::ostringstream sposs;
+ for (int i = 0; i < parts; ++i)
{
- std::ostringstream hposs;
- for (int i = 0; i < parts; ++i)
+ ptrValue = loKitDocument->pClass->getPartInfo(loKitDocument, i);
+ const std::string partinfo(ptrValue);
+ std::free(ptrValue);
+ for (const auto& prop : Util::JsonToMap(partinfo))
{
-
- ptrValue = loKitDocument->pClass->getPartInfo(loKitDocument, i);
- std::string partinfo(ptrValue);
- std::free(ptrValue);
- const auto aPartInfo = Util::JsonToMap(partinfo);
- for (const auto& prop: aPartInfo)
+ const std::string& name = prop.first;
+ if (name == "visible")
{
- const std::string& name = prop.first;
- if (name == "visible")
- {
- if (prop.second == "0")
- hposs << i << ",";
- }
+ if (prop.second == "0")
+ hposs << i << ',';
+ }
+ else if (name == "selected")
+ {
+ if (prop.second == "1")
+ sposs << i << ',';
}
}
- std::string hiddenparts = hposs.str();
- if (!hiddenparts.empty())
- {
- hiddenparts.pop_back();
- oss << " hiddenparts=" << hiddenparts;
- }
+ }
+
+ std::string hiddenparts = hposs.str();
+ if (!hiddenparts.empty())
+ {
+ hiddenparts.pop_back(); // Remove last ','
+ oss << " hiddenparts=" << hiddenparts;
+ }
+
+ std::string selectedparts = sposs.str();
+ if (!selectedparts.empty())
+ {
+ selectedparts.pop_back(); // Remove last ','
+ oss << " selectedparts=" << selectedparts;
}
for (int i = 0; i < parts; ++i)
diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index 49a8de3ec..24e57ba55 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -57,6 +57,7 @@ L.Map.include({
// part is the part index/id
// how is 0 to deselect, 1 to select, and 2 to toggle selection
selectPart: function (part, how, external) {
+ //TODO: Update/track selected parts.
var docLayer = this._docLayer;
if (typeof (part) === 'number' && part >= 0 && part < docLayer._parts) {
var selectedPart = part;
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 350f19f2b..19a23b1c2 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -1000,6 +1000,13 @@ L.Socket = L.Class.extend({
command.hiddenparts.push(parseInt(item));
});
}
+ else if (tokens[i].startsWith('selectedparts=')) {
+ var selectedparts = tokens[i].substring(14).split(',');
+ command.selectedparts = [];
+ selectedparts.forEach(function (item) {
+ command.selectedparts.push(parseInt(item));
+ });
+ }
}
if (command.tileWidth && command.tileHeight && this._map._docLayer) {
var defaultZoom = this._map.options.zoom;
More information about the Libreoffice-commits
mailing list