summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2016-10-23 08:42:56 -0400
committerHenry Castro <hcastro@collabora.com>2016-10-23 08:46:30 -0400
commit00445ba1a8723b43d65abaed680615e91f4ddb37 (patch)
tree258b15e4a1cabe265f95ff1e319bbd3b46dce447
parentloleaflet: updated uno command translations (diff)
downloadonline-00445ba1a8723b43d65abaed680615e91f4ddb37.tar.gz
online-00445ba1a8723b43d65abaed680615e91f4ddb37.zip
loleaflet: add hide/show row/column to header context menu
-rw-r--r--loleaflet/src/control/Control.ColumnHeader.js40
-rw-r--r--loleaflet/src/control/Control.RowHeader.js40
2 files changed, 74 insertions, 6 deletions
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index ef67d60f11..70fed02b61 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 7406131df8..5263875879 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);