kit/ChildSession.cpp                  |    3 +++
 loleaflet/css/leaflet.css             |   22 ++++++++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js |   31 +++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)

New commits:
commit f05906aac5af7043cac477b84cd2114097557fcf
Author:     gokaysatir <gokaysa...@collabora.com>
AuthorDate: Tue Sep 15 17:10:15 2020 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Thu Sep 17 14:23:13 2020 +0200

    Online: Show input help on Online / Online part.
    
    Change-Id: Ida8c5e8baccf87dae68c1c6d8f5302b1288741e7
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102747
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 96bf87372..54d900da6 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -2594,6 +2594,9 @@ void ChildSession::loKitCallback(const int type, const 
std::string& payload)
     case LOK_CALLBACK_VALIDITY_LIST_BUTTON:
         sendTextFrame("validitylistbutton: " + payload);
         break;
+    case LOK_CALLBACK_VALIDITY_INPUT_HELP:
+        sendTextFrame("validityinputhelp: " + payload);
+        break;
     case LOK_CALLBACK_CLIPBOARD_CHANGED:
     {
         std::string selection;
diff --git a/loleaflet/css/leaflet.css b/loleaflet/css/leaflet.css
index c2c35430c..d8d8bd651 100644
--- a/loleaflet/css/leaflet.css
+++ b/loleaflet/css/leaflet.css
@@ -1001,3 +1001,25 @@ path.leaflet-pane-splitter:hover {
        stroke: #cdcdcd;
        fill: #cdcdcd;
 }
+
+.input-help {
+       border-radius: 15px;
+       padding: 5px;
+       box-sizing: content-box;
+       border: 1px solid black;
+       color: black;
+       background-color: wheat;
+       min-width: 200px;
+       text-align: center;
+}
+
+.input-help > h4 {
+       display: block;
+       font-weight: 900;
+}
+
+.input-help > p {
+       display: block;
+       text-indent: 20px;
+       text-align: justify;
+}
\ No newline at end of file
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index bdd3f3486..6f4445084 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -704,6 +704,9 @@ L.TileLayer = L.GridLayer.extend({
                else if (textMsg.startsWith('validitylistbutton:')) {
                        this._onValidityListButtonMsg(textMsg);
                }
+               else if (textMsg.startsWith('validityinputhelp:')) {
+                       this._onValidityInputHelpMsg(textMsg);
+               }
                else if (textMsg.startsWith('signaturestatus:')) {
                        var signstatus = 
textMsg.substring('signaturestatus:'.length + 1);
                        this._map.onChangeSignStatus(signstatus);
@@ -1200,6 +1203,16 @@ L.TileLayer = L.GridLayer.extend({
                }
 
                this._onUpdateCellCursor(horizontalDirection, 
verticalDirection, onPgUpDn);
+
+               // Remove input help if there is any:
+               this._removeInputHelpMarker();
+       },
+
+       _removeInputHelpMarker: function() {
+               if (this._inputHelpPopUp) {
+                       this._map.removeLayer(this._inputHelpPopUp);
+                       this._inputHelpPopUp = null;
+               }
        },
 
        _onDocumentRepair: function (textMsg) {
@@ -3108,6 +3121,24 @@ L.TileLayer = L.GridLayer.extend({
                }
        },
 
+       _onValidityInputHelpMsg: function(textMsg) {
+               var message = textMsg.replace('validityinputhelp: ', '');
+               message = JSON.parse(message);
+
+               var icon = L.divIcon({
+                       html: '<div class="input-help"><h4 
id="input-help-title"></h4><p id="input-help-content"></p></div>',
+                       iconSize: [0, 0],
+                       iconAnchor: [0, 0]
+               });
+
+               this._removeInputHelpMarker();
+               var inputHelpMarker = L.marker(this._cellCursor.getNorthEast(), 
{ icon: icon });
+               inputHelpMarker.addTo(this._map);
+               document.getElementById('input-help-title').innerText = 
message.title;
+               document.getElementById('input-help-content').innerText = 
message.content;
+               this._inputHelpPopUp = inputHelpMarker;
+       },
+
        _addDropDownMarker: function () {
                if (this._validatedCellXY && this._cellCursorXY && 
this._validatedCellXY.equals(this._cellCursorXY)) {
                        var pos = this._cellCursor.getNorthEast();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to