diff --git a/apps/common/embed/lib/util/utils.js b/apps/common/embed/lib/util/utils.js index 96b16c173..0ad2ed91e 100644 --- a/apps/common/embed/lib/util/utils.js +++ b/apps/common/embed/lib/util/utils.js @@ -65,7 +65,7 @@ iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - api.asc_DownloadAs(Asc.c_oAscFileType.PDF); + api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); } }; diff --git a/apps/common/main/lib/controller/History.js b/apps/common/main/lib/controller/History.js index 8e8978193..056183ee3 100644 --- a/apps/common/main/lib/controller/History.js +++ b/apps/common/main/lib/controller/History.js @@ -113,7 +113,7 @@ define([ Common.Gateway.requestRestore(record.get('revision')); else { this.isFromSelectRevision = record.get('revision'); - this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } return; } 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/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 87d6b1e47..07d2debb1 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -204,7 +204,7 @@ DE.ApplicationController = new(function(){ function onPrint() { if ( permissions.print!==false ) - api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera); + api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera)); } function onPrintUrl(url) { @@ -259,7 +259,7 @@ DE.ApplicationController = new(function(){ common.utils.openLink(embedConfig.saveUrl); } else if (api && permissions.print!==false){ - api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera); + api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera)); } Common.Analytics.trackEvent('Save'); @@ -458,7 +458,7 @@ DE.ApplicationController = new(function(){ Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); return; } - if (api) api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true); + if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } // Helpers diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index fb82b1432..4479c224d 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -237,7 +237,7 @@ define([ if ( isopts ) close_menu = false; else this.clickSaveCopyAsFormat(undefined); break; - case 'print': this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); break; + case 'print': this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); break; case 'exit': Common.NotificationCenter.trigger('goback'); break; case 'edit': this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText); @@ -302,13 +302,35 @@ define([ buttons: ['ok', 'cancel'], callback: _.bind(function(btn){ if (btn == 'ok') { - this.api.asc_DownloadAs(format); + Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.TXT, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) }); + } else if (format == Asc.c_oAscFileType.DOCX) { + if (!Common.Utils.InternalSettings.get("de-settings-compatible") && !Common.localStorage.getBool("de-hide-save-compatible") /* && this.api.checkCompatibility()*/) { + Common.UI.warning({ + closable: false, + width: 600, + title: this.notcriticalErrorTitle, + msg: this.txtCompatible, + buttons: ['ok', 'cancel'], + dontshow: true, + callback: _.bind(function(btn, dontshow){ + if (dontshow) Common.localStorage.setItem("de-hide-save-compatible", 1); + if (btn == 'ok') { + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); + menu.hide(); + } + }, this) + }); + } else { + var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX); + opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible")); + this.api.asc_DownloadAs(opts); + } } else { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } } else @@ -326,14 +348,38 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(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) }); + } else if (format == Asc.c_oAscFileType.DOCX) { + if (!Common.Utils.InternalSettings.get("de-settings-compatible") && !Common.localStorage.getBool("de-hide-save-compatible") /* && this.api.checkCompatibility()*/) { + Common.UI.warning({ + closable: false, + width: 600, + title: this.notcriticalErrorTitle, + msg: this.txtCompatible, + buttons: ['ok', 'cancel'], + dontshow: true, + callback: _.bind(function(btn, dontshow){ + if (dontshow) Common.localStorage.setItem("de-hide-save-compatible", 1); + if (btn == 'ok') { + this.isFromFileDownloadAs = ext; + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); + menu.hide(); + } + }, this) + }); + } 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")); + this.api.asc_DownloadAs(opts); + } } else { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } } else { @@ -822,6 +868,8 @@ define([ leavePageText: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.', warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.
Are you sure you want to continue?', warnDownloadAsRTF : 'If you continue saving in this format some of the formatting might be lost.
Are you sure you want to continue?', - txtUntitled: 'Untitled' + txtUntitled: 'Untitled', + txtCompatible: 'The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.
Use the \'Compatibility\' option of the advanced settings if you want to make the files compatible with older MS Word versions.' + }, DE.Controllers.LeftMenu || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a88d2fce4..ebcb64a20 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; @@ -463,7 +464,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.DOCX; - this.api.asc_DownloadAs(_format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)); } }, @@ -890,6 +891,9 @@ define([ Common.Utils.InternalSettings.set("de-settings-spellcheck", value); me.api.asc_setSpellCheck(value); + value = Common.localStorage.getBool("de-settings-compatible", false); + Common.Utils.InternalSettings.set("de-settings-compatible", value); + Common.Utils.InternalSettings.set("de-settings-showsnaplines", me.api.get_ShowSnapLines()); function checkWarns() { @@ -1945,25 +1949,28 @@ define([ this.getApplication().getController('Toolbar').getView().updateMetricUnit(); }, - onAdvancedOptions: function(advOptions, mode) { + 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) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); + if (mode==2) { + formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding)); + me.api.asc_DownloadAs(formatOptions); + } else + me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding)); me.loadMask && me.loadMask.show(); } } @@ -2002,7 +2009,7 @@ define([ }, onTryUndoInFastCollaborative: function() { - if (!window.localStorage.getBool("de-hide-try-undoredo")) + if (!Common.localStorage.getBool("de-hide-try-undoredo")) Common.UI.info({ width: 500, msg: this.textTryUndoRedo, @@ -2012,7 +2019,7 @@ define([ customButtonText: this.textStrict, dontshow: true, callback: _.bind(function(btn, dontshow){ - if (dontshow) window.localStorage.setItem("de-hide-try-undoredo", 1); + if (dontshow) Common.localStorage.setItem("de-hide-try-undoredo", 1); if (btn == 'custom') { Common.localStorage.setItem("de-settings-coauthmode", 0); Common.Utils.InternalSettings.set("de-settings-coauthmode", false); @@ -2070,7 +2077,7 @@ define([ if (!this.appOptions.canPrint || this.isModalShowed) return; if (this.api) - this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event + this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event Common.component.Analytics.trackEvent('Print'); }, @@ -2096,7 +2103,7 @@ define([ me.iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); } }; } diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index dc5c863f6..38d4f5857 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -152,7 +152,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.PDF; - _main.api.asc_DownloadAs(_format); + _main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format)); }, 'go:editor': function() { Common.Gateway.requestEditRights(); @@ -966,7 +966,7 @@ define([ onPrint: function(e) { if (this.api) - this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event + this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event Common.NotificationCenter.trigger('edit:complete', this.toolbar); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index a32be4c16..fbb208dd0 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -198,6 +198,10 @@ define([ '', '', '','', + '', + '', + '', + '','', '', '', '', @@ -270,6 +274,11 @@ define([ labelText: this.strSpellCheckMode }); + this.chCompatible = new Common.UI.CheckBox({ + el: $('#fms-chb-compatible'), + labelText: this.textOldVersions + }); + this.chAutosave = new Common.UI.CheckBox({ el: $('#fms-chb-autosave'), labelText: this.strAutosave @@ -448,6 +457,7 @@ define([ this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck")); this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines")); + this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible")); }, applySettings: function() { @@ -469,6 +479,8 @@ define([ if (this.mode.canForcesave) Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); + Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); + Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0); Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked()); Common.localStorage.save(); @@ -531,7 +543,9 @@ define([ txtFitWidth: 'Fit to Width', textForceSave: 'Save to Server', strForcesave: 'Always save to server (otherwise save to server on document close)', - strResolvedComment: 'Turn on display of the resolved comments' + strResolvedComment: 'Turn on display of the resolved comments', + textCompatible: 'Compatibility', + textOldVersions: 'Make the files compatible with older MS Word versions' }, DE.Views.FileMenuPanels.Settings || {})); DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 830450879..0f9300050 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -330,6 +330,7 @@ "DE.Controllers.LeftMenu.txtUntitled": "Untitled", "DE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.
Are you sure you want to continue?", "DE.Controllers.LeftMenu.warnDownloadAsRTF": "If you continue saving in this format some of the formatting might be lost.
Are you sure you want to continue?", + "DE.Controllers.LeftMenu.txtCompatible": "The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.
Use the 'Compatibility' option of the advanced settings if you want to make the files compatible with older MS Word versions.", "DE.Controllers.Main.applyChangesTextText": "Loading the changes...", "DE.Controllers.Main.applyChangesTitleText": "Loading the Changes", "DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.", @@ -1423,6 +1424,8 @@ "DE.Views.FileMenuPanels.Settings.txtPt": "Point", "DE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", + "DE.Views.FileMenuPanels.Settings.textCompatible": "Compatibility", + "DE.Views.FileMenuPanels.Settings.textOldVersions": "Make the files compatible with older MS Word versions", "DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center", "DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left", "DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page", diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 10ea23815..780d7b80a 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -322,7 +322,7 @@ define([ if (type && typeof type[1] === 'string') { this.api.asc_DownloadOrigin(true) } else { - this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true)); } }, @@ -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/documenteditor/mobile/app/controller/Settings.js b/apps/documenteditor/mobile/app/controller/Settings.js index ed2c91303..5b60752d7 100644 --- a/apps/documenteditor/mobile/app/controller/Settings.js +++ b/apps/documenteditor/mobile/app/controller/Settings.js @@ -567,13 +567,13 @@ define([ me.warnDownloadAs, me.notcriticalErrorTitle, function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); } ); }); } else { _.defer(function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); }); } diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 6faead079..a425b3840 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -201,7 +201,7 @@ PE.ApplicationController = new(function(){ function onPrint() { if (permissions.print!==false) - api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera); + api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera)); } function onPrintUrl(url) { @@ -267,7 +267,7 @@ PE.ApplicationController = new(function(){ common.utils.openLink(embedConfig.saveUrl); } else if (api && permissions.print!==false){ - api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera); + api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera)); } Common.Analytics.trackEvent('Save'); @@ -558,7 +558,7 @@ PE.ApplicationController = new(function(){ Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); return; } - if (api) api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true); + if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); } // Helpers // ------------------------- diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index d38358c8d..c206574d2 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -215,7 +215,7 @@ define([ case 'back': break; case 'save': this.api.asc_Save(); break; case 'save-desktop': this.api.asc_DownloadAs(); break; - case 'print': this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); break; + case 'print': this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); break; case 'exit': Common.NotificationCenter.trigger('goback'); break; case 'edit': this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText); @@ -247,13 +247,13 @@ define([ }, clickSaveAsFormat: function(menu, format) { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); }, clickSaveCopyAsFormat: function(menu, format, ext) { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3bfe5f948..926f0962d 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -419,7 +419,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.PPTX; - this.api.asc_DownloadAs(_format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)); }, onProcessMouse: function(data) { @@ -1758,7 +1758,7 @@ define([ if (!this.appOptions.canPrint || this.isModalShowed) return; if (this.api) - this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event + this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event Common.component.Analytics.trackEvent('Print'); }, @@ -1784,18 +1784,17 @@ define([ me.iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); } }; } 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/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index e236209f8..4d32a2ae5 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -161,7 +161,7 @@ define([ if ( !_format || _supported.indexOf(_format) < 0 ) _format = Asc.c_oAscFileType.PDF; - _main.api.asc_DownloadAs(_format); + _main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format)); }, 'go:editor': function() { Common.Gateway.requestEditRights(); @@ -893,7 +893,7 @@ define([ onPrint: function(e) { if (this.api) - this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event + this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event Common.NotificationCenter.trigger('edit:complete', this.toolbar); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index a3e746c08..36185cf0f 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -311,7 +311,7 @@ define([ return; } this._state.isFromGatewayDownloadAs = true; - this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); }, goBack: function(current) { @@ -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/presentationeditor/mobile/app/controller/Settings.js b/apps/presentationeditor/mobile/app/controller/Settings.js index ba56d02d7..bd2c06493 100644 --- a/apps/presentationeditor/mobile/app/controller/Settings.js +++ b/apps/presentationeditor/mobile/app/controller/Settings.js @@ -381,7 +381,7 @@ define([ if (format) { _.defer(function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); }); } diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 40235cd48..9dafa9ae0 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -156,7 +156,7 @@ SSE.ApplicationController = new(function(){ function onPrint() { if ( permissions.print!==false ) - api.asc_Print(undefined, $.browser.chrome || $.browser.safari || $.browser.opera); + api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera)); } function onPrintUrl(url) { @@ -204,7 +204,7 @@ SSE.ApplicationController = new(function(){ common.utils.openLink(embedConfig.saveUrl); } else if (permissions.print!==false){ - api.asc_Print(undefined, $.browser.chrome || $.browser.safari || $.browser.opera); + api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera)); } Common.Analytics.trackEvent('Save'); @@ -464,7 +464,7 @@ SSE.ApplicationController = new(function(){ Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); return; } - api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true); + api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true)); } function onApiMouseMove(array) { 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 596a68398..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') { - this.api.asc_DownloadAs(format); + Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) @@ -273,7 +273,7 @@ define([ menu.hide(); Common.NotificationCenter.trigger('download:settings', this.leftMenu, format); } else { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, @@ -287,7 +287,7 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(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) @@ -298,7 +298,7 @@ define([ Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, true); } else { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index c760ad729..24bb00796 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, @@ -434,7 +435,7 @@ define([ if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA) Common.NotificationCenter.trigger('download:settings', this, _format, true); else - this.api.asc_DownloadAs(_format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)); }, onProcessMouse: function(data) { @@ -1602,25 +1603,28 @@ define([ return false; }, - onAdvancedOptions: function(advOptions, mode) { + 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) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar)); + if (mode==2) { + 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_CTextOptions(encoding, delimiter, delimiterChar)); me.loadMask && me.loadMask.show(); } } @@ -2021,7 +2025,9 @@ define([ me.iframePrint.contentWindow.blur(); window.focus(); } catch (e) { - me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF, false, me.getApplication().getController('Print').getPrintParams()); + var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF); + opts.asc_setAdvancedOptions(me.getApplication().getController('Print').getPrintParams()); + me.api.asc_DownloadAs(opts); } }; } diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index aba2b4079..df38ffdea 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -266,10 +266,15 @@ define([ this.adjPrintParams.asc_setIgnorePrintArea(this.printSettingsDlg.getIgnorePrintArea()); Common.localStorage.setItem("sse-print-settings-range", printtype); - if ( this.printSettingsDlg.type=='print' ) - this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); - else - this.api.asc_DownloadAs(this.downloadFormat, this.asUrl, this.adjPrintParams); + if ( this.printSettingsDlg.type=='print' ) { + var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); + opts.asc_setAdvancedOptions(this.adjPrintParams); + this.api.asc_Print(opts); + } else { + var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl); + opts.asc_setAdvancedOptions(this.adjPrintParams); + this.api.asc_DownloadAs(opts); + } Common.component.Analytics.trackEvent((this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs'); Common.component.Analytics.trackEvent('ToolBar', (this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs'); Common.NotificationCenter.trigger('edit:complete', view); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index de919924c..29b125961 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -113,7 +113,7 @@ define([ if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA) Common.NotificationCenter.trigger('download:settings', this.toolbar, _format); else - _main.api.asc_DownloadAs(_format); + _main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format)); }, 'go:editor': function() { Common.Gateway.requestEditRights(); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 25a029017..6532dee44 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -319,7 +319,7 @@ define([ return; } this._state.isFromGatewayDownloadAs = true; - this.api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true)); }, goBack: function(current) { @@ -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', diff --git a/apps/spreadsheeteditor/mobile/app/controller/Settings.js b/apps/spreadsheeteditor/mobile/app/controller/Settings.js index 15d9200c1..def0ccc68 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Settings.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Settings.js @@ -676,11 +676,11 @@ define([ me.warnDownloadAs, me.notcriticalErrorTitle, function () { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); } ); } else { - me.api.asc_DownloadAs(format); + me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); } me.hideModal();