[SSE] Fix bug 60105
This commit is contained in:
parent
645f8cd55b
commit
33663d2bbe
|
@ -91,11 +91,16 @@ define([
|
|||
}
|
||||
}, this));
|
||||
this.printSettings.btnsSave.forEach(function (btn) {
|
||||
btn.on('click', _.bind(me.querySavePrintSettings, me, false));
|
||||
btn.on('click', _.bind(me.querySavePrintSettings, me, 'save'));
|
||||
});
|
||||
this.printSettings.btnsPrint.forEach(function (btn) {
|
||||
btn.on('click', _.bind(me.querySavePrintSettings, me, true));
|
||||
btn.on('click', _.bind(me.querySavePrintSettings, me, 'print'));
|
||||
});
|
||||
if (this.mode.isDesktopApp) {
|
||||
this.printSettings.btnsPrintPDF.forEach(function (btn) {
|
||||
btn.on('click', _.bind(me.querySavePrintSettings, me, 'print-pdf'));
|
||||
});
|
||||
}
|
||||
this.printSettings.btnPrevPage.on('click', _.bind(this.onChangePreviewPage, this, false));
|
||||
this.printSettings.btnNextPage.on('click', _.bind(this.onChangePreviewPage, this, true));
|
||||
this.printSettings.txtNumberPage.on({
|
||||
|
@ -442,34 +447,37 @@ define([
|
|||
querySavePrintSettings: function(print) {
|
||||
if ( this.checkMargins(this.printSettings) ) {
|
||||
this.savePageOptions(this.printSettings);
|
||||
this._isPrint = print;
|
||||
this._isPrint = print === 'print';
|
||||
this.printSettings.applySettings();
|
||||
|
||||
if (print) {
|
||||
var view = SSE.getController('Toolbar').getView('Toolbar');
|
||||
var printType = this.printSettings.getRange();
|
||||
this.adjPrintParams.asc_setPrintType(printType);
|
||||
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);
|
||||
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
|
||||
this.adjPrintParams.asc_setActiveSheetsArray(printType === Asc.c_oAscPrintType.ActiveSheets ? SSE.getController('Statusbar').getSelectTabs() : null);
|
||||
var pageFrom = this.printSettings.getPagesFrom(),
|
||||
pageTo = this.printSettings.getPagesTo();
|
||||
if (pageFrom > pageTo) {
|
||||
var t = pageFrom;
|
||||
pageFrom = pageTo;
|
||||
pageTo = t;
|
||||
}
|
||||
this.adjPrintParams.asc_setStartPageIndex(pageFrom > 0 ? pageFrom - 1 : null);
|
||||
this.adjPrintParams.asc_setEndPageIndex(pageTo > 0 ? pageTo - 1 : null);
|
||||
Common.localStorage.setItem("sse-print-settings-range", printType);
|
||||
var view = SSE.getController('Toolbar').getView('Toolbar');
|
||||
var printType = this.printSettings.getRange();
|
||||
this.adjPrintParams.asc_setPrintType(printType);
|
||||
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);
|
||||
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
|
||||
this.adjPrintParams.asc_setActiveSheetsArray(printType === Asc.c_oAscPrintType.ActiveSheets ? SSE.getController('Statusbar').getSelectTabs() : null);
|
||||
var pageFrom = this.printSettings.getPagesFrom(),
|
||||
pageTo = this.printSettings.getPagesTo();
|
||||
if (pageFrom > pageTo) {
|
||||
var t = pageFrom;
|
||||
pageFrom = pageTo;
|
||||
pageTo = t;
|
||||
}
|
||||
this.adjPrintParams.asc_setStartPageIndex(pageFrom > 0 ? pageFrom - 1 : null);
|
||||
this.adjPrintParams.asc_setEndPageIndex(pageTo > 0 ? pageTo - 1 : null);
|
||||
Common.localStorage.setItem("sse-print-settings-range", printType);
|
||||
|
||||
if (print === 'print') {
|
||||
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
|
||||
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||
this.api.asc_Print(opts);
|
||||
Common.NotificationCenter.trigger('edit:complete', view);
|
||||
|
||||
this._isPrint = false;
|
||||
} else if (print === 'print-pdf') {
|
||||
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
|
||||
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||
this.api.asc_DownloadAs(opts);
|
||||
}
|
||||
Common.NotificationCenter.trigger('edit:complete', view);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -2735,6 +2735,26 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
|||
|
||||
this.btnsSave = [];
|
||||
this.btnsPrint = [];
|
||||
if (this.mode.isDesktopApp) {
|
||||
this.btnsPrintPDF = [];
|
||||
for (var i=0; i<2; i++) {
|
||||
var table =
|
||||
['<table>',
|
||||
'<tr>',
|
||||
'<td><button id="print-btn-print-<%= index %>" class="btn normal dlg-btn primary btn-text-default auto" result="print" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrint %></button></td>',
|
||||
'<td><button id="print-btn-print-pdf-<%= index %>" class="btn normal dlg-btn btn-text-default auto" result="save-pdf" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtPrintToPDF %></button></td>',
|
||||
'<td><button id="print-btn-save-<%= index %>" class="btn normal dlg-btn btn-text-default auto" result="save" data-hint="2" data-hint-direction="bottom" data-hint-offset="big"><%= scope.txtSave %></button></td>',
|
||||
'</tr>', '</table>',
|
||||
].join('');
|
||||
var tableTemplate = _.template(table)({scope: this, index: i});
|
||||
$($markup.find('.footer')[i]).html(tableTemplate);
|
||||
this.btnsPrintPDF.push(new Common.UI.Button({
|
||||
el: $markup.findById('#print-btn-print-pdf-'+i)
|
||||
}));
|
||||
}
|
||||
$markup.find('.footer').addClass('footer-with-pdf');
|
||||
}
|
||||
|
||||
for (var i=0; i<2; i++) {
|
||||
this.btnsSave.push(new Common.UI.Button({
|
||||
el: $markup.findById('#print-btn-save-'+i)
|
||||
|
@ -2744,6 +2764,13 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
|||
}));
|
||||
}
|
||||
|
||||
this.btnsSavePDF = [];
|
||||
for (var i=0; i<2; i++) {
|
||||
this.btnsSavePDF.push(new Common.UI.Button({
|
||||
el: $markup.findById('#print-btn-save-pdf-'+i)
|
||||
}));
|
||||
}
|
||||
|
||||
this.btnPrevPage = new Common.UI.Button({
|
||||
parentEl: $markup.findById('#print-prev-page'),
|
||||
cls: 'btn-prev-page',
|
||||
|
@ -2950,6 +2977,7 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
|||
|
||||
txtPrint: 'Print',
|
||||
txtSave: 'Save',
|
||||
txtPrintToPDF: 'Print to PDF',
|
||||
txtPrintRange: 'Print range',
|
||||
txtCurrentSheet: 'Current sheet',
|
||||
txtActiveSheets: 'Active sheets',
|
||||
|
|
|
@ -3122,6 +3122,7 @@
|
|||
"SSE.Views.PrintWithPreview.txtSettingsOfSheet": "Settings of sheet",
|
||||
"SSE.Views.PrintWithPreview.txtSheet": "Sheet: {0}",
|
||||
"SSE.Views.PrintWithPreview.txtTop": "Top",
|
||||
"SSE.Views.PrintWithPreview.txtPrintToPDF": "Print to PDF",
|
||||
"SSE.Views.ProtectDialog.textExistName": "ERROR! Range with such a title already exists",
|
||||
"SSE.Views.ProtectDialog.textInvalidName": "The range title must begin with a letter and may only contain letters, numbers, and spaces.",
|
||||
"SSE.Views.ProtectDialog.textInvalidRange": "ERROR! Invalid cells range",
|
||||
|
|
|
@ -693,7 +693,7 @@
|
|||
font-weight: 700;
|
||||
}
|
||||
.footer {
|
||||
.btn.primary {
|
||||
.btn:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
@ -728,6 +728,20 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.footer-with-pdf {
|
||||
table {
|
||||
width: 247px;
|
||||
}
|
||||
td:not(:last-child) {
|
||||
padding-right: 5px;
|
||||
}
|
||||
.btn-text-default.auto {
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
min-width: 64px;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
#print-navigation {
|
||||
height: 50px;
|
||||
|
|
Loading…
Reference in a new issue