[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - loleaflet/dist

Pranav Kant pranavk at collabora.co.uk
Mon Jan 23 07:37:04 UTC 2017


 loleaflet/dist/toolbar/toolbar.js |   30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

New commits:
commit 35757a2f1802d2a6295f23e8ea9bb29d7ead80dd
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Sat Jan 21 17:24:16 2017 +0530

    loleaflet: Make things simpler - use separate cell alignment commands
    
    ... instead of using HorizontalAlignment command with different
    parameters to do a cell alignment. The state change events for
    that would add further complexity here. Lets keep using separate
    UNO commands for alignment.
    
    Additonally, change a typo, 'alignblock' -> 'justifypara' when
    hiding the toolbar buttons on 'doclayerinit' event - we don't
    want to show justify alignment button for spreadsheets.
    
    Change-Id: Iaf7406af9e3172b3fa9d41b3dac6d1e2677f0db8
    (cherry picked from commit 40307955841b070483736117d41b9dff88013cfb)

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 22f74a2..371623f 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -473,10 +473,10 @@ $(function () {
 			{type: 'html',  id: 'backcolor-html', html: '<div id="backcolor-wrapper"><input id="backColorPicker" style="display:none;"></div>'},
 			{type: 'button',  id: 'backcolor', img: 'backcolor', hint: _('Highlighting')},
 			{type: 'break'},
-			{type: 'button',  id: 'leftpara',  img: 'alignleft', hint: _('Align left'), uno: 'LeftPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"1"}}'},
-			{type: 'button',  id: 'centerpara',  img: 'alignhorizontal', hint: _('Center horizontally'), uno: 'CenterPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"2"}}'},
-			{type: 'button',  id: 'rightpara',  img: 'alignright', hint: _('Align right'), uno: 'RightPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"3"}}'},
-			{type: 'button',  id: 'justifypara',  img: 'alignblock', hint: _('Justified'), uno: 'JustifyPara', unosheet: 'HorizontalAlignment {"HorizontalAlignment":{"type":"unsigned short", "value":"4"}}'},
+			{type: 'button',  id: 'leftpara',  img: 'alignleft', hint: _('Align left'), uno: 'LeftPara', unosheet: 'AlignLeft'},
+			{type: 'button',  id: 'centerpara',  img: 'alignhorizontal', hint: _('Center horizontally'), uno: 'CenterPara', unosheet: 'AlignHorizontalCenter'},
+			{type: 'button',  id: 'rightpara',  img: 'alignright', hint: _('Align right'), uno: 'RightPara', unosheet: 'AlignRight'},
+			{type: 'button',  id: 'justifypara',  img: 'alignblock', hint: _('Justified'), uno: 'JustifyPara', unosheet: ''},
 			{type: 'break',  id: 'wraptextseparator'},
 			{type: 'button',  id: 'wraptext',  img: 'wraptext', hint: _('Wrap Text'), uno: 'WrapText'},
 			{type: 'button',  id: 'togglemergecells',  img: 'togglemergecells', hint: _('Merge and Center Cells'), uno: 'ToggleMergeCells'},
@@ -742,7 +742,23 @@ function toLocalePattern (pattern, regex, text, sub1, sub2) {
 
 function unoCmdToToolbarId(commandname)
 {
-	return commandname.toLowerCase().substr(5);
+	var id = commandname.toLowerCase().substr(5);
+	if (map.getDocType() === 'spreadsheet') {
+		switch (id) {
+		case 'alignleft':
+			id = 'leftpara';
+			break;
+		case 'alignhorizontalcenter':
+			id = 'centerpara';
+			break;
+		case 'alignright':
+			id = 'rightpara';
+			break;
+		default:
+			id = null;
+		}
+	}
+	return id;
 }
 
 function selectItem(item, func)
@@ -958,8 +974,8 @@ map.on('doclayerinit', function () {
 
 	switch (docType) {
 	case 'spreadsheet':
-		toolbarUp.remove('inserttable', 'styles', 'alignblock', 'defaultbullet', 'defaultnumbering', 'break-numbering');
-		toolbarUpMore.remove('inserttable', 'styles', 'alignblock', 'defaultbullet', 'defaultnumbering', 'break-numbering');
+		toolbarUp.remove('inserttable', 'styles', 'justifypara', 'defaultbullet', 'defaultnumbering', 'break-numbering');
+		toolbarUpMore.remove('inserttable', 'styles', 'justifypara', 'defaultbullet', 'defaultnumbering', 'break-numbering');
 		statusbar.disable('zoomreset', 'zoomout', 'zoomin', 'zoomlevel');
 		statusbar.insert('left', [
 			{type: 'break', id:'break1'},


More information about the Libreoffice-commits mailing list