diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js
index 639ca18a35..9c50211f5d 100644
--- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js
+++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js
@@ -391,6 +391,17 @@ define([
'
',
' | ',
'
',
+ '',
+ ' | ',
+ '
',
+ '',
+ ' | ',
+ ' | ',
+ '
',
+ '',
+ ' | ',
+ ' | ',
+ '
',
'
',
'',
' | ',
@@ -803,6 +814,42 @@ define([
me.chQuickPrint.setValue(!me.chQuickPrint.isChecked());
});
+ this.chIterative = new Common.UI.CheckBox({
+ el: $markup.findById('#fms-chb-iterative-calc'),
+ labelText: this.strEnableIterative,
+ dataHint: '2',
+ dataHintDirection: 'left',
+ dataHintOffset: 'small'
+ });
+
+ this.inputMaxChange = new Common.UI.InputField({
+ el: $markup.findById('#fms-max-change'),
+ style: 'width: 60px;',
+ validateOnBlur: false,
+ maskExp: /[0-9,\.]/,
+ dataHint : '2',
+ dataHintDirection: 'left',
+ dataHintOffset: 'small',
+ validation: function(value) {
+ return !_.isEmpty(value) && (!/^(\d*(\.|,)?\d+)$|^(\d+(\.|,)?\d*)$/.test(value) || isNaN(Common.Utils.String.parseFloat(value))) ? me.txtErrorNumber : true;
+ }
+ });
+
+ this.spnMaxIterations = new Common.UI.MetricSpinner({
+ el: $markup.findById('#fms-max-iterations'),
+ step: 1,
+ width: 60,
+ defaultUnit : '',
+ value: 100,
+ maxValue: 32767,
+ minValue: 1,
+ allowDecimal: false,
+ maskExp: /[0-9]/,
+ dataHint : '2',
+ dataHintDirection: 'left',
+ dataHintOffset: 'small'
+ });
+
this.pnlSettings = $markup.find('.flex-settings').addBack().filter('.flex-settings');
this.pnlApply = $markup.find('.fms-flex-apply').addBack().filter('.fms-flex-apply');
this.pnlTable = this.pnlSettings.find('table');
@@ -968,6 +1015,13 @@ define([
this.chRTL.setValue(Common.localStorage.getBool("ui-rtl", Common.Locale.isCurrentLanguageRtl()));
this.chQuickPrint.setValue(Common.Utils.InternalSettings.get("sse-settings-quick-print-button"));
+ value = this.api.asc_GetCalcSettings();
+ if (value) {
+ this.chIterative.setValue(!!value.asc_getIterativeCalc());
+ this.spnMaxIterations.setValue(value.asc_getMaxIterations());
+ this.inputMaxChange.setValue(value.asc_getMaxChange());
+ }
+
var data = [];
for (var t in Common.UI.Themes.map()) {
data.push({value: t, displayValue: Common.UI.Themes.get(t).text});
@@ -1021,7 +1075,20 @@ define([
}
},
+ isValid: function() {
+ if (this.mode.isEdit) {
+ if (this.inputMaxChange.checkValidate() !== true) {
+ this.inputMaxChange.focus();
+ return;
+ }
+ }
+ return true;
+ },
+
applySettings: function() {
+ if (!this.isValid())
+ return;
+
Common.UI.Themes.setTheme(this.cmbTheme.getValue());
Common.localStorage.setItem("sse-settings-show-alt-hints", this.chUseAltKey.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("sse-settings-show-alt-hints", Common.localStorage.getBool("sse-settings-show-alt-hints"));
@@ -1105,9 +1172,18 @@ define([
}
}
- if (this.mode.isEdit)
+ if (this.mode.isEdit) {
this.api.asc_setDate1904(this.chDateSystem.isChecked());
+ value = this.api.asc_GetCalcSettings();
+ if (value) {
+ value.asc_setIterativeCalc(this.chIterative.isChecked());
+ value.asc_setMaxIterations(this.spnMaxIterations.getNumberValue());
+ this.inputMaxChange.getValue() && value.asc_setMaxChange(Common.Utils.String.parseFloat(this.inputMaxChange.getValue()));
+ this.api.asc_UpdateCalcSettings(value);
+ }
+ }
+
if (isRtlChanged) {
var config = {
title: this.txtWorkspaceSettingChange,
@@ -1281,7 +1357,11 @@ define([
txtRestartEditor: 'Please restart spreadsheet editor so that your workspace settings can take effect',
txtHy: 'Armenian',
txtLastUsed: 'Last used',
- txtScreenReader: 'Turn on screen reader support'
+ txtScreenReader: 'Turn on screen reader support',
+ strMaxIterations: 'Maximum iterations',
+ strMaxChange: 'Maximum change',
+ strEnableIterative: 'Enable iterative calculation',
+ txtErrorNumber: 'Your entry cannot be used. An integer or decimal number may be required.'
}, SSE.Views.FileMenuPanels.MainSettingsGeneral || {}));
diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json
index 7ff4b3e448..d32781e649 100644
--- a/apps/spreadsheeteditor/main/locale/en.json
+++ b/apps/spreadsheeteditor/main/locale/en.json
@@ -2676,6 +2676,10 @@
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWin": "as Windows",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWorkspace": "Workspace",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtZh": "Chinese",
+ "SSE.Views.FileMenuPanels.MainSettingsGeneral.strMaxIterations": "Maximum iterations",
+ "SSE.Views.FileMenuPanels.MainSettingsGeneral.strMaxChange": "Maximum change",
+ "SSE.Views.FileMenuPanels.MainSettingsGeneral.strEnableIterative": "Enable iterative calculation",
+ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtErrorNumber": "Your entry cannot be used. An integer or decimal number may be required.",
"SSE.Views.FileMenuPanels.ProtectDoc.notcriticalErrorTitle": "Warning",
"SSE.Views.FileMenuPanels.ProtectDoc.strEncrypt": "With password",
"SSE.Views.FileMenuPanels.ProtectDoc.strProtect": "Protect Spreadsheet",