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

Henry Castro hcastro at collabora.com
Fri May 27 01:37:53 UTC 2016


 loleaflet/dist/toolbar/toolbar.js |   20 ++++----------------
 loleaflet/src/control/Styles.js   |   21 ++++++++++++++++++++-
 loleaflet/src/control/Toolbar.js  |   14 ++++++++++++++
 3 files changed, 38 insertions(+), 17 deletions(-)

New commits:
commit b1172c6b2463dc8c80f336edc0feadfe85fd3408
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu May 26 21:37:09 2016 -0400

    loleaflet: bccu#1799 Apply Styles does not work in Presentation

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 117a75f..3fb3da7 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -377,7 +377,7 @@ function onStyleSelect (e) {
 		map.applyStyle(style, 'CellStyles');
 	}
 	else if (map.getDocType() === 'presentation' || map.getDocType() === 'drawing') {
-		map.applyStyle(style, 'Default');
+		map.applyLayout(style);
 	}
 	map.focus();
 }
@@ -718,21 +718,9 @@ map.on('updatetoolbarcommandvalues', function (e) {
 			styles = e.commandValues.CellStyles;
 		}
 		else if (map.getDocType() === 'presentation' || map.getDocType() === 'drawing') {
-			Object.keys(e.commandValues).forEach(function(style) {
-				switch (style) {
-					case 'graphics':
-					case 'table':
-					case 'cell':
-					case 'Commands':
-						break;
-
-					default:
-						if ( styles.length === 0 ) {
-							styles = e.commandValues[style];
-						}
-						break;
-				}
-			});
+			L.Styles.impressLayout.forEach(function(layout) {
+				data = data.concat({id: layout.id, text: layout.text});
+			}, this);
 		}
 
 		if (topStyles.length > 0) {
diff --git a/loleaflet/src/control/Styles.js b/loleaflet/src/control/Styles.js
index 124d652..0f396f4 100644
--- a/loleaflet/src/control/Styles.js
+++ b/loleaflet/src/control/Styles.js
@@ -297,5 +297,24 @@ L.Styles = {
 		'Hintergrund':'background',
 		'Hintergrundobjekte':'backgroundobjects',
 		'Notizen':'notes'
-	}
+	},
+
+	impressLayout : [
+		{id: 0, text: 'Title Slide'},
+		{id: 1, text: 'Title, Content'},
+		{id: 3, text: 'Title and 2 Content'},
+		{id: 19, text: 'Title Only'},
+		{id: 20, text: 'Blank Slide'},
+		{id: 32, text: 'Centered Text'},
+		{id: 12, text: 'Title, Content and 2 Content'},
+		{id: 15, text: 'Title, 2 Content and Content'},
+		{id: 16, text: 'Title, 2 Content over Content'},
+		{id: 14, text: 'Title, Content over Content'},
+		{id: 18, text: 'Title, 4 Content'},
+		{id: 34, text: 'Title, 6 Content'},
+		{id: 27, text: 'Vertical Title, Text, Chart'},
+		{id: 28, text: 'Vertical Title, Vertical Text'},
+		{id: 29, text: 'Title, Vertical Content'},
+		{id: 30, text: 'Title, 2 Vertical Content'}
+	]
 };
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 9ebdd4e..aff5e3f 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -85,6 +85,20 @@ L.Map.include({
 		}
 	},
 
+	applyLayout: function (layout) {
+		if (!layout) {
+			this.fire('error', {cmd: 'setLayout', kind: 'incorrectparam'});
+			return;
+		}
+		if (this._permission === 'edit') {
+			var msg = 'uno .uno:AssignLayout {' +
+					'"WhatPage":{"type":"unsigned short", "value": "' + this.getCurrentPartNumber() + '"},' +
+					'"WhatLayout":{"type":"unsigned short", "value": "' + layout + '"}' +
+					'}';
+			this._socket.sendMessage(msg);
+		}
+	},
+
 	sendUnoCommand: function (command, json) {
 		if (this._permission === 'edit') {
 			this._socket.sendMessage('uno ' + command + (json ? ' ' + JSON.stringify(json) : ''));


More information about the Libreoffice-commits mailing list