[SSE] By bug 59219

This commit is contained in:
JuliaSvinareva 2022-11-21 01:36:38 +03:00
parent e81c8dedb8
commit 63f2801a99
5 changed files with 95 additions and 11 deletions

View file

@ -147,21 +147,30 @@ define([
this.isFillSheets = false;
}
},
updateSettings: function(panel) {
resetSheets: function (panel) {
var wc = this.api.asc_getWorksheetsCount(), i = -1;
var items = [];
var rangeRecord = panel.cmbRange.getSelectedRecord(),
rangeValue = rangeRecord && rangeRecord.value,
selectedTabs = SSE.getController('Statusbar').getSelectTabs();
while (++i < wc) {
if (!this.api.asc_isWorksheetHidden(i)) {
items.push({
displayValue:this.api.asc_getWorksheetName(i),
value: i
});
if ((rangeRecord && rangeValue !== Asc.c_oAscPrintType.ActiveSheets) || selectedTabs.indexOf(i) !== -1) {
items.push({
displayValue: this.api.asc_getWorksheetName(i),
value: i
});
}
}
}
panel.cmbSheet.store.reset(items);
},
updateSettings: function(panel) {
this.resetSheets(panel);
var item = panel.cmbSheet.store.findWhere({value: panel.cmbSheet.getValue()}) ||
panel.cmbSheet.store.findWhere({value: this.api.asc_getActiveWorksheetIndex()});
if (item) {
@ -256,15 +265,16 @@ define([
},
onChangeRange: function(isDlg) {
var menu = isDlg ? this.printSettingsDlg : this.printSettings;
var printtype = menu.getRange(),
store = menu.cmbSheet.store,
var menu = isDlg ? this.printSettingsDlg : this.printSettings,
printtype = menu.getRange();
this.resetSheets(menu);
var store = menu.cmbSheet.store,
item = (printtype !== Asc.c_oAscPrintType.EntireWorkbook) ? store.findWhere({value: this.api.asc_getActiveWorksheetIndex()}) : store.at(0);
if (item) {
menu.cmbSheet.setValue(item.get('value'));
this.comboSheetsChange(menu, menu.cmbSheet, item.toJSON());
}
menu.cmbSheet.setDisabled(printtype !== Asc.c_oAscPrintType.EntireWorkbook);
//menu.cmbSheet.setDisabled(printtype !== Asc.c_oAscPrintType.EntireWorkbook);
menu.chIgnorePrintArea.setDisabled(printtype == Asc.c_oAscPrintType.Selection);
if (!isDlg) {
@ -335,6 +345,8 @@ define([
if (!this.isFillSheets) {
this.isFillSheets = true;
this.updateSettings(this.printSettings);
} else {
this.resetSheets(this.printSettings);
}
this.printSettings.cmbSheet.store.each(function (item) {
var sheetIndex = item.get('value');
@ -429,6 +441,9 @@ define([
this.adjPrintParams.asc_setPrintType(printType);
this.adjPrintParams.asc_setPageOptionsMap(this._changedProps);
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
this.adjPrintParams.asc_setActiveSheetsArray(SSE.getController('Statusbar').getSelectTabs());
this.adjPrintParams.asc_setStartPageIndex(this.printSettings.getPagesFrom() - 1);
this.adjPrintParams.asc_setEndPageIndex(this.printSettings.getPagesTo() - 1);
Common.localStorage.setItem("sse-print-settings-range", printType);
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
@ -730,6 +745,7 @@ define([
updatePreview: function (needUpdate) {
if (this._isPreviewVisible) {
console.log('update preview');
this.printSettings.$previewBox.removeClass('hidden');
var adjPrintParams = new Asc.asc_CAdjustPrint(),
@ -737,6 +753,9 @@ define([
adjPrintParams.asc_setPrintType(printType);
adjPrintParams.asc_setPageOptionsMap(this._changedProps);
adjPrintParams.asc_setIgnorePrintArea(this.printSettings.getIgnorePrintArea());
adjPrintParams.asc_setActiveSheetsArray(SSE.getController('Statusbar').getSelectTabs());
adjPrintParams.asc_setStartPageIndex(this.printSettings.getPagesFrom() - 1);
adjPrintParams.asc_setEndPageIndex(this.printSettings.getPagesTo() - 1);
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
opts.asc_setAdvancedOptions(adjPrintParams);

View file

@ -840,6 +840,15 @@ define([
this.disconnectTip = null;
},
getSelectTabs: function () {
var selectTabs = this.statusbar.tabbar.selectTabs,
tabIndArr = [];
selectTabs.forEach(function (item) {
tabIndArr.push(item.sheetindex);
});
return tabIndArr;
},
zoomText : 'Zoom {0}%',
errorLastSheet : 'Workbook must have at least one visible worksheet.',
errorRemoveSheet: 'Can\'t delete the worksheet.',

View file

@ -2260,6 +2260,14 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
'<tr><td><label class="header"><%= scope.txtPrintRange %></label></td></tr>',
'<tr><td class="padding-small"><div id="print-combo-range" style="width: 248px;"></div></td></tr>',
'<tr><td class="padding-large"><div id="print-chb-ignore" style="width: 248px;"></div></td></tr>',
'<tr><td class="padding-large">',
'<div class="pages">',
'<label><%= scope.txtPages %></label>',
'<div id="print-spin-pages-from"></div>',
'<label><%= scope.txtTo %></label>',
'<div id="print-spin-pages-to"></div>',
'</div>',
'</td></tr>',
'<tr><td><label class="header"><%= scope.txtSettingsOfSheet %></label></td></tr>',
'<tr><td class="padding-large"><div id="print-combo-sheets" style="width: 248px;"></div></td></tr>',
'<tr><td><label class="header"><%= scope.txtPageSize %></label></td></tr>',
@ -2368,7 +2376,7 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
takeFocusOnClose: true,
cls: 'input-group-nr',
data: [
{ value: Asc.c_oAscPrintType.ActiveSheets, displayValue: this.txtCurrentSheet },
{ value: Asc.c_oAscPrintType.ActiveSheets, displayValue: this.txtActiveSheets },
{ value: Asc.c_oAscPrintType.EntireWorkbook, displayValue: this.txtAllSheets },
{ value: Asc.c_oAscPrintType.Selection, displayValue: this.txtSelection }
],
@ -2386,6 +2394,32 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
dataHintOffset: 'small'
});
this.spnPagesFrom = new Common.UI.MetricSpinner({
el: $markup.findById('#print-spin-pages-from'),
step: 1,
width: 60,
defaultUnit : '',
value: '1',
maxValue: 1000,
minValue: 1,
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.spnPagesTo = new Common.UI.MetricSpinner({
el: $markup.findById('#print-spin-pages-to'),
step: 1,
width: 60,
defaultUnit : '',
value: '1',
maxValue: 1000,
minValue: 1,
dataHint: '2',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.cmbSheet = new Common.UI.ComboBox({
el: $markup.findById('#print-combo-sheets'),
menuStyle: 'min-width: 248px;max-height: 280px;',
@ -2768,6 +2802,14 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
return (this.chIgnorePrintArea.getValue()=='checked');
},
getPagesFrom: function () {
return this.spnPagesFrom.getValue();
},
getPagesTo: function () {
return this.spnPagesTo.getValue();
},
comboRangeChange: function(combo, record) {
this.fireEvent('changerange', this);
},
@ -2797,6 +2839,9 @@ SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
txtSave: 'Save',
txtPrintRange: 'Print range',
txtCurrentSheet: 'Current sheet',
txtActiveSheets: 'Active sheets',
txtPages: 'Pages:',
txtTo: 'to',
txtAllSheets: 'All sheets',
txtSelection: 'Selection',
txtSettingsOfSheet: 'Settings of sheet',

View file

@ -3059,6 +3059,9 @@
"SSE.Views.PrintWithPreview.txtApplyToAllSheets": "Apply to all sheets",
"SSE.Views.PrintWithPreview.txtBottom": "Bottom",
"SSE.Views.PrintWithPreview.txtCurrentSheet": "Current sheet",
"SSE.Views.PrintWithPreview.txtActiveSheets": "Active sheets",
"SSE.Views.PrintWithPreview.txtPages": "Pages:",
"SSE.Views.PrintWithPreview.txtTo": "to",
"SSE.Views.PrintWithPreview.txtCustom": "Custom",
"SSE.Views.PrintWithPreview.txtCustomOptions": "Custom Options",
"SSE.Views.PrintWithPreview.txtEmptyTable": "There is nothing to print because the table is empty",

View file

@ -610,6 +610,14 @@
flex-direction: column;
border-right: @scaled-one-px-value-ie solid @border-toolbar-ie;
border-right: @scaled-one-px-value solid @border-toolbar;
.pages {
label, #print-spin-pages-from {
margin-right: 6px;
}
label, div {
display: inline-block;
}
}
label.header {
font-weight: 700;
}