[Libreoffice-commits] online.git: loleaflet/css loleaflet/src
Marco Cecchetti (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 29 11:27:40 UTC 2020
loleaflet/css/device-mobile.css | 3 +
loleaflet/src/control/Control.FormulaBar.js | 15 +++--
loleaflet/src/control/Control.JSDialogBuilder.js | 26 ++++++----
loleaflet/src/control/Control.UIManager.js | 2
loleaflet/src/layer/tile/TileLayer.js | 58 +++++++++++++++++++++--
5 files changed, 85 insertions(+), 19 deletions(-)
New commits:
commit 7f105d02a889e29cbfc806e4f625ec6373348809
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Feb 20 19:09:15 2020 +0100
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Wed Apr 29 13:27:21 2020 +0200
loleaflet: function wizard for all functions subdivided in categories
Change-Id: Ib8e6bb4155ab3a0562c7a76a6eeb58c4d725058d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89200
Tested-by: Marco Cecchetti <marco.cecchetti at collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti at collabora.com>
diff --git a/loleaflet/css/device-mobile.css b/loleaflet/css/device-mobile.css
index b1b44fd2e..24f26678a 100644
--- a/loleaflet/css/device-mobile.css
+++ b/loleaflet/css/device-mobile.css
@@ -195,6 +195,9 @@ div#w2ui-overlay-actionbar.w2ui-overlay{
#tb_formulabar_item_formula > div, #tb_formulabar_item_address > div {
margin-top: -16px;
}
+#tb_formulabar_item_functiondialog > div {
+ margin-top: -20px;
+}
.inputbar_multiline #tb_formulabar_item_formula > div,
.inputbar_multiline #tb_formulabar_item_address > div {
margin-top:0px;
diff --git a/loleaflet/src/control/Control.FormulaBar.js b/loleaflet/src/control/Control.FormulaBar.js
index fe7d8f838..48d8a4f2d 100644
--- a/loleaflet/src/control/Control.FormulaBar.js
+++ b/loleaflet/src/control/Control.FormulaBar.js
@@ -5,9 +5,6 @@
/* global $ w2ui _ */
L.Control.FormulaBar = L.Control.extend({
- options: {
- showfunctionwizard: true
- },
onAdd: function (map) {
this.map = map;
@@ -34,8 +31,8 @@ L.Control.FormulaBar = L.Control.extend({
items: [
{type: 'html', id: 'left'},
{type: 'html', id: 'address', html: '<input id="addressInput" type="text">'},
- {type: 'break', hidden: !this.options.showfunctionwizard},
- {type: 'button', hidden: !this.options.showfunctionwizard, id: 'functiondialog', img: 'functiondialog', hint: _('Function Wizard'), uno: '.uno:FunctionDialog'},
+ {type: 'break'},
+ {type: 'button', id: 'functiondialog', img: 'functiondialog', hint: _('Function Wizard')},
{type: 'html', id: 'formula', html: '<div id="calc-inputbar-wrapper"><div id="calc-inputbar"></div></div>'}
],
onClick: function (e) {
@@ -83,6 +80,14 @@ L.Control.FormulaBar = L.Control.extend({
this.map.toggleCommandState(window.getUNOCommand(item.uno));
}
}
+ else if (id === 'functiondialog') {
+ if (window.mode.isMobile() && this.map._functionWizardData) {
+ this.map._docLayer._closeMobileWizard();
+ this.map._docLayer._openMobileWizard(this.map._functionWizardData);
+ } else {
+ this.map.sendUnoCommand('.uno:FunctionDialog');
+ }
+ }
},
onDocLayerInit: function() {
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index a9a4fd1aa..7aa3f67d5 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -349,7 +349,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
}
},
- _explorableEntry: function(parentContainer, data, contentNode, builder, valueNode, iconPath, updateCallback) {
+ _explorableEntry: function(parentContainer, data, content, builder, valueNode, iconPath, updateCallback) {
var sectionTitle = L.DomUtil.create('div', 'ui-header level-' + builder._currentDepth + ' mobile-wizard ui-widget', parentContainer);
$(sectionTitle).css('justify-content', 'space-between');
if (data && data.id)
@@ -418,8 +418,11 @@ L.Control.JSDialogBuilder = L.Control.extend({
var contentDiv = L.DomUtil.create('div', 'ui-content level-' + builder._currentDepth + ' mobile-wizard', parentContainer);
contentDiv.title = data.text;
+ var contentData = content.length ? content : [content];
+ var contentNode = contentData.length === 1 ? contentData[0] : null;
+
builder._currentDepth++;
- builder.build(contentDiv, [contentNode]);
+ builder.build(contentDiv, contentData);
builder._currentDepth--;
if (!data.nosubmenu)
@@ -471,6 +474,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
});
$(leftDiv).click(function() {
that.map._socket.sendMessage('completefunction index=' + data.index);
+ that.map.fire('closemobilewizard');
});
} else {
console.debug('Builder used outside of mobile wizard: please implement the click handler');
@@ -565,17 +569,19 @@ L.Control.JSDialogBuilder = L.Control.extend({
},
_panelHandler: function(parentContainer, data, builder) {
- var contentNode = data.children[0];
+ var content = data.children;
+ var contentData = content.length ? content : [content];
+ var contentNode = contentData.length === 1 ? contentData[0] : null;
- var entryId = contentNode.id;
var iconPath = null;
-
- if (entryId && entryId.length) {
- iconPath = builder._createIconPath(entryId);
+ if (contentNode) {
+ var entryId = contentNode.id;
+ if (entryId && entryId.length) {
+ iconPath = builder._createIconPath(entryId);
+ }
}
- builder._explorableEntry(parentContainer, data, contentNode, builder, null, iconPath);
-
+ builder._explorableEntry(parentContainer, data, content, builder, null, iconPath);
return false;
},
@@ -1316,7 +1322,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (builder.wizard) {
$(sectionTitle).click(function(event, data) {
builder.wizard.goLevelDown(contentDiv, data);
- if (contentNode.onshow)
+ if (contentNode && contentNode.onshow)
contentNode.onshow();
});
} else {
diff --git a/loleaflet/src/control/Control.UIManager.js b/loleaflet/src/control/Control.UIManager.js
index 14c9eb98b..8ac35bb50 100644
--- a/loleaflet/src/control/Control.UIManager.js
+++ b/loleaflet/src/control/Control.UIManager.js
@@ -71,7 +71,7 @@ L.Control.UIManager = L.Control.extend({
if (docType === 'spreadsheet') {
this.map.addControl(L.control.sheetsBar({shownavigation: isDesktop}));
- this.map.addControl(L.control.formulaBar({showfunctionwizard: isDesktop}));
+ this.map.addControl(L.control.formulaBar());
}
if (isDesktop && docType === 'presentation') {
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index df9910230..1650c4def 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -789,7 +789,7 @@ L.TileLayer = L.GridLayer.extend({
},
_onCalcFunctionListMsg: function (textMsg) {
- var funcList = JSON.parse(textMsg);
+ var funcData = JSON.parse(textMsg);
this._closeMobileWizard();
var data = {
@@ -800,6 +800,18 @@ L.TileLayer = L.GridLayer.extend({
children: []
};
+ if (funcData.categories)
+ this._onCalcFunctionListWithCategories(funcData, data);
+ else
+ this._onCalcFunctionList(funcData, data);
+
+ if (funcData.wholeList)
+ this._map._functionWizardData = data;
+
+ this._openMobileWizard(data);
+ },
+
+ _onCalcFunctionList: function (funcList, data) {
var entries = data.children;
for (var idx = 0; idx < funcList.length; ++idx) {
var func = funcList[idx];
@@ -808,7 +820,7 @@ L.TileLayer = L.GridLayer.extend({
id: '',
type: 'calcfuncpanel',
text: name,
- index: idx,
+ index: func.index,
enabled: true,
children: []
};
@@ -821,8 +833,48 @@ L.TileLayer = L.GridLayer.extend({
style: 'func-info'
};
}
+ },
+
+ _onCalcFunctionListWithCategories: function (funcData, data) {
+ var categoryList = funcData.categories;
+ var categoryEntries = data.children;
+ for (var idx = 0; idx < categoryList.length; ++idx) {
+ var category = categoryList[idx];
+ var categoryEntry = {
+ id: '',
+ type: 'panel',
+ text: category.name,
+ index: idx,
+ enabled: true,
+ children: []
+ };
+ categoryEntries.push(categoryEntry);
+ }
- this._openMobileWizard(data);
+ var funcList = funcData.functions;
+ for (idx = 0; idx < funcList.length; ++idx) {
+ var func = funcList[idx];
+ var name = func.signature.split('(')[0];
+ var funcEntry = {
+ id: '',
+ type: 'calcfuncpanel',
+ text: name,
+ index: func.index,
+ category: func.category,
+ enabled: true,
+ children: []
+ };
+ var funcEntries = categoryEntries[func.category].children;
+ funcEntries.push(funcEntry);
+
+ funcEntries[funcEntries.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'
+ };
+ }
},
_onCursorVisibleMsg: function(textMsg) {
More information about the Libreoffice-commits
mailing list