[Libreoffice-commits] online.git: 2 commits - bundled/include kit/ChildSession.cpp loleaflet/css loleaflet/src

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 26 07:56:48 UTC 2019


 bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |    8 +
 kit/ChildSession.cpp                                 |    3 
 loleaflet/css/mobilewizard.css                       |   25 +++
 loleaflet/css/toolbar-mobile.css                     |   14 +
 loleaflet/css/toolbar.css                            |   13 +
 loleaflet/src/control/Control.JSDialogBuilder.js     |   43 +++++
 loleaflet/src/control/Control.LokDialog.js           |  151 ++++++++++++++++++-
 loleaflet/src/control/Control.MobileWizard.js        |    4 
 loleaflet/src/control/Control.Toolbar.js             |    9 -
 loleaflet/src/layer/tile/CalcTileLayer.js            |    9 -
 loleaflet/src/layer/tile/TileLayer.js                |   40 +++++
 loleaflet/src/map/Map.js                             |   16 ++
 12 files changed, 314 insertions(+), 21 deletions(-)

New commits:
commit 4574a98bff207e6f89504aab5f81d08847d1f086
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Mon Nov 25 21:55:18 2019 +0100
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Nov 25 22:02:50 2019 +0100

    formula bar tunneling: function list wizard
    
    Change-Id: I63670151a009ce0a67ba64cebf326e13219f2ded

diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 244a8ea20..e620fb6c3 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -710,6 +710,12 @@ typedef enum
      * the description.
      */
     LOK_CALLBACK_JSDIALOG = 46,
+
+    /**
+     * Send the list of functions whose name starts with the characters entered
+     * by the user.
+     */
+    LOK_CALLBACK_CALC_FUNCTION_LIST = 47
 }
 LibreOfficeKitCallbackType;
 
@@ -832,6 +838,8 @@ static inline const char* lokCallbackTypeToString(int nType)
         return "LOK_CALLBACK_REFERENCE_MARKS";
     case LOK_CALLBACK_JSDIALOG:
         return "LOK_CALLBACK_JSDIALOG";
+    case LOK_CALLBACK_CALC_FUNCTION_LIST:
+        return "LOK_CALLBACK_CALC_FUNCTION_LIST";
     }
 
     assert(!"Unknown LibreOfficeKitCallbackType type.");
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 677505ad9..e254b94de 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -2470,6 +2470,9 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
     case LOK_CALLBACK_JSDIALOG:
         sendTextFrame("jsdialog: " + payload);
         break;
+    case LOK_CALLBACK_CALC_FUNCTION_LIST:
+        sendTextFrame("calcfunctionlist: " + payload);
+        break;
 
 #if !ENABLE_DEBUG
     // we want a compilation-time failure in the debug builds; but ERR in the
diff --git a/loleaflet/css/mobilewizard.css b/loleaflet/css/mobilewizard.css
index 22279d1ff..783d63d1e 100644
--- a/loleaflet/css/mobilewizard.css
+++ b/loleaflet/css/mobilewizard.css
@@ -314,7 +314,7 @@
 	.sub-menu-arrow {
 		display: table-cell;
 		padding-left: 10px;
-		padding-right: 20px;
+		padding-right: 10px;
 		background: transparent;
 		font-size: 1.5em;
 		font-weight: bold;
@@ -322,6 +322,28 @@
 		vertical-align: middle;
 	}
 
+	.func-info-icon {
+		display: table-cell;
+		padding-left: 8px;
+		padding-right: 8px;
+		background: transparent;
+		font-size: 1.2em;
+		font-weight: bold;
+		color: #aaa !important;
+		vertical-align: middle;
+		border-radius: 100px;
+		border: solid 2px #aaa;
+	}
+
+	.func-info-sig {
+		margin-left: 1em;
+		margin-bottom: 2em;
+	}
+
+	.func-info-desc {
+		margin-left: 1em;
+	}
+
 	.entry-value {
 		display: table-cell;
 		vertical-align: middle;
@@ -329,6 +351,7 @@
 
 	.ui-header-right {
 		display: table;
+		margin-right: 10px;
 	}
 
 	.ui-header.level-1.mobile-wizard.ui-widget .ui-header-left span.menu-entry-with-icon {
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 61befb59a..ba39f3d2d 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -42,6 +42,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		this._controlHandlers['grid'] = this._gridHandler;
 		this._controlHandlers['frame'] = this._frameHandler;
 		this._controlHandlers['panel'] = this._panelHandler;
+		this._controlHandlers['calcfuncpanel'] = this._calcFuncListPanelHandler;
 		this._controlHandlers['paneltabs'] = this._panelTabsHandler;
 		this._controlHandlers['container'] = this._containerHandler;
 		this._controlHandlers['window'] = this._containerHandler;
@@ -270,6 +271,40 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		}
 	},
 
+	_calcFunctionEntry: function(parentContainer, data, contentNode, builder) {
+		var sectionTitle = L.DomUtil.create('div', 'func-entry ui-header level-' + builder._currentDepth + ' mobile-wizard ui-widget', parentContainer);
+		$(sectionTitle).css('justify-content', 'space-between');
+		if (data && data.id)
+			sectionTitle.id = data.id;
+
+		var leftDiv = L.DomUtil.create('div', 'ui-header-left', sectionTitle);
+		var titleClass = 'func-name';
+		var titleSpan = L.DomUtil.create('span', titleClass, leftDiv);
+		titleSpan.innerHTML = data.text;
+
+		var rightDiv = L.DomUtil.create('div', 'ui-header-right', sectionTitle);
+		var arrowSpan = L.DomUtil.create('span', 'func-info-icon', rightDiv);
+		arrowSpan.innerHTML = 'i';
+
+		var contentDiv = L.DomUtil.create('div', 'ui-content level-' + builder._currentDepth + ' mobile-wizard', parentContainer);
+		contentDiv.title = data.text;
+
+		builder._currentDepth++;
+		builder.build(contentDiv, [contentNode]);
+		builder._currentDepth--;
+
+		$(contentDiv).hide();
+		if (builder.wizard) {
+			$(rightDiv).click(function() {
+				builder.wizard.goLevelDown(contentDiv);
+				if (contentNode.onshow)
+					contentNode.onshow();
+			});
+		} else {
+			console.debug('Builder used outside of mobile wizard: please implement the click handler');
+		}
+	},
+
 	_explorableMenu: function(parentContainer, title, children, builder, customContent) {
 		var sectionTitle = L.DomUtil.create('div', 'ui-header level-' + builder._currentDepth + ' mobile-wizard ui-widget', parentContainer);
 		$(sectionTitle).css('justify-content', 'space-between');
@@ -317,6 +352,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		return false;
 	},
 
+	_calcFuncListPanelHandler: function(parentContainer, data, builder) {
+		var contentNode = data.children[0];
+
+		builder._calcFunctionEntry(parentContainer, data, contentNode, builder);
+
+		return false;
+	},
+
 	_panelTabsHandler: function(parentContainer, data, builder) {
 		var tabsContainer = L.DomUtil.create('div', 'ui-tabs mobile-wizard ui-widget');
 		var contentsContainer = L.DomUtil.create('div', 'ui-tabs-content mobile-wizard ui-widget', parentContainer);
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index d8ff8a61a..69205e60f 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -191,6 +191,10 @@ L.Control.MobileWizard = L.Control.extend({
 					$('#mobile-wizard').css('top', $('#spreadsheet-row-column-frame').css('top'));
 				else
 					$('#mobile-wizard').css('top', $('#document-container').css('top'));
+			} else if (data.id === 'funclist') {
+				$('#mobile-wizard').height('100%');
+				$('#mobile-wizard').css('top', $('#spreadsheet-row-column-frame').css('top'));
+				$('#mobile-wizard').addClass('funcwizard');
 			} else {
 				$('#mobile-wizard').height(this.options.maxHeight);
 				$('#mobile-wizard').css('top', '');
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 85c82b826..707a4d601 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -680,6 +680,9 @@ L.TileLayer = L.GridLayer.extend({
 		else if (textMsg.startsWith('jsdialog:')) {
 			this._onJSDialogMsg(textMsg);
 		}
+		else if (textMsg.startsWith('calcfunctionlist:')) {
+			this._onCalcFunctionListMsg(textMsg.substring('calcfunctionlist:'.length + 1));
+		}
 	},
 
 	toggleTileDebugModeImpl: function() {
@@ -747,6 +750,43 @@ L.TileLayer = L.GridLayer.extend({
 		this._map.fire('cellformula', {formula: formula});
 	},
 
+	_onCalcFunctionListMsg: function (textMsg) {
+		console.log('_onCalcFunctionList: textMsg: ' + textMsg);
+		var funcList = JSON.parse(textMsg);
+		this._closeMobileWizard();
+
+		var data = {
+			id: 'funclist',
+			type: '',
+			text: 'Functions',
+			enabled: true,
+			children: []
+		};
+
+		var entries = data.children;
+		for (var idx in funcList) {
+			var func =  funcList[idx];
+			var name = func.signature.split('(')[0];
+			var entry = {
+				id: '',
+				type: 'calcfuncpanel',
+				text: name,
+				enabled: true,
+				children: []
+			}
+			entries.push(entry);
+			entries[entries.length-1].children[0] = {
+				id: '',
+				type: 'fixedtext',
+				text: '<div class="func-info-sig">' + func.signature + '</div>' + '<div class="func-info-desc">' + func.description + '</div>',
+				enabled: true,
+				style: 'func-info'
+			};
+		}
+
+		this._openMobileWizard(data);
+	},
+
 	_onCursorVisibleMsg: function(textMsg) {
 		var command = textMsg.match('cursorvisible: true');
 		this._isCursorVisible = command ? true : false;
commit b7743930cde9b9583490bbdc6d7b6b09d32cdccd
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Mon Nov 4 17:12:19 2019 +0100
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Nov 25 21:57:16 2019 +0100

    loleaflet: calc formula bar tunneling
    
    Change-Id: I1e9de5eee5ce8992f37cdee4928476954b84b299

diff --git a/loleaflet/css/toolbar-mobile.css b/loleaflet/css/toolbar-mobile.css
index 8bbdb3dd2..a749a845a 100644
--- a/loleaflet/css/toolbar-mobile.css
+++ b/loleaflet/css/toolbar-mobile.css
@@ -47,6 +47,20 @@
 		border-right: none;
 		height: 35px !important;
 	}
+
+	#calc-inputbar-wrapper {
+		display: block;
+		border: none;
+	}
+
+	#calc-inputbar {
+		display: block;
+		width: 100%;
+		position: relative;
+		padding:0px;
+		margin: 0px;
+	}
+
 	#tb_actionbar_item_undo .w2ui-tb-image, #tb_actionbar_item_redo .w2ui-tb-image, #tb_actionbar_item_mobile_wizard .w2ui-tb-image, #tb_actionbar_item_prev  .w2ui-tb-image, #tb_actionbar_item_next  .w2ui-tb-image, #tb_actionbar_item_insertion_mobile_wizard .w2ui-tb-image, #tb_actionbar_item_insertcomment .w2ui-tb-image, #tb_actionbar_item_fullscreen-presentation .w2ui-tb-image{
 		min-width: 38px;
 	}
diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css
index 146490d58..f4ca398c5 100644
--- a/loleaflet/css/toolbar.css
+++ b/loleaflet/css/toolbar.css
@@ -119,6 +119,19 @@ w2ui-toolbar {
 		width: 100%;
 }
 
+#calc-inputbar-wrapper {
+	display: block;
+	border: none;
+}
+
+#calc-inputbar {
+	display: block;
+	width: 100%;
+	position: relative;
+	padding:0px;
+	margin: 0px;
+}
+
 #tb_formulabar_item_formula {
 		width: 100%;
 }
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 97e105874..0d3c3f420 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -153,6 +153,10 @@ L.Control.LokDialog = L.Control.extend({
 		return (id in this._dialogs) && this._dialogs[id].isSidebar;
 	},
 
+	_isCalcInputBar: function(id) {
+		return (id in this._dialogs) && this._dialogs[id].isCalcInputBar;
+	},
+
 	// Given a prefixed dialog id like 'lokdialog-323', gives a raw id, 323.
 	_toIntId: function(id) {
 		if (typeof(id) === 'string')
@@ -231,7 +235,7 @@ L.Control.LokDialog = L.Control.extend({
 
 	_onDialogMsg: function(e) {
 		console.log('onDialogMsg: id: ' + e.id + ', winType: ' + e.winType + ', action: ' + e.action + ', size: ' + e.size + ', rectangle: ' + e.rectangle);
-		if (e.winType != undefined && e.winType !== 'dialog' && e.winType !== 'child' && e.winType !== 'deck') {
+		if (e.winType != undefined && e.winType !== 'dialog' && e.winType !== 'calc-input-win' && e.winType !== 'child' && e.winType !== 'deck') {
 			return;
 		}
 
@@ -261,6 +265,8 @@ L.Control.LokDialog = L.Control.extend({
 			if (e.winType === 'dialog') {
 				// When left/top are invalid, the dialog shows in the center.
 				this._launchDialog(e.id, left, top, width, height, e.title);
+			} else if (e.winType === 'calc-input-win') {
+				this._launchCalcInputBar(e.id, width, height);
 			} else if (e.winType === 'deck') {
 				if (!window.mode.isMobile()) {
 					this._launchSidebar(e.id, width, height);
@@ -319,6 +325,8 @@ L.Control.LokDialog = L.Control.extend({
 			$('#' + strId).remove();
 			if (e.winType  === 'deck' || this._isSidebar(e.id))
 				this._launchSidebar(e.id, width, height);
+			else if (e.winType  === 'calc-input-win' || this._isCalcInputBar(e.id))
+				this._launchCalcInputBar(e.id, width, height);
 			else
 				this._launchDialog(e.id, null, null, width, height, this._dialogs[parseInt(e.id)].title);
 		} else if (e.action === 'cursor_invalidate') {
@@ -350,6 +358,8 @@ L.Control.LokDialog = L.Control.extend({
 				this._onDialogChildClose(parent);
 			else if (this._isSidebar(e.id))
 				this._onSidebarClose(e.id);
+			else if (this._isCalcInputBar(e.id))
+				this._onCalcInputBarClose(e.id);
 			else
 				this._onDialogClose(e.id, false);
 		} else if (e.action === 'hide') {
@@ -395,6 +405,9 @@ L.Control.LokDialog = L.Control.extend({
 				return;
 			}
 		}
+		else if (this._isCalcInputBar(dlgId) && (!this._isOpen(dlgId) || !this._dialogs[dlgId].cursorVisible)) {
+			return;
+		}
 
 		this._map.setWinId(dlgId);
 		var inputContainer = this._map.getTextInput();
@@ -483,6 +496,7 @@ L.Control.LokDialog = L.Control.extend({
 			id: id,
 			strId: strId,
 			isSidebar: false,
+			isCalcInputBar: false,
 			width: width,
 			height: height,
 			cursor: null,
@@ -500,6 +514,110 @@ L.Control.LokDialog = L.Control.extend({
 		this._sendPaintWindow(id, this._createRectStr(id));
 	},
 
+	_launchCalcInputBar: function(id, width, height) {
+
+		if (false && this._map._permission !== 'edit')
+			return;
+
+		console.log('_launchCalcInputBar: start: id: ' + id + ', width: ' + width);
+		if (this._calcInputBar) {
+			var oldHeight = this._calcInputBar.height;
+			var delta = height - oldHeight;
+			this._onCalcInputBarClose(this._calcInputBar.id);
+			if (delta !== 0) {
+				var documentContainer = L.DomUtil.get('document-container');
+				if (documentContainer) {
+					var top = documentContainer.offsetTop;
+					var noTopProp = true;
+					var props = documentContainer.style.cssText.split(';');
+					for (var i = 0; i < props.length; ++i) {
+						if (props[i].startsWith('top')) {
+							props[i] = 'top: ' + (top + delta).toString() + 'px !important';
+							documentContainer.setAttribute('style', props.join(';'));
+							noTopProp = false;
+							break;
+						}
+					}
+					if (noTopProp) {
+						var styleAttr = documentContainer.style.cssText;
+						styleAttr += '; top: ' + (top + delta).toString() + 'px !important';
+						documentContainer.setAttribute('style', styleAttr);
+					}
+				}
+
+				var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
+				if (spreadsheetRowColumnFrame) {
+					top = spreadsheetRowColumnFrame.offsetTop;
+					noTopProp = true;
+					props = spreadsheetRowColumnFrame.style.cssText.split(';');
+					for (i = 0; i < props.length; ++i) {
+						if (props[i].startsWith('top')) {
+							props[i] = 'top: ' + (top + delta).toString() + 'px !important';
+							spreadsheetRowColumnFrame.setAttribute('style', props.join(';'));
+							noTopProp = false;
+							break;
+						}
+					}
+					if (noTopProp) {
+						styleAttr = spreadsheetRowColumnFrame.style.cssText;
+						styleAttr += '; top: ' + (top + delta).toString() + 'px !important';
+						spreadsheetRowColumnFrame.setAttribute('style', styleAttr);
+					}
+				}
+			}
+		}
+
+		var strId = this._toStrId(id);
+
+		$('#calc-inputbar-wrapper').css({display: 'block'});
+
+		var container = L.DomUtil.create('div', 'inputbar_container', L.DomUtil.get('calc-inputbar'));
+		container.id = strId;
+		L.DomUtil.setStyle(container, 'width', '100%');
+		L.DomUtil.setStyle(container, 'height', height + 'px');
+
+		// Create the canvas.
+		var canvas = L.DomUtil.create('canvas', 'inputbar_canvas', container);
+		L.DomUtil.setStyle(canvas, 'position', 'absolute');
+		this._setCanvasWidthHeight(canvas, width, height);
+		canvas.id = strId + '-canvas';
+
+		// Don't show the inputbar until we get the contents.
+		$(container).parent().hide();
+
+		this._dialogs[id] = {
+			open: true,
+			id: id,
+			strId: strId,
+			isSidebar: false,
+			isCalcInputBar: true,
+			left: 0,
+			top: 0,
+			width: width,
+			height: height,
+			cursor: null,
+			child: null, // never used for inputbar
+			title: null  // never used for inputbar
+		};
+
+		this._createDialogCursor(strId);
+		this._setupWindowEvents(id, canvas/*, dlgInput*/);
+
+		L.DomEvent.on(container, 'mouseleave', function() {
+			// Move the mouse off-screen when we leave the inputbar
+			// so we don't leave edge-elements highlighted as if
+			// the mouse is still over them.
+			this._map.lastActiveTime = Date.now();
+			this._postWindowMouseEvent('move', id, -1, -1, 1, 0, 0);
+		}, this);
+
+		// Render window.
+		this._sendPaintWindowRect(id);
+
+		this._calcInputBar = this._dialogs[id];
+		console.log('_launchCalcInputBar: end');
+	},
+
 	_launchSidebar: function(id, width, height) {
 
 		if ((window.mode.isMobile() || window.mode.isTablet())
@@ -617,6 +735,7 @@ L.Control.LokDialog = L.Control.extend({
 			// 'mousedown' -> 'buttondown'
 			var lokEventType = e.type.replace('mouse', 'button');
 			this._postWindowMouseEvent(lokEventType, id, e.offsetX, e.offsetY, 1, buttons, 0);
+			this._map.setWinId(id);
 			//dlgInput.focus();
 		}, this);
 
@@ -753,6 +872,17 @@ L.Control.LokDialog = L.Control.extend({
 		$('#sidebar-dock-wrapper').css({display: ''});
 	},
 
+	_onCalcInputBarClose: function(dialogId) {
+		console.log('_onCalcInputBarClose: start: id: ' + dialogId);
+		$('#' + this._calcInputBar.strId).remove();
+		this._map.focus();
+		delete this._dialogs[dialogId];
+		this._calcInputBar = null;
+
+		$('#calc-inputbar-wrapper').css({display: ''});
+		console.log('_onCalcInputBarClose: end');
+	},
+
 	_onDialogClose: function(dialogId, notifyBackend) {
 		if (window.ThisIsTheiOSApp)
 			w2ui['editbar'].enable('closemobile');
@@ -773,7 +903,7 @@ L.Control.LokDialog = L.Control.extend({
 
 	_onClosePopups: function() {
 		for (var dialogId in this._dialogs) {
-			if (!this._isSidebar(dialogId)) {
+			if (!this._isSidebar(dialogId) && !this._isCalcInputBar(dialogId)) {
 				this._onDialogClose(dialogId, true);
 			}
 		}
@@ -782,7 +912,7 @@ L.Control.LokDialog = L.Control.extend({
 	onCloseCurrentPopUp: function() {
 		// for title-less dialog only (context menu, pop-up)
 		if (this._currentId && this._isOpen(this._currentId) &&
-			!this._dialogs[this._currentId].title && !this._isSidebar(this._currentId))
+			!this._dialogs[this._currentId].title && !this._isSidebar(this._currentId) && !this._isCalcInputBar(this._currentId))
 			this._onDialogClose(this._currentId, true);
 	},
 
@@ -809,6 +939,7 @@ L.Control.LokDialog = L.Control.extend({
 		if (!canvas)
 			return; // no window to paint to
 
+		this._dialogs[parentId].isPainting = true;
 		var ctx = canvas.getContext('2d');
 
 		var that = this;
@@ -832,6 +963,12 @@ L.Control.LokDialog = L.Control.extend({
 				that._setCanvasWidthHeight(panelCanvas, that._currentDeck.width, that._currentDeck.height);
 			}
 
+			var isCalcInputBar = that._isCalcInputBar(parentId);
+			if (isCalcInputBar) {
+				var canvas = L.DomUtil.get(that._calcInputBar.strId + '-canvas');
+				that._setCanvasWidthHeight(canvas, that._calcInputBar.width, that._calcInputBar.height);
+			}
+
 			ctx.drawImage(img, x, y);
 
 			// if dialog is hidden, show it
@@ -839,6 +976,12 @@ L.Control.LokDialog = L.Control.extend({
 			if (container)
 				$(container).parent().show();
 			that.focus(parentId);
+			that._dialogs[parentId].isPainting = false;
+
+			if (isCalcInputBar && container && that._calcInputBar.width !== container.clientWidth) {
+				console.log('_paintDialog: container width: ' + container.clientWidth + ', _calcInputBar width: ' + that._calcInputBar.width);
+				that._map._socket.sendMessage('resizewindow ' + parentId + ' size=' + container.clientWidth + ',' + that._calcInputBar.height);
+			}
 		};
 		img.src = imgData;
 	},
@@ -904,7 +1047,7 @@ L.Control.LokDialog = L.Control.extend({
 
 	_onDialogChildClose: function(dialogId) {
 		$('#' + this._toStrId(dialogId) + '-floating').remove();
-		if (!this._isSidebar(dialogId)) {
+		if (!this._isSidebar(dialogId) && !this._isCalcInputBar(dialogId)) {
 			// Remove any extra height allocated for the parent container (only for floating dialogs).
 			var canvas = document.getElementById(dialogId + '-canvas');
 			if (!canvas) {
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index b27fa584e..b40023cf8 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -964,11 +964,7 @@ function initNormalToolbar() {
 			{type: 'html', id: 'address', html: '<input id="addressInput" type="text">'},
 			{type: 'break'},
 			{type: 'button',  id: 'functiondialog', img: 'functiondialog', hint: _UNO('.uno:FunctionDialog', '', true), uno: '.uno:FunctionDialog'},
-			{type: 'button',  id: 'sum',  img: 'autosum', hint: _('Sum')},
-			{type: 'button',  id: 'function',  img: 'equal', hint: _('Function')},
-			{type: 'button', hidden: true, id: 'cancelformula',  img: 'cancel', hint: _('Cancel')},
-			{type: 'button', hidden: true, id: 'acceptformula',  img: 'accepttrackedchanges', hint: _('Accept')},
-			{type: 'html', id: 'formula', html: '<input id="formulaInput" type="text">'}
+			{type: 'html', id: 'formula', html: '<div id="calc-inputbar-wrapper"><div id="calc-inputbar"></div></div>'}
 		],
 		onClick: function (e) {
 			onClick(e, e.target);
@@ -976,9 +972,6 @@ function initNormalToolbar() {
 		},
 		onRefresh: function() {
 			$('#addressInput').off('keyup', onAddressInput).on('keyup', onAddressInput);
-			$('#formulaInput').off('keyup', onFormulaInput).on('keyup', onFormulaInput);
-			$('#formulaInput').off('blur', onFormulaBarBlur).on('blur', onFormulaBarBlur);
-			$('#formulaInput').off('focus', onFormulaBarFocus).on('focus', onFormulaBarFocus);
 		}
 	});
 	toolbar.bind('touchstart', function() {
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 37c6f9b0a..6963e04a9 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -160,11 +160,7 @@ L.CalcTileLayer = L.TileLayer.extend({
 			items: [
 				{type: 'html',  id: 'left'},
 				{type: 'html', id: 'address', html: '<input id="addressInput" type="text">'},
-				{type: 'button',  id: 'sum',  img: 'autosum', hint: _('Sum')},
-				{type: 'button',  id: 'function',  img: 'equal', hint: _('Function')},
-				{type: 'button', hidden: true, id: 'cancelformula',  img: 'cancel', hint: _('Cancel')},
-				{type: 'button', hidden: true, id: 'acceptformula',  img: 'accepttrackedchanges', hint: _('Accept')},
-				{type: 'html', id: 'formula', html: '<input id="formulaInput" type="text">'}
+				{type: 'html', id: 'formula', html: '<div id="calc-inputbar-wrapper"><div id="calc-inputbar"></div></div>'}
 			],
 			onClick: function (e) {
 				window.onClick(e, e.target);
@@ -172,9 +168,6 @@ L.CalcTileLayer = L.TileLayer.extend({
 			},
 			onRefresh: function() {
 				$('#addressInput').off('keyup', window.onAddressInput).on('keyup', window.onAddressInput);
-				$('#formulaInput').off('keyup', window.onFormulaInput).on('keyup', window.onFormulaInput);
-				$('#formulaInput').off('blur', window.onFormulaBarBlur).on('blur', window.onFormulaBarBlur);
-				$('#formulaInput').off('focus', window.onFormulaBarFocus).on('focus', window.onFormulaBarFocus);
 			}
 		});
 		toolbar.bind('touchstart', function(e) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 9db28ab4c..b0530df28 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1117,6 +1117,22 @@ L.Map = L.Evented.extend({
 				}
 			}
 		}
+
+		if (this.dialog._calcInputBar && !this.dialog._calcInputBar.isPainting) {
+			var id = this.dialog._calcInputBar.id;
+			var calcInputbar = L.DomUtil.get('calc-inputbar');
+			if (calcInputbar) {
+				var calcInputbarContainer = calcInputbar.children[0];
+				if (calcInputbarContainer) {
+					var width = calcInputbarContainer.clientWidth;
+					var height = calcInputbarContainer.clientHeight;
+					if (width !== 0 && height !== 0) {
+						console.log('_onResize: container width: ' + width + ', container height: ' + height + ', _calcInputBar width: ' + this.dialog._calcInputBar.width);
+						this._socket.sendMessage('resizewindow ' + id + ' size=' + width + ',' + height);
+					}
+				}
+			}
+		}
 	},
 
 	makeActive: function() {


More information about the Libreoffice-commits mailing list