From a43e7a0c8519fe2b91d90cccbcbf6caf4fe49031 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 25 Jul 2019 10:14:45 +0300 Subject: [PATCH] Change usage of advanced options on load/save csv, txt, rtf --- apps/common/main/lib/view/OpenDialog.js | 6 +++--- .../main/app/controller/LeftMenu.js | 4 ++-- apps/documenteditor/main/app/controller/Main.js | 15 +++++++-------- apps/documenteditor/mobile/app/controller/Main.js | 11 +++++------ .../main/app/controller/Main.js | 5 ++--- .../mobile/app/controller/Main.js | 5 ++--- .../main/app/controller/DataTab.js | 4 ++-- .../main/app/controller/DocumentHolder.js | 2 +- .../main/app/controller/LeftMenu.js | 4 ++-- .../spreadsheeteditor/main/app/controller/Main.js | 15 +++++++-------- .../mobile/app/controller/Main.js | 11 +++++------ 11 files changed, 38 insertions(+), 44 deletions(-) diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index 4e54e1690..aa7a80a92 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -339,14 +339,14 @@ define([ switch (this.type) { case Common.Utils.importTextType.CSV: - this.api.asc_decodeBuffer(this.preview, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this)); + this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this)); break; case Common.Utils.importTextType.TXT: - this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(encoding), _.bind(this.previewCallback, this)); + this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTextOptions(encoding), _.bind(this.previewCallback, this)); break; case Common.Utils.importTextType.Paste: case Common.Utils.importTextType.Columns: - this.api.asc_TextImport(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste); + this.api.asc_TextImport(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste); break; } }, diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 49ccd2a7d..4479c224d 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -302,7 +302,7 @@ define([ buttons: ['ok', 'cancel'], callback: _.bind(function(btn){ if (btn == 'ok') { - Common.NotificationCenter.trigger('download:advanced', this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); + Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.TXT, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) @@ -348,7 +348,7 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - Common.NotificationCenter.trigger('download:advanced', this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true)); + Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.TXT, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, this) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 5fd1a37ff..ebcb64a20 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1949,29 +1949,28 @@ define([ this.getApplication().getController('Toolbar').getView().updateMetricUnit(); }, - onAdvancedOptions: function(advOptions, mode, formatOptions) { + onAdvancedOptions: function(type, advOptions, mode, formatOptions) { if (this._state.openDlg) return; - var type = advOptions.asc_getOptionId(), - me = this; + var me = this; if (type == Asc.c_oAscAdvancedOptionsID.TXT) { me._state.openDlg = new Common.Views.OpenDialog({ title: Common.Views.OpenDialog.prototype.txtTitle.replace('%1', 'TXT'), closable: (mode==2), // if save settings type: Common.Utils.importTextType.TXT, - preview: advOptions.asc_getOptions().asc_getData(), - codepages: advOptions.asc_getOptions().asc_getCodePages(), - settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), + preview: advOptions.asc_getData(), + codepages: advOptions.asc_getCodePages(), + settings: advOptions.asc_getRecommendedSettings(), api: me.api, handler: function (result, encoding) { me.isShowOpenDialog = false; if (result == 'ok') { if (me && me.api) { if (mode==2) { - formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTXTAdvancedOptions(encoding)); + formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding)); me.api.asc_DownloadAs(formatOptions); } else - me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding)); me.loadMask && me.loadMask.show(); } } diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index f657b5f9c..780d7b80a 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -1113,17 +1113,16 @@ define([ Common.Utils.ThemeColor.setColors(colors, standart_colors); }, - onAdvancedOptions: function(advOptions) { + onAdvancedOptions: function(type, advOptions) { if (this._state.openDlg) return; - var type = advOptions.asc_getOptionId(), - me = this; + var me = this; if (type == Asc.c_oAscAdvancedOptionsID.TXT) { var picker, pages = [], pagesName = []; - _.each(advOptions.asc_getOptions().asc_getCodePages(), function(page) { + _.each(advOptions.asc_getCodePages(), function(page) { pages.push(page.asc_getCodePage()); pagesName.push(page.asc_getCodePageName()); }); @@ -1150,7 +1149,7 @@ define([ var encoding = picker.value; if (me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding)); if (!me._isDocReady) { me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); @@ -1166,7 +1165,7 @@ define([ container: '#txt-encoding', toolbar: false, rotateEffect: true, - value: [advOptions.asc_getOptions().asc_getRecommendedSettings().asc_getCodePage()], + value: [advOptions.asc_getRecommendedSettings().asc_getCodePage()], cols: [{ values: pages, displayValues: pagesName diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 888098165..926f0962d 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1791,11 +1791,10 @@ define([ if (url) this.iframePrint.src = url; }, - onAdvancedOptions: function(advOptions) { + onAdvancedOptions: function(type, advOptions) { if (this._state.openDlg) return; - var type = advOptions.asc_getOptionId(), - me = this; + var me = this; if (type == Asc.c_oAscAdvancedOptionsID.DRM) { me._state.openDlg = new Common.Views.OpenDialog({ title: Common.Views.OpenDialog.prototype.txtTitleProtected, diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 2b36d8157..36185cf0f 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -1089,11 +1089,10 @@ define([ this.isThumbnailsShow = isShow; }, - onAdvancedOptions: function(advOptions) { + onAdvancedOptions: function(type, advOptions) { if (this._state.openDlg) return; - var type = advOptions.asc_getOptionId(), - me = this; + var me = this; if (type == Asc.c_oAscAdvancedOptionsID.DRM) { $(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask); diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js index cf8a5635c..3f967f4ad 100644 --- a/apps/spreadsheeteditor/main/app/controller/DataTab.js +++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js @@ -68,7 +68,7 @@ define([ }); this._state = { - CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '') + CSVOptions: new Asc.asc_CTextOptions(0, 4, '') }; }, onLaunch: function () { @@ -177,7 +177,7 @@ define([ handler: function (result, encoding, delimiter, delimiterChar) { if (result == 'ok') { if (me && me.api) { - me.api.asc_TextToColumns(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + me.api.asc_TextToColumns(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar)); } } } diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 1ea24df64..2da2da7c1 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -2204,7 +2204,7 @@ define([ if (me && me.api) { var props = new Asc.SpecialPasteProps(); props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport); - props.asc_setAdvancedOptions(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + props.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar)); me.api.asc_SpecialPaste(props); } me._state.lastSpecPasteChecked = item; diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 14358ea3c..6c6bd98de 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -264,7 +264,7 @@ define([ buttons: ['ok', 'cancel'], callback: _.bind(function(btn){ if (btn == 'ok') { - Common.NotificationCenter.trigger('download:advanced', this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); + Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) @@ -287,7 +287,7 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - Common.NotificationCenter.trigger('download:advanced', this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true)); + Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, this) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 48d4f1e77..7d96550c7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1603,29 +1603,28 @@ define([ return false; }, - onAdvancedOptions: function(advOptions, mode, formatOptions) { + onAdvancedOptions: function(type, advOptions, mode, formatOptions) { if (this._state.openDlg) return; - var type = advOptions.asc_getOptionId(), - me = this; + var me = this; if (type == Asc.c_oAscAdvancedOptionsID.CSV) { me._state.openDlg = new Common.Views.OpenDialog({ title: Common.Views.OpenDialog.prototype.txtTitle.replace('%1', 'CSV'), closable: (mode==2), // if save settings type: Common.Utils.importTextType.CSV, - preview: advOptions.asc_getOptions().asc_getData(), - codepages: advOptions.asc_getOptions().asc_getCodePages(), - settings: advOptions.asc_getOptions().asc_getRecommendedSettings(), + preview: advOptions.asc_getData(), + codepages: advOptions.asc_getCodePages(), + settings: advOptions.asc_getRecommendedSettings(), api: me.api, handler: function (result, encoding, delimiter, delimiterChar) { me.isShowOpenDialog = false; if (result == 'ok') { if (me && me.api) { if (mode==2) { - formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar)); me.api.asc_DownloadAs(formatOptions); } else - me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar)); me.loadMask && me.loadMask.show(); } } diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 02df0244b..6532dee44 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -1213,17 +1213,16 @@ define([ Common.Utils.ThemeColor.setColors(colors, standart_colors); }, - onAdvancedOptions: function(advOptions) { + onAdvancedOptions: function(type, advOptions) { if (this._state.openDlg) return; - var type = advOptions.asc_getOptionId(), - me = this; + var me = this; if (type == Asc.c_oAscAdvancedOptionsID.CSV) { var picker, pages = [], pagesName = []; - _.each(advOptions.asc_getOptions().asc_getCodePages(), function(page) { + _.each(advOptions.asc_getCodePages(), function(page) { pages.push(page.asc_getCodePage()); pagesName.push(page.asc_getCodePageName()); }); @@ -1252,7 +1251,7 @@ define([ delimiter = picker.cols[1].value; if (me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter)); + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter)); if (!me._isDocReady) { me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); @@ -1264,7 +1263,7 @@ define([ ] }); - var recommendedSettings = advOptions.asc_getOptions().asc_getRecommendedSettings(); + var recommendedSettings = advOptions.asc_getRecommendedSettings(); picker = uiApp.picker({ container: '#txt-encoding',