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

Henry Castro hcastro at collabora.com
Sun Oct 23 12:45:09 UTC 2016


 loleaflet/src/control/Control.ColumnHeader.js |   40 ++++++++++++++++++++++++--
 loleaflet/src/control/Control.RowHeader.js    |   40 ++++++++++++++++++++++++--
 2 files changed, 74 insertions(+), 6 deletions(-)

New commits:
commit 00445ba1a8723b43d65abaed680615e91f4ddb37
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Oct 23 08:42:56 2016 -0400

    loleaflet: add hide/show row/column to header context menu

diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index ef67d60..70fed02 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -54,6 +54,20 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 						var colAlpha = options.$trigger.attr('rel').split('spreadsheet-column-')[1];
 						colHeaderObj.optimalWidth.call(colHeaderObj, colAlpha);
 					}
+				},
+				'hideColumn': {
+					name: _('Hide Columns'),
+					callback: function(key, options) {
+						var colAlpha = options.$trigger.attr('rel').split('spreadsheet-column-')[1];
+						colHeaderObj.hideColumn.call(colHeaderObj, colAlpha);
+					}
+				},
+				'showColumn': {
+					name: _('Show Columns'),
+					callback: function(key, options) {
+						var colAlpha = options.$trigger.attr('rel').split('spreadsheet-column-')[1];
+						colHeaderObj.showColumn.call(colHeaderObj, colAlpha);
+					}
 				}
 			},
 			zIndex: 10
@@ -66,7 +80,9 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 							     this._map._docLayer.twipsToHMM(this._map._docLayer.STD_EXTRA_WIDTH),
 							     {title: _('Optimal Column Width')});
 		}
-		this._selectColumn(colAlpha, 0);
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectColumn(colAlpha, 0);
+		}
 		this._dialog.addTo(this._map);
 		this._map.enable(false);
 		this._dialog.show();
@@ -76,15 +92,33 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 		// First select the corresponding column because
 		// .uno:InsertColumn doesn't accept any column number
 		// as argument and just inserts before the selected column
-		this._selectColumn(colAlpha, 0);
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectColumn(colAlpha, 0);
+		}
 		this._map.sendUnoCommand('.uno:InsertColumns');
 	},
 
 	deleteColumn: function(colAlpha) {
-		this._selectColumn(colAlpha, 0);
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectColumn(colAlpha, 0);
+		}
 		this._map.sendUnoCommand('.uno:DeleteColumns');
 	},
 
+	hideColumn: function(colAlpha) {
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectColumn(colAlpha, 0);
+		}
+		this._map.sendUnoCommand('.uno:HideColumn');
+	},
+
+	showColumn: function(colAlpha) {
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectColumn(colAlpha, 0);
+		}
+		this._map.sendUnoCommand('.uno:ShowColumn');
+	},
+
 	clearColumns : function () {
 		while (this._columns.firstChild) {
 			this._columns.removeChild(this._columns.firstChild);
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 7406131..5263875 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -52,6 +52,20 @@ L.Control.RowHeader = L.Control.Header.extend({
 						var row = parseInt(options.$trigger.attr('rel').split('spreadsheet-row-')[1]);
 						rowHeaderObj.optimalHeight.call(rowHeaderObj, row);
 					}
+				},
+				'hideRow': {
+					name: _('Hide Rows'),
+					callback: function(key, options) {
+						var row = parseInt(options.$trigger.attr('rel').split('spreadsheet-row-')[1]);
+						rowHeaderObj.hideRow.call(rowHeaderObj, row);
+					}
+				},
+				'showRow': {
+					name: _('Show Rows'),
+					callback: function(key, options) {
+						var row = parseInt(options.$trigger.attr('rel').split('spreadsheet-row-')[1]);
+						rowHeaderObj.showRow.call(rowHeaderObj, row);
+					}
 				}
 			},
 			zIndex: 10
@@ -62,7 +76,9 @@ L.Control.RowHeader = L.Control.Header.extend({
 		if (!this._dialog) {
 			this._dialog = L.control.metricInput(this._onDialogResult, this, 0, {title: _('Optimal Row Height')});
 		}
-		this._selectRow(row, 0);
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectRow(row, 0);
+		}
 		this._dialog.addTo(this._map);
 		this._map.enable(false);
 		this._dialog.show();
@@ -72,15 +88,33 @@ L.Control.RowHeader = L.Control.Header.extend({
 		// First select the corresponding row because
 		// .uno:InsertRows doesn't accept any row number
 		// as argument and just inserts before the selected row
-		this._selectRow(row, 0);
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectRow(row, 0);
+		}
 		this._map.sendUnoCommand('.uno:InsertRows');
 	},
 
 	deleteRow: function(row) {
-		this._selectRow(row, 0);
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectRow(row, 0);
+		}
 		this._map.sendUnoCommand('.uno:DeleteRows');
 	},
 
+	hideRow: function(row) {
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectRow(row, 0);
+		}
+		this._map.sendUnoCommand('.uno:HideRow');
+	},
+
+	showRow: function(row) {
+		if (this._map._docLayer._selections.getLayers().length === 0) {
+			this._selectColumn(row, 0);
+		}
+		this._map.sendUnoCommand('.uno:ShowRow');
+	},
+
 	clearRows: function () {
 		while (this._rows.firstChild) {
 			this._rows.removeChild(this._rows.firstChild);


More information about the Libreoffice-commits mailing list