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

Henry Castro hcastro at collabora.com
Sat May 28 03:51:36 UTC 2016


 loleaflet/dist/toolbar/toolbar.js |   32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

New commits:
commit ffd5f7eb5ce245de29a0e0cd2802272be61edd6f
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri May 27 23:51:32 2016 -0400

    loleaflet: rename style to layout combobox

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 3fb3da7..5aef38d 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -542,7 +542,10 @@ map.on('commandstatechanged', function (e) {
 	var commandName = e.commandName;
 	var state = e.state;
 	var found = false;
-	if (commandName === '.uno:StyleApply') {
+	if (commandName === '.uno:AssignLayout') {
+		$(".styles-select").val(state).trigger('change');
+	}
+	else if (commandName === '.uno:StyleApply') {
 		if (!state)
 			return;
 
@@ -717,10 +720,9 @@ map.on('updatetoolbarcommandvalues', function (e) {
 		else if (map.getDocType() === 'spreadsheet') {
 			styles = e.commandValues.CellStyles;
 		}
-		else if (map.getDocType() === 'presentation' || map.getDocType() === 'drawing') {
-			L.Styles.impressLayout.forEach(function(layout) {
-				data = data.concat({id: layout.id, text: layout.text});
-			}, this);
+		else if (map.getDocType() === 'presentation') {
+			// styles are not applied for presentation
+			return;
 		}
 
 		if (topStyles.length > 0) {
@@ -987,6 +989,26 @@ map.on('locontextmenu', function (e) {
 	// TODO: context menu handling...
 });
 
+map.on('statusindicator', function (e) {
+	if (e.statusType === 'loleafletloaded') {
+		var data = [''];
+		if (map.getDocType() === 'presentation') {
+			// Inserts a separator element
+			data = data.concat({text: '\u2500\u2500\u2500\u2500\u2500\u2500', disabled: true});
+
+			L.Styles.impressLayout.forEach(function(layout) {
+				data = data.concat({id: layout.id, text: layout.text});
+			}, this);
+
+			$(".styles-select").select2({
+				data: data,
+				placeholder: _("Layout")
+			});
+			$(".styles-select").on('select2:select', onStyleSelect);
+		}
+	}
+});
+
 $(window).resize(function() {
 	resizeToolbar();
 });


More information about the Libreoffice-commits mailing list