[Libreoffice-commits] online.git: Branch 'libreoffice-6-0' - bundled/include common/Message.hpp kit/ChildSession.cpp kit/ChildSession.hpp kit/Kit.cpp kit/KitHelper.hpp loleaflet/build loleaflet/debug loleaflet/dist loleaflet/main.js loleaflet/src tools/KitClient.cpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/protocol.txt
Jan Holesovsky
kendy at collabora.com
Thu Dec 21 10:47:01 UTC 2017
bundled/include/LibreOfficeKit/LibreOfficeKit.h | 42 --
bundled/include/LibreOfficeKit/LibreOfficeKit.hxx | 105 -----
bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 23 -
bundled/include/LibreOfficeKit/LibreOfficeKitInit.h | 1
common/Message.hpp | 4
kit/ChildSession.cpp | 106 +----
kit/ChildSession.hpp | 12
kit/Kit.cpp | 112 ------
kit/KitHelper.hpp | 4
loleaflet/build/deps.js | 3
loleaflet/debug/document/loleaflet.html | 2
loleaflet/dist/loleaflet.css | 17
loleaflet/main.js | 3
loleaflet/src/control/Control.Dialog.js | 6
loleaflet/src/control/Control.LokDialog.js | 349 -------------------
loleaflet/src/control/Control.Menubar.js | 21 -
loleaflet/src/control/Toolbar.js | 14
loleaflet/src/core/Socket.js | 14
loleaflet/src/layer/tile/TileLayer.js | 52 --
tools/KitClient.cpp | 2
wsd/ClientSession.cpp | 11
wsd/DocumentBroker.cpp | 40 --
wsd/DocumentBroker.hpp | 2
wsd/protocol.txt | 4
24 files changed, 40 insertions(+), 909 deletions(-)
New commits:
commit 82d5d38708088126391c700b11c92578f6dd1502
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Dec 21 11:02:38 2017 +0100
Revert the incomplete dialog tunneling, the API has changed completely.
Change-Id: I8ad2005bffd43ea0ef9bdf6c2e76caa9debd7041
Reviewed-on: https://gerrit.libreoffice.org/46894
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index 14824821..0633f46f 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -266,48 +266,6 @@ struct _LibreOfficeKitDocumentClass
int* pArray,
size_t nSize);
- /// Paints dialog with given dialog id to the buffer
- /// @see lok::Document::paintDialog().
- void (*paintDialog) (LibreOfficeKitDocument* pThis, const char* pDialogId,
- unsigned char* pBuffer,
- const int x, const int y,
- const int width, const int height);
-
- /// Get info about dialog with given dialog id
- /// @see lok::Document::getDialogInfo().
- void (*getDialogInfo) (LibreOfficeKitDocument* pThis, const char* pDialogId,
- char** pDialogTitle, int* pWidth, int* pHeight);
-
- /// @see lok::Document::paintActiveFloatingWindow().
- void (*paintActiveFloatingWindow) (LibreOfficeKitDocument* pThis, const char* pDialogId, unsigned char* pBuffer, int* nWidth, int* nHeight);
-
- /// @see lok::Document::postDialogKeyEvent().
- void (*postDialogKeyEvent) (LibreOfficeKitDocument* pThis,
- const char* pDialogId,
- int nType,
- int nCharCode,
- int nKeyCode);
-
- /// @see lok::Document::postDialogMouseEvent().
- void (*postDialogMouseEvent) (LibreOfficeKitDocument* pThis,
- const char* pDialogId,
- int nType,
- int nX,
- int nY,
- int nCount,
- int nButtons,
- int nModifier);
-
- /// @see lok::Document::postDialogChildMouseEvent().
- void (*postDialogChildMouseEvent) (LibreOfficeKitDocument* pThis,
- const char* pDialogId,
- int nType,
- int nX,
- int nY,
- int nCount,
- int nButtons,
- int nModifier);
-
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
index 19e121fe..0781e7d1 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -156,65 +156,6 @@ public:
}
/**
- * Renders a dialog with give dialog id and writes the width and height of the rendered dialog
- *
- * Client must truncate pBuffer according to the nWidth and nHeight returned after the call.
- *
- * @param pDialogId Unique dialog id to be painted
- * @param pBuffer Buffer with enough memory allocated to render any dialog
- * @param x x-coordinate from where the dialog should start painting
- * @param y y-coordinate from where the dialog should start painting
- * @param width The width of the dialog image to be painted
- * @param height The height of the dialog image to be painted
- */
- void paintDialog(const char* pDialogId,
- unsigned char* pBuffer,
- const int x,
- const int y,
- const int width,
- const int height)
- {
- return mpDoc->pClass->paintDialog(mpDoc, pDialogId, pBuffer,
- x, y, width, height);
- }
-
- /* Get info about dialog with given dialog id
- *
- * @param pDialogId Unique dialog id for which to get info about
- * @param pDialogTitle Pointer to pointer pointing to string containing the
- * dialog title. Caller should the pointer to allocated string themselves.
- * @param pWidth The width of the dialog
- * @param pHeight The height of the dialog
- */
- void getDialogInfo(const char* pDialogId,
- char** pDialogTitle,
- int& pWidth,
- int& pHeight)
- {
- return mpDoc->pClass->getDialogInfo(mpDoc, pDialogId, pDialogTitle, &pWidth, &pHeight);
-
- }
-
- /**
- * Renders the active floating window of a dialog
- *
- * Client must truncate pBuffer according to the nWidth and nHeight returned after the call.
- *
- * @param pDialogId Unique dialog id
- * @param pBuffer Buffer with enough memory allocated to render any dialog
- * @param nWidth output parameter returning the width of the rendered dialog.
- * @param nHeight output parameter returning the height of the rendered dialog
- */
- void paintActiveFloatingWindow(const char* pDialogId,
- unsigned char* pBuffer,
- int& nWidth,
- int& nHeight)
- {
- return mpDoc->pClass->paintActiveFloatingWindow(mpDoc, pDialogId, pBuffer,
- &nWidth, &nHeight);
- }
-
- /**
* Gets the tile mode: the pixel format used for the pBuffer of paintTile().
*
* @return an element of the LibreOfficeKitTileMode enum.
@@ -280,19 +221,6 @@ public:
}
/**
- * Posts a keyboard event to the dialog
- *
- * @param pDialogId Dialog id on which key event should be posted
- * @param nType Event type, like press or release.
- * @param nCharCode contains the Unicode character generated by this event or 0
- * @param nKeyCode contains the integer code representing the key of the event (non-zero for control keys)
- */
- void postDialogKeyEvent(const char* pDialogId, int nType, int nCharCode, int nKeyCode)
- {
- mpDoc->pClass->postDialogKeyEvent(mpDoc, pDialogId, nType, nCharCode, nKeyCode);
- }
-
- /**
* Posts a mouse event to the document.
*
* @param nType Event type, like down, move or up.
@@ -308,39 +236,6 @@ public:
}
/**
- * Posts a mouse event to the dialog with given id.
- *
- * @param pDialogId Dialog id where mouse event is to be posted
- * @param nType Event type, like down, move or up.
- * @param nX horizontal position in document coordinates
- * @param nY vertical position in document coordinates
- * @param nCount number of clicks: 1 for single click, 2 for double click
- * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
- * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
- */
- void postDialogMouseEvent(const char* pDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
- {
- mpDoc->pClass->postDialogMouseEvent(mpDoc, pDialogId, nType, nX, nY, nCount, nButtons, nModifier);
- }
-
- /**
- * Posts a mouse event to the child of a dialog with given id.
- *
- * @param aDialogId Dialog id
- * @param nType Event type, like down, move or up.
- * @param nX horizontal position in document coordinates
- * @param nY vertical position in document coordinates
- * @param nCount number of clicks: 1 for single click, 2 for double click
- * @param nButtons: which mouse buttons: 1 for left, 2 for middle, 4 right
- * @param nModifier: which keyboard modifier: (see include/vcl/vclenum.hxx for possible values)
- */
- void postDialogChildMouseEvent(const char* pDialogId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
- {
- mpDoc->pClass->postDialogChildMouseEvent(mpDoc, pDialogId, nType, nX, nY, nCount, nButtons, nModifier);
- }
-
-
- /**
* Posts an UNO command to the document.
*
* Example argument string:
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 62b9faf7..451ed2c9 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -522,29 +522,6 @@ typedef enum
* Here all aproperties are same as described in svxruler.
*/
LOK_CALLBACK_RULER_UPDATE = 35,
- /**
- * Dialog invalidation
- */
- LOK_CALLBACK_DIALOG = 36,
-
- /**
- * Invalidation corresponding to dialog's children.
- * Eg: Floating window etc.
- *
- * Payload example:
- * {
- * "dialogID": "SpellDialog",
- * "action": "close"
- * }
- *
- * - dialogID is the UNO command of the dialog
- * - action can be
- * - close, means dialog child window is closed now
- * - invalidate, means dialog child window is invalidated
- * It also means that dialog child window is created if it's the first
- * invalidate
- */
- LOK_CALLBACK_DIALOG_CHILD = 37
}
LibreOfficeKitCallbackType;
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h b/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
index f95ee496..a0c111a9 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -234,6 +234,7 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
}
}
#else
+ (void)install_path;
imp_lib = strdup("the app executable");
dlhandle = RTLD_MAIN_ONLY;
#endif
diff --git a/common/Message.hpp b/common/Message.hpp
index bfd38cb7..99ccd77a 100644
--- a/common/Message.hpp
+++ b/common/Message.hpp
@@ -130,9 +130,7 @@ private:
{
if (_tokens[0] == "tile:" ||
_tokens[0] == "tilecombine:" ||
- _tokens[0] == "renderfont:" ||
- _tokens[0] == "dialogpaint:" ||
- _tokens[0] == "dialogchildpaint:")
+ _tokens[0] == "renderfont:")
{
return Type::Binary;
}
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 71feb376..d98e0947 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -219,10 +219,7 @@ bool ChildSession::_handleInput(const char *buffer, int length)
tokens[0] == "paste" ||
tokens[0] == "insertfile" ||
tokens[0] == "key" ||
- tokens[0] == "dialogkey" ||
tokens[0] == "mouse" ||
- tokens[0] == "dialogmouse" ||
- tokens[0] == "dialogchildmouse" ||
tokens[0] == "uno" ||
tokens[0] == "selecttext" ||
tokens[0] == "selectgraphic" ||
@@ -261,23 +258,11 @@ bool ChildSession::_handleInput(const char *buffer, int length)
}
else if (tokens[0] == "key")
{
- return keyEvent(buffer, length, tokens, LokEventTargetEnum::Document);
- }
- else if (tokens[0] == "dialogkey")
- {
- return keyEvent(buffer, length, tokens, LokEventTargetEnum::Dialog);
+ return keyEvent(buffer, length, tokens);
}
else if (tokens[0] == "mouse")
{
- return mouseEvent(buffer, length, tokens, LokEventTargetEnum::Document);
- }
- else if (tokens[0] == "dialogmouse")
- {
- return mouseEvent(buffer, length, tokens, LokEventTargetEnum::Dialog);
- }
- else if (tokens[0] == "dialogchildmouse")
- {
- return mouseEvent(buffer, length, tokens, LokEventTargetEnum::DialogChild);
+ return mouseEvent(buffer, length, tokens);
}
else if (tokens[0] == "uno")
{
@@ -721,28 +706,17 @@ bool ChildSession::insertFile(const char* /*buffer*/, int /*length*/, const std:
return true;
}
-bool ChildSession::keyEvent(const char* /*buffer*/, int /*length*/,
- const std::vector<std::string>& tokens,
- const LokEventTargetEnum target)
+bool ChildSession::keyEvent(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens)
{
int type, charcode, keycode;
- std::string dialogId;
- unsigned counter = 1;
- unsigned minTotal = 4; // cmdname, type, char, key are strictly required
- if (target == LokEventTargetEnum::Dialog || target == LokEventTargetEnum::DialogChild)
- {
- getTokenString(tokens[counter++], "dialogid", dialogId);
- minTotal++; // other params still necessarily required
- }
-
- if (tokens.size() != minTotal ||
- !getTokenKeyword(tokens[counter++], "type",
+ if (tokens.size() != 4 ||
+ !getTokenKeyword(tokens[1], "type",
{{"input", LOK_KEYEVENT_KEYINPUT}, {"up", LOK_KEYEVENT_KEYUP}},
type) ||
- !getTokenInteger(tokens[counter++], "char", charcode) ||
- !getTokenInteger(tokens[counter++], "key", keycode))
+ !getTokenInteger(tokens[2], "char", charcode) ||
+ !getTokenInteger(tokens[3], "key", keycode))
{
- sendTextFrame("error: cmd=" + std::string(tokens[0]) + " kind=syntax");
+ sendTextFrame("error: cmd=key kind=syntax");
return false;
}
@@ -763,20 +737,15 @@ bool ChildSession::keyEvent(const char* /*buffer*/, int /*length*/,
}
std::unique_lock<std::mutex> lock(_docManager.getDocumentMutex());
- if (target == LokEventTargetEnum::Document)
- {
- getLOKitDocument()->setView(_viewId);
- getLOKitDocument()->postKeyEvent(type, charcode, keycode);
- }
- else if (!dialogId.empty())
- getLOKitDocument()->postDialogKeyEvent(dialogId.c_str(), type, charcode, keycode);
+
+ getLOKitDocument()->setView(_viewId);
+
+ getLOKitDocument()->postKeyEvent(type, charcode, keycode);
return true;
}
-bool ChildSession::mouseEvent(const char* /*buffer*/, int /*length*/,
- const std::vector<std::string>& tokens,
- const LokEventTargetEnum target)
+bool ChildSession::mouseEvent(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens)
{
int type, x, y, count;
bool success = true;
@@ -785,59 +754,38 @@ bool ChildSession::mouseEvent(const char* /*buffer*/, int /*length*/,
int buttons = 1; // left button
int modifier = 0;
- std::string dialogId;
- unsigned counter = 1;
- unsigned minTotal = 5; // cmdname, type, x, y, count are strictly required
- if (target == LokEventTargetEnum::Dialog || target == LokEventTargetEnum::DialogChild)
- {
- getTokenString(tokens[counter++], "dialogid", dialogId);
- minTotal++; // other params still necessarily required
- }
-
- if (tokens.size() < minTotal ||
- !getTokenKeyword(tokens[counter++], "type",
+ if (tokens.size() < 5 ||
+ !getTokenKeyword(tokens[1], "type",
{{"buttondown", LOK_MOUSEEVENT_MOUSEBUTTONDOWN},
{"buttonup", LOK_MOUSEEVENT_MOUSEBUTTONUP},
{"move", LOK_MOUSEEVENT_MOUSEMOVE}},
type) ||
- !getTokenInteger(tokens[counter++], "x", x) ||
- !getTokenInteger(tokens[counter++], "y", y) ||
- !getTokenInteger(tokens[counter++], "count", count))
+ !getTokenInteger(tokens[2], "x", x) ||
+ !getTokenInteger(tokens[3], "y", y) ||
+ !getTokenInteger(tokens[4], "count", count))
{
success = false;
}
// compatibility with older loleaflets
- if (success && tokens.size() > counter && !getTokenInteger(tokens[counter++], "buttons", buttons))
+ if (success && tokens.size() > 5 && !getTokenInteger(tokens[5], "buttons", buttons))
success = false;
// compatibility with older loleaflets
- if (success && tokens.size() > counter && !getTokenInteger(tokens[counter++], "modifier", modifier))
+ if (success && tokens.size() > 6 && !getTokenInteger(tokens[6], "modifier", modifier))
success = false;
if (!success)
{
- sendTextFrame("error: cmd=" + std::string(tokens[0]) + " kind=syntax");
+ sendTextFrame("error: cmd=mouse kind=syntax");
return false;
}
std::unique_lock<std::mutex> lock(_docManager.getDocumentMutex());
- switch (target)
- {
- case LokEventTargetEnum::Document:
- getLOKitDocument()->setView(_viewId);
- getLOKitDocument()->postMouseEvent(type, x, y, count, buttons, modifier);
- break;
- case LokEventTargetEnum::Dialog:
- getLOKitDocument()->postDialogMouseEvent(dialogId.c_str(), type, x, y, count, buttons, modifier);
- break;
- case LokEventTargetEnum::DialogChild:
- getLOKitDocument()->postDialogChildMouseEvent(dialogId.c_str(), type, x, y, count, buttons, modifier);
- break;
- default:
- assert(false && "Unsupported mouse target type");
- }
+ getLOKitDocument()->setView(_viewId);
+
+ getLOKitDocument()->postMouseEvent(type, x, y, count, buttons, modifier);
return true;
}
@@ -1351,12 +1299,6 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
case LOK_CALLBACK_RULER_UPDATE:
sendTextFrame("rulerupdate: " + payload);
break;
- case LOK_CALLBACK_DIALOG:
- sendTextFrame("dialog: " + payload);
- break;
- case LOK_CALLBACK_DIALOG_CHILD:
- sendTextFrame("dialogchild: " + payload);
- break;
default:
LOG_ERR("Unknown callback event (" << type << "): " << payload);
}
diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp
index 82c5b541..c3af96ec 100644
--- a/kit/ChildSession.hpp
+++ b/kit/ChildSession.hpp
@@ -25,13 +25,6 @@
class ChildSession;
-enum class LokEventTargetEnum
-{
- Document,
- Dialog,
- DialogChild
-};
-
/// An abstract interface that defines the
/// DocumentManager interface and functionality.
class IDocumentManager
@@ -181,9 +174,8 @@ private:
bool getTextSelection(const char* buffer, int length, const std::vector<std::string>& tokens);
bool paste(const char* buffer, int length, const std::vector<std::string>& tokens);
bool insertFile(const char* buffer, int length, const std::vector<std::string>& tokens);
- bool keyEvent(const char* buffer, int length, const std::vector<std::string>& tokens, const LokEventTargetEnum target);
- bool dialogKeyEvent(const char* buffer, int length, const std::vector<std::string>& tokens);
- bool mouseEvent(const char* buffer, int length, const std::vector<std::string>& tokens, const LokEventTargetEnum target);
+ bool keyEvent(const char* buffer, int length, const std::vector<std::string>& tokens);
+ bool mouseEvent(const char* buffer, int length, const std::vector<std::string>& tokens);
bool unoCommand(const char* buffer, int length, const std::vector<std::string>& tokens);
bool selectText(const char* buffer, int length, const std::vector<std::string>& tokens);
bool selectGraphic(const char* buffer, int length, const std::vector<std::string>& tokens);
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 1a7d87c1..3bb5e373 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -846,111 +846,6 @@ public:
ws->sendFrame(output.data(), output.size(), WebSocket::FRAME_BINARY);
}
- void renderDialog(const std::vector<std::string>& tokens, const std::shared_ptr<LOOLWebSocket>& ws)
- {
- assert(ws && "Expected a non-null websocket.");
-
- const bool child = tokens[0] == "dialogchild";
-
- std::unique_lock<std::mutex> lock(_documentMutex);
- if (!_loKitDocument)
- {
- LOG_ERR("Dialog rendering requested before loading document.");
- return;
- }
-
- if (_loKitDocument->getViewsCount() <= 0)
- {
- LOG_ERR("Dialog rendering requested without views.");
- return;
- }
-
- int startX = 0, startY = 0;
- int bufferWidth = 800, bufferHeight = 600; // hopefully, this is big enough
- std::string paintRectangle;
- // find the rectangle to paint, if specified
- if (tokens.size() >= 3 && getTokenString(tokens[2], "rectangle", paintRectangle))
- {
- const std::vector<std::string> rectParts = LOOLProtocol::tokenize(paintRectangle.c_str(), paintRectangle.length(), ',');
- startX = std::atoi(rectParts[0].c_str());
- startY = std::atoi(rectParts[1].c_str());
- bufferWidth = std::atoi(rectParts[2].c_str());
- bufferHeight = std::atoi(rectParts[3].c_str());
- }
-
- size_t pixmapDataSize = 4 * bufferWidth * bufferHeight;
- std::vector<unsigned char> pixmap(pixmapDataSize);
-
- char* pDialogTitle = nullptr;
- int width = bufferWidth;
- int height = bufferHeight;
- std::string response;
- if (child)
- {
- Timestamp timestamp;
- _loKitDocument->paintActiveFloatingWindow(tokens[1].c_str(), pixmap.data(), width, height);
- const auto elapsed = timestamp.elapsed();
- const double area = width * height;
- LOG_TRC("paintActiveFloatingWindow for " << tokens[1] << " returned floating window "
- << width << "X" << height << " "
- << "rendered in " << (elapsed/1000.)
- << "ms (" << area / elapsed << " MP/s).");
-
- response = "dialogchildpaint: id=" + tokens[1] + " width=" + std::to_string(width) + " height=" + std::to_string(height) + "\n";
- }
- else
- {
- Timestamp timestamp;
- _loKitDocument->paintDialog(tokens[1].c_str(), pixmap.data(), startX, startY, width, height);
- const auto elapsed = timestamp.elapsed();
-
- int dialogWidth = 0;
- int dialogHeight = 0;
- _loKitDocument->getDialogInfo(tokens[1].c_str(), &pDialogTitle, dialogWidth, dialogHeight);
-
- std::string encodedDialogTitle;
- if (pDialogTitle)
- {
- std::string aDialogTitle(pDialogTitle);
- URI::encode(aDialogTitle, "", encodedDialogTitle);
- free(pDialogTitle);
- }
-
- // rendered width, height cannot be less than the dialog width, height
- width = std::min(width, dialogWidth);
- height = std::min(height, dialogHeight);
- const double area = width * height;
-
- LOG_TRC("paintDialog for " << tokens[1] << " returned " << width << "X" << height
- << "@(" << startX << "," << startY << ")"
- << "and rendered in " << (elapsed/1000.)
- << "ms (" << area / elapsed << " MP/s).");
-
- response = "dialogpaint: id=" + tokens[1] + " title=" + encodedDialogTitle +
- " dialogwidth=" + std::to_string(dialogWidth) + " dialogheight=" + std::to_string(dialogHeight);
-
- if (!paintRectangle.empty())
- response += " rectangle=" + paintRectangle;
-
- response += "\n";
- }
-
- std::vector<char> output;
- output.reserve(response.size() + pixmapDataSize);
- output.resize(response.size());
- std::memcpy(output.data(), response.data(), response.size());
-
- // TODO: use png cache for dialogs too
- if (!Png::encodeSubBufferToPNG(pixmap.data(), 0, 0, width, height, bufferWidth, bufferHeight, output, LOK_TILEMODE_RGBA))
- {
- LOG_ERR("Failed to encode into PNG.");
- return;
- }
-
- LOG_TRC("Sending response (" << output.size() << " bytes) for: " << response);
- ws->sendFrame(output.data(), output.size(), WebSocket::FRAME_BINARY);
- }
-
void renderCombinedTiles(const std::vector<std::string>& tokens, const std::shared_ptr<LOOLWebSocket>& ws)
{
assert(ws && "Expected a non-null websocket.");
@@ -1011,7 +906,7 @@ public:
const auto mode = static_cast<LibreOfficeKitTileMode>(_loKitDocument->getTileMode());
std::vector<char> output;
- output.reserve(pixmapSize);
+ output.reserve(pixmapWidth * pixmapHeight * 4);
size_t tileIndex = 0;
for (Util::Rectangle& tileRect : tileRecs)
@@ -1775,10 +1670,6 @@ private:
{
renderCombinedTiles(tokens, _ws);
}
- else if (tokens[0] == "dialog" || tokens[0] == "dialogchild")
- {
- renderDialog(tokens, _ws);
- }
else if (LOOLProtocol::getFirstToken(tokens[0], '-') == "child")
{
forwardToChild(tokens[0], input);
@@ -2230,7 +2121,6 @@ void lokit_main(const std::string& childRoot,
TerminationFlag = true;
}
else if (tokens[0] == "tile" || tokens[0] == "tilecombine" || tokens[0] == "canceltiles" ||
- tokens[0] == "dialog" || tokens[0] == "dialogchild" ||
LOOLProtocol::getFirstToken(tokens[0], '-') == "child")
{
if (document)
diff --git a/kit/KitHelper.hpp b/kit/KitHelper.hpp
index dccf2741..efb0d5cb 100644
--- a/kit/KitHelper.hpp
+++ b/kit/KitHelper.hpp
@@ -113,10 +113,6 @@ namespace LOKitHelper
return "INVALIDATE_HEADER";
case LOK_CALLBACK_CELL_ADDRESS:
return "CELL_ADDRESS";
- case LOK_CALLBACK_DIALOG:
- return "DIALOG";
- case LOK_CALLBACK_DIALOG_CHILD:
- return "DIALOG_CHILD";
}
diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index a3009c56..7044f43d 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -357,8 +357,7 @@ var deps = {
ControlDialog: {
src: ['control/Control.js',
- 'control/Control.LokDialog.js',
- 'control/Control.AlertDialog.js'],
+ 'control/Control.Dialog.js'],
heading: 'Controls',
desc: 'Handles vex dialogs for displaying alerts'
},
diff --git a/loleaflet/debug/document/loleaflet.html b/loleaflet/debug/document/loleaflet.html
index ff9b80f4..70d923f6 100644
--- a/loleaflet/debug/document/loleaflet.html
+++ b/loleaflet/debug/document/loleaflet.html
@@ -125,7 +125,7 @@
////// Controls /////
map.addControl(L.control.scroll());
- map.addControl(L.control.alertDialog());
+ map.addControl(L.control.dialog());
map.addControl(L.control.partsPreview());
map.addControl(L.control.tabs());
map.addControl(L.control.columnHeader());
diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index 48456535..a0604c5f 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -333,20 +333,3 @@ body {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
-
-.lokdialog_container.ui-dialog.ui-widget-content {
- padding: 0px;
- overflow: hidden;
- width: auto;
- height: auto;
- border: none;
- background-color: transparent;
-}
-
-.lokdialog.ui-dialog-content.ui-widget-content {
- padding: 0px;
-}
-
-.lokdialog_canvas {
- display: block; /* required to remove all borders around canvas element */
-}
diff --git a/loleaflet/main.js b/loleaflet/main.js
index ca143017..a780f866 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -118,8 +118,7 @@ global.map = map;
////// Controls /////
map.addControl(L.control.scroll());
-map.addControl(L.control.alertDialog());
-map.addControl(L.control.lokDialog());
+map.addControl(L.control.dialog());
map.addControl(L.control.partsPreview());
map.addControl(L.control.tabs());
map.addControl(L.control.columnHeader());
diff --git a/loleaflet/src/control/Control.AlertDialog.js b/loleaflet/src/control/Control.Dialog.js
similarity index 89%
rename from loleaflet/src/control/Control.AlertDialog.js
rename to loleaflet/src/control/Control.Dialog.js
index 4b937200..daad5e6e 100644
--- a/loleaflet/src/control/Control.AlertDialog.js
+++ b/loleaflet/src/control/Control.Dialog.js
@@ -3,7 +3,7 @@
*/
/* global vex */
-L.Control.AlertDialog = L.Control.extend({
+L.Control.Dialog = L.Control.extend({
onAdd: function (map) {
// TODO: Better distinction between warnings and errors
map.on('error', this._onError, this);
@@ -47,6 +47,6 @@ L.Control.AlertDialog = L.Control.extend({
}
});
-L.control.alertDialog = function (options) {
- return new L.Control.AlertDialog(options);
+L.control.dialog = function (options) {
+ return new L.Control.Dialog(options);
};
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
deleted file mode 100644
index f64c19e4..00000000
--- a/loleaflet/src/control/Control.LokDialog.js
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * L.Control.LokDialog used for displaying LOK dialogs
- */
-
-/* global vex $ map */
-L.Control.LokDialog = L.Control.extend({
- onAdd: function (map) {
- map.on('dialogpaint', this._onDialogPaint, this);
- map.on('dialogchildpaint', this._onDialogChildPaint, this);
- map.on('dialogchild', this._onDialogChildMsg, this);
- map.on('dialog', this._onDialogMsg, this);
- map.on('opendialog', this._openDialog, this);
- },
-
- _dialogs: {},
-
- _isOpen: function(dialogId) {
- return this._dialogs[dialogId] &&
- this._dialogs[dialogId].open &&
- $('#' + dialogId).length > 0;
- },
-
- _onDialogMsg: function(e) {
- e.dialogId = e.dialogId.replace('.uno:', '');
- if (e.action === 'invalidate') {
- // ignore any invalidate callbacks when we have closed the dialog
- if (this._isOpen(e.dialogId)) {
- this._map.sendDialogCommand(e.dialogId, e.rectangle);
- }
- } else if (e.action === 'cursor_invalidate') {
- if (this._isOpen(e.dialogId) && !!e.rectangle) {
- var rectangle = e.rectangle.split(',');
- var x = parseInt(rectangle[0]);
- var y = parseInt(rectangle[1]);
- var height = parseInt(rectangle[3]);
-
- $('#' + e.dialogId + '-cursor').css({height: height});
- // set the position of the lokdialog-cursor
- $(this._dialogs[e.dialogId].cursor).css({left: x, top: y});
- }
- } else if (e.action === 'cursor_visible') {
- var visible = e.visible === 'true';
- if (visible)
- $('#' + e.dialogId + '-cursor').css({display: 'block'});
- else
- $('#' + e.dialogId + '-cursor').css({display: 'none'});
- } else if (e.action === 'close') {
- this._onDialogClose(e.dialogId);
- }
- },
-
- _openDialog: function(e) {
- e.dialogId = e.dialogId.replace('.uno:', '');
- this._dialogs[e.dialogId] = {open: true};
-
- this._map.sendDialogCommand(e.dialogId);
- },
-
- _launchDialogCursor: function(dialogId) {
- if (!this._isOpen(dialogId))
- return;
-
- this._dialogs[dialogId].cursor = L.DomUtil.create('div', 'leaflet-cursor-container', L.DomUtil.get(dialogId));
- var cursor = L.DomUtil.create('div', 'leaflet-cursor lokdialog-cursor', this._dialogs[dialogId].cursor);
- cursor.id = dialogId + '-cursor';
- L.DomUtil.addClass(cursor, 'blinking-cursor');
- },
-
- _launchDialog: function(dialogId, width, height) {
- var canvas = '<div class="lokdialog" style="padding: 0px; margin: 0px; overflow: hidden;" id="' + dialogId + '">' +
- '<canvas class="lokdialog_canvas" tabindex="0" id="' + dialogId + '-canvas" width="' + width + 'px" height="' + height + 'px"></canvas>' +
- '</div>';
- $(document.body).append(canvas);
- var that = this;
- $('#' + dialogId).dialog({
- width: width,
- height: 'auto',
- title: 'LOK Dialog', // TODO: Get the 'real' dialog title from the backend
- modal: false,
- closeOnEscape: true,
- resizable: false,
- dialogClass: 'lokdialog_container',
- close: function() {
- that._onDialogClose(dialogId);
- }
- });
-
- // don't make 'TAB' focus on this button; we want to cycle focus in the lok dialog with each TAB
- $('.lokdialog_container button.ui-dialog-titlebar-close').attr('tabindex', '-1').blur();
-
- // attach the mouse/key events
- $('#' + dialogId + '-canvas').on('mousedown', function(e) {
- var buttons = 0;
- buttons |= e.button === map['mouse'].JSButtons.left ? map['mouse'].LOButtons.left : 0;
- buttons |= e.button === map['mouse'].JSButtons.middle ? map['mouse'].LOButtons.middle : 0;
- buttons |= e.button === map['mouse'].JSButtons.right ? map['mouse'].LOButtons.right : 0;
- var modifier = 0;
- that._postDialogMouseEvent('buttondown', dialogId, e.offsetX, e.offsetY, 1, buttons, modifier);
- });
-
- $('#' + dialogId + '-canvas').on('mouseup', function(e) {
- var buttons = 0;
- buttons |= e.button === map['mouse'].JSButtons.left ? map['mouse'].LOButtons.left : 0;
- buttons |= e.button === map['mouse'].JSButtons.middle ? map['mouse'].LOButtons.middle : 0;
- buttons |= e.button === map['mouse'].JSButtons.right ? map['mouse'].LOButtons.right : 0;
- var modifier = 0;
- that._postDialogMouseEvent('buttonup', dialogId, e.offsetX, e.offsetY, 1, buttons, modifier);
- });
-
- $('#' + dialogId + '-canvas').on('keyup keypress keydown', function(e) {
- e.dialogId = dialogId;
- that._handleDialogKeyEvent(e);
- });
-
- $('#' + dialogId + '-canvas').on('contextmenu', function() {
- return false;
- });
-
- // set the dialog's cursor
- this._launchDialogCursor(dialogId);
-
- if (!this._dialogs[dialogId] || !this._dialogs[dialogId].open)
- this._dialogs[dialogId] = { open: true };
- },
-
- _postDialogMouseEvent: function(type, dialogid, x, y, count, buttons, modifier) {
- if (!dialogid.startsWith('.uno:'))
- dialogid = '.uno:' + dialogid;
-
- this._map._socket.sendMessage('dialogmouse dialogid=' + dialogid + ' type=' + type +
- ' x=' + x + ' y=' + y + ' count=' + count +
- ' buttons=' + buttons + ' modifier=' + modifier);
- },
-
- _postDialogKeyboardEvent: function(type, dialogid, charcode, keycode) {
- this._map._socket.sendMessage('dialogkey dialogid=' + dialogid + ' type=' + type +
- ' char=' + charcode + ' key=' + keycode);
- },
-
- _postDialogChildMouseEvent: function(type, dialogid, x, y, count, buttons, modifier) {
- if (!dialogid.startsWith('.uno:'))
- dialogid = '.uno:' + dialogid;
-
- this._map._socket.sendMessage('dialogchildmouse dialogid=' + dialogid + ' type=' + type +
- ' x=' + x + ' y=' + y + ' count=' + count +
- ' buttons=' + buttons + ' modifier=' + modifier);
- },
-
- _handleDialogKeyEvent: function(e) {
- this.modifier = 0;
- var shift = e.originalEvent.shiftKey ? this._map['keyboard'].keyModifier.shift : 0;
- var ctrl = e.originalEvent.ctrlKey ? this._map['keyboard'].keyModifier.ctrl : 0;
- var alt = e.originalEvent.altKey ? this._map['keyboard'].keyModifier.alt : 0;
- var cmd = e.originalEvent.metaKey ? this._map['keyboard'].keyModifier.ctrl : 0;
- this.modifier = shift | ctrl | alt | cmd;
-
- var charCode = e.originalEvent.charCode;
- var keyCode = e.originalEvent.keyCode;
- var unoKeyCode = this._map['keyboard']._toUNOKeyCode(keyCode);
-
- if (this.modifier) {
- unoKeyCode |= this.modifier;
- if (e.type !== 'keyup') {
- this._postDialogKeyboardEvent('input', e.dialogId, charCode, unoKeyCode);
- return;
- }
- }
-
- if (e.type === 'keydown' && this._map['keyboard'].handleOnKeyDownKeys[keyCode]) {
- this._postDialogKeyboardEvent('input', e.dialogId, charCode, unoKeyCode);
- }
- else if (e.type === 'keypress' && (!this._map['keyboard'].handleOnKeyDownKeys[keyCode] || charCode !== 0)) {
- if (charCode === keyCode && charCode !== 13) {
- keyCode = 0;
- unoKeyCode = this._map['keyboard']._toUNOKeyCode(keyCode);
- }
- this._postDialogKeyboardEvent('input', e.dialogId, charCode, unoKeyCode);
- }
- else if (e.type === 'keyup') {
- this._postDialogKeyboardEvent('up', e.dialogId, charCode, unoKeyCode);
- }
- },
-
- _onDialogClose: function(dialogId) {
- $('#' + dialogId).remove();
- this._map.focus();
- delete this._dialogs[dialogId];
- },
-
- _paintDialog: function(dialogId, title, rectangle, imgData) {
- if (!this._isOpen(dialogId))
- return;
-
- $('#' + dialogId).dialog('option', 'title', decodeURIComponent(title));
- var img = new Image();
- var canvas = document.getElementById(dialogId + '-canvas');
- var ctx = canvas.getContext('2d');
- img.onload = function() {
- var x = 0;
- var y = 0;
- if (rectangle) {
- rectangle = rectangle.split(',');
- x = parseInt(rectangle[0]);
- y = parseInt(rectangle[1]);
- }
-
- ctx.drawImage(img, x, y);
- };
- img.src = imgData;
- },
-
- _isSameSize: function(dialogId, newWidth, newHeight) {
- var ret = false;
- if (this._isOpen(dialogId))
- {
- var oldWidth = $('#' + dialogId + '-canvas').width();
- var oldHeight = $('#' + dialogId + '-canvas').height();
- if (oldWidth == newWidth && oldHeight == newHeight)
- ret = true;
- }
-
- return ret;
- },
-
- // Binary dialog msg recvd from core
- _onDialogPaint: function (e) {
- var dialogId = e.id.replace('.uno:', '');
- // is our request to open dialog still valid?
- if (!this._dialogs[dialogId] || !this._dialogs[dialogId].open)
- return;
-
- if (!this._isOpen(dialogId)) {
- this._launchDialog(dialogId, e.dialogWidth, e.dialogHeight);
- } else if (!this._isSameSize(dialogId, e.dialogWidth, e.dialogHeight)) {
- var canvas = document.getElementById(dialogId + '-canvas');
- canvas.width = e.dialogWidth;
- canvas.height = e.dialogHeight;
- }
-
- this._paintDialog(dialogId, e.title, e.rectangle, e.dialog);
- },
-
- _onDialogChildPaint: function(e) {
- var dialogId = e.id.replace('.uno:', '');
- var img = new Image();
- var canvas = document.getElementById(dialogId + '-floating');
- canvas.width = e.width;
- canvas.height = e.height;
- var ctx = canvas.getContext('2d');
- img.onload = function() {
- ctx.drawImage(img, 0, 0);
- };
- img.src = e.dialog;
-
- // increase the height of the container,
- // so that if the floating window goes out of the parent,
- // it doesn't get stripped off
- var height = parseInt(canvas.style.top) + canvas.height;
- var currentHeight = parseInt($('#' + dialogId).css('height'));
- if (height > currentHeight)
- $('#' + dialogId).css('height', height + 'px');
- },
-
- _onDialogChildClose: function(dialogId) {
- $('#' + dialogId + '-floating').remove();
- },
-
- _isDialogChildUnchanged: function(dialogId, left, top) {
- // get pervious dialog child's specs
- var oldLeft = $('#' + dialogId + '-floating').css('left');
- var oldTop = $('#' + dialogId + '-floating').css('top');
- if (!oldLeft || !oldTop) {
- // no left or top position set earlier; this is first dialog child placement
- return false;
- }
-
- oldLeft = parseInt(oldLeft);
- oldTop = parseInt(oldTop);
- if (oldLeft !== left || oldTop !== top) {
- // something changed in new dialog child
- return false;
- }
-
- return true;
- },
-
- _launchDialogChild: function(e) {
- var positions = e.position.split(',');
- var left = parseInt(positions[0]);
- var top = parseInt(positions[1]);
- // ignore spurious "0, 0" dialog child position recvd from backend
- if (e.position === '0, 0' || this._isDialogChildUnchanged(e.dialogId, left, top)) {
- // ignore
- return;
- }
-
- // remove any existing floating element if there's any
- $('#' + e.dialogId + '-floating').remove();
- var floatingCanvas = '<canvas class="lokdialogchild-canvas" id="' + e.dialogId + '-floating"></canvas>';
- $('#' + e.dialogId).append(floatingCanvas);
- $('#' + e.dialogId + '-floating').css({position: 'absolute', left: left, top: top});
-
- var that = this;
- var dialogId = e.dialogId;
- // attach events
- $('#' + dialogId + '-floating').on('mousedown', function(e) {
- var buttons = 0;
- buttons |= e.button === map['mouse'].JSButtons.left ? map['mouse'].LOButtons.left : 0;
- buttons |= e.button === map['mouse'].JSButtons.middle ? map['mouse'].LOButtons.middle : 0;
- buttons |= e.button === map['mouse'].JSButtons.right ? map['mouse'].LOButtons.right : 0;
- var modifier = 0;
- that._postDialogChildMouseEvent('buttondown', dialogId, e.offsetX, e.offsetY, 1, buttons, modifier);
- });
-
- $('#' + dialogId + '-floating').on('mouseup', function(e) {
- var buttons = 0;
- buttons |= e.button === map['mouse'].JSButtons.left ? map['mouse'].LOButtons.left : 0;
- buttons |= e.button === map['mouse'].JSButtons.middle ? map['mouse'].LOButtons.middle : 0;
- buttons |= e.button === map['mouse'].JSButtons.right ? map['mouse'].LOButtons.right : 0;
- var modifier = 0;
- that._postDialogChildMouseEvent('buttonup', dialogId, e.offsetX, e.offsetY, 1, buttons, modifier);
- });
-
- $('#' + dialogId + '-floating').on('mousemove', function(e) {
- that._postDialogChildMouseEvent('move', dialogId, e.offsetX, e.offsetY, 1, 0, 0);
- });
-
- $('#' + dialogId + '-floating').on('contextmenu', function() {
- return false;
- });
- },
-
- _onDialogChildMsg: function(e) {
- e.dialogId = e.dialogId.replace('.uno:', '');
- if (e.action === 'invalidate') {
- if (this._isOpen(e.dialogId))
- {
- this._map.sendDialogCommand(e.dialogId, false /* no json */, true /* dialog child*/);
- this._launchDialogChild(e);
- }
- } else if (e.action === 'close') {
- this._onDialogChildClose(e.dialogId);
- }
- }
-});
-
-L.control.lokDialog = function (options) {
- return new L.Control.LokDialog(options);
-};
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index fda37f4b..2d4c8301 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -41,13 +41,11 @@ L.Control.Menubar = L.Control.extend({
{name: _('Record'), type: 'unocommand', uno: '.uno:TrackChanges'},
{name: _('Show'), type: 'unocommand', uno: '.uno:ShowTrackedChanges'},
{type: 'separator'},
- {name: _('Manage Changes...'), id: '.uno:AcceptTrackedChanges', type: 'dialog'},
{name: _('Accept All'), type: 'unocommand', uno: '.uno:AcceptAllTrackedChanges'},
{name: _('Reject All'), type: 'unocommand', uno: '.uno:RejectAllTrackedChanges'},
{name: _('Previous'), type: 'unocommand', uno: '.uno:PreviousTrackedChange'},
{name: _('Next'), type: 'unocommand', uno: '.uno:NextTrackedChange'}
- ]},
- {name: _('ImageMap'), id: '.uno:ImageMapDialog', type: 'dialog'}
+ ]}
]},
{name: _('View'), id: 'view', type: 'menu', menu: [
{name: _('Full screen'), id: 'fullscreen', type: 'action'},
@@ -69,7 +67,6 @@ L.Control.Menubar = L.Control.extend({
{name: _('Page break'), type: 'unocommand', uno: '.uno:InsertPageBreak'},
{name: _('Column break'), type: 'unocommand', uno: '.uno:InsertColumnBreak'},
{type: 'separator'},
- {name: _('Hyperlink'), id: '.uno:HyperlinkDialog', type: 'dialog'},
{name: _('Special character...'), id: 'specialcharacter', type: 'action'},
{name: _('Formatting mark'), type: 'menu', menu: [
{name: _('Non-breaking space'), type: 'unocommand', uno: '.uno:InsertNonBreakingSpace'},
@@ -78,11 +75,7 @@ L.Control.Menubar = L.Control.extend({
{name: _('No-width optional break'), type: 'unocommand', uno: '.uno:InsertZWSP'},
{name: _('No-width no break'), type: 'unocommand', uno: '.uno:InsertZWNBSP'},
{name: _('Left-to-right mark'), type: 'unocommand', uno: '.uno:InsertLRM'},
- {name: _('Right-to-left mark'), type: 'unocommand', uno: '.uno:InsertRLM'}]},
- {name: _('Field...'), id: '.uno:InsertField', type: 'dialog'},
- {name: _('Index Entry...'), id: '.uno:InsertIndexesEntry', type: 'dialog'},
- {name: _('Bibliography Entry...'), id: '.uno:InsertAuthoritiesEntry', type: 'dialog'}
- ]
+ {name: _('Right-to-left mark'), type: 'unocommand', uno: '.uno:InsertRLM'}]}]
},
{name: _('Format'), type: 'menu', menu: [
{name: _('Text'), type: 'menu', menu: [
@@ -182,16 +175,13 @@ L.Control.Menubar = L.Control.extend({
{name: _('Merge cells'), type: 'unocommand', uno: '.uno:MergeCells'}]
},
{name: _('Tools'), id: 'tools', type: 'menu', menu: [
- {name: _('Spelling and Grammar'), id: '.uno:SpellingAndGrammarDialog', type: 'dialog'},
{name: _('Automatic spell checking'), type: 'unocommand', uno: '.uno:SpellOnline'},
{name: _('Language for selection'), type: 'menu', menu: [
{name: _('None (Do not check spelling)'), id: 'noneselection', type: 'unocommand', uno: '.uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE'}]},
{name: _('Language for paragraph'), type: 'menu', menu: [
{name: _('None (Do not check spelling)'), id: 'noneparagraph', type: 'unocommand', uno: '.uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE'}]},
{name: _('Language for entire document'), type: 'menu', menu: [
- {name: _('None (Do not check spelling)'), id: 'nonelanguage', type: 'unocommand', uno: '.uno:LanguageStatus?Language:string=Default_LANGUAGE_NONE'}]},
- {name: _('Find & replace Dialog'), id: '.uno:SearchDialog', type: 'dialog'},
- {name: _('Word count'), id: '.uno:WordCountDialog', type: 'dialog'}
+ {name: _('None (Do not check spelling)'), id: 'nonelanguage', type: 'unocommand', uno: '.uno:LanguageStatus?Language:string=Default_LANGUAGE_NONE'}]}
]},
{name: _('Help'), id: 'help', type: 'menu', menu: [
{name: _('Keyboard shortcuts'), id: 'keyboard-shortcuts', type: 'action'},
@@ -788,8 +778,6 @@ L.Control.Menubar = L.Control.extend({
map.sendUnoCommand(unoCommand);
} else if (type === 'action') {
self._executeAction(item);
- } else if (type === 'dialog') {
- map.fire('opendialog', {dialogId: $(item).data('id')});
}
if ($(item).data('id') !== 'insertcomment')
@@ -869,9 +857,6 @@ L.Control.Menubar = L.Control.extend({
} else if (menu[i].type === 'unocommand') {
$(aItem).data('type', 'unocommand');
$(aItem).data('uno', menu[i].uno);
- } else if (menu[i].type === 'dialog') {
- $(aItem).data('type', 'dialog');
- $(aItem).data('id', menu[i].id);
} else if (menu[i].type === 'separator') {
$(aItem).addClass('separator');
} else if (menu[i].type === 'action') {
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 66514d7b..337188a0 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -142,20 +142,6 @@ L.Map.include({
}
},
- sendDialogCommand: function (command, rectangle, child) {
- if (this._permission === 'edit') {
- if (!command.startsWith('.uno:'))
- command = '.uno:' + command;
- var dialogCmd = 'dialog';
- if (child)
- dialogCmd = 'dialogchild';
- // make sure there are no spaces in rectangle
- if (rectangle)
- rectangle = rectangle.replace(/ /g, '');
- this._socket.sendMessage(dialogCmd + ' ' + command + (rectangle ? ' rectangle=' + rectangle : ''));
- }
- },
-
toggleCommandState: function (unoState) {
if (this._permission === 'edit') {
if (!unoState.startsWith('.uno:')) {
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 5adf34b8..ec69b42b 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -608,7 +608,7 @@ L.Socket = L.Class.extend({
}
}
}
- else if (!textMsg.startsWith('tile:') && !textMsg.startsWith('renderfont:') && !textMsg.startsWith('dialogpaint:') && !textMsg.startsWith('dialogchildpaint:')) {
+ else if (!textMsg.startsWith('tile:') && !textMsg.startsWith('renderfont:')) {
// log the tile msg separately as we need the tile coordinates
L.Log.log(textMsg, L.INCOMING);
if (imgBytes !== undefined) {
@@ -838,18 +838,6 @@ L.Socket = L.Class.extend({
else if (tokens[i].startsWith('wid=')) {
command.wireId = this.getParameterValue(tokens[i]);
}
- else if (tokens[i].substring(0, 6) === 'title=') {
- command.title = tokens[i].substring(6);
- }
- else if (tokens[i].substring(0, 12) === 'dialogwidth=') {
- command.dialogwidth = tokens[i].substring(12);
- }
- else if (tokens[i].substring(0, 13) === 'dialogheight=') {
- command.dialogheight = tokens[i].substring(13);
- }
- else if (tokens[i].substring(0, 10) === 'rectangle=') {
- command.rectangle = tokens[i].substring(10);
- }
}
if (command.tileWidth && command.tileHeight && this._map._docLayer) {
var defaultZoom = this._map.options.zoom;
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 7ee9c90c..ca9fbffd 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -437,18 +437,6 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.startsWith('tile:')) {
this._onTileMsg(textMsg, img);
}
- else if (textMsg.startsWith('dialogpaint:')) {
- this._onDialogPaintMsg(textMsg, img);
- }
- else if (textMsg.startsWith('dialogchildpaint:')) {
- this._onDialogChildPaintMsg(textMsg, img);
- }
- else if (textMsg.startsWith('dialog:')) {
- this._onDialogMsg(textMsg);
- }
- else if (textMsg.startsWith('dialogchild:')) {
- this._onDialogChildMsg(textMsg);
- }
else if (textMsg.startsWith('unocommandresult:')) {
this._onUnoCommandResultMsg(textMsg);
}
@@ -1192,46 +1180,6 @@ L.TileLayer = L.GridLayer.extend({
},
- _onDialogPaintMsg: function(textMsg, img) {
- var command = this._map._socket.parseServerCmd(textMsg);
-
- this._map.fire('dialogpaint', {
- id: command.id,
- dialog: img,
- title: command.title,
- // TODO: add id too
- dialogWidth: command.dialogwidth,
- dialogHeight: command.dialogheight,
- rectangle: command.rectangle
- });
- },
-
- _onDialogChildPaintMsg: function(textMsg, img) {
- var command = this._map._socket.parseServerCmd(textMsg);
- var width = command.width;
- var height = command.height;
-
- this._map.fire('dialogchildpaint', {
- id: command.id,
- dialog: img,
- // TODO: add id too
- width: width,
- height: height
- });
- },
-
- _onDialogMsg: function(textMsg) {
- textMsg = textMsg.substring('dialog: '.length);
- var dialogMsg = JSON.parse(textMsg);
- this._map.fire('dialog', dialogMsg);
- },
-
- _onDialogChildMsg: function(textMsg) {
- textMsg = textMsg.substring('dialogchild: '.length);
- var dialogMsg = JSON.parse(textMsg);
- this._map.fire('dialogchild', dialogMsg);
- },
-
_onTileMsg: function (textMsg, img) {
var command = this._map._socket.parseServerCmd(textMsg);
var coords = this._twipsToCoords(command);
diff --git a/tools/KitClient.cpp b/tools/KitClient.cpp
index 98ee4d9f..aa2c012f 100644
--- a/tools/KitClient.cpp
+++ b/tools/KitClient.cpp
@@ -79,8 +79,6 @@ extern "C"
CASE(INVALIDATE_HEADER);
CASE(CELL_ADDRESS);
CASE(RULER_UPDATE);
- CASE(DIALOG);
- CASE(DIALOG_CHILD);
#undef CASE
}
std::cout << " payload: " << payload << std::endl;
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 586f1ea9..84624ba1 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -134,10 +134,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
tokens[0] != "paste" &&
tokens[0] != "insertfile" &&
tokens[0] != "key" &&
- tokens[0] != "dialogkey" &&
tokens[0] != "mouse" &&
- tokens[0] != "dialogmouse" &&
- tokens[0] != "dialogchildmouse" &&
tokens[0] != "partpagerectangles" &&
tokens[0] != "ping" &&
tokens[0] != "renderfont" &&
@@ -155,9 +152,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
tokens[0] != "tilecombine" &&
tokens[0] != "uno" &&
tokens[0] != "useractive" &&
- tokens[0] != "userinactive" &&
- tokens[0] != "dialog" &&
- tokens[0] != "dialogchild")
+ tokens[0] != "userinactive")
{
sendTextFrame("error: cmd=" + tokens[0] + " kind=unknown");
return false;
@@ -221,10 +216,6 @@ bool ClientSession::_handleInput(const char *buffer, int length)
{
return sendTile(buffer, length, tokens, docBroker);
}
- else if (tokens[0] == "dialog" || tokens[0] == "dialogchild")
- {
- docBroker->handleDialogRequest(std::string(buffer, length));
- }
else if (tokens[0] == "tilecombine")
{
return sendCombinedTiles(buffer, length, tokens, docBroker);
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 69cd515b..fad24344 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1140,14 +1140,6 @@ bool DocumentBroker::handleInput(const std::vector<char>& payload)
{
handleTileCombinedResponse(payload);
}
- else if (command == "dialogpaint:")
- {
- handleDialogPaintResponse(payload, false);
- }
- else if (command == "dialogchildpaint:")
- {
- handleDialogPaintResponse(payload, true);
- }
else if (command == "errortoall:")
{
LOG_CHECK_RET(message->tokens().size() == 3, false);
@@ -1239,13 +1231,6 @@ void DocumentBroker::handleTileRequest(TileDesc& tile,
_debugRenderedTileCount++;
}
-void DocumentBroker::handleDialogRequest(const std::string& dialogCmd)
-{
- assertCorrectThread();
- std::unique_lock<std::mutex> lock(_mutex);
- _childProcess->sendTextFrame(dialogCmd);
-}
-
void DocumentBroker::handleTileCombinedRequest(TileCombined& tileCombined,
const std::shared_ptr<ClientSession>& session)
{
@@ -1346,31 +1331,6 @@ void DocumentBroker::handleTileResponse(const std::vector<char>& payload)
}
}
-void DocumentBroker::handleDialogPaintResponse(const std::vector<char>& payload, bool child)
-{
- const std::string firstLine = getFirstLine(payload);
- LOG_DBG("Handling " << (child ? "dialogchildpaint" : "dialogpaint") << " " << firstLine);
-
- const auto length = payload.size();
- if (firstLine.size() < static_cast<std::string::size_type>(length) - 1)
- {
- const auto buffer = payload.data();
- const auto offset = firstLine.size() + 1;
-
- auto msgPayload = std::make_shared<Message>(firstLine,
- Message::Dir::Out,
- payload.size());
- msgPayload->append("\n", 1);
- msgPayload->append(buffer + offset, payload.size() - offset);
-
- std::unique_lock<std::mutex> lock(_mutex);
- for (const auto& sessionIt : _sessions)
- {
- sessionIt.second->enqueueSendMessage(msgPayload);
- }
- }
-}
-
void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload)
{
const std::string firstLine = getFirstLine(payload);
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index a56d3332..5d8a955a 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -303,12 +303,10 @@ public:
void invalidateTiles(const std::string& tiles);
void handleTileRequest(TileDesc& tile,
const std::shared_ptr<ClientSession>& session);
- void handleDialogRequest(const std::string& dialogCmd);
void handleTileCombinedRequest(TileCombined& tileCombined,
const std::shared_ptr<ClientSession>& session);
void cancelTileRequests(const std::shared_ptr<ClientSession>& session);
void handleTileResponse(const std::vector<char>& payload);
- void handleDialogPaintResponse(const std::vector<char>& payload, bool child);
void handleTileCombinedResponse(const std::vector<char>& payload);
void destroyIfLastEditor(const std::string& id);
diff --git a/wsd/protocol.txt b/wsd/protocol.txt
index 3af10f64..ce52204f 100644
--- a/wsd/protocol.txt
+++ b/wsd/protocol.txt
@@ -149,10 +149,6 @@ tilecombine <parameters>
comma-separated lists, and the number of elements in each must be
same.
-dialog <command>
-
- <command> is unique identifier for the dialog that needs to be painted.
-
uno <command>
<command> is a line of text.
More information about the Libreoffice-commits
mailing list