[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - kit/KitHelper.hpp loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Apr 15 02:23:26 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 b3fe7a05d8392d41951865cd2d0fad43dd7625cf
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Sep 16 17:32:56 2018 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Apr 15 04:23:07 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>
diff --git a/kit/KitHelper.hpp b/kit/KitHelper.hpp
index b6225feda..f8ec0c9a3 100644
--- a/kit/KitHelper.hpp
+++ b/kit/KitHelper.hpp
@@ -157,32 +157,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 b21a3b496..4e3ee7547 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -996,6 +996,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