diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 3a1c6de2d..e68e0f148 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -155,7 +155,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(undefined, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); break; + case 'print': Common.NotificationCenter.trigger('print', this.leftMenu); break; case 'exit': Common.NotificationCenter.trigger('goback'); break; case 'edit': // this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 01fe651fa..74601e800 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -761,6 +761,10 @@ define([ if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram) { this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); + + var printController = app.getController('Print'); + printController && this.api && printController.setApi(this.api); + } var celleditorController = this.getApplication().getController('CellEditor'); @@ -774,7 +778,6 @@ define([ toolbarController = application.getController('Toolbar'), statusbarController = application.getController('Statusbar'), rightmenuController = application.getController('RightMenu'), - printController = application.getController('Print'), /** coauthoring begin **/ commentsController = application.getController('Common.Controllers.Comments'), /** coauthoring end **/ @@ -794,7 +797,6 @@ define([ } rightmenuController && rightmenuController.setApi(me.api); - printController && printController.setApi(me.api); if (statusbarController) { statusbarController.getView('Statusbar').changeViewMode(true); @@ -1604,10 +1606,7 @@ define([ onPrint: function() { if (!this.appOptions.canPrint) return; - - if (this.api) - this.api.asc_Print(undefined, 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'); + Common.NotificationCenter.trigger('print', this); }, onPrintUrl: function(url) { diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index cce2ce5a0..94ab528ed 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -37,9 +37,7 @@ define([ onAfterRender: function(view) { this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings)); this.printSettings.btnOk.on('click', _.bind(this.querySavePrintSettings, this)); - var toolbar = SSE.getController('Toolbar').getView('Toolbar'); - if (toolbar) - toolbar.mnuPrint.on('item:click', _.bind(this.openPrintSettings, this)); + Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this)); this.registerControlEvents(this.printSettings); }, @@ -189,8 +187,8 @@ define([ } }, - openPrintSettings: function(menu, item) { - if (item.value === 'options' && this.api ) { + openPrintSettings: function(btn) { + if (this.api) { this.printSettingsDlg = (new SSE.Views.PrintSettings({ handler: _.bind(this.resultPrintSettings,this), afterrender: _.bind(function() { @@ -216,6 +214,9 @@ define([ Common.localStorage.setItem("sse-print-settings-range", printtype); this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); + + Common.component.Analytics.trackEvent('Print'); + Common.component.Analytics.trackEvent('ToolBar', 'Print'); Common.NotificationCenter.trigger('edit:complete', view); } else return true; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index c20acd4ed..225550521 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -136,7 +136,6 @@ define([ toolbar.btnNewDocument.on('click', _.bind(this.onNewDocument, this)); toolbar.btnOpenDocument.on('click', _.bind(this.onOpenDocument, this)); toolbar.btnPrint.on('click', _.bind(this.onPrint, this)); - toolbar.btnPrint.menu.on('item:click', _.bind(this.onPrintMenu, this)); toolbar.btnSave.on('click', _.bind(this.onSave, this)); toolbar.btnUndo.on('click', _.bind(this.onUndo, this)); toolbar.btnRedo.on('click', _.bind(this.onRedo, this)); @@ -258,25 +257,7 @@ define([ }, onPrint: function(e) { - if (this.api) { - this.api.asc_Print(undefined, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari == true use asc_onPrintUrl event - - Common.NotificationCenter.trigger('edit:complete', this.toolbar); - - Common.component.Analytics.trackEvent('Print'); - Common.component.Analytics.trackEvent('ToolBar', 'Print'); - } - }, - - onPrintMenu: function(menu, item) { - if (item.value === 'print' && this.api) { - this.api.asc_Print(undefined, 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); - - Common.component.Analytics.trackEvent('Print'); - Common.component.Analytics.trackEvent('ToolBar', 'Print'); - } + Common.NotificationCenter.trigger('print', this.toolbar); }, onSave: function(e) { diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 59b8393db..2a013cf0a 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -165,21 +165,8 @@ define([ id : 'id-toolbar-btn-print', cls : 'btn-toolbar', iconCls : 'btn-print', - split : true, hint : me.tipPrint + Common.Utils.String.platformKey('Ctrl+P'), - lock : [_set.editCell, _set.cantPrint], - menu : new Common.UI.Menu({ - items: [ - { - caption: me.textPrint, - value: 'print' - }, - { - caption: me.textPrintOptions, - value: 'options' - } - ] - }) + lock : [_set.editCell, _set.cantPrint] }); me.btnSave = new Common.UI.Button({ @@ -1470,8 +1457,6 @@ define([ }) }); - me.mnuPrint = me.btnPrint.menu; - me.lockControls = [ me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,