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

Henry Castro hcastro at collabora.com
Mon Feb 19 19:17:46 UTC 2018


 loleaflet/build/deps.js                       |    7 -
 loleaflet/src/control/Control.ColumnHeader.js |    9 --
 loleaflet/src/control/Control.MetricInput.js  |  102 --------------------------
 loleaflet/src/control/Control.RowHeader.js    |    7 -
 4 files changed, 2 insertions(+), 123 deletions(-)

New commits:
commit 64e6cf189c028e7b2be8ead0d58e1a2b43f66d16
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Feb 19 15:14:11 2018 -0400

    loleaflet: remove MetricInput dialog
    
    Change-Id: I64dbd732caac575cc15e0b0b1fb5762c2678fe76

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 9fd024f9..9c905d76 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -292,13 +292,6 @@ var deps = {
 		desc: 'Row Header bar'
 	},
 
-	ControlMetricInput: {
-		src: ['control/Control.js',
-		      'control/Control.MetricInput.js'],
-		heading: 'Controls',
-		desc: 'Metric Input'
-	},
-
 	ControlDocumentRepair: {
 		src: ['control/Control.js',
 		      'control/Control.DocumentRepair.js'],
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 7871436b..b377582b 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -109,17 +109,10 @@ L.Control.ColumnHeader = L.Control.Header.extend({
 	},
 
 	optimalWidth: function(index) {
-		if (!this._dialog) {
-			this._dialog = L.control.metricInput(this._onDialogResult, this,
-							     this._map._docLayer.twipsToHMM(this._map._docLayer.STD_EXTRA_WIDTH),
-							     {title: _UNO('.uno:SetOptimalColumnWidth', 'spreadsheet', true).replace('...', '')});
-		}
 		if (this._map._docLayer._selections.getLayers().length === 0) {
 			this._selectColumn(index, 0);
 		}
-		this._dialog.addTo(this._map);
-		this._map.enable(false);
-		this._dialog.show();
+		this._map.sendUnoCommand('.uno:SetOptimalColumnWidth');
 	},
 
 	insertColumn: function(index) {
diff --git a/loleaflet/src/control/Control.MetricInput.js b/loleaflet/src/control/Control.MetricInput.js
deleted file mode 100644
index c174bcef..00000000
--- a/loleaflet/src/control/Control.MetricInput.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * L.Control.MetricInput.
- */
-/* global _ */
-L.Control.MetricInput = L.Control.extend({
-	options: {
-		position: 'topmiddle',
-		title: ''
-	},
-
-	initialize: function (callback, context, value, options) {
-		L.setOptions(this, options);
-
-		this._callback = callback;
-		this._context = context;
-		this._default = value;
-	},
-
-	onAdd: function () {
-		this._initLayout();
-
-		return this._container;
-	},
-
-	_initLayout: function () {
-		var className = 'leaflet-control-layers',
-		container = this._container = L.DomUtil.create('div', className);
-		container.style.visibility = 'hidden';
-
-		var closeButton = L.DomUtil.create('a', 'leaflet-popup-close-button', container);
-		closeButton.href = '#close';
-		closeButton.innerHTML = '×';
-		L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
-
-		var wrapper = L.DomUtil.create('div', 'leaflet-popup-content-wrapper', container);
-		var content = L.DomUtil.create('div', 'leaflet-popup-content', wrapper);
-		var labelTitle = document.createElement('span');
-		labelTitle.innerHTML = '<b>' + this.options.title + ' ' + _('(100th/mm)') + '</b>';
-		content.appendChild(labelTitle);
-		content.appendChild(document.createElement('br'));
-		content.appendChild(document.createElement('br'));
-
-		var labelAdd = document.createElement('span');
-		labelAdd.innerHTML = _('Add: ');
-		content.appendChild(labelAdd);
-
-		var inputMetric = this._input = document.createElement('input');
-		inputMetric.type = 'text';
-		inputMetric.value = this._default;
-		content.appendChild(inputMetric);
-		content.appendChild(document.createElement('br'));
-		content.appendChild(document.createElement('br'));
-
-		var inputValue = document.createElement('input');
-		inputValue.type = 'checkbox';
-		inputValue.checked = true;
-		L.DomEvent.on(inputValue, 'click', this._onDefaultClick, this);
-		content.appendChild(inputValue);
-
-		var labelValue = document.createElement('span');
-		labelValue.innerHTML = _('Default value');
-		content.appendChild(labelValue);
-		content.appendChild(document.createElement('br'));
-		content.appendChild(document.createElement('br'));
-
-		var inputButton = document.createElement('input');
-		inputButton.type = 'button';
-		inputButton.value = _('Submit');
-		L.DomEvent.on(inputButton, 'click', this._onOKButtonClick, this);
-
-		content.appendChild(inputButton);
-	},
-
-	onRemove: function () {
-		this._input = null;
-	},
-
-	show: function () {
-		this._container.style.marginLeft = (-this._container.offsetWidth / 2) + 'px';
-		this._container.style.visibility = '';
-		this._input.focus();
-	},
-
-	_onDefaultClick: function () {
-		this._input.value = this._default;
-	},
-
-	_onOKButtonClick: function () {
-		var data = parseFloat(this._input.value);
-		this.remove();
-		this._callback.call(this._context, {type: 'submit', value: data});
-	},
-
-	_onCloseButtonClick: function () {
-		this.remove();
-		this._callback.call(this._context, {type : 'close'});
-	}
-});
-
-L.control.metricInput = function (callback, context, value, options) {
-	return new L.Control.MetricInput(callback, context, value, options);
-};
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index a04d1b73..fd9a1c1d 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -106,15 +106,10 @@ L.Control.RowHeader = L.Control.Header.extend({
 	},
 
 	optimalHeight: function(index) {
-		if (!this._dialog) {
-			this._dialog = L.control.metricInput(this._onDialogResult, this, 0, {title: _UNO('.uno:SetOptimalRowHeight', 'spreadsheet', true).replace('...','')});
-		}
 		if (this._map._docLayer._selections.getLayers().length === 0) {
 			this._selectRow(index, 0);
 		}
-		this._dialog.addTo(this._map);
-		this._map.enable(false);
-		this._dialog.show();
+		this._map.sendUnoCommand('.uno:SetOptimalRowHeight');
 	},
 
 	insertRow: function(index) {


More information about the Libreoffice-commits mailing list