[DE] Send print settings to sdk. Enable print preview only for desktop.
This commit is contained in:
parent
50bf470a63
commit
24830cb70b
|
@ -1494,7 +1494,7 @@ define([
|
||||||
}
|
}
|
||||||
this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit;
|
this.appOptions.canEditStyles = this.appOptions.canLicense && this.appOptions.canEdit;
|
||||||
this.appOptions.canPrint = (this.permissions.print !== false);
|
this.appOptions.canPrint = (this.permissions.print !== false);
|
||||||
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac;
|
this.appOptions.canPreviewPrint = this.appOptions.canPrint && !Common.Utils.isMac && this.appOptions.isDesktopApp;
|
||||||
this.appOptions.canRename = this.editorConfig.canRename;
|
this.appOptions.canRename = this.editorConfig.canRename;
|
||||||
this.appOptions.buildVersion = params.asc_getBuildVersion();
|
this.appOptions.buildVersion = params.asc_getBuildVersion();
|
||||||
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
|
this.appOptions.canForcesave = this.appOptions.isEdit && !this.appOptions.isOffline && (typeof (this.editorConfig.customization) == 'object' && !!this.editorConfig.customization.forcesave);
|
||||||
|
|
|
@ -42,14 +42,10 @@ define([
|
||||||
],
|
],
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
var value = Common.localStorage.getItem("de-print-settings-range");
|
|
||||||
value = (value!==null) ? parseInt(value) : Asc.c_oAscPrintType.ActiveSheets;
|
|
||||||
|
|
||||||
this.adjPrintParams = new Asc.asc_CAdjustPrint();
|
this.adjPrintParams = new Asc.asc_CAdjustPrint();
|
||||||
this.adjPrintParams.asc_setPrintType(value);
|
|
||||||
|
|
||||||
this._state = {
|
this._state = {
|
||||||
lock_doc: false
|
lock_doc: false,
|
||||||
|
firstPrintPage: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
this._navigationPreview = {
|
this._navigationPreview = {
|
||||||
|
@ -119,6 +115,7 @@ define([
|
||||||
}
|
}
|
||||||
if (res.length>0) {
|
if (res.length>0) {
|
||||||
// me.adjPrintParams.asc_setPages(res);
|
// me.adjPrintParams.asc_setPages(res);
|
||||||
|
me._state.firstPrintPage = res[0];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,8 +132,6 @@ define([
|
||||||
|
|
||||||
var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
|
var eventname = (/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
|
||||||
this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this));
|
this.printSettings.$previewBox.on(eventname, _.bind(this.onPreviewWheel, this));
|
||||||
|
|
||||||
this.fillPrintOptions();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function (mode) {
|
setMode: function (mode) {
|
||||||
|
@ -224,23 +219,14 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fillPrintOptions: function(props) {
|
|
||||||
// fill page numbers, copies, collated
|
|
||||||
var panel = this.printSettings;
|
|
||||||
panel.cmbRange.setValue(this.adjPrintParams.asc_getPrintType());
|
|
||||||
panel.inputPages.setValue(''); // pages numbers
|
|
||||||
},
|
|
||||||
|
|
||||||
comboRangeChange: function(combo, record) {
|
comboRangeChange: function(combo, record) {
|
||||||
if (record.value === -1) {
|
if (record.value === -1) {
|
||||||
var me = this;
|
var me = this;
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
me.printSettings.inputPages.focus();
|
me.printSettings.inputPages.focus();
|
||||||
}, 50);
|
}, 50);
|
||||||
// this.adjPrintParams.asc_setPrintType(record.value)
|
|
||||||
} else {
|
} else {
|
||||||
this.printSettings.inputPages.setValue('');
|
this.printSettings.inputPages.setValue('');
|
||||||
this.adjPrintParams.asc_setPrintType(record.value)
|
|
||||||
}
|
}
|
||||||
this.printSettings.inputPages.showError();
|
this.printSettings.inputPages.showError();
|
||||||
},
|
},
|
||||||
|
@ -501,8 +487,19 @@ define([
|
||||||
this.isInputFirstChange = true;
|
this.isInputFirstChange = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.printSettings.cmbRange.getValue()==='all')
|
||||||
|
this._state.firstPrintPage = 0;
|
||||||
|
else if (this.printSettings.cmbRange.getValue()==='current')
|
||||||
|
this._state.firstPrintPage = this._navigationPreview.currentPage;
|
||||||
|
|
||||||
this._isPrint = print;
|
this._isPrint = print;
|
||||||
|
|
||||||
|
this.adjPrintParams.asc_setNativeOptions({
|
||||||
|
pages: this.printSettings.cmbRange.getValue()===-1 ? this.printSettings.inputPages.getValue() : this.printSettings.cmbRange.getValue(),
|
||||||
|
paperSize: this._state.pgsize, //this.api.asc_getPageSize(this._state.firstPrintPage),
|
||||||
|
paperOrientation: this._state.pgorient ? 'portrait' : 'landscape' // this.api.asc_getPageOrient(this._state.firstPrintPage) ? 'portrait' : 'landscape'
|
||||||
|
});
|
||||||
|
|
||||||
if ( print ) {
|
if ( print ) {
|
||||||
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
|
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);
|
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||||
|
@ -521,7 +518,7 @@ define([
|
||||||
this.isInputFirstChange = false;
|
this.isInputFirstChange = false;
|
||||||
|
|
||||||
if (value.length<1)
|
if (value.length<1)
|
||||||
this.printSettings.cmbRange.setValue(Asc.c_oAscPrintType.EntireWorkbook);
|
this.printSettings.cmbRange.setValue('all');
|
||||||
else if (this.printSettings.cmbRange.getValue()!==-1)
|
else if (this.printSettings.cmbRange.getValue()!==-1)
|
||||||
this.printSettings.cmbRange.setValue(-1);
|
this.printSettings.cmbRange.setValue(-1);
|
||||||
},
|
},
|
||||||
|
|
|
@ -2399,14 +2399,15 @@ define([
|
||||||
takeFocusOnClose: true,
|
takeFocusOnClose: true,
|
||||||
cls: 'input-group-nr',
|
cls: 'input-group-nr',
|
||||||
data: [
|
data: [
|
||||||
{ value: Asc.c_oAscPrintType.EntireWorkbook, displayValue: this.txtAllPages },
|
{ value: 'all', displayValue: this.txtAllPages },
|
||||||
{ value: Asc.c_oAscPrintType.ActiveSheets, displayValue: this.txtCurrentPage },
|
{ value: 'current', displayValue: this.txtCurrentPage },
|
||||||
{ value: -1, displayValue: this.txtCustomPages }
|
{ value: -1, displayValue: this.txtCustomPages }
|
||||||
],
|
],
|
||||||
dataHint: '2',
|
dataHint: '2',
|
||||||
dataHintDirection: 'bottom',
|
dataHintDirection: 'bottom',
|
||||||
dataHintOffset: 'big'
|
dataHintOffset: 'big'
|
||||||
});
|
});
|
||||||
|
this.cmbRange.setValue('all');
|
||||||
|
|
||||||
this.inputPages = new Common.UI.InputField({
|
this.inputPages = new Common.UI.InputField({
|
||||||
el: $markup.findById('#print-txt-pages'),
|
el: $markup.findById('#print-txt-pages'),
|
||||||
|
|
Loading…
Reference in a new issue