From 0bc009b7db63bf0fa4ad5a0cfd6f98d6aa28fec0 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 27 Aug 2019 15:24:10 +0300 Subject: [PATCH 1/6] [SSE] Add Calculate into Toolbar --- .../main/app/controller/FormulaDialog.js | 10 ++++- .../main/app/template/Toolbar.template | 4 ++ .../main/app/view/FormulaTab.js | 38 ++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js index 5093269b1..45a977803 100644 --- a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js @@ -80,7 +80,8 @@ define([ } }, 'FormulaTab': { - 'function:apply': this.applyFunction + 'function:apply': this.applyFunction, + 'function:calculate': this.onCalculate }, 'Toolbar': { 'function:apply': this.applyFunction, @@ -353,6 +354,13 @@ define([ } }, + onCalculate: function(calc) { + var type = calc.type; + if (type === Asc.c_oAscCalculateType.All || type === Asc.c_oAscCalculateType.ActiveSheet) { + this.api && this.api.asc_calculate(type); + } + }, + sCategoryAll: 'All', sCategoryLast10: '10 last used', sCategoryLogical: 'Logical', diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index fae46d2d5..ffd9e89f0 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -172,6 +172,10 @@ +
+
+ +
diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index 21e3523f7..af51c513b 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -57,6 +57,12 @@ define([ me.btnFormula.on('click', function(){ me.fireEvent('function:apply', [{name: 'more', origin: 'more'}]); }); + me.btnCalculate.on('click', function () { + me.fireEvent('function:calculate', [{name: 'calculate', type: Asc.c_oAscCalculateType.All}]); + }); + me.btnCalculate.menu.on('item:click', function (menu, item, e) { + me.fireEvent('function:calculate', [{name: item.caption, type: item.value}]); + }); } return { options: {}, @@ -214,6 +220,18 @@ define([ Common.Utils.injectComponent($host.find('#slot-btn-more'), this.btnMore); this.lockedControls.push(this.btnMore); + this.btnCalculate = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-cell-group', + caption: this.txtCalculate, + split: true, + menu: true, + disabled: true, + lock: [_set.editCell, _set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth] + }); + Common.Utils.injectComponent($host.find('#slot-btn-calculate'), this.btnCalculate); + this.lockedControls.push(this.btnCalculate); + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, @@ -226,6 +244,17 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function(){ + me.btnCalculate.updateHint([me.tipCalculateTheEntireWorkbook, me.tipCalculate]); + var _menu = new Common.UI.Menu({ + items: [ + {caption: me.textEntireWorkbook, value: Asc.c_oAscCalculateType.All}, + {caption: me.textCurrentSheet, value: Asc.c_oAscCalculateType.ActiveSheet}, + {caption: '--'}, + {caption: me.textAutomatic, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: true}, + {caption: me.textManual, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: false} + ] + }); + me.btnCalculate.setMenu(_menu); setEvents.call(me); }); }, @@ -480,7 +509,14 @@ define([ txtAdditional: 'Additional', txtFormula: 'Function', txtFormulaTip: 'Insert function', - txtMore: 'More functions' + txtMore: 'More functions', + txtCalculate: 'Calculate', + tipCalculate: 'Calculate', + textEntireWorkbook: 'Entire Workbook', + textCurrentSheet: 'Current Sheet', + textAutomatic: 'Automatic', + textManual: 'Manual', + tipCalculateTheEntireWorkbook: 'Calculate the entire workbook' } }()), SSE.Views.FormulaTab || {})); }); From 3d7849468568472b83829b2848792bc68cf332f8 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 27 Aug 2019 16:04:21 +0300 Subject: [PATCH 2/6] [SSE] Fix Calculate, Add translations --- apps/spreadsheeteditor/main/app/view/FormulaTab.js | 6 +++--- apps/spreadsheeteditor/main/locale/en.json | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index af51c513b..a05c58a44 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -58,10 +58,10 @@ define([ me.fireEvent('function:apply', [{name: 'more', origin: 'more'}]); }); me.btnCalculate.on('click', function () { - me.fireEvent('function:calculate', [{name: 'calculate', type: Asc.c_oAscCalculateType.All}]); + me.fireEvent('function:calculate', [{type: Asc.c_oAscCalculateType.All}]); }); me.btnCalculate.menu.on('item:click', function (menu, item, e) { - me.fireEvent('function:calculate', [{name: item.caption, type: item.value}]); + me.fireEvent('function:calculate', [{type: item.value}]); }); } return { @@ -227,7 +227,7 @@ define([ split: true, menu: true, disabled: true, - lock: [_set.editCell, _set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth] + lock: [_set.editCell, _set.selRangeEdit, _set.lostConnect, _set.coAuth] }); Common.Utils.injectComponent($host.find('#slot-btn-calculate'), this.btnCalculate); this.lockedControls.push(this.btnCalculate); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index b644c07c0..454ac6d14 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1633,6 +1633,13 @@ "SSE.Views.FormulaTab.txtFormulaTip": "Insert function", "SSE.Views.FormulaTab.txtMore": "More functions", "SSE.Views.FormulaTab.txtRecent": "Recently used", + "SSE.Views.txtCalculate": "Calculate", + "SSE.Views.tipCalculate": "Calculate", + "SSE.Views.textEntireWorkbook": "Entire Workbook", + "SSE.Views.textCurrentSheet": "Current Sheet", + "SSE.Views.textAutomatic": "Automatic", + "SSE.Views.textManual": "Manual", + "SSE.Views.tipCalculateTheEntireWorkbook": "Calculate the entire workbook", "SSE.Views.GroupDialog.cancelButtonText": "Cancel", "SSE.Views.GroupDialog.okButtonText": "OK", "SSE.Views.GroupDialog.textColumns": "Columns", From 6ddd317400766da6bc3ad9a54d10f9bb96c58a79 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 27 Aug 2019 16:07:25 +0300 Subject: [PATCH 3/6] [SSE] Fix translations --- apps/spreadsheeteditor/main/locale/en.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 454ac6d14..701afdd43 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1633,13 +1633,13 @@ "SSE.Views.FormulaTab.txtFormulaTip": "Insert function", "SSE.Views.FormulaTab.txtMore": "More functions", "SSE.Views.FormulaTab.txtRecent": "Recently used", - "SSE.Views.txtCalculate": "Calculate", - "SSE.Views.tipCalculate": "Calculate", - "SSE.Views.textEntireWorkbook": "Entire Workbook", - "SSE.Views.textCurrentSheet": "Current Sheet", - "SSE.Views.textAutomatic": "Automatic", - "SSE.Views.textManual": "Manual", - "SSE.Views.tipCalculateTheEntireWorkbook": "Calculate the entire workbook", + "SSE.Views.FormulaTab.txtCalculate": "Calculate", + "SSE.Views.FormulaTab.tipCalculate": "Calculate", + "SSE.Views.FormulaTab.textEntireWorkbook": "Entire Workbook", + "SSE.Views.FormulaTab.textCurrentSheet": "Current Sheet", + "SSE.Views.FormulaTab.textAutomatic": "Automatic", + "SSE.Views.FormulaTab.textManual": "Manual", + "SSE.Views.FormulaTab.tipCalculateTheEntireWorkbook": "Calculate the entire workbook", "SSE.Views.GroupDialog.cancelButtonText": "Cancel", "SSE.Views.GroupDialog.okButtonText": "OK", "SSE.Views.GroupDialog.textColumns": "Columns", From aa0d30c679e98dd35af11d143904bacaac5eb65a Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 27 Aug 2019 16:23:06 +0300 Subject: [PATCH 4/6] [SSE] Hide Automatic and Manual into Calculate --- apps/spreadsheeteditor/main/app/view/FormulaTab.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index a05c58a44..9e76b7cee 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -249,9 +249,9 @@ define([ items: [ {caption: me.textEntireWorkbook, value: Asc.c_oAscCalculateType.All}, {caption: me.textCurrentSheet, value: Asc.c_oAscCalculateType.ActiveSheet}, - {caption: '--'}, - {caption: me.textAutomatic, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: true}, - {caption: me.textManual, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: false} + //{caption: '--'}, + //{caption: me.textAutomatic, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: true}, + //{caption: me.textManual, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: false} ] }); me.btnCalculate.setMenu(_menu); From b72481b79ae68daf9a382846e5bcac6c7210cf91 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 27 Aug 2019 16:57:12 +0300 Subject: [PATCH 5/6] [SSE] update hint of Calculate button --- apps/spreadsheeteditor/main/app/view/FormulaTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index 9e76b7cee..efa80f017 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -244,7 +244,7 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function(){ - me.btnCalculate.updateHint([me.tipCalculateTheEntireWorkbook, me.tipCalculate]); + me.btnCalculate.updateHint([me.tipCalculateTheEntireWorkbook + Common.Utils.String.platformKey('F9'), me.tipCalculate]); var _menu = new Common.UI.Menu({ items: [ {caption: me.textEntireWorkbook, value: Asc.c_oAscCalculateType.All}, From 6c55703a93618b54b6d4ac84ccd6b7040512b13e Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Tue, 27 Aug 2019 17:45:50 +0300 Subject: [PATCH 6/6] [SSE] Rename Calculation --- .../main/app/view/FormulaTab.js | 16 ++++++++-------- apps/spreadsheeteditor/main/locale/en.json | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index efa80f017..7b89d3870 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -223,7 +223,7 @@ define([ this.btnCalculate = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'btn-cell-group', - caption: this.txtCalculate, + caption: this.txtCalculation, split: true, menu: true, disabled: true, @@ -247,11 +247,11 @@ define([ me.btnCalculate.updateHint([me.tipCalculateTheEntireWorkbook + Common.Utils.String.platformKey('F9'), me.tipCalculate]); var _menu = new Common.UI.Menu({ items: [ - {caption: me.textEntireWorkbook, value: Asc.c_oAscCalculateType.All}, - {caption: me.textCurrentSheet, value: Asc.c_oAscCalculateType.ActiveSheet}, + {caption: me.textCalculateWorkbook, value: Asc.c_oAscCalculateType.All}, + {caption: me.textCalculateCurrentSheet, value: Asc.c_oAscCalculateType.ActiveSheet}, //{caption: '--'}, - //{caption: me.textAutomatic, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: true}, - //{caption: me.textManual, value: '', toggleGroup: 'menuCoauthMode', checkable: true, checked: false} + //{caption: me.textAutomatic, value: '', toggleGroup: 'menuCalcMode', checkable: true, checked: true}, + //{caption: me.textManual, value: '', toggleGroup: 'menuCalcMode', checkable: true, checked: false} ] }); me.btnCalculate.setMenu(_menu); @@ -510,10 +510,10 @@ define([ txtFormula: 'Function', txtFormulaTip: 'Insert function', txtMore: 'More functions', - txtCalculate: 'Calculate', + txtCalculation: 'Calculation', tipCalculate: 'Calculate', - textEntireWorkbook: 'Entire Workbook', - textCurrentSheet: 'Current Sheet', + textCalculateWorkbook: 'Calculate workbook', + textCalculateCurrentSheet: 'Calculate current sheet', textAutomatic: 'Automatic', textManual: 'Manual', tipCalculateTheEntireWorkbook: 'Calculate the entire workbook' diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 701afdd43..894f3aa36 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1633,10 +1633,10 @@ "SSE.Views.FormulaTab.txtFormulaTip": "Insert function", "SSE.Views.FormulaTab.txtMore": "More functions", "SSE.Views.FormulaTab.txtRecent": "Recently used", - "SSE.Views.FormulaTab.txtCalculate": "Calculate", + "SSE.Views.FormulaTab.txtCalculation": "Calculation", "SSE.Views.FormulaTab.tipCalculate": "Calculate", - "SSE.Views.FormulaTab.textEntireWorkbook": "Entire Workbook", - "SSE.Views.FormulaTab.textCurrentSheet": "Current Sheet", + "SSE.Views.FormulaTab.textCalculateWorkbook": "Calculate workbook", + "SSE.Views.FormulaTab.textCalculateCurrentSheet": "Calculate current sheet", "SSE.Views.FormulaTab.textAutomatic": "Automatic", "SSE.Views.FormulaTab.textManual": "Manual", "SSE.Views.FormulaTab.tipCalculateTheEntireWorkbook": "Calculate the entire workbook",