Commit 225120e0 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Bug 25965, 21666: при попытке печати всегда показывать окно с настройками печати.

parent 152cd455
...@@ -155,7 +155,7 @@ define([ ...@@ -155,7 +155,7 @@ define([
case 'back': break; case 'back': break;
case 'save': this.api.asc_Save(); break; case 'save': this.api.asc_Save(); break;
case 'save-desktop': this.api.asc_DownloadAs(); 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 'exit': Common.NotificationCenter.trigger('goback'); break;
case 'edit': case 'edit':
// this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText); // this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText);
......
...@@ -761,6 +761,10 @@ define([ ...@@ -761,6 +761,10 @@ define([
if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram) { if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram) {
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); 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'); var celleditorController = this.getApplication().getController('CellEditor');
...@@ -774,7 +778,6 @@ define([ ...@@ -774,7 +778,6 @@ define([
toolbarController = application.getController('Toolbar'), toolbarController = application.getController('Toolbar'),
statusbarController = application.getController('Statusbar'), statusbarController = application.getController('Statusbar'),
rightmenuController = application.getController('RightMenu'), rightmenuController = application.getController('RightMenu'),
printController = application.getController('Print'),
/** coauthoring begin **/ /** coauthoring begin **/
commentsController = application.getController('Common.Controllers.Comments'), commentsController = application.getController('Common.Controllers.Comments'),
/** coauthoring end **/ /** coauthoring end **/
...@@ -794,7 +797,6 @@ define([ ...@@ -794,7 +797,6 @@ define([
} }
rightmenuController && rightmenuController.setApi(me.api); rightmenuController && rightmenuController.setApi(me.api);
printController && printController.setApi(me.api);
if (statusbarController) { if (statusbarController) {
statusbarController.getView('Statusbar').changeViewMode(true); statusbarController.getView('Statusbar').changeViewMode(true);
...@@ -1604,10 +1606,7 @@ define([ ...@@ -1604,10 +1606,7 @@ define([
onPrint: function() { onPrint: function() {
if (!this.appOptions.canPrint) return; if (!this.appOptions.canPrint) return;
Common.NotificationCenter.trigger('print', this);
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');
}, },
onPrintUrl: function(url) { onPrintUrl: function(url) {
......
...@@ -37,9 +37,7 @@ define([ ...@@ -37,9 +37,7 @@ define([
onAfterRender: function(view) { onAfterRender: function(view) {
this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings)); this.printSettings.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettings));
this.printSettings.btnOk.on('click', _.bind(this.querySavePrintSettings, this)); this.printSettings.btnOk.on('click', _.bind(this.querySavePrintSettings, this));
var toolbar = SSE.getController('Toolbar').getView('Toolbar'); Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this));
if (toolbar)
toolbar.mnuPrint.on('item:click', _.bind(this.openPrintSettings, this));
this.registerControlEvents(this.printSettings); this.registerControlEvents(this.printSettings);
}, },
...@@ -189,8 +187,8 @@ define([ ...@@ -189,8 +187,8 @@ define([
} }
}, },
openPrintSettings: function(menu, item) { openPrintSettings: function(btn) {
if (item.value === 'options' && this.api ) { if (this.api) {
this.printSettingsDlg = (new SSE.Views.PrintSettings({ this.printSettingsDlg = (new SSE.Views.PrintSettings({
handler: _.bind(this.resultPrintSettings,this), handler: _.bind(this.resultPrintSettings,this),
afterrender: _.bind(function() { afterrender: _.bind(function() {
...@@ -216,6 +214,9 @@ define([ ...@@ -216,6 +214,9 @@ define([
Common.localStorage.setItem("sse-print-settings-range", printtype); Common.localStorage.setItem("sse-print-settings-range", printtype);
this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); 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); Common.NotificationCenter.trigger('edit:complete', view);
} else } else
return true; return true;
......
...@@ -136,7 +136,6 @@ define([ ...@@ -136,7 +136,6 @@ define([
toolbar.btnNewDocument.on('click', _.bind(this.onNewDocument, this)); toolbar.btnNewDocument.on('click', _.bind(this.onNewDocument, this));
toolbar.btnOpenDocument.on('click', _.bind(this.onOpenDocument, this)); toolbar.btnOpenDocument.on('click', _.bind(this.onOpenDocument, this));
toolbar.btnPrint.on('click', _.bind(this.onPrint, 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.btnSave.on('click', _.bind(this.onSave, this));
toolbar.btnUndo.on('click', _.bind(this.onUndo, this)); toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
toolbar.btnRedo.on('click', _.bind(this.onRedo, this)); toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
...@@ -258,25 +257,7 @@ define([ ...@@ -258,25 +257,7 @@ define([
}, },
onPrint: function(e) { onPrint: function(e) {
if (this.api) { Common.NotificationCenter.trigger('print', this.toolbar);
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');
}
}, },
onSave: function(e) { onSave: function(e) {
......
...@@ -165,21 +165,8 @@ define([ ...@@ -165,21 +165,8 @@ define([
id : 'id-toolbar-btn-print', id : 'id-toolbar-btn-print',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-print', iconCls : 'btn-print',
split : true,
hint : me.tipPrint + Common.Utils.String.platformKey('Ctrl+P'), hint : me.tipPrint + Common.Utils.String.platformKey('Ctrl+P'),
lock : [_set.editCell, _set.cantPrint], lock : [_set.editCell, _set.cantPrint]
menu : new Common.UI.Menu({
items: [
{
caption: me.textPrint,
value: 'print'
},
{
caption: me.textPrintOptions,
value: 'options'
}
]
})
}); });
me.btnSave = new Common.UI.Button({ me.btnSave = new Common.UI.Button({
...@@ -1470,8 +1457,6 @@ define([ ...@@ -1470,8 +1457,6 @@ define([
}) })
}); });
me.mnuPrint = me.btnPrint.menu;
me.lockControls = [ me.lockControls = [
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold, me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold,
me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment