[Libreoffice-commits] online.git: loleaflet/dist

Henry Castro hcastro at collabora.com
Fri Jul 15 12:25:44 UTC 2016


 loleaflet/dist/images/lc_ok.png   |binary
 loleaflet/dist/toolbar.css        |    1 
 loleaflet/dist/toolbar/toolbar.js |   82 ++++++++++++++++++++++++++++++--------
 3 files changed, 66 insertions(+), 17 deletions(-)

New commits:
commit d57c5758fdbf5dfac2496dd5bd159b5d11e232c0
Author: Henry Castro <hcastro at collabora.com>
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 2cc31ac..4e25d6b 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'];
@@ -708,15 +735,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</div>' },
+			{type: 'html',  id: 'StatusDocPos',
+				html: '<div id="StatusDocPos" class="loleaflet-font" title="'+_('Number of Sheets')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break2'},
-			{type: 'html',  id: 'RowColSelCount',  html: '<div id="RowColSelCount" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'RowColSelCount',
+				html: '<div id="RowColSelCount" class="loleaflet-font" title="'+_('Selected range of cells')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break3'},
-			{type: 'html',  id: 'InsertMode',  html: '<div id="InsertMode" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'InsertMode',
+				html: '<div id="InsertMode" class="loleaflet-font" title="'+_('Entering text mode')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break5'},
-			{type: 'html',  id: 'StatusSelectionMode',  html: '<div id="StatusSelectionMode" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'StatusSelectionMode',
+				html: '<div id="StatusSelectionMode" class="loleaflet-font" title="'+_('Selection Mode')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break8'},
-			{type: 'html',  id: 'StateTableCell',  html: '<div id="StateTableCell" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'StateTableCell',
+				html: '<div id="StateTableCell" class="loleaflet-font" title="'+_('Choice of functions')+ '" style="padding: 5px 5px;">    &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', [
@@ -739,20 +781,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</div>' },
+			{type: 'html',  id: 'StatePageNumber',
+				html: '<div id="StatePageNumber" class="loleaflet-font" title="'+_('Number of Pages')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break2'},
-			{type: 'html',  id: 'StateWordCount',  html: '<div id="StateWordCount" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'StateWordCount',
+				html: '<div id="StateWordCount" class="loleaflet-font" title="'+_('Word Counter')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break5'},
-			{type: 'html',  id: 'InsertMode',  html: '<div id="InsertMode" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'InsertMode',
+				html: '<div id="InsertMode" class="loleaflet-font" title="'+_('Entering text mode')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 			{type: 'break', id:'break6'},
-			{type: 'html',  id: 'SelectionMode',  html: '<div id="StatusSelectionMode" class="loleaflet-font" style="padding: 5px 5px;">    &nbsp</div>' },
+			{type: 'html',  id: 'SelectionMode',
+				html: '<div id="StatusSelectionMode" class="loleaflet-font" title="'+_('Selection Mode')+ '" style="padding: 5px 5px;">    &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</div>' },
+			{type: 'html',  id: 'PageStatus',
+				html: '<div id="PageStatus" class="loleaflet-font" title="'+_('Number of Slides')+ '" style="padding: 5px 5px;">    &nbsp</div>' },
 		]);
 		statusbar.refresh();
 		break;
@@ -761,6 +808,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;
@@ -886,12 +934,12 @@ map.on('commandstatechanged', function (e) {
 		 commandName === '.uno:SelectionMode') {
 		$('#StatusSelectionMode').html(state ? L.Styles.selectionMode[state].toLocaleString() : '    &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');
+	}
+	else if (commandName === '.uno:StatusBarFunc') {
 		if (state) {
-			$('#StateTableCell').html(state);
+			selectItem(statusbar.get('StateTableCellMenu'), state);
 		}
 	}
 	else if (commandName === '.uno:StatePageNumber') {


More information about the Libreoffice-commits mailing list