loleaflet/dist/images/lc_ok.png             |binary
 loleaflet/dist/images/sc_sortascending.png  |binary
 loleaflet/dist/images/sc_sortdescending.png |binary
 loleaflet/dist/toolbar.css                  |    3 
 loleaflet/dist/toolbar/toolbar.js           |  106 +++++++++++++++++++++++-----
 5 files changed, 92 insertions(+), 17 deletions(-)

New commits:
commit 2297d1bb5c01eecb7859a19293549b1f65172e9d
Author: Henry Castro <[email protected]>
Date:   Thu Jul 14 22:12:28 2016 -0400

    loleaflet: add a menu drop down toolbar item

diff --git a/loleaflet/dist/images/lc_ok.png b/loleaflet/dist/images/lc_ok.png
new file mode 100644
index 0000000..c169240
Binary files /dev/null and b/loleaflet/dist/images/lc_ok.png differ
diff --git a/loleaflet/dist/toolbar.css b/loleaflet/dist/toolbar.css
index 200a47b..c96c1a7 100644
--- a/loleaflet/dist/toolbar.css
+++ b/loleaflet/dist/toolbar.css
@@ -266,6 +266,7 @@ button.leaflet-control-search-next
 .w2ui-icon.numberformatdecdecimals{ background: 
url('/loleaflet/dist/images/lc_numberformatdecdecimals.png') no-repeat center 
!important; }
 .w2ui-icon.sortascending{ background: 
url('/loleaflet/dist/images/sc_sortascending.png') no-repeat center !important; 
}
 .w2ui-icon.sortdescending{ background: 
url('/loleaflet/dist/images/sc_sortdescending.png') no-repeat center 
!important; }
+.w2ui-icon.selected{ background: url('/loleaflet/dist/images/lc_ok.png') 
no-repeat center !important; }
 
 .inserttable-pop {
     z-index: 100000;
diff --git a/loleaflet/dist/toolbar/toolbar.js 
b/loleaflet/dist/toolbar/toolbar.js
index a58c096..7a30824 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -52,7 +52,7 @@ function resizeToolbar() {
        }
 }
 
-function onClick(id) {
+function onClick(id, item, subItem) {
        if (w2ui['toolbar-up'].get(id) !== null) {
                var toolbar = w2ui['toolbar-up'];
                var item = toolbar.get(id);
@@ -77,6 +77,16 @@ function onClick(id) {
                toolbar = w2ui['toolbar-up-more'];
                item = toolbar.get(id);
        }
+       else if (item && subItem)
+       {
+               var command = {
+                       'StatusBarFunc': {
+                               type: 'unsigned short',
+                               value: subItem.func
+                       }
+               };
+               map.sendUnoCommand('.uno:StatusBarFunc', command);
+       }
        else {
                throw new Error('unknown id: ' + id);
        }
@@ -448,7 +458,7 @@ $(function () {
                        {type: 'button',  id: 'zoomin', img: 'zoomin', hint: 
_('Zoom in')}
                ],
                onClick: function (e) {
-                       onClick(e.target);
+                       onClick(e.target, e.item, e.subItem);
                }
        });
 });
@@ -516,6 +526,23 @@ function toLocalePattern (pattern, regex, text, sub1, 
sub2) {
        return text;
 }
 
+function selectItem(item, func)
+{
+       var index = -1;
+       for (var it = 0; it < item.items.length; it++) {
+               if (item.items[it].func === func) {
+                       index = it;
+                       break;
+               }
+       }
+
+       if (index !== -1) {
+               item.items[item.current].icon = '';
+               item.items[index].icon = 'selected';
+               item.current = index;
+       }
+}
+
 function onSearch(e) {
        if (e.keyCode === 13) {
                var toolbar = w2ui['toolbar-down'];
@@ -703,15 +730,30 @@ map.on('doclayerinit', function () {
        case 'spreadsheet':
                statusbar.insert('left', [
                        {type: 'break', id:'break1'},
-                       {type: 'html',  id: 'StatusDocPos',  html: '<div 
id="StatusDocPos" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'StatusDocPos',
+                               html: '<div id="StatusDocPos" 
class="loleaflet-font" title="'+_('Number of Sheets')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break2'},
-                       {type: 'html',  id: 'RowColSelCount',  html: '<div 
id="RowColSelCount" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'RowColSelCount',
+                               html: '<div id="RowColSelCount" 
class="loleaflet-font" title="'+_('Selected range of cells')+ '" 
style="padding: 5px 5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break3'},
-                       {type: 'html',  id: 'InsertMode',  html: '<div 
id="InsertMode" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'InsertMode',
+                               html: '<div id="InsertMode" 
class="loleaflet-font" title="'+_('Entering text mode')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break5'},
-                       {type: 'html',  id: 'StatusSelectionMode',  html: '<div 
id="StatusSelectionMode" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'StatusSelectionMode',
+                               html: '<div id="StatusSelectionMode" 
class="loleaflet-font" title="'+_('Selection Mode')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break8'},
-                       {type: 'html',  id: 'StateTableCell',  html: '<div 
id="StateTableCell" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'StateTableCell',
+                               html: '<div id="StateTableCell" 
class="loleaflet-font" title="'+_('Choice of functions')+ '" style="padding: 
5px 5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'menu', id: 'StateTableCellMenu', caption: '', 
current: 7, items: [
+                               { func: '1', text: _('Average'), icon: ''},
+                               { func: '3', text: _('CountA'), icon: ''},
+                               { func: '2', text: _('Count'), icon: ''},
+                               { func: '4', text: _('Maximum'), icon: ''},
+                               { func: '5', text: _('Minimum'), icon: ''},
+                               { func: '9', text: _('Sum'), icon: ''},
+                               { func: '12', text: _('Selection count'), icon: 
''},
+                               { func: '16', text: _('None'), icon: 
'selected'},
+               ]},
                ]);
                toolbar.remove('alignblock', 'bullet', 'numbering', 
'break-numbering');
                toolbar.insert('break-align', [
@@ -734,20 +776,25 @@ map.on('doclayerinit', function () {
        case 'text':
                statusbar.insert('left', [
                        {type: 'break', id:'break1'},
-                       {type: 'html',  id: 'StatePageNumber',  html: '<div 
id="StatePageNumber" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'StatePageNumber',
+                               html: '<div id="StatePageNumber" 
class="loleaflet-font" title="'+_('Number of Pages')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break2'},
-                       {type: 'html',  id: 'StateWordCount',  html: '<div 
id="StateWordCount" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'StateWordCount',
+                               html: '<div id="StateWordCount" 
class="loleaflet-font" title="'+_('Word Counter')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break5'},
-                       {type: 'html',  id: 'InsertMode',  html: '<div 
id="InsertMode" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'InsertMode',
+                               html: '<div id="InsertMode" 
class="loleaflet-font" title="'+_('Entering text mode')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                        {type: 'break', id:'break6'},
-                       {type: 'html',  id: 'SelectionMode',  html: '<div 
id="StatusSelectionMode" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'SelectionMode',
+                               html: '<div id="StatusSelectionMode" 
class="loleaflet-font" title="'+_('Selection Mode')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                ]);
                statusbar.refresh();
                break;
        case 'presentation':
                statusbar.insert('left', [
                        {type: 'break', id:'break1'},
-                       {type: 'html',  id: 'PageStatus',  html: '<div 
id="PageStatus" class="loleaflet-font" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
+                       {type: 'html',  id: 'PageStatus',
+                               html: '<div id="PageStatus" 
class="loleaflet-font" title="'+_('Number of Slides')+ '" style="padding: 5px 
5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp</div>' },
                ]);
                statusbar.refresh();
                break;
@@ -756,6 +803,7 @@ map.on('doclayerinit', function () {
 
 map.on('commandstatechanged', function (e) {
        var toolbar = w2ui['toolbar-up'];
+       var statusbar = w2ui['toolbar-down'];
        var commandName = e.commandName;
        var state = e.state;
        var found = false;
@@ -881,12 +929,12 @@ map.on('commandstatechanged', function (e) {
                 commandName === '.uno:SelectionMode') {
                $('#StatusSelectionMode').html(state ? 
L.Styles.selectionMode[state].toLocaleString() : 
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp');
        }
-       else if (commandName === '.uno:Position' ||
-                commandName === '.uno:StateTableCell' ||
-                commandName === '.uno:StatusBarFunc' ||
-                commandName === '.uno:Size') {
+       else if (commandName == '.uno:StateTableCell') {
+               $('#StateTableCell').html(state ? state : 
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp');
+       }
+       else if (commandName === '.uno:StatusBarFunc') {
                if (state) {
-                       $('#StateTableCell').html(state);
+                       selectItem(statusbar.get('StateTableCellMenu'), state);
                }
        }
        else if (commandName === '.uno:StatePageNumber') {
commit 2ca77a31ec316e9e637ab5a513204d025e00e108
Author: Henry Castro <[email protected]>
Date:   Thu Jul 14 13:48:06 2016 -0400

    loleaflet: add more toolbar items
    
    .uno:SortAscending
    .uno:SortDescending

diff --git a/loleaflet/dist/images/sc_sortascending.png 
b/loleaflet/dist/images/sc_sortascending.png
new file mode 100644
index 0000000..9039006
Binary files /dev/null and b/loleaflet/dist/images/sc_sortascending.png differ
diff --git a/loleaflet/dist/images/sc_sortdescending.png 
b/loleaflet/dist/images/sc_sortdescending.png
new file mode 100644
index 0000000..a928731
Binary files /dev/null and b/loleaflet/dist/images/sc_sortdescending.png differ
diff --git a/loleaflet/dist/toolbar.css b/loleaflet/dist/toolbar.css
index 41bb6c6..200a47b 100644
--- a/loleaflet/dist/toolbar.css
+++ b/loleaflet/dist/toolbar.css
@@ -264,6 +264,8 @@ button.leaflet-control-search-next
 .w2ui-icon.numberformatdate{ background: 
url('/loleaflet/dist/images/lc_datefield.png') no-repeat center !important; }
 .w2ui-icon.numberformatincdecimals{ background: 
url('/loleaflet/dist/images/lc_numberformatincdecimals.png') no-repeat center 
!important; }
 .w2ui-icon.numberformatdecdecimals{ background: 
url('/loleaflet/dist/images/lc_numberformatdecdecimals.png') no-repeat center 
!important; }
+.w2ui-icon.sortascending{ background: 
url('/loleaflet/dist/images/sc_sortascending.png') no-repeat center !important; 
}
+.w2ui-icon.sortdescending{ background: 
url('/loleaflet/dist/images/sc_sortdescending.png') no-repeat center 
!important; }
 
 .inserttable-pop {
     z-index: 100000;
diff --git a/loleaflet/dist/toolbar/toolbar.js 
b/loleaflet/dist/toolbar/toolbar.js
index 7e2952e..a58c096 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -491,6 +491,23 @@ function toggleButton(toolbar, state, command)
        }
 }
 
+function disableButton(toolbar, state, command)
+{
+       var disabled;
+       command = command.replace('.uno:', '');
+       var item = toolbar.get(command);
+       if (!item) {
+               return;
+       }
+
+       if (state) {
+               disabled = item.disabled ? toolbar.enable(command) : undefined;
+       }
+       else {
+               disabled = !item.disabled ? toolbar.disable(command) : 
undefined;
+       }
+}
+
 function toLocalePattern (pattern, regex, text, sub1, sub2) {
        var matches = new RegExp(regex, 'g').exec(text);
        if (matches) {
@@ -707,6 +724,9 @@ map.on('doclayerinit', function () {
                        {type: 'button',  id: 'NumberFormatDate',  img: 
'numberformatdate', hint: _('Format as Date'), uno: 'NumberFormatDate'},
                        {type: 'button',  id: 'NumberFormatIncDecimals',  img: 
'numberformatincdecimals', hint: _('Add Decimal Place'), uno: 
'NumberFormatIncDecimals'},
                        {type: 'button',  id: 'NumberFormatDecDecimals',  img: 
'numberformatdecdecimals', hint: _('Delete Decimal Place'), uno: 
'NumberFormatDecDecimals'},
+                       {type: 'break',   id: 'break-number'},
+                       {type: 'button',  id: 'SortAscending',  img: 
'sortascending', hint: _('Sort Ascending'), uno: 'SortAscending'},
+                       {type: 'button',  id: 'SortDescending',  img: 
'sortdescending', hint: _('Sort Descending'), uno: 'SortDescending'},
                ]);
                statusbar.refresh();
                toolbar.refresh();
@@ -888,6 +908,10 @@ map.on('commandstatechanged', function (e) {
                 commandName === '.uno:NumberFormatDate') {
                toggleButton(toolbar, state, commandName);
        }
+       else if (commandName === '.uno:SortAscending' ||
+                commandName === '.uno:SortDescending') {
+               disableButton(toolbar, state, commandName);
+       }
 
        var toolbarUpMore = w2ui['toolbar-up-more'];
        var id = commandName.toLowerCase().substr(5);
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to