diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index e30618447..49ccd2a7d 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') { - this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); + Common.NotificationCenter.trigger('download:advanced', this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) @@ -326,7 +326,7 @@ define([ }); } else { var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX); - // opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible")); + opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible")); this.api.asc_DownloadAs(opts); } } else { @@ -348,7 +348,7 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); + Common.NotificationCenter.trigger('download:advanced', this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, this) @@ -374,7 +374,7 @@ define([ } else { this.isFromFileDownloadAs = ext; var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true); - // opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible")); + opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible")); this.api.asc_DownloadAs(opts); } } else { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 3a2efd1c6..5fd1a37ff 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -195,6 +195,7 @@ define([ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('goback', _.bind(this.goBack, this)); + Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this)); this.isShowOpenDialog = false; @@ -1948,7 +1949,7 @@ define([ this.getApplication().getController('Toolbar').getView().updateMetricUnit(); }, - onAdvancedOptions: function(advOptions, mode) { + onAdvancedOptions: function(advOptions, mode, formatOptions) { if (this._state.openDlg) return; var type = advOptions.asc_getOptionId(), @@ -1966,7 +1967,11 @@ define([ me.isShowOpenDialog = false; if (result == 'ok') { if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); + if (mode==2) { + formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTXTAdvancedOptions(encoding)); + me.api.asc_DownloadAs(formatOptions); + } else + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); me.loadMask && me.loadMask.show(); } } diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 558d43d5d..14358ea3c 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') { - this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); + Common.NotificationCenter.trigger('download:advanced', 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; - this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); + Common.NotificationCenter.trigger('download:advanced', 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 86a6720c7..48d4f1e77 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -168,6 +168,7 @@ define([ Common.NotificationCenter.on('goback', _.bind(this.goBack, this)); Common.NotificationCenter.on('namedrange:locked', _.bind(this.onNamedRangeLocked, this)); Common.NotificationCenter.on('download:cancel', _.bind(this.onDownloadCancel, this)); + Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this)); this.stackLongActions = new Common.IrregularStack({ strongCompare : this._compareActionStrong, @@ -1602,7 +1603,7 @@ define([ return false; }, - onAdvancedOptions: function(advOptions, mode) { + onAdvancedOptions: function(advOptions, mode, formatOptions) { if (this._state.openDlg) return; var type = advOptions.asc_getOptionId(), @@ -1620,7 +1621,11 @@ define([ me.isShowOpenDialog = false; if (result == 'ok') { if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + if (mode==2) { + formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + me.api.asc_DownloadAs(formatOptions); + } else + me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); me.loadMask && me.loadMask.show(); } }