From df151f23d4279f7fcbf9e7618a0a86ec4dc8dde4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 17 Apr 2019 16:16:02 +0300 Subject: [PATCH] [SSE] Add Text to Columns button to the cell settings panel --- .../main/app/controller/DocumentHolder.js | 1 + .../main/app/template/CellSettings.template | 10 ++++++ .../main/app/view/CellSettings.js | 31 +++++++++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 2 ++ 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index ccf2eb6d41..601d66f103 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -45,6 +45,7 @@ define([ 'common/main/lib/util/utils', 'common/main/lib/util/Shortcuts', 'common/main/lib/view/CopyWarningDialog', + 'common/main/lib/view/OpenDialog', 'spreadsheeteditor/main/app/view/DocumentHolder', 'spreadsheeteditor/main/app/view/HyperlinkSettingsDialog', 'spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced', diff --git a/apps/spreadsheeteditor/main/app/template/CellSettings.template b/apps/spreadsheeteditor/main/app/template/CellSettings.template index f02f4417d0..59be2c71d7 100644 --- a/apps/spreadsheeteditor/main/app/template/CellSettings.template +++ b/apps/spreadsheeteditor/main/app/template/CellSettings.template @@ -60,5 +60,15 @@
+ + +
+ + + + + + + \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index 776d80a9b6..07520e2eca 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -46,7 +46,8 @@ define([ 'common/main/lib/component/Button', 'common/main/lib/component/ThemeColorPalette', 'common/main/lib/component/ColorButton', - 'common/main/lib/component/ComboBorderSize' + 'common/main/lib/component/ComboBorderSize', + 'common/main/lib/view/OpenDialog' ], function (menuTemplate, $, _, Backbone) { 'use strict'; @@ -138,6 +139,24 @@ define([ this.api && this.api.asc_setCellAngle(field.getNumberValue()); }, + onTextToColumn: function() { + var me = this; + (new Common.Views.OpenDialog({ + title: me.txtImportWizard, + closable: true, + type: Common.Utils.importTextType.Columns, + preview: true, + api: me.api, + handler: function (result, encoding, delimiter, delimiterChar) { + if (result == 'ok') { + if (me && me.api) { + me.api.asc_TextToColumns(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + } + } + } + })).show(); + }, + render: function () { var el = $(this.el); el.html(this.template({ @@ -236,6 +255,12 @@ define([ }); this.lockedControls.push(this.spnAngle); this.spnAngle.on('change', _.bind(this.onAngleChange, this)); + + this.btnTextToColumn = new Common.UI.Button({ + el: $('#cell-btn-text-to-column') + }); + this.btnTextToColumn.on('click', _.bind(this.onTextToColumn, this)); + this.lockedControls.push(this.btnTextToColumn); }, createDelayedElements: function() { @@ -367,7 +392,9 @@ define([ tipDiagU: 'Set Diagonal Up Border', tipDiagD: 'Set Diagonal Down Border', textOrientation: 'Text Orientation', - textAngle: 'Angle' + textAngle: 'Angle', + textTextToColumn: 'Text to Columns', + textWizard: 'Text to Columns Wizard' }, SSE.Views.CellSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 9dfbcda75d..0dcac7cb2c 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1145,6 +1145,8 @@ "SSE.Views.CellSettings.tipOuter": "Set outer border only", "SSE.Views.CellSettings.tipRight": "Set outer right border only", "SSE.Views.CellSettings.tipTop": "Set outer top border only", + "SSE.Views.CellSettings.textTextToColumn": "Text to Columns", + "SSE.Views.CellSettings.textWizard": "Text to Columns Wizard", "SSE.Views.ChartSettings.strLineWeight": "Line Weight", "SSE.Views.ChartSettings.strSparkColor": "Color", "SSE.Views.ChartSettings.strTemplate": "Template",