loleaflet/css/mobilewizard.css                   |    5 +
 loleaflet/src/control/Control.JSDialogBuilder.js |   81 +++++++++++++++++++++--
 2 files changed, 80 insertions(+), 6 deletions(-)

New commits:
commit 51cdf48138e182b6d1101ff5d8f26456948867cf
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Nov 14 12:08:35 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Nov 14 12:09:05 2019 +0100

    jsdialog: add uno listener for uno toolitems
    
    Change-Id: I5967c847ad0aea4845fdcac67555fb5179161e92

diff --git a/loleaflet/css/mobilewizard.css b/loleaflet/css/mobilewizard.css
index ea63d43fb..4877a2ced 100644
--- a/loleaflet/css/mobilewizard.css
+++ b/loleaflet/css/mobilewizard.css
@@ -284,6 +284,11 @@ p.mobile-wizard.ui-combobox-text.selected {
        vertical-align: middle;
 }
 
+.ui-content.unobutton.selected {
+       border: 1px solid #4d82b8;
+       border-radius: 10px;
+}
+
 #mobile-wizard-content .ui-content > table > tr > td > table > table > 
tr:first-child > td > img{
        margin-top: 0px !important;
 }
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index d768485e0..48a60f997 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -811,6 +811,24 @@ L.Control.JSDialogBuilder = L.Control.extend({
                        var label = L.DomUtil.create('span', 'ui-content 
unolabel', div);
                        label.for = buttonId;
                        label.innerHTML = data.text;
+
+                       var updateFunction = function() {
+                               var items = builder.map['stateChangeHandler'];
+                               var state = items.getItemValue(data.command);
+                               console.warn('state: ' + state);
+                               if (state && state === 'true')
+                                       $(button).addClass('selected');
+                               else
+                                       $(button).removeClass('selected');
+                       }
+
+                       updateFunction();
+
+                       builder.map.on('commandstatechanged', function(e) {
+                               if (e.commandName === data.command)
+                                       updateFunction();
+                       }, this);
+
                } else {
                        button = L.DomUtil.create('label', 'ui-content 
unolabel', div);
                        button.innerHTML = builder._cleanText(data.text);
commit 52aab52dd3b051f01602a305aa635c3af2ddd921
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Nov 14 11:48:52 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Nov 14 12:09:05 2019 +0100

    jsdialog: add uno listener for spinfields
    
    Change-Id: If61609e55680272661f0ab953cf18907c07f9f07

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 3ca843e20..d768485e0 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -419,6 +419,48 @@ L.Control.JSDialogBuilder = L.Control.extend({
                return unit;
        },
 
+       _mapWindowIdToUnoCommand: function(id) {
+               switch (id) {
+               case 'beforetextindent':
+                       return '.uno:LeftRightParaMargin';
+
+               case 'aftertextindent':
+                       return '.uno:LeftRightParaMargin';
+
+               case 'firstlineindent':
+                       return '.uno:LeftRightParaMargin';
+
+               case 'aboveparaspacing':
+                       return '.uno:ULSpacing';
+
+               case 'belowparaspacing':
+                       return '.uno:ULSpacing';
+
+               case 'rowheight':
+                       return '.uno:TableRowHeight';
+
+               case 'columnwidth':
+                       return '.uno:TableColumWidth';
+
+               case 'decimalplaces':
+                       return '.uno:NumberFormat';
+
+               case 'leadingzeros':
+                       return '.uno:NumberFormat';
+
+               case 'linetransparency':
+                       return '.uno:LineTransparence';
+
+               case 'settransparency':
+                       return '.uno:FillTransparence';
+
+               case 'FIELD_TRANSPARENCY':
+                       return '.uno:FillShadowTransparency';
+               }
+
+               return null;
+       },
+
        _getUnoStateForItemId: function(id, builder) {
                var items = builder.map['stateChangeHandler'];
                var state = null;
@@ -549,14 +591,23 @@ L.Control.JSDialogBuilder = L.Control.extend({
                if (data.enabled == 'false')
                        $(spinfield).attr('disabled', 'disabled');
 
-               var value = builder._getUnoStateForItemId(data.id, builder);
+               var updateFunction = function() {
+                       var value = builder._getUnoStateForItemId(data.id, 
builder);
+
+                       if (!value && data.text != undefined)
+                               value = data.text;
+                       else if (!value && data.children && 
data.children.length)
+                               value = data.children[0].text;
+
+                       $(spinfield).attr('value', 
builder._cleanValueFromUnits(value));
+               }
 
-               if (!value && data.text != undefined)
-                       value = data.text;
-               else if (!value && data.children && data.children.length)
-                       value = data.children[0].text;
+               updateFunction();
 
-               $(spinfield).attr('value', builder._cleanValueFromUnits(value));
+               builder.map.on('commandstatechanged', function(e) {
+                       if (e.commandName === 
builder._mapWindowIdToUnoCommand(data.id))
+                               updateFunction();
+               }, this);
 
                spinfield.addEventListener('change', function() {
                        if (customCallback)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to