wsd: leaflet: support statusupdate: messages to sync clients

This new message is identical to status: except it doesn't
imply (re)connection. It's unfortunate that status: is
assumed to be sent only when establishing connection and
loading a document, so we need a different notification
that can be sent at any time, without triggering
initalization logic on the client-side.

Change-Id: I9c804119aec292b873aeed132cc32f13c030d845
Reviewed-on: https://gerrit.libreoffice.org/69634
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71098
This commit is contained in:
Ashod Nakashian 2018-09-17 06:45:57 -04:00 committed by Ashod Nakashian
parent 7d03d68e1a
commit 8e118889cb
3 changed files with 10 additions and 3 deletions

View file

@ -452,7 +452,7 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.startsWith('statechanged:')) {
this._onStateChangedMsg(textMsg);
}
else if (textMsg.startsWith('status:')) {
else if (textMsg.startsWith('status:') || textMsg.startsWith('statusupdate:')) {
this._onStatusMsg(textMsg);
}
else if (textMsg.startsWith('textselection:')) {

View file

@ -404,6 +404,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
tokens[0] != "selectclientpart" &&
tokens[0] != "setpage" &&
tokens[0] != "status" &&
tokens[0] != "statusupdate" &&
tokens[0] != "tile" &&
tokens[0] != "tilecombine" &&
tokens[0] != "uno" &&
@ -419,6 +420,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
tokens[0] != "removesession" &&
tokens[0] != "renamefile")
{
LOG_ERR("Session [" << getId() << "] got unknown command [" << tokens[0] << "].");
sendTextFrame("error: cmd=" + tokens[0] + " kind=unknown");
return false;
}
@ -481,7 +483,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
{
return sendFontRendering(buffer, length, tokens, docBroker);
}
else if (tokens[0] == "status")
else if (tokens[0] == "status" || tokens[0] == "statusupdate")
{
assert(firstLine.size() == static_cast<size_t>(length));
return forwardToChild(firstLine, docBroker);

View file

@ -373,11 +373,16 @@ saveas: url=<url> name=<name>
<name> is the resulting name (without path) that was created on the wopi
host. It can differ from what was requested in case the file already existed.
status: type=<typeName> parts=<numberOfParts> current=<currentPartNumber> width=<width> height=<height> viewid=<viewId> [partNames]
status: type=<typeName> parts=<numberOfParts> current=<currentPartNumber> width=<width> height=<height> viewid=<viewId> hiddenparts=<part1,part2,...> selectedparts=<part1,part2,...> [partNames]
<typeName> is 'text, 'spreadsheet', 'presentation', 'drawing' or 'other. Others are numbers.
if the document has multiple parts and those have names, part names follow separated by '\n'
statusupdate: type=<typeName> parts=<numberOfParts> current=<currentPartNumber> width=<width> height=<height> viewid=<viewId> hiddenparts=<part1,part2,...> selectedparts=<part1,part2,...> [partNames]
Same as status: but issued whenever the document parts have updated significantly.
status: implies document loading. statusupdate: is just an update.
styles: {"styleFamily": ["styles in family"], etc. }
statechanged: <key>=<value>