[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - 8 commits - loleaflet/dist loleaflet/src loolwsd/ChildProcessSession.cpp loolwsd/DocumentBroker.cpp loolwsd/LOOLKit.cpp loolwsd/MasterProcessSession.cpp loolwsd/MasterProcessSession.hpp loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu May 12 07:31:07 UTC 2016


 dev/null                          |binary
 loleaflet/dist/toolbar.css        |    1 
 loleaflet/dist/toolbar/toolbar.js |    6 -
 loleaflet/src/map/Map.js          |    2 
 loolwsd/ChildProcessSession.cpp   |    5 
 loolwsd/DocumentBroker.cpp        |   31 -----
 loolwsd/LOOLKit.cpp               |    8 +
 loolwsd/MasterProcessSession.cpp  |   23 ----
 loolwsd/MasterProcessSession.hpp  |    5 
 loolwsd/test/httpwstest.cpp       |  204 ++++++++++++++++++++++++++++++++++++++
 10 files changed, 220 insertions(+), 65 deletions(-)

New commits:
commit 910c02385cd47d897902e032d5db14077422d295
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed May 11 21:16:10 2016 -0400

    loolwsd: proper error handling of document load failure
    
    Change-Id: Ide14609b18b5dad9ac4451ab2dbbbe0544c60b47
    Reviewed-on: https://gerrit.libreoffice.org/24908
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit a35a000da88b0b7991c5471dd0475652d137e5ea)

diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 5ea3da6..21c2aad 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -423,6 +423,11 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length)
         }
 
         _isDocLoaded = loadDocument(buffer, length, tokens);
+        if (!_isDocLoaded)
+        {
+            sendTextFrame("error: cmd=load kind=faileddocloading");
+        }
+
         return _isDocLoaded;
     }
     else if (!_isDocLoaded)
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 309cc65..183768b 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -901,6 +901,7 @@ private:
         catch (const std::exception& exc)
         {
             Log::error("Exception while loading [" + uri + "] : " + exc.what());
+            return nullptr;
         }
 
         // Done loading, let the next one in (if any).
@@ -991,8 +992,10 @@ private:
                 // Checking if wrong password or no password was reason for failure.
                 if (_isDocPasswordProtected)
                 {
+                    Log::info("Document [" + uri + "] is password protected.");
                     if (!_haveDocPassword)
                     {
+                        Log::info("No password provided for password-protected document [" + uri + "].");
                         std::string passwordFrame = "passwordrequired:";
                         if (_docPasswordType == PasswordType::ToView)
                             passwordFrame += "to-view";
@@ -1001,7 +1004,10 @@ private:
                         session->sendTextFrame("error: cmd=load kind=" + passwordFrame);
                     }
                     else
+                    {
+                        Log::info("Wrong password for password-protected document [" + uri + "].");
                         session->sendTextFrame("error: cmd=load kind=wrongpassword");
+                    }
                 }
 
                 return nullptr;
commit 25858988145140d40f557cc02ea5fcac2473aedd
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed May 11 21:15:46 2016 -0400

    loleaflet: disable fade animation which is distracting and buggy
    
    Change-Id: I4170a9f58f4069cba9c88c85d520574a7fcb3885
    Reviewed-on: https://gerrit.libreoffice.org/24907
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit 81e2e25ed8618bcab14914af69f85e53c1b79afb)

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 8b3cb77..1c0bcd9 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -11,7 +11,7 @@ L.Map = L.Evented.extend({
 		zoom: 10,
 		minZoom: 1,
 		maxZoom: 20,
-		fadeAnimation: true,
+		fadeAnimation: false, // Not useful for typing.
 		trackResize: true,
 		markerZoomAnimation: true,
 		defaultZoom: 10,
commit 87a7f3067a15c3cbb888f67ba78755e3b2f16c5b
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed May 11 19:46:51 2016 -0400

    loolwsd: fix wrong condition
    
    (cherry picked from commit 797e41ca56bfd8cac3718dfb4943a25132b233b0)

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index af05e17..309cc65 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -290,7 +290,7 @@ public:
                     return true;
                 },
                 [&session]() { session->closeFrame(); },
-                [&queueHandlerThread]() { return TerminationFlag && queueHandlerThread.isRunning(); });
+                [&queueHandlerThread]() { return TerminationFlag || !queueHandlerThread.isRunning(); });
 
             queue->clear();
             queue->put("eof");
commit f960b3e5d39375cfa607eda8c94b5603fbdd4c93
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed May 11 18:47:48 2016 -0400

    loolwsd: test: add test max col and row
    
    (cherry picked from commit f1c56d198a90df2d7f05462fbb1c272c90abdae7)

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index de19f21..0099ded 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -76,6 +76,8 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testEditLock);
     CPPUNIT_TEST(testSlideShow);
     CPPUNIT_TEST(testInactiveClient);
+    CPPUNIT_TEST(testMaxColumn);
+    CPPUNIT_TEST(testMaxRow);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -101,12 +103,33 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     void testEditLock();
     void testSlideShow();
     void testInactiveClient();
+    void testMaxColumn();
+    void testMaxRow();
 
     void loadDoc(const std::string& documentURL);
 
     void getPartHashCodes(const std::string response,
                           std::vector<std::string>& parts);
 
+    void getDocSize(const std::string& message,
+                    const std::string& type,
+                    int& part,
+                    int& parts,
+                    int& width,
+                    int& height);
+
+    void getCursor(const std::string& message,
+                   int& cursorX,
+                   int& cursorY,
+                   int& cursorWidth,
+                   int& cursorHeight);
+
+    void testLimitCursor( std::function<void(const std::shared_ptr<Poco::Net::WebSocket>& socket,
+                                             int cursorX, int cursorY,
+                                             int cursorWidth, int cursorHeight,
+                                             int docWidth, int docHeight)> keyhandler,
+                          std::function<void(int docWidth, int docHeight,
+                                             int newWidth, int newHeight)> checkhandler);
 public:
     HTTPWSTest()
         : _uri(helpers::getTestServerURI())
@@ -1206,6 +1229,84 @@ void HTTPWSTest::testInactiveClient()
     }
 }
 
+void HTTPWSTest::testMaxColumn()
+{
+    try
+    {
+        testLimitCursor(
+            // move cursor to last column
+            [](const std::shared_ptr<Poco::Net::WebSocket>& socket,
+               int cursorX, int cursorY, int cursorWidth, int cursorHeight,
+               int docWidth, int docHeight)
+            {
+                CPPUNIT_ASSERT(cursorX >= 0);
+                CPPUNIT_ASSERT(cursorY >= 0);
+                CPPUNIT_ASSERT(cursorWidth >= 0);
+                CPPUNIT_ASSERT(cursorHeight >= 0);
+                CPPUNIT_ASSERT(docWidth >= 0);
+                CPPUNIT_ASSERT(docHeight >= 0);
+
+                const std::string text = "key type=input char=0 key=1027";
+                while ( cursorX <= docWidth )
+                {
+                    sendTextFrame(socket, text);
+                    cursorX += cursorWidth;
+                }
+            },
+            // check new document width
+            [](int docWidth, int docHeight, int newWidth, int newHeight)
+            {
+                CPPUNIT_ASSERT_EQUAL(docHeight, newHeight);
+                CPPUNIT_ASSERT(newWidth > docWidth);
+            }
+
+        );
+    }
+    catch (const Poco::Exception& exc)
+    {
+        CPPUNIT_FAIL(exc.displayText());
+    }
+}
+
+void HTTPWSTest::testMaxRow()
+{
+    try
+    {
+        testLimitCursor(
+            // move cursor to last row
+            [](const std::shared_ptr<Poco::Net::WebSocket>& socket,
+               int cursorX, int cursorY, int cursorWidth, int cursorHeight,
+               int docWidth, int docHeight)
+            {
+                CPPUNIT_ASSERT(cursorX >= 0);
+                CPPUNIT_ASSERT(cursorY >= 0);
+                CPPUNIT_ASSERT(cursorWidth >= 0);
+                CPPUNIT_ASSERT(cursorHeight >= 0);
+                CPPUNIT_ASSERT(docWidth >= 0);
+                CPPUNIT_ASSERT(docHeight >= 0);
+
+                const std::string text = "key type=input char=0 key=1024";
+                while ( cursorY <= docHeight )
+                {
+                    sendTextFrame(socket, text);
+                    cursorY += cursorHeight;
+                }
+            },
+            // check new document height
+            [](int docWidth, int docHeight, int newWidth, int newHeight)
+            {
+                CPPUNIT_ASSERT_EQUAL(docWidth, newWidth);
+                CPPUNIT_ASSERT(newHeight > docHeight);
+            }
+
+        );
+    }
+    catch (const Poco::Exception& exc)
+    {
+        CPPUNIT_FAIL(exc.displayText());
+    }
+}
+
 void HTTPWSTest::testNoExtraLoolKitsLeft()
 {
     const auto countNow = countLoolKitProcesses(_initialLoolKitCount);
@@ -1253,6 +1354,109 @@ void HTTPWSTest::getPartHashCodes(const std::string status,
     CPPUNIT_ASSERT_EQUAL(totalParts, (int)parts.size());
 }
 
+void HTTPWSTest::getDocSize(const std::string& message, const std::string& type,
+                            int& part, int& parts, int& width, int& height)
+{
+    Poco::StringTokenizer tokens(message, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), tokens.count());
+
+    // Expected format is something like 'type= parts= current= width= height='.
+    const std::string text = tokens[0].substr(std::string("type=").size());
+    parts = std::stoi(tokens[1].substr(std::string("parts=").size()));
+    part = std::stoi(tokens[2].substr(std::string("current=").size()));
+    width = std::stoi(tokens[3].substr(std::string("width=").size()));
+    height = std::stoi(tokens[4].substr(std::string("height=").size()));
+    CPPUNIT_ASSERT_EQUAL(type, text);
+    CPPUNIT_ASSERT(parts > 0);
+    CPPUNIT_ASSERT(part >= 0);
+    CPPUNIT_ASSERT(width > 0);
+    CPPUNIT_ASSERT(height > 0);
+}
+
+void HTTPWSTest::getCursor(const std::string& message,
+                           int& cursorX, int& cursorY, int& cursorWidth, int& cursorHeight)
+{
+    Poco::JSON::Parser parser;
+    const auto result = parser.parse(message);
+    const auto& command = result.extract<Poco::JSON::Object::Ptr>();
+    auto text = command->get("commandName").toString();
+    CPPUNIT_ASSERT_EQUAL(std::string(".uno:CellCursor"), text);
+    text = command->get("commandValues").toString();
+    CPPUNIT_ASSERT(!text.empty());
+    Poco::StringTokenizer position(text, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
+    cursorX = std::stoi(position[0]);
+    cursorY = std::stoi(position[1]);
+    cursorWidth = std::stoi(position[2]);
+    cursorHeight = std::stoi(position[3]);
+    CPPUNIT_ASSERT(cursorX >= 0);
+    CPPUNIT_ASSERT(cursorY >= 0);
+    CPPUNIT_ASSERT(cursorWidth >= 0);
+    CPPUNIT_ASSERT(cursorHeight >= 0);
+}
+
+void HTTPWSTest::testLimitCursor( std::function<void(const std::shared_ptr<Poco::Net::WebSocket>& socket,
+                                                     int cursorX, int cursorY,
+                                                     int cursorWidth, int cursorHeight,
+                                                     int docWidth, int docHeight)> keyhandler,
+                                  std::function<void(int docWidth, int docHeight,
+                                                     int newWidth, int newHeight)> checkhandler)
+
+{
+    int docSheet = -1;
+    int docSheets = 0;
+    int docHeight = 0;
+    int docWidth = 0;
+    int newSheet = -1;
+    int newSheets = 0;
+    int newHeight = 0;
+    int newWidth = 0;
+    int cursorX = 0;
+    int cursorY = 0;
+    int cursorWidth = 0;
+    int cursorHeight = 0;
+
+    std::string docPath;
+    std::string docURL;
+    std::string response;
+    std::string text;
+
+    getDocumentPathAndURL("setclientpart.ods", docPath, docURL);
+    Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL);
+
+    auto socket = loadDocAndGetSocket(_uri, docURL);
+    // check document size
+    sendTextFrame(socket, "status");
+    getResponseMessage(socket, "status:", response, false);
+    CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
+    getDocSize(response, "spreadsheet", docSheet, docSheets, docWidth, docHeight);
+
+    text.clear();
+    Poco::format(text, "commandvalues command=.uno:CellCursor?outputHeight=%d&outputWidth=%d&tileHeight=%d&tileWidth=%d",
+        256, 256, 3840, 3840);
+    sendTextFrame(socket, text);
+    getResponseMessage(socket, "commandvalues:", response, false);
+    CPPUNIT_ASSERT_MESSAGE("did not receive a commandvalues: message as expected", !response.empty());
+    getCursor(response, cursorX, cursorY, cursorWidth, cursorHeight);
+
+    // move cursor
+    keyhandler(socket, cursorX, cursorY, cursorWidth, cursorHeight, docWidth, docHeight);
+
+    // filter messages, and expect to receive new document size
+    getResponseMessage(socket, "status:", response, false);
+    CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty());
+    getDocSize(response, "spreadsheet", newSheet, newSheets, newWidth, newHeight);
+
+    CPPUNIT_ASSERT_EQUAL(docSheets, newSheets);
+    CPPUNIT_ASSERT_EQUAL(docSheet, newSheet);
+
+    // check new document size
+    checkhandler(docWidth, docHeight, newWidth, newHeight);
+
+    socket->shutdown();
+    Util::removeFile(docPath);
+}
+
+
 CPPUNIT_TEST_SUITE_REGISTRATION(HTTPWSTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 19fcec460ce1a747b6969b133646e13692a03fb1
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed May 11 19:16:52 2016 +0530

    Use new DontTerminateEdit param in .uno:Save to be in edit mode
    
    Change-Id: I781eba73af668be874ab91881bcb88494b43a2e9
    (cherry picked from commit a1b351d32801a5b3b3789501de917a3dc27f3624)

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 3bb4572..cf7d479 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -284,7 +284,8 @@ bool DocumentBroker::sendUnoSave()
                 // Invalidate the timestamp to force persisting.
                 _lastFileModifiedTime.fromEpochTime(0);
 
-                queue->put("uno .uno:Save");
+                // We do not want save to terminate editing mode if we are in edit mode now
+                queue->put("uno .uno:Save {\"DontTerminateEdit\":{\"type\":\"boolean\",\"value\":true}}");
                 return true;
             }
         }
commit 4666d08095bb62f17f1ef6b729a567d0fc01d5db
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed May 11 19:15:59 2016 +0530

    Revert "bccu#1776: Restore input mode if we are in one before saving"
    
    This reverts commit 5500b090167b46a9b02b465c0cce75abacde37f8.
    
    Change-Id: I54b385dc823d8fc4e5ef9f6d8291c5cb8ca85417
    (cherry picked from commit 7a96c2fff0fb29ff83ac201309124f8a73673366)

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 9a4db8a..3bb4572 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -285,14 +285,6 @@ bool DocumentBroker::sendUnoSave()
                 _lastFileModifiedTime.fromEpochTime(0);
 
                 queue->put("uno .uno:Save");
-
-                // Set calc cell mode back to edit mode
-                // if we were in edit before save
-                if (sessionIt.second->isCursorVisible())
-                {
-                    queue->put("uno .uno:SetInputMode");
-                }
-
                 return true;
             }
         }
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 990c309..c62ef32 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -175,10 +175,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                     }
                 }
             }
-            else if (tokens.count() == 2 && tokens[0] == "cursorvisible:")
-            {
-                peer->setCursorVisible(tokens[1] == "true");
-            }
         }
 
         if (peer && !_isDocPasswordProtected)
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index 2472eb5..19a4788 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -50,8 +50,6 @@ class MasterProcessSession final : public LOOLSession, public std::enable_shared
     void setEditLock(const bool value);
     void markEditLock(const bool value) { _bEditLock = value; }
     bool isEditLocked() const { return _bEditLock; }
-    void setCursorVisible(const bool value) { _isCursorVisible = value; }
-    bool isCursorVisible() { return _isCursorVisible; }
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
@@ -88,7 +86,6 @@ public:
 
     int _curPart;
     int _loadPart;
-    bool _isCursorVisible;
     /// Kind::ToClient instances store URLs of completed 'save as' documents.
     MessageQueue _saveAsQueue;
     std::shared_ptr<DocumentBroker> _docBroker;
commit ca348b398f40f7139964b46499799a43be977ee3
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed May 11 19:14:00 2016 +0530

    Revert "bccu#1776: Fake double click after auto-saving"
    
    This reverts commit 55a85ddb33854ef18f950ba63a656eb5e15b04ed.
    
    (cherry picked from commit 58123086b8ef322da65fa5695e05558df81f18c8)

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 31be2ce..9a4db8a 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -54,16 +54,6 @@ std::string getCachePath(const std::string& uri)
             Poco::DigestEngine::digestToHex(digestEngine.digest()).insert(3, "/").insert(2, "/").insert(1, "/"));
 }
 
-/// Return mouse commands
-std::string getMouseCommand(std::string type, long posX, long posY, int count)
-{
-    return std::string("mouse type=" + type +
-                       " x=" + std::to_string(posX) +
-                       " y=" + std::to_string(posY) +
-                       " count=" + std::to_string(count) +
-                       " buttons=1 modifier=0");
-}
-
 }
 
 Poco::URI DocumentBroker::sanitizeURI(const std::string& uri)
@@ -294,23 +284,13 @@ bool DocumentBroker::sendUnoSave()
                 // Invalidate the timestamp to force persisting.
                 _lastFileModifiedTime.fromEpochTime(0);
 
-                // Store the cursor position before saving, if visible
-                long posX = -1;
-                long posY = -1;
-                if (sessionIt.second->isCursorVisible())
-                {
-                    sessionIt.second->getCursorPos(posX, posY);
-                }
-
                 queue->put("uno .uno:Save");
 
-                // Restore the cursor position, if visible, by a fake double click
-                if (posX != -1 && posY != -1)
+                // Set calc cell mode back to edit mode
+                // if we were in edit before save
+                if (sessionIt.second->isCursorVisible())
                 {
-                    queue->put(getMouseCommand("buttondown", posX, posY, 1));
-                    queue->put(getMouseCommand("buttonup", posX, posY, 1));
-                    queue->put(getMouseCommand("buttondown", posX, posY, 2));
-                    queue->put(getMouseCommand("buttonup", posX, posY, 2));
+                    queue->put("uno .uno:SetInputMode");
                 }
 
                 return true;
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 9cd67ff..990c309 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -175,16 +175,9 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                     }
                 }
             }
-            else if (tokens.count() == 5 && tokens[0] == "invalidatecursor:")
-            {
-                peer->setCursorPos(std::stoi(tokens[1]), std::stoi(tokens[2]));
-            }
             else if (tokens.count() == 2 && tokens[0] == "cursorvisible:")
             {
-                if (tokens[1] == "false")
-                {
-                    peer->setCursorPos(-1, -1);
-                }
+                peer->setCursorVisible(tokens[1] == "true");
             }
         }
 
@@ -669,16 +662,4 @@ bool MasterProcessSession::shutdownPeer(Poco::UInt16 statusCode, const std::stri
     return peer != nullptr;
 }
 
-void MasterProcessSession::setCursorPos(long posX, long posY)
-{
-    _cursorPosX = posX;
-    _cursorPosY = posY;
-}
-
-void MasterProcessSession::getCursorPos(long& posX, long& posY)
-{
-    posX = _cursorPosX;
-    posY = _cursorPosY;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index d2227e7..2472eb5 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -50,9 +50,8 @@ class MasterProcessSession final : public LOOLSession, public std::enable_shared
     void setEditLock(const bool value);
     void markEditLock(const bool value) { _bEditLock = value; }
     bool isEditLocked() const { return _bEditLock; }
-    void setCursorPos(const long posX, const long posY);
-    void getCursorPos(long& posX, long& posY);
-    bool isCursorVisible() { return _cursorPosX != -1 && _cursorPosY != -1; }
+    void setCursorVisible(const bool value) { _isCursorVisible = value; }
+    bool isCursorVisible() { return _isCursorVisible; }
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
@@ -89,8 +88,7 @@ public:
 
     int _curPart;
     int _loadPart;
-    long _cursorPosX;
-    long _cursorPosY;
+    bool _isCursorVisible;
     /// Kind::ToClient instances store URLs of completed 'save as' documents.
     MessageQueue _saveAsQueue;
     std::shared_ptr<DocumentBroker> _docBroker;
commit 269e2230914df55c5019d4f20bad1957e7a0823b
Author: Andras Timar <andras.timar at collabora.com>
Date:   Thu May 12 09:29:24 2016 +0200

    Revert "loleaflet: Added Comment button to toolbar"
    
    This reverts commit f2fec436d1bde7a9f9cd4da9396c9ca0431e6b37.

diff --git a/loleaflet/dist/images/sc_annotation.png b/loleaflet/dist/images/sc_annotation.png
deleted file mode 100644
index 92fe6e5..0000000
Binary files a/loleaflet/dist/images/sc_annotation.png and /dev/null differ
diff --git a/loleaflet/dist/toolbar.css b/loleaflet/dist/toolbar.css
index bb864fc..40922cb 100644
--- a/loleaflet/dist/toolbar.css
+++ b/loleaflet/dist/toolbar.css
@@ -196,7 +196,6 @@ button.leaflet-control-search-next
 .w2ui-icon.autosum{ background: url('/loleaflet/dist/images/sc_autosum.png') no-repeat center !important; }
 .w2ui-icon.backcolor{ background: url('/loleaflet/dist/images/sc_backcolor.png') no-repeat center !important; }
 .w2ui-icon.bold{ background: url('/loleaflet/dist/images/sc_bold.png') no-repeat center !important; }
-.w2ui-icon.annotation{ background: url('/loleaflet/dist/images/sc_annotation.png') no-repeat center !important; }
 .w2ui-icon.bullet{ background: url('/loleaflet/dist/images/sc_bullet.png') no-repeat center !important; }
 .w2ui-icon.cancel{ background: url('/loleaflet/dist/images/sc_cancel.png') no-repeat center !important; }
 .w2ui-icon.color{ background: url('/loleaflet/dist/images/sc_color.png') no-repeat center !important; }
diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index d97920a..48b6deb 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -77,7 +77,6 @@ $(function () {
 			{ type: 'button',  id: 'incrementindent',  img: 'incrementindent', hint: _("Increase Indent"), uno: 'IncrementIndent' },
 			{ type: 'button',  id: 'decrementindent',  img: 'decrementindent', hint: _("Decrease Indent"), uno: 'DecrementIndent' },
 			{ type: 'break', id: 'incdecindent' },
-			{ type: 'button',  id: 'annotation', img: 'annotation', hint: _("Comment"), uno: 'InsertAnnotation' },
 			{ type: 'button',  id: 'insertgraphic',  img: 'insertgraphic', hint: _("Insert Graphic") },
 			{ type: 'break' },
 			{ type: 'button',  id: 'help',  img: 'help', hint: _("Help") },
@@ -177,7 +176,7 @@ $(function () {
 });
 
 var formatButtons = ['undo', 'redo', 'save',
-                     'bold', 'italic', 'underline', 'strikeout', 'annotation',
+                     'bold', 'italic', 'underline', 'strikeout',
                      'fontcolor', 'backcolor', 'bullet', 'numbering', 'alignleft', 'alignhorizontal', 'alignright', 'alignblock',
                      'incrementindent', 'decrementindent', 'insertgraphic'];
 
@@ -565,7 +564,6 @@ map.on('updatepermission', function (e) {
 		toolbar.hide('writer:menu:file');
 		if (docType === 'presentation') {
 			toolbar.show('impress:menu:file');
-			toolbar.hide('annotation');
 
 			toolbar = w2ui['presentation-toolbar'];
 			toolbar.show('presentation');
@@ -575,14 +573,12 @@ map.on('updatepermission', function (e) {
 		}
 		else if (docType === 'drawing') {
 			toolbar.show('impress:menu:file');
-			toolbar.hide('annotation');
 		}
 		else if (docType === 'spreadsheet') {
 			toolbar.show('calc:menu:file');
 		}
 		else {
 			toolbar.show('other:menu:file');
-			toolbar.hide('annotation');
 		}
 	}
 });


More information about the Libreoffice-commits mailing list