[SSE] Add "Print titles" option to print dialog and page options
This commit is contained in:
parent
c7f6ede2a4
commit
a882b4530c
|
@ -72,6 +72,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));
|
||||||
|
this.fillComponents(this.printSettings);
|
||||||
this.registerControlEvents(this.printSettings);
|
this.registerControlEvents(this.printSettings);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -157,6 +158,14 @@ define([
|
||||||
|
|
||||||
panel.chPrintGrid.setValue(props.asc_getGridLines(), true);
|
panel.chPrintGrid.setValue(props.asc_getGridLines(), true);
|
||||||
panel.chPrintRows.setValue(props.asc_getHeadings(), true);
|
panel.chPrintRows.setValue(props.asc_getHeadings(), true);
|
||||||
|
|
||||||
|
// var value = props.asc_getPrintTitlesWidth();
|
||||||
|
// panel.txtRangeTop.setValue((value) ? value : '');
|
||||||
|
// panel.dataRangeTop = value;
|
||||||
|
//
|
||||||
|
// value = props.asc_getPrintTitlesHeight();
|
||||||
|
// panel.txtRangeLeft.setValue((value) ? value : '');
|
||||||
|
// panel.dataRangeLeft = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
fillPrintOptions: function(props) {
|
fillPrintOptions: function(props) {
|
||||||
|
@ -214,6 +223,9 @@ define([
|
||||||
|
|
||||||
props.asc_setPageMargins(opt);
|
props.asc_setPageMargins(opt);
|
||||||
|
|
||||||
|
props.asc_setPrintTitlesWidth(panel.txtRangeTop.getValue());
|
||||||
|
props.asc_setPrintTitlesHeight(panel.txtRangeLeft.getValue());
|
||||||
|
|
||||||
return props;
|
return props;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -253,6 +265,7 @@ define([
|
||||||
this._changedProps = [];
|
this._changedProps = [];
|
||||||
this.updateSettings(this.printSettingsDlg);
|
this.updateSettings(this.printSettingsDlg);
|
||||||
this.printSettingsDlg.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettingsDlg));
|
this.printSettingsDlg.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettingsDlg));
|
||||||
|
this.fillComponents(this.printSettingsDlg, true);
|
||||||
this.fillPrintOptions(this.adjPrintParams);
|
this.fillPrintOptions(this.adjPrintParams);
|
||||||
this.registerControlEvents(this.printSettingsDlg);
|
this.registerControlEvents(this.printSettingsDlg);
|
||||||
},this)
|
},this)
|
||||||
|
@ -353,6 +366,8 @@ define([
|
||||||
panel.spnMarginRight.on('change', _.bind(this.propertyChange, this, panel));
|
panel.spnMarginRight.on('change', _.bind(this.propertyChange, this, panel));
|
||||||
panel.chPrintGrid.on('change', _.bind(this.propertyChange, this, panel));
|
panel.chPrintGrid.on('change', _.bind(this.propertyChange, this, panel));
|
||||||
panel.chPrintRows.on('change', _.bind(this.propertyChange, this, panel));
|
panel.chPrintRows.on('change', _.bind(this.propertyChange, this, panel));
|
||||||
|
panel.btnPresetsTop.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'top'));
|
||||||
|
panel.btnPresetsLeft.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'left'));
|
||||||
},
|
},
|
||||||
|
|
||||||
propertyChange: function(panel, scale, combo, record) {
|
propertyChange: function(panel, scale, combo, record) {
|
||||||
|
@ -407,9 +422,104 @@ define([
|
||||||
panel.cmbLayout.setValue(value, true);
|
panel.cmbLayout.setValue(value, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fillComponents: function(panel, selectdata) {
|
||||||
|
var me = this;
|
||||||
|
panel.txtRangeTop.validation = function(value) {
|
||||||
|
if (_.isEmpty(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false);
|
||||||
|
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true;
|
||||||
|
};
|
||||||
|
panel.txtRangeLeft.validation = function(value) {
|
||||||
|
if (_.isEmpty(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart, value, false);
|
||||||
|
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true;
|
||||||
|
};
|
||||||
|
var data = ((selectdata) ? [{caption: this.textSelectRange, value: 'select'}] : []).concat([
|
||||||
|
{caption: this.textFrozenRows, value: 'frozen'},
|
||||||
|
{caption: this.textFirstRow, value: 'first'},
|
||||||
|
{caption: '--'},
|
||||||
|
{caption: this.textNoRepeat, value: 'empty'}
|
||||||
|
]);
|
||||||
|
panel.btnPresetsTop.setMenu(new Common.UI.Menu({
|
||||||
|
style: 'min-width: 100px;',
|
||||||
|
maxHeight: 200,
|
||||||
|
items: data
|
||||||
|
}));
|
||||||
|
data = ((selectdata) ? [{caption: this.textSelectRange, value: 'select'}] : []).concat([
|
||||||
|
{caption: this.textFrozenCols, value: 'frozen'},
|
||||||
|
{caption: this.textFirstCol, value: 'first'},
|
||||||
|
{caption: '--'},
|
||||||
|
{caption: this.textNoRepeat, value: 'empty'}
|
||||||
|
]);
|
||||||
|
panel.btnPresetsLeft.setMenu(new Common.UI.Menu({
|
||||||
|
style: 'min-width: 100px;',
|
||||||
|
maxHeight: 200,
|
||||||
|
items: data
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
onPresetSelect: function(panel, type, menu, item) {
|
||||||
|
var txtRange = (type=='top') ? panel.txtRangeTop : panel.txtRangeLeft;
|
||||||
|
if (item.value == 'select') {
|
||||||
|
var me = this;
|
||||||
|
if (me.api) {
|
||||||
|
var handlerDlg = function(dlg, result) {
|
||||||
|
if (result == 'ok') {
|
||||||
|
var valid = dlg.getSettings();
|
||||||
|
if (type=='top')
|
||||||
|
panel.dataRangeTop = valid;
|
||||||
|
else
|
||||||
|
panel.dataRangeLeft = valid;
|
||||||
|
txtRange.setValue(valid);
|
||||||
|
txtRange.checkValidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var win = new SSE.Views.CellRangeDialog({
|
||||||
|
handler: handlerDlg
|
||||||
|
}).on('close', function() {
|
||||||
|
panel.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
var xy = panel.$window.offset();
|
||||||
|
panel.hide();
|
||||||
|
win.show(xy.left + 160, xy.top + 125);
|
||||||
|
win.setSettings({
|
||||||
|
api : me.api,
|
||||||
|
range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft),
|
||||||
|
type : Asc.c_oAscSelectionDialogType.Chart
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var value = '';
|
||||||
|
if (item.value == 'frozen')
|
||||||
|
value = this.api.asc_getFrozen(type=='top');
|
||||||
|
else if (item.value == 'first')
|
||||||
|
value = this.api.asc_getFirst(type=='top');
|
||||||
|
txtRange.setValue(value);
|
||||||
|
txtRange.checkValidate();
|
||||||
|
if (type=='top')
|
||||||
|
panel.dataRangeTop = value;
|
||||||
|
else
|
||||||
|
panel.dataRangeLeft = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
warnCheckMargings: 'Margins are incorrect',
|
warnCheckMargings: 'Margins are incorrect',
|
||||||
strAllSheets: 'All Sheets',
|
strAllSheets: 'All Sheets',
|
||||||
textWarning: 'Warning',
|
textWarning: 'Warning',
|
||||||
txtCustom: 'Custom'
|
txtCustom: 'Custom',
|
||||||
|
textInvalidRange: 'ERROR! Invalid cells range',
|
||||||
|
textRepeat: 'Repeat...',
|
||||||
|
textNoRepeat: 'Not repeat',
|
||||||
|
textSelectRange: 'Select range...',
|
||||||
|
textFrozenRows: 'Frozen rows',
|
||||||
|
textFrozenCols: 'Frozen columns',
|
||||||
|
textFirstRow: 'First row',
|
||||||
|
textFirstCol: 'First column'
|
||||||
}, SSE.Controllers.Print || {}));
|
}, SSE.Controllers.Print || {}));
|
||||||
});
|
});
|
|
@ -17,6 +17,24 @@
|
||||||
<span id="printadv-dlg-combo-layout" />
|
<span id="printadv-dlg-combo-layout" />
|
||||||
</div>
|
</div>
|
||||||
<div id="printadv-dlg-content-to-hide">
|
<div id="printadv-dlg-content-to-hide">
|
||||||
|
<div class="padding-large inner-content" >
|
||||||
|
<table cols="2" class="no-padding">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" ><label><%= scope.textRepeatTop %></label></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding-small"><div id="printadv-dlg-txt-top" style="margin-right: 10px;"></div></td>
|
||||||
|
<td class="padding-small"><div id="printadv-dlg-presets-top"></div></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" ><label><%= scope.textRepeatLeft %></label></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><div id="printadv-dlg-txt-left" style="margin-right: 10px;"></div></td>
|
||||||
|
<td><div id="printadv-dlg-presets-left"></div></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<div class="padding-large inner-content" >
|
<div class="padding-large inner-content" >
|
||||||
<table cols="2" class="no-padding">
|
<table cols="2" class="no-padding">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -273,6 +273,27 @@ define([
|
||||||
'<td class="left"><label><%= scope.textPageScaling %></label></td>',
|
'<td class="left"><label><%= scope.textPageScaling %></label></td>',
|
||||||
'<td class="right"><span id="advsettings-print-combo-layout" /></td>',
|
'<td class="right"><span id="advsettings-print-combo-layout" /></td>',
|
||||||
'</tr>','<tr class="divider"></tr>',
|
'</tr>','<tr class="divider"></tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="left" style="vertical-align: top;"><label><%= scope.strPrintTitles %></label></td>',
|
||||||
|
'<td class="right" style="vertical-align: top;"><div id="advsettings-margins">',
|
||||||
|
'<table cols="2" class="no-padding">',
|
||||||
|
'<tr>',
|
||||||
|
'<td colspan="2" ><label><%= scope.textRepeatTop %></label></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="padding-small"><div id="advsettings-txt-top" style="margin-right: 10px;"></div></td>',
|
||||||
|
'<td class="padding-small"><div id="advsettings-presets-top"></div></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td colspan="2" ><label><%= scope.textRepeatLeft %></label></td>',
|
||||||
|
'</tr>',
|
||||||
|
'<tr>',
|
||||||
|
'<td class="padding-small"><div id="advsettings-txt-left" style="margin-right: 10px;"></div></td>',
|
||||||
|
'<td class="padding-small"><div id="advsettings-presets-left"></div></td>',
|
||||||
|
'</tr>',
|
||||||
|
'</table>',
|
||||||
|
'</div></td>',
|
||||||
|
'</tr>','<tr class="divider"></tr>',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td class="left" style="vertical-align: top;"><label><%= scope.strMargins %></label></td>',
|
'<td class="left" style="vertical-align: top;"><label><%= scope.strMargins %></label></td>',
|
||||||
'<td class="right" style="vertical-align: top;"><div id="advsettings-margins">',
|
'<td class="right" style="vertical-align: top;"><div id="advsettings-margins">',
|
||||||
|
@ -443,6 +464,36 @@ define([
|
||||||
});
|
});
|
||||||
this.spinners.push(this.spnMarginRight);
|
this.spinners.push(this.spnMarginRight);
|
||||||
|
|
||||||
|
this.txtRangeTop = new Common.UI.InputField({
|
||||||
|
el : $markup.findById('#advsettings-txt-top'),
|
||||||
|
style : 'width: 100%;',
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.btnPresetsTop = new Common.UI.Button({
|
||||||
|
cls: 'btn-text-menu-default',
|
||||||
|
caption: this.textRepeat,
|
||||||
|
style: 'width: 95px;',
|
||||||
|
menu: true
|
||||||
|
});
|
||||||
|
this.btnPresetsTop.render( $markup.findById('#advsettings-presets-top')) ;
|
||||||
|
|
||||||
|
this.txtRangeLeft = new Common.UI.InputField({
|
||||||
|
el : $markup.findById('#advsettings-txt-left'),
|
||||||
|
style : 'width: 100%;',
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.btnPresetsLeft = new Common.UI.Button({
|
||||||
|
cls: 'btn-text-menu-default',
|
||||||
|
caption: this.textRepeat,
|
||||||
|
style: 'width: 95px;',
|
||||||
|
menu: true
|
||||||
|
});
|
||||||
|
this.btnPresetsLeft.render( $markup.findById('#advsettings-presets-left')) ;
|
||||||
|
|
||||||
this.btnOk = new Common.UI.Button({
|
this.btnOk = new Common.UI.Button({
|
||||||
el: $markup.findById('#advsettings-print-button-save')
|
el: $markup.findById('#advsettings-print-button-save')
|
||||||
});
|
});
|
||||||
|
@ -539,7 +590,11 @@ define([
|
||||||
textFitCols: 'Fit All Columns on One Page',
|
textFitCols: 'Fit All Columns on One Page',
|
||||||
textFitRows: 'Fit All Rows on One Page',
|
textFitRows: 'Fit All Rows on One Page',
|
||||||
textCustomOptions: 'Custom Options',
|
textCustomOptions: 'Custom Options',
|
||||||
textCustom: 'Custom'
|
textCustom: 'Custom',
|
||||||
|
strPrintTitles: 'Print Titles',
|
||||||
|
textRepeatTop: 'Repeat rows at top',
|
||||||
|
textRepeatLeft: 'Repeat columns at left',
|
||||||
|
textRepeat: 'Repeat...'
|
||||||
}, SSE.Views.MainSettingsPrint || {}));
|
}, SSE.Views.MainSettingsPrint || {}));
|
||||||
|
|
||||||
SSE.Views.FileMenuPanels.MainSettingsGeneral = Common.UI.BaseView.extend(_.extend({
|
SSE.Views.FileMenuPanels.MainSettingsGeneral = Common.UI.BaseView.extend(_.extend({
|
||||||
|
|
|
@ -51,7 +51,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
options: {
|
options: {
|
||||||
alias: 'PrintSettings',
|
alias: 'PrintSettings',
|
||||||
contentWidth: 280,
|
contentWidth: 280,
|
||||||
height: 475,
|
height: 575,
|
||||||
buttons: null
|
buttons: null
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageSize + '</div>',
|
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageSize + '</div>',
|
||||||
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageOrientation + '</div>',
|
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageOrientation + '</div>',
|
||||||
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageScaling + '</div>',
|
'<div style="height: 38px; line-height: 38px;" class="div-category">' + this.textPageScaling + '</div>',
|
||||||
|
'<div style="height: 98px; line-height: 33px;" class="div-category">' + this.strPrintTitles + '</div>',
|
||||||
'<div style="height: 108px; line-height: 33px;" class="div-category">' + this.strMargins + '</div>',
|
'<div style="height: 108px; line-height: 33px;" class="div-category">' + this.strMargins + '</div>',
|
||||||
'<div style="height: 58px; line-height: 40px;" class="div-category">' + ((this.type == 'print') ? this.strPrint : this.strShow) + '</div>',
|
'<div style="height: 58px; line-height: 40px;" class="div-category">' + ((this.type == 'print') ? this.strPrint : this.strShow) + '</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
|
@ -228,6 +229,36 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
itemsTemplate: itemsTemplate
|
itemsTemplate: itemsTemplate
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.txtRangeTop = new Common.UI.InputField({
|
||||||
|
el : $('#printadv-dlg-txt-top'),
|
||||||
|
style : 'width: 100%;',
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.btnPresetsTop = new Common.UI.Button({
|
||||||
|
cls: 'btn-text-menu-default',
|
||||||
|
caption: this.textRepeat,
|
||||||
|
style: 'width: 95px;',
|
||||||
|
menu: true
|
||||||
|
});
|
||||||
|
this.btnPresetsTop.render( $('#printadv-dlg-presets-top')) ;
|
||||||
|
|
||||||
|
this.txtRangeLeft = new Common.UI.InputField({
|
||||||
|
el : $('#printadv-dlg-txt-left'),
|
||||||
|
style : 'width: 100%;',
|
||||||
|
allowBlank : true,
|
||||||
|
validateOnChange: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.btnPresetsLeft = new Common.UI.Button({
|
||||||
|
cls: 'btn-text-menu-default',
|
||||||
|
caption: this.textRepeat,
|
||||||
|
style: 'width: 95px;',
|
||||||
|
menu: true
|
||||||
|
});
|
||||||
|
this.btnPresetsLeft.render( $('#printadv-dlg-presets-left')) ;
|
||||||
|
|
||||||
this.btnHide = new Common.UI.Button({
|
this.btnHide = new Common.UI.Button({
|
||||||
el: $('#printadv-dlg-btn-hide')
|
el: $('#printadv-dlg-btn-hide')
|
||||||
});
|
});
|
||||||
|
@ -314,7 +345,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
} else {
|
} else {
|
||||||
this.extended = false;
|
this.extended = false;
|
||||||
this.panelDetails.css({'display': 'block'});
|
this.panelDetails.css({'display': 'block'});
|
||||||
this.setHeight(475);
|
this.setHeight(585);
|
||||||
btn.setCaption(this.textHideDetails);
|
btn.setCaption(this.textHideDetails);
|
||||||
Common.localStorage.setItem("sse-hide-print-settings", 0);
|
Common.localStorage.setItem("sse-hide-print-settings", 0);
|
||||||
}
|
}
|
||||||
|
@ -355,7 +386,11 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
textRange: 'Range',
|
textRange: 'Range',
|
||||||
textIgnore: 'Ignore Print Area',
|
textIgnore: 'Ignore Print Area',
|
||||||
textCustomOptions: 'Custom Options',
|
textCustomOptions: 'Custom Options',
|
||||||
textCustom: 'Custom'
|
textCustom: 'Custom',
|
||||||
|
strPrintTitles: 'Print Titles',
|
||||||
|
textRepeatTop: 'Repeat rows at top',
|
||||||
|
textRepeatLeft: 'Repeat columns at left',
|
||||||
|
textRepeat: 'Repeat...'
|
||||||
|
|
||||||
}, SSE.Views.PrintSettings || {}));
|
}, SSE.Views.PrintSettings || {}));
|
||||||
});
|
});
|
Loading…
Reference in a new issue