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

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 15:23:56 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   10 +++++++
 loleaflet/src/control/Control.MobileWizard.js    |   29 ++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit 8211e9058e05c0bc885523630f8515dc4f3199f6
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Oct 9 17:23:24 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Oct 9 17:23:36 2019 +0200

    jsdialogs: inject chart type selector
    
    Change-Id: Ib6a6fe192107d2847e69953e3ab55307eefd3f21

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index fc5dc52b8..449072d9c 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -47,6 +47,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		this._controlHandlers['toolbox'] = this._containerHandler;
 		this._controlHandlers['toolitem'] = this._toolitemHandler;
 
+		this._controlHandlers['chartTypeSelector'] = this._chartTypeControl;
+
 		this._controlHandlers['mainmenu'] = this._containerHandler;
 		this._controlHandlers['submenu'] = this._subMenuHandler;
 		this._controlHandlers['menuitem'] = this._menuItemHandler;
@@ -97,6 +99,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
 	},
 
 	_cleanText: function(text) {
+		if (!text)
+			return '';
 		return text.replace('~', '');
 	},
 
@@ -509,6 +513,12 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		builder._spinfieldControl(parentContainer, data, builder);
 	},
 
+	_chartTypeControl: function(parentContainer, data, builder) {
+		data.entries = [ 'Bar', 'Column', 'Pie', 'Area', 'Line' ];
+		data.title = 'ChartType';
+		builder._comboboxControl(parentContainer, data, builder);
+	},
+
 	_subMenuHandler: function(parentContainer, data, builder) {
 		var title = data.text;
 		builder._explorableMenu(parentContainer, title, data.children, builder);
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index a87ad2176..982f7118f 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -3,7 +3,7 @@
  * L.Control.MobileWizard
  */
 
-/* global $ w2ui */
+/* global $ w2ui _ */
 L.Control.MobileWizard = L.Control.extend({
 
 	_inMainMenu: true,
@@ -147,6 +147,7 @@ L.Control.MobileWizard = L.Control.extend({
 	_modifySidebarLayout: function (data) {
 		this._mergeStylesAndTextPropertyPanels(data);
 		this._removeItems(data, ['editcontour']);
+		this._injectChartTypePanel(data);
 	},
 
 	_mergeStylesAndTextPropertyPanels: function (data) {
@@ -192,6 +193,32 @@ L.Control.MobileWizard = L.Control.extend({
 		return null;
 	},
 
+	_findChartElementsPanelAndGetContent: function (data) {
+		if (data.children) {
+			for (var i = 0; i < data.children.length; i++) {
+				if (data.children[i].type === 'panel' && data.children[i].children &&
+					data.children[i].children.length > 0 && data.children[i].children[0].id === 'ChartElementsPanel') {
+					var ret = data.children[i];
+					return ret;
+				}
+
+				var childReturn = this._findChartElementsPanelAndGetContent(data.children[i]);
+				if (childReturn !== null) {
+					return childReturn;
+				}
+			}
+		}
+		return null;
+	},
+
+	_injectChartTypePanel: function(data) {
+		var chartPanels = this._findChartElementsPanelAndGetContent(data);
+		if (chartPanels) {
+			var chartTypePanel = [{type: 'chartTypeSelector', text: _('Chart type')}];
+			data.children = chartTypePanel.concat(data.children);
+		}
+	},
+
 	_removeItems: function (data, items) {
 		if (data.children) {
 			var childRemoved = false;


More information about the Libreoffice-commits mailing list