loleaflet: add a menu drop down toolbar item
This commit is contained in:
parent
ddfd0a3341
commit
d57c5758fd
3 changed files with 66 additions and 17 deletions
BIN
loleaflet/dist/images/lc_ok.png
vendored
Normal file
BIN
loleaflet/dist/images/lc_ok.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 B |
1
loleaflet/dist/toolbar.css
vendored
1
loleaflet/dist/toolbar.css
vendored
|
@ -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.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.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.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 {
|
.inserttable-pop {
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
|
|
82
loleaflet/dist/toolbar/toolbar.js
vendored
82
loleaflet/dist/toolbar/toolbar.js
vendored
|
@ -52,7 +52,7 @@ function resizeToolbar() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClick(id) {
|
function onClick(id, item, subItem) {
|
||||||
if (w2ui['toolbar-up'].get(id) !== null) {
|
if (w2ui['toolbar-up'].get(id) !== null) {
|
||||||
var toolbar = w2ui['toolbar-up'];
|
var toolbar = w2ui['toolbar-up'];
|
||||||
var item = toolbar.get(id);
|
var item = toolbar.get(id);
|
||||||
|
@ -77,6 +77,16 @@ function onClick(id) {
|
||||||
toolbar = w2ui['toolbar-up-more'];
|
toolbar = w2ui['toolbar-up-more'];
|
||||||
item = toolbar.get(id);
|
item = toolbar.get(id);
|
||||||
}
|
}
|
||||||
|
else if (item && subItem)
|
||||||
|
{
|
||||||
|
var command = {
|
||||||
|
'StatusBarFunc': {
|
||||||
|
type: 'unsigned short',
|
||||||
|
value: subItem.func
|
||||||
|
}
|
||||||
|
};
|
||||||
|
map.sendUnoCommand('.uno:StatusBarFunc', command);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error('unknown id: ' + id);
|
throw new Error('unknown id: ' + id);
|
||||||
}
|
}
|
||||||
|
@ -448,7 +458,7 @@ $(function () {
|
||||||
{type: 'button', id: 'zoomin', img: 'zoomin', hint: _('Zoom in')}
|
{type: 'button', id: 'zoomin', img: 'zoomin', hint: _('Zoom in')}
|
||||||
],
|
],
|
||||||
onClick: function (e) {
|
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;
|
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) {
|
function onSearch(e) {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
var toolbar = w2ui['toolbar-down'];
|
var toolbar = w2ui['toolbar-down'];
|
||||||
|
@ -708,15 +735,30 @@ map.on('doclayerinit', function () {
|
||||||
case 'spreadsheet':
|
case 'spreadsheet':
|
||||||
statusbar.insert('left', [
|
statusbar.insert('left', [
|
||||||
{type: 'break', id:'break1'},
|
{type: 'break', id:'break1'},
|
||||||
{type: 'html', id: 'StatusDocPos', html: '<div id="StatusDocPos" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'StatusDocPos',
|
||||||
|
html: '<div id="StatusDocPos" class="loleaflet-font" title="'+_('Number of Sheets')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break2'},
|
{type: 'break', id:'break2'},
|
||||||
{type: 'html', id: 'RowColSelCount', html: '<div id="RowColSelCount" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'RowColSelCount',
|
||||||
|
html: '<div id="RowColSelCount" class="loleaflet-font" title="'+_('Selected range of cells')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break3'},
|
{type: 'break', id:'break3'},
|
||||||
{type: 'html', id: 'InsertMode', html: '<div id="InsertMode" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'InsertMode',
|
||||||
|
html: '<div id="InsertMode" class="loleaflet-font" title="'+_('Entering text mode')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break5'},
|
{type: 'break', id:'break5'},
|
||||||
{type: 'html', id: 'StatusSelectionMode', html: '<div id="StatusSelectionMode" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'StatusSelectionMode',
|
||||||
|
html: '<div id="StatusSelectionMode" class="loleaflet-font" title="'+_('Selection Mode')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break8'},
|
{type: 'break', id:'break8'},
|
||||||
{type: 'html', id: 'StateTableCell', html: '<div id="StateTableCell" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'StateTableCell',
|
||||||
|
html: '<div id="StateTableCell" class="loleaflet-font" title="'+_('Choice of functions')+ '" style="padding: 5px 5px;">  </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.remove('alignblock', 'bullet', 'numbering', 'break-numbering');
|
||||||
toolbar.insert('break-align', [
|
toolbar.insert('break-align', [
|
||||||
|
@ -739,20 +781,25 @@ map.on('doclayerinit', function () {
|
||||||
case 'text':
|
case 'text':
|
||||||
statusbar.insert('left', [
|
statusbar.insert('left', [
|
||||||
{type: 'break', id:'break1'},
|
{type: 'break', id:'break1'},
|
||||||
{type: 'html', id: 'StatePageNumber', html: '<div id="StatePageNumber" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'StatePageNumber',
|
||||||
|
html: '<div id="StatePageNumber" class="loleaflet-font" title="'+_('Number of Pages')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break2'},
|
{type: 'break', id:'break2'},
|
||||||
{type: 'html', id: 'StateWordCount', html: '<div id="StateWordCount" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'StateWordCount',
|
||||||
|
html: '<div id="StateWordCount" class="loleaflet-font" title="'+_('Word Counter')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break5'},
|
{type: 'break', id:'break5'},
|
||||||
{type: 'html', id: 'InsertMode', html: '<div id="InsertMode" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'InsertMode',
|
||||||
|
html: '<div id="InsertMode" class="loleaflet-font" title="'+_('Entering text mode')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
{type: 'break', id:'break6'},
|
{type: 'break', id:'break6'},
|
||||||
{type: 'html', id: 'SelectionMode', html: '<div id="StatusSelectionMode" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'SelectionMode',
|
||||||
|
html: '<div id="StatusSelectionMode" class="loleaflet-font" title="'+_('Selection Mode')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
]);
|
]);
|
||||||
statusbar.refresh();
|
statusbar.refresh();
|
||||||
break;
|
break;
|
||||||
case 'presentation':
|
case 'presentation':
|
||||||
statusbar.insert('left', [
|
statusbar.insert('left', [
|
||||||
{type: 'break', id:'break1'},
|
{type: 'break', id:'break1'},
|
||||||
{type: 'html', id: 'PageStatus', html: '<div id="PageStatus" class="loleaflet-font" style="padding: 5px 5px;">  </div>' },
|
{type: 'html', id: 'PageStatus',
|
||||||
|
html: '<div id="PageStatus" class="loleaflet-font" title="'+_('Number of Slides')+ '" style="padding: 5px 5px;">  </div>' },
|
||||||
]);
|
]);
|
||||||
statusbar.refresh();
|
statusbar.refresh();
|
||||||
break;
|
break;
|
||||||
|
@ -761,6 +808,7 @@ map.on('doclayerinit', function () {
|
||||||
|
|
||||||
map.on('commandstatechanged', function (e) {
|
map.on('commandstatechanged', function (e) {
|
||||||
var toolbar = w2ui['toolbar-up'];
|
var toolbar = w2ui['toolbar-up'];
|
||||||
|
var statusbar = w2ui['toolbar-down'];
|
||||||
var commandName = e.commandName;
|
var commandName = e.commandName;
|
||||||
var state = e.state;
|
var state = e.state;
|
||||||
var found = false;
|
var found = false;
|
||||||
|
@ -886,12 +934,12 @@ map.on('commandstatechanged', function (e) {
|
||||||
commandName === '.uno:SelectionMode') {
|
commandName === '.uno:SelectionMode') {
|
||||||
$('#StatusSelectionMode').html(state ? L.Styles.selectionMode[state].toLocaleString() : '  ');
|
$('#StatusSelectionMode').html(state ? L.Styles.selectionMode[state].toLocaleString() : '  ');
|
||||||
}
|
}
|
||||||
else if (commandName === '.uno:Position' ||
|
else if (commandName == '.uno:StateTableCell') {
|
||||||
commandName === '.uno:StateTableCell' ||
|
$('#StateTableCell').html(state ? state : '  ');
|
||||||
commandName === '.uno:StatusBarFunc' ||
|
}
|
||||||
commandName === '.uno:Size') {
|
else if (commandName === '.uno:StatusBarFunc') {
|
||||||
if (state) {
|
if (state) {
|
||||||
$('#StateTableCell').html(state);
|
selectItem(statusbar.get('StateTableCellMenu'), state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (commandName === '.uno:StatePageNumber') {
|
else if (commandName === '.uno:StatePageNumber') {
|
||||||
|
|
Loading…
Reference in a new issue