From ab35148e464a18412e0501dc3c0b4baf62ee7f16 Mon Sep 17 00:00:00 2001 From: OVSharova Date: Wed, 14 Jun 2023 16:40:18 +0300 Subject: [PATCH 1/3] [SSE] Update PrintSettings --- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 6 +++--- apps/spreadsheeteditor/main/app/controller/Print.js | 3 ++- apps/spreadsheeteditor/main/app/view/FileMenu.js | 2 +- apps/spreadsheeteditor/main/app/view/PrintSettings.js | 7 +++++-- apps/spreadsheeteditor/main/locale/en.json | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 10561a4178..4a8e7dd785 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -266,7 +266,7 @@ define([ case 'back': break; case 'save': this.api.asc_Save(); break; case 'save-desktop': this.api.asc_DownloadAs(); break; - case 'export-pdf': this.clickSaveAsFormat(menu, Asc.c_oAscFileType.PDF); break; + case 'export-pdf': this.clickSaveAsFormat(menu, Asc.c_oAscFileType.PDF, true); break; case 'print': Common.NotificationCenter.trigger('print', this.leftMenu); break; case 'exit': Common.NotificationCenter.trigger('goback'); break; case 'edit': @@ -338,7 +338,7 @@ define([ }); }, - clickSaveAsFormat: function(menu, format) { + clickSaveAsFormat: function(menu, format, asExport) { if (format == Asc.c_oAscFileType.CSV) { var me = this; if (this.api.asc_getWorksheetsCount()>1) { @@ -362,7 +362,7 @@ define([ }); } else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) { menu.hide(); - Common.NotificationCenter.trigger('download:settings', this.leftMenu, format); + Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, undefined, asExport); } else { this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index 056963f15e..dc50906839 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -390,7 +390,7 @@ define([ !!pageCount && this.updatePreview(); }, - openPrintSettings: function(type, cmp, format, asUrl) { + openPrintSettings: function(type, cmp, format, asUrl, asExport) { if (this.printSettingsDlg && this.printSettingsDlg.isVisible()) { asUrl && Common.NotificationCenter.trigger('download:cancel'); return; @@ -402,6 +402,7 @@ define([ this.downloadFormat = format; this.printSettingsDlg = (new SSE.Views.PrintSettings({ type: type, + asexport: asExport, handler: _.bind(this.resultPrintSettings,this), afterrender: _.bind(function() { this._changedProps = []; diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index 4e08976606..748da583b1 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -631,6 +631,6 @@ define([ btnHistoryCaption : 'Versions History', btnExitCaption : 'Exit', btnFileOpenCaption : 'Open...', - btnExportToPDFCaption : 'Export to PDF' + btnExportToPDFCaption : 'Export to PDF' }, SSE.Views.FileMenu || {})); }); diff --git a/apps/spreadsheeteditor/main/app/view/PrintSettings.js b/apps/spreadsheeteditor/main/app/view/PrintSettings.js index 0b24debbe9..a79f7661a2 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PrintSettings.js @@ -56,6 +56,8 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', initialize : function(options) { this.type = options.type || 'print'; + var txtBtn = (this.type == 'print') ? this.btnPrint : + options.asexport ? this.btnExport : this.btnDownload; _.extend(this.options, { title: (this.type == 'print') ? this.textTitle : this.textTitlePDF, template: [ @@ -76,7 +78,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', '' ].join('') }, options); @@ -422,7 +424,8 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', textMarginsNormal: 'Normal', textMarginsNarrow: 'Narrow', textMarginsWide: 'Wide', - txtMarginsLast: 'Last Custom' + txtMarginsLast: 'Last Custom', + btnExport: 'Save & Export' }, SSE.Views.PrintSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index a3fca93a5d..a10159a835 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -3160,6 +3160,7 @@ "SSE.Views.PivotTable.txtTable_PivotStyleMedium": "Pivot Table Style Medium", "SSE.Views.PrintSettings.btnDownload": "Save & Download", "SSE.Views.PrintSettings.btnPrint": "Save & Print", + "SSE.Views.PrintSettings.btnExport": "Save & Export", "SSE.Views.PrintSettings.strBottom": "Bottom", "SSE.Views.PrintSettings.strLandscape": "Landscape", "SSE.Views.PrintSettings.strLeft": "Left", From 51315740c64e3f34ee6546ddfa30b50dd7d4c98d Mon Sep 17 00:00:00 2001 From: OVSharova Date: Mon, 19 Jun 2023 23:18:36 +0300 Subject: [PATCH 2/3] refactoring --- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 2 +- apps/spreadsheeteditor/main/app/controller/Print.js | 4 ++-- apps/spreadsheeteditor/main/app/view/PrintSettings.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 4a8e7dd785..fddb136462 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -362,7 +362,7 @@ define([ }); } else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) { menu.hide(); - Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, undefined, asExport); + Common.NotificationCenter.trigger(asExport ? 'export' : 'download:settings', this.leftMenu, format); } else { this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index dc50906839..a4404eeede 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -75,6 +75,7 @@ define([ }); Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this, 'print')); Common.NotificationCenter.on('download:settings', _.bind(this.openPrintSettings, this, 'download')); + Common.NotificationCenter.on('export', _.bind(this.openPrintSettings, this, 'export')); }, onLaunch: function() { @@ -390,7 +391,7 @@ define([ !!pageCount && this.updatePreview(); }, - openPrintSettings: function(type, cmp, format, asUrl, asExport) { + openPrintSettings: function(type, cmp, format, asUrl) { if (this.printSettingsDlg && this.printSettingsDlg.isVisible()) { asUrl && Common.NotificationCenter.trigger('download:cancel'); return; @@ -402,7 +403,6 @@ define([ this.downloadFormat = format; this.printSettingsDlg = (new SSE.Views.PrintSettings({ type: type, - asexport: asExport, handler: _.bind(this.resultPrintSettings,this), afterrender: _.bind(function() { this._changedProps = []; diff --git a/apps/spreadsheeteditor/main/app/view/PrintSettings.js b/apps/spreadsheeteditor/main/app/view/PrintSettings.js index a79f7661a2..56db3fd087 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PrintSettings.js @@ -57,7 +57,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', initialize : function(options) { this.type = options.type || 'print'; var txtBtn = (this.type == 'print') ? this.btnPrint : - options.asexport ? this.btnExport : this.btnDownload; + (this.type == 'export') ? this.btnExport : this.btnDownload; _.extend(this.options, { title: (this.type == 'print') ? this.textTitle : this.textTitlePDF, template: [ From 4df246ca2efb8986eb7079f358088273d39296dc Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Thu, 22 Jun 2023 13:11:06 +0300 Subject: [PATCH 3/3] [SSE] refactoring --- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 8 +++++--- apps/spreadsheeteditor/main/app/controller/Print.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index fddb136462..af9c6ebacf 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -266,7 +266,9 @@ define([ case 'back': break; case 'save': this.api.asc_Save(); break; case 'save-desktop': this.api.asc_DownloadAs(); break; - case 'export-pdf': this.clickSaveAsFormat(menu, Asc.c_oAscFileType.PDF, true); break; + case 'export-pdf': + Common.NotificationCenter.trigger('export:to', this.leftMenu, Asc.c_oAscFileType.PDF); + break; case 'print': Common.NotificationCenter.trigger('print', this.leftMenu); break; case 'exit': Common.NotificationCenter.trigger('goback'); break; case 'edit': @@ -338,7 +340,7 @@ define([ }); }, - clickSaveAsFormat: function(menu, format, asExport) { + clickSaveAsFormat: function(menu, format) { if (format == Asc.c_oAscFileType.CSV) { var me = this; if (this.api.asc_getWorksheetsCount()>1) { @@ -362,7 +364,7 @@ define([ }); } else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) { menu.hide(); - Common.NotificationCenter.trigger(asExport ? 'export' : 'download:settings', this.leftMenu, format); + Common.NotificationCenter.trigger('download:settings', this.leftMenu, format); } else { this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format)); menu.hide(); diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index a4404eeede..ef6a0c2874 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -75,7 +75,7 @@ define([ }); Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this, 'print')); Common.NotificationCenter.on('download:settings', _.bind(this.openPrintSettings, this, 'download')); - Common.NotificationCenter.on('export', _.bind(this.openPrintSettings, this, 'export')); + Common.NotificationCenter.on('export:to', _.bind(this.openPrintSettings, this, 'export')); }, onLaunch: function() {