diff --git a/apps/spreadsheeteditor/main/app/controller/Spellcheck.js b/apps/spreadsheeteditor/main/app/controller/Spellcheck.js index 6a7a2f8ef4..0a58ef1b32 100644 --- a/apps/spreadsheeteditor/main/app/controller/Spellcheck.js +++ b/apps/spreadsheeteditor/main/app/controller/Spellcheck.js @@ -150,6 +150,7 @@ define([ if (a.shortName > b.shortName) return 1; return 0; }); + this.langs = langs; combo.setData(langs); var item = combo.store.findWhere({value: value}); if (!item && allLangs[value]) { @@ -164,8 +165,11 @@ define([ combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]); combo.setDisabled(true); } + this.langValue = value; this.api.asc_setDefaultLanguage(value); this._initSettings = false; + + return [this.langs, this.langValue]; }, onSelectLanguage: function (combo, record) { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index ea75615354..3810c812fc 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -171,6 +171,7 @@ define([ '
', '
', '
', + '
', '
', '' ].join('')), @@ -192,11 +193,15 @@ define([ this.printSettings.menu = this.menu; this.printSettings.render($markup.findById('#panel-settings-print')); + this.spellcheckSettings = new SSE.Views.FileMenuPanels.MainSpellCheckSettings({menu: this.menu}); + this.spellcheckSettings.render($markup.findById('#panel-settings-spellcheck')); + this.viewSettingsPicker = new Common.UI.DataView({ el: $markup.findById('#id-settings-menu'), store: new Common.UI.DataViewStore([ {name: this.txtGeneral, panel: this.generalSettings, iconCls:'mnu-settings-general', selected: true}, - {name: this.txtPageSettings, panel: this.printSettings, iconCls:'mnu-print'} + {name: this.txtPageSettings, panel: this.printSettings, iconCls:'mnu-print'}, + {name: this.txtSpellСhecking, panel: this.spellcheckSettings, iconCls:'btn-ic-docspell'} ]), itemTemplate: _.template([ '
', @@ -234,7 +239,8 @@ define([ }, txtGeneral: 'General', - txtPageSettings: 'Page Settings' + txtPageSettings: 'Page Settings', + txtSpellСhecking: 'Spell checking' }, SSE.Views.FileMenuPanels.Settings || {})); SSE.Views.MainSettingsPrint = Common.UI.BaseView.extend(_.extend({ @@ -948,6 +954,109 @@ define([ strR1C1: 'Turn on R1C1 style' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); + SSE.Views.FileMenuPanels.MainSpellCheckSettings = Common.UI.BaseView.extend(_.extend({ + el: '#panel-settings-spellcheck', + menu: undefined, + + template: _.template([ + '', + '', + '', + '', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '
' + ].join('')), + + initialize: function(options) { + Common.UI.BaseView.prototype.initialize.call(this,arguments); + + this.menu = options.menu; + }, + + render: function(node) { + var me = this; + var $markup = $(this.template({scope: this})); + + this.chIgnoreUppercase = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-ignore-uppercase-words'), + labelText: this.strIgnoreWordsInUPPERCASE + }).on('change', function(field, newValue, oldValue, eOpts){ + }); + + this.chIgnoreNumbers = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-ignore-numbers-words'), + labelText: this.strIgnoreWordsWithNumbers + }).on('change', function(field, newValue, oldValue, eOpts){ + }); + + this.cmbDictionaryLanguage = new Common.UI.ComboBox({ + el: $markup.findById('#fms-cmb-dictionary-language'), + cls: 'input-group-nr', + editable: false, + menuStyle: 'min-width: 100%; max-height: 209px;' + }); + + this.btnApply = new Common.UI.Button({ + el: $markup.findById('#fms-btn-apply') + }); + + this.btnApply.on('click', _.bind(this.applySettings, this)); + + this.$el = $(node).html($markup); + + if (_.isUndefined(this.scroller)) { + this.scroller = new Common.UI.Scroller({ + el: this.$el, + suppressScrollX: true + }); + } + + return this; + }, + + show: function() { + Common.UI.BaseView.prototype.show.call(this,arguments); + + this.updateSettings(); + }, + + setMode: function(mode) { + this.mode = mode; + }, + + setApi: function(api) { + this.api = api; + }, + + updateSettings: function() { + var array = SSE.getController('Spellcheck').loadLanguages(), + lang = array[0], + value = array[1]; + if (lang) { + this.cmbDictionaryLanguage.setData(lang); + this.cmbDictionaryLanguage.setValue(value); + } else { + this.cmbDictionaryLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]); + this.cmbDictionaryLanguage.setDisabled(true); + } + }, + + applySettings: function() { + + }, + + strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE', + strIgnoreWordsWithNumbers: 'Ignore words with numbers', + strDictionaryLanguage: 'Dictionary language' + + }, SSE.Views.FileMenuPanels.MainSpellCheckSettings || {})); + SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ el: '#panel-recentfiles', menu: undefined,