loleaflet/css/mobilewizard.css                   |    4 +
 loleaflet/src/control/Control.JSDialogBuilder.js |   64 ++++++++++++++++++++++-
 2 files changed, 66 insertions(+), 2 deletions(-)

New commits:
commit 402a42d3db9e5d3b1836c5fd5010c5a5f7054b02
Author:     Szymon Kłos <[email protected]>
AuthorDate: Mon Aug 10 12:58:53 2020 +0200
Commit:     Jan Holesovsky <[email protected]>
CommitDate: Mon Aug 10 21:12:12 2020 +0200

    mobile-wizard: update selected cell border style
    
    Change-Id: Id2f98c0824e589d63d658f00b384fa0abfb48f2f
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100425
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Jan Holesovsky <[email protected]>

diff --git a/loleaflet/css/mobilewizard.css b/loleaflet/css/mobilewizard.css
index 0d9ef8a62..8cba28d8e 100644
--- a/loleaflet/css/mobilewizard.css
+++ b/loleaflet/css/mobilewizard.css
@@ -299,6 +299,10 @@ p.mobile-wizard.ui-combobox-text.selected {
        -webkit-box-shadow: inset 0px 0px 0px 2px #fff;
        box-shadow: inset 0px 0px 0px 2px #fff;
 }
+#mobile-wizard-content > #ScCellAppearancePropertyPanel > 
.ui-content.level-0.mobile-wizard .borderbutton.selected {
+       -webkit-box-shadow: inset 0px 0px 0px 2px #0867af !important;
+       box-shadow: inset 0px 0px 0px 2px #0867af !important;
+}
 .ui-header.mobile-wizard {
        width: 100%;
        height: 56px !important;
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js 
b/loleaflet/src/control/Control.JSDialogBuilder.js
index 101e3d3bb..6a2f8e0aa 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1846,7 +1846,48 @@ L.Control.JSDialogBuilder = L.Control.extend({
                return false;
        },
 
-       _borderControlItem: function(parentContainer, data, builder, i) {
+       _getCurrentBorderNumber: function(builder) {
+               var outer = 
builder.map['stateChangeHandler'].getItemValue('.uno:BorderOuter');
+               var inner = 
builder.map['stateChangeHandler'].getItemValue('.uno:BorderInner');
+
+               if (!outer || !inner)
+                       return 0;
+
+               var left = outer.left === 'true';
+               var right = outer.right === 'true';
+               var bottom = outer.bottom === 'true';
+               var top = outer.top === 'true';
+               var horiz = inner.horizontal === 'true';
+               var vert = inner.vertical === 'true';
+
+               if (left && !right && !bottom && !top && !horiz && !vert) {
+                       return 2;
+               } else if (!left && right && !bottom && !top && !horiz && 
!vert) {
+                       return 3;
+               } else if (left && right && !bottom && !top && !horiz && !vert) 
{
+                       return 4;
+               } else if (!left && !right && !bottom && top && !horiz && 
!vert) {
+                       return 5;
+               } else if (!left && !right && bottom && !top && !horiz && 
!vert) {
+                       return 6;
+               } else if (!left && !right && bottom && top && !horiz && !vert) 
{
+                       return 7;
+               } else if (left && right && bottom && top && !horiz && !vert) {
+                       return 8;
+               } else if (!left && !right && bottom && top && horiz && !vert) {
+                       return 9;
+               } else if (left && right && bottom && top && horiz && !vert) {
+                       return 10;
+               } else if (left && right && bottom && top && !horiz && vert) {
+                       return 11;
+               } else if (left && right && bottom && top && horiz && vert) {
+                       return 12;
+               }
+
+               return 1;
+       },
+
+       _borderControlItem: function(parentContainer, data, builder, i, 
selected) {
                var button = null;
 
                var div = this._createIdentifiable('div', 'ui-content unospan', 
parentContainer, data);
@@ -1856,6 +1897,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
                button.src = L.LOUtil.getImageURL('fr0' + i + '.svg');
                button.id = buttonId;
 
+               if (selected)
+                       $(button).addClass('selected');
+
                $(div).click(function () {
                        var color = 0;
                        // Find our associated color picker
@@ -1870,8 +1914,24 @@ L.Control.JSDialogBuilder = L.Control.extend({
                var bordercontrollabel = L.DomUtil.create('p', 
builder.options.cssClass + ' ui-text', parentContainer);
                bordercontrollabel.innerHTML = _('Cell borders');
                bordercontrollabel.id = data.id + 'label';
+               var current = builder._getCurrentBorderNumber(builder);
                for (var i = 1; i < 13; ++i)
-                       builder._borderControlItem(parentContainer, data, 
builder, i);
+                       builder._borderControlItem(parentContainer, data, 
builder, i, i === current);
+
+               var updateFunction = function() {
+                       var current = builder._getCurrentBorderNumber(builder);
+                       for (var i = 1; i < 13; ++i) {
+                               if (i !== current)
+                                       $('#border-' + 
i).removeClass('selected');
+                               else
+                                       $('#border-' + i).addClass('selected');
+                       }
+               };
+
+               builder.map.on('commandstatechanged', function(e) {
+                       if (e.commandName === '.uno:BorderOuter' || 
e.commandName === '.uno:BorderInner')
+                               updateFunction();
+               }, this);
        },
 
        _colorControl: function(parentContainer, data, builder) {
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to