From 4abaffcf88cd4b2018bc0897071c9c6fc16bbb78 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Jul 2019 11:36:13 +0300 Subject: [PATCH 1/6] Change usage of asc_DownloadAs --- apps/common/embed/lib/util/utils.js | 2 +- apps/common/main/lib/controller/History.js | 2 +- apps/documenteditor/embed/js/ApplicationController.js | 2 +- apps/documenteditor/main/app/controller/LeftMenu.js | 8 ++++---- apps/documenteditor/main/app/controller/Main.js | 4 ++-- apps/documenteditor/main/app/controller/Toolbar.js | 2 +- apps/documenteditor/mobile/app/controller/Main.js | 2 +- apps/documenteditor/mobile/app/controller/Settings.js | 4 ++-- apps/presentationeditor/embed/js/ApplicationController.js | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 4 ++-- apps/presentationeditor/main/app/controller/Main.js | 4 ++-- apps/presentationeditor/main/app/controller/Toolbar.js | 2 +- apps/presentationeditor/mobile/app/controller/Main.js | 2 +- apps/presentationeditor/mobile/app/controller/Settings.js | 2 +- apps/spreadsheeteditor/embed/js/ApplicationController.js | 2 +- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 8 ++++---- apps/spreadsheeteditor/main/app/controller/Main.js | 6 ++++-- apps/spreadsheeteditor/main/app/controller/Print.js | 7 +++++-- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- apps/spreadsheeteditor/mobile/app/controller/Main.js | 2 +- apps/spreadsheeteditor/mobile/app/controller/Settings.js | 4 ++-- 21 files changed, 39 insertions(+), 34 deletions(-) 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/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 87d6b1e47..7a551c55d 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -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..3395df3da 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -302,13 +302,13 @@ define([ buttons: ['ok', 'cancel'], callback: _.bind(function(btn){ if (btn == 'ok') { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } }, this) }); } else { - this.api.asc_DownloadAs(format); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); } } else @@ -326,14 +326,14 @@ define([ callback: _.bind(function(btn){ if (btn == 'ok') { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } }, this) }); } else { this.isFromFileDownloadAs = ext; - this.api.asc_DownloadAs(format, true); + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true)); menu.hide(); } } else { diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a88d2fce4..156643c26 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -463,7 +463,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)); } }, @@ -2096,7 +2096,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..f32b7224a 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(); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 10ea23815..f657b5f9c 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)); } }, 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..5229c9ae4 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -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..943cfb61a 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -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..c88587ea9 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) { @@ -1784,7 +1784,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/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index e236209f8..c1712c590 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(); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index a3e746c08..2b36d8157 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) { 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..4586f1580 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -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/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 596a68398..558d43d5d 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); + this.api.asc_DownloadAs(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); + this.api.asc_DownloadAs(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..86a6720c7 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -434,7 +434,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) { @@ -2021,7 +2021,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_setAdjustPrint(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..d2899e595 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -268,8 +268,11 @@ define([ 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); + else { + var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl); + opts.asc_setAdjustPrint(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 1c1aedbe2..d9e4ba653 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..02df0244b 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) { 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(); From b0d6c172b9f4e967a771ff441bdcacf9498a5913 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Jul 2019 12:27:14 +0300 Subject: [PATCH 2/6] [DE] Set option for saving docx in mode compatible with old versions --- .../main/app/controller/LeftMenu.js | 50 ++++++++++++++++++- .../main/app/controller/Main.js | 7 ++- .../main/app/view/FileMenuPanels.js | 16 +++++- apps/documenteditor/main/locale/en.json | 3 ++ 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 3395df3da..921b52e72 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -307,6 +307,28 @@ define([ } }, 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(new Asc.asc_CDownloadOptions(format)); menu.hide(); @@ -331,6 +353,30 @@ define([ } }, 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(new Asc.asc_CDownloadOptions(format, true)); @@ -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 156643c26..ba5ab5465 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -890,6 +890,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() { @@ -2002,7 +2005,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 +2015,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); 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", From 39bfe54860f03ecd9629d573c8073f52f5f88983 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Jul 2019 16:07:16 +0300 Subject: [PATCH 3/6] Change usage of asc_Print --- apps/documenteditor/embed/js/ApplicationController.js | 4 ++-- apps/documenteditor/main/app/controller/LeftMenu.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/documenteditor/main/app/controller/Toolbar.js | 2 +- apps/presentationeditor/embed/js/ApplicationController.js | 4 ++-- apps/presentationeditor/main/app/controller/LeftMenu.js | 2 +- apps/presentationeditor/main/app/controller/Main.js | 2 +- apps/presentationeditor/main/app/controller/Toolbar.js | 2 +- apps/spreadsheeteditor/embed/js/ApplicationController.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Print.js | 8 +++++--- 10 files changed, 17 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 7a551c55d..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'); diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 921b52e72..e30618447 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); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ba5ab5465..3a2efd1c6 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -2073,7 +2073,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'); }, diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index f32b7224a..38d4f5857 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -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/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 5229c9ae4..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'); diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 943cfb61a..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); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index c88587ea9..888098165 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -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'); }, diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index c1712c590..4d32a2ae5 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -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/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 4586f1580..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'); diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index d2899e595..4ffddea96 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -266,9 +266,11 @@ 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 { + if ( this.printSettingsDlg.type=='print' ) { + var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); + opts.asc_setAdjustPrint(this.adjPrintParams); + this.api.asc_Print(opts); + } else { var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl); opts.asc_setAdjustPrint(this.adjPrintParams); this.api.asc_DownloadAs(opts); From c0862be9b9a764d88f676845284d160708d3e4af Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Jul 2019 17:33:29 +0300 Subject: [PATCH 4/6] [DE][SSE] Change downloading as TXT/ RTF and CSV --- apps/documenteditor/main/app/controller/LeftMenu.js | 8 ++++---- apps/documenteditor/main/app/controller/Main.js | 9 +++++++-- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 4 ++-- apps/spreadsheeteditor/main/app/controller/Main.js | 9 +++++++-- 4 files changed, 20 insertions(+), 10 deletions(-) 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(); } } From a43e7a0c8519fe2b91d90cccbcbf6caf4fe49031 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 25 Jul 2019 10:14:45 +0300 Subject: [PATCH 5/6] 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', From cb552da2777471b61d1ede0ae9dcd145fbb2b168 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 25 Jul 2019 13:17:33 +0300 Subject: [PATCH 6/6] [SSE] Set pdf options --- apps/spreadsheeteditor/main/app/controller/Main.js | 2 +- apps/spreadsheeteditor/main/app/controller/Print.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 7d96550c7..24bb00796 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -2026,7 +2026,7 @@ define([ window.focus(); } catch (e) { var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF); - opts.asc_setAdjustPrint(me.getApplication().getController('Print').getPrintParams()); + 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 4ffddea96..df38ffdea 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -268,11 +268,11 @@ define([ if ( this.printSettingsDlg.type=='print' ) { var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); - opts.asc_setAdjustPrint(this.adjPrintParams); + opts.asc_setAdvancedOptions(this.adjPrintParams); this.api.asc_Print(opts); } else { var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl); - opts.asc_setAdjustPrint(this.adjPrintParams); + opts.asc_setAdvancedOptions(this.adjPrintParams); this.api.asc_DownloadAs(opts); } Common.component.Analytics.trackEvent((this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs');