[SSE] Print titles: check frozen areas, check print ranges
This commit is contained in:
parent
e5c35c772e
commit
d8e79bded7
|
@ -111,10 +111,10 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
comboSheetsChange: function(panel, combo, record) {
|
comboSheetsChange: function(panel, combo, record) {
|
||||||
this.fillPageOptions(panel, this._changedProps[record.value] ? this._changedProps[record.value] : this.api.asc_getPageOptions(record.value));
|
this.fillPageOptions(panel, this._changedProps[record.value] ? this._changedProps[record.value] : this.api.asc_getPageOptions(record.value), record.value);
|
||||||
},
|
},
|
||||||
|
|
||||||
fillPageOptions: function(panel, props) {
|
fillPageOptions: function(panel, props, sheet) {
|
||||||
var opt = props.asc_getPageSetup();
|
var opt = props.asc_getPageSetup();
|
||||||
this._originalPageSettings = opt;
|
this._originalPageSettings = opt;
|
||||||
|
|
||||||
|
@ -159,13 +159,18 @@ 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();
|
var value = props.asc_getPrintTitlesWidth();
|
||||||
// panel.txtRangeTop.setValue((value) ? value : '');
|
panel.txtRangeTop.setValue((value) ? value : '');
|
||||||
// panel.dataRangeTop = value;
|
panel.txtRangeTop.checkValidate();
|
||||||
//
|
panel.dataRangeTop = value;
|
||||||
// value = props.asc_getPrintTitlesHeight();
|
|
||||||
// panel.txtRangeLeft.setValue((value) ? value : '');
|
value = props.asc_getPrintTitlesHeight();
|
||||||
// panel.dataRangeLeft = value;
|
panel.txtRangeLeft.setValue((value) ? value : '');
|
||||||
|
panel.txtRangeLeft.checkValidate();
|
||||||
|
panel.dataRangeLeft = value;
|
||||||
|
|
||||||
|
panel.btnPresetsTop.menu.items[panel.btnPresetsTop.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, false, sheet));
|
||||||
|
panel.btnPresetsLeft.menu.items[panel.btnPresetsLeft.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, sheet));
|
||||||
},
|
},
|
||||||
|
|
||||||
fillPrintOptions: function(props) {
|
fillPrintOptions: function(props) {
|
||||||
|
@ -223,8 +228,11 @@ define([
|
||||||
|
|
||||||
props.asc_setPageMargins(opt);
|
props.asc_setPageMargins(opt);
|
||||||
|
|
||||||
props.asc_setPrintTitlesWidth(panel.txtRangeTop.getValue());
|
var check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, panel.txtRangeTop.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError;
|
||||||
props.asc_setPrintTitlesHeight(panel.txtRangeLeft.getValue());
|
props.asc_setPrintTitlesWidth(check ? panel.txtRangeTop.getValue() : panel.dataRangeTop);
|
||||||
|
|
||||||
|
check = this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, panel.txtRangeLeft.getValue(), false) !== Asc.c_oAscError.ID.DataRangeError;
|
||||||
|
props.asc_setPrintTitlesHeight(check ? panel.txtRangeLeft.getValue() : panel.dataRangeLeft);
|
||||||
|
|
||||||
return props;
|
return props;
|
||||||
},
|
},
|
||||||
|
@ -366,6 +374,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.txtRangeTop.on('changing', _.bind(this.propertyChange, this, panel));
|
||||||
|
panel.txtRangeLeft.on('changing', _.bind(this.propertyChange, this, panel));
|
||||||
panel.btnPresetsTop.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'top'));
|
panel.btnPresetsTop.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'top'));
|
||||||
panel.btnPresetsLeft.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'left'));
|
panel.btnPresetsLeft.menu.on('item:click', _.bind(this.onPresetSelect, this, panel, 'left'));
|
||||||
},
|
},
|
||||||
|
@ -425,6 +435,7 @@ define([
|
||||||
fillComponents: function(panel, selectdata) {
|
fillComponents: function(panel, selectdata) {
|
||||||
var me = this;
|
var me = this;
|
||||||
panel.txtRangeTop.validation = function(value) {
|
panel.txtRangeTop.validation = function(value) {
|
||||||
|
me.propertyChange(panel);
|
||||||
if (_.isEmpty(value)) {
|
if (_.isEmpty(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -432,6 +443,7 @@ define([
|
||||||
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true;
|
return (isvalid==Asc.c_oAscError.ID.DataRangeError) ? me.textInvalidRange : true;
|
||||||
};
|
};
|
||||||
panel.txtRangeLeft.validation = function(value) {
|
panel.txtRangeLeft.validation = function(value) {
|
||||||
|
me.propertyChange(panel);
|
||||||
if (_.isEmpty(value)) {
|
if (_.isEmpty(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +503,7 @@ define([
|
||||||
win.setSettings({
|
win.setSettings({
|
||||||
api : me.api,
|
api : me.api,
|
||||||
range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft),
|
range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? panel.dataRangeTop : panel.dataRangeLeft),
|
||||||
type : Asc.c_oAscSelectionDialogType.None
|
type : Asc.c_oAscSelectionDialogType.Chart
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -275,20 +275,20 @@ define([
|
||||||
'</tr>','<tr class="divider"></tr>',
|
'</tr>','<tr class="divider"></tr>',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td class="left" style="vertical-align: top;"><label><%= scope.strPrintTitles %></label></td>',
|
'<td class="left" style="vertical-align: top;"><label><%= scope.strPrintTitles %></label></td>',
|
||||||
'<td class="right" style="vertical-align: top;"><div id="advsettings-margins">',
|
'<td class="right" style="vertical-align: top;"><div id="advsettings-print-titles">',
|
||||||
'<table cols="2" class="no-padding">',
|
'<table cols="2" class="no-padding">',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td colspan="2" ><label><%= scope.textRepeatTop %></label></td>',
|
'<td colspan="2" ><label><%= scope.textRepeatTop %></label></td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td class="padding-small"><div id="advsettings-txt-top" style="margin-right: 10px;"></div></td>',
|
'<td class="padding-small" style="padding-right: 10px;"><div id="advsettings-txt-top"></div></td>',
|
||||||
'<td class="padding-small"><div id="advsettings-presets-top"></div></td>',
|
'<td class="padding-small"><div id="advsettings-presets-top"></div></td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td colspan="2" ><label><%= scope.textRepeatLeft %></label></td>',
|
'<td colspan="2" ><label><%= scope.textRepeatLeft %></label></td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td class="padding-small"><div id="advsettings-txt-left" style="margin-right: 10px;"></div></td>',
|
'<td class="padding-small" style="padding-right: 10px;"><div id="advsettings-txt-left"></div></td>',
|
||||||
'<td class="padding-small"><div id="advsettings-presets-left"></div></td>',
|
'<td class="padding-small"><div id="advsettings-presets-left"></div></td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'</table>',
|
'</table>',
|
||||||
|
@ -466,7 +466,7 @@ define([
|
||||||
|
|
||||||
this.txtRangeTop = new Common.UI.InputField({
|
this.txtRangeTop = new Common.UI.InputField({
|
||||||
el : $markup.findById('#advsettings-txt-top'),
|
el : $markup.findById('#advsettings-txt-top'),
|
||||||
style : 'width: 100%;',
|
style : 'width: 147px',
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
validateOnChange: true
|
validateOnChange: true
|
||||||
});
|
});
|
||||||
|
@ -474,14 +474,14 @@ define([
|
||||||
this.btnPresetsTop = new Common.UI.Button({
|
this.btnPresetsTop = new Common.UI.Button({
|
||||||
cls: 'btn-text-menu-default',
|
cls: 'btn-text-menu-default',
|
||||||
caption: this.textRepeat,
|
caption: this.textRepeat,
|
||||||
style: 'width: 95px;',
|
style: 'width: 85px;',
|
||||||
menu: true
|
menu: true
|
||||||
});
|
});
|
||||||
this.btnPresetsTop.render( $markup.findById('#advsettings-presets-top')) ;
|
this.btnPresetsTop.render( $markup.findById('#advsettings-presets-top')) ;
|
||||||
|
|
||||||
this.txtRangeLeft = new Common.UI.InputField({
|
this.txtRangeLeft = new Common.UI.InputField({
|
||||||
el : $markup.findById('#advsettings-txt-left'),
|
el : $markup.findById('#advsettings-txt-left'),
|
||||||
style : 'width: 100%;',
|
style : 'width: 147px',
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
validateOnChange: true
|
validateOnChange: true
|
||||||
});
|
});
|
||||||
|
@ -489,7 +489,7 @@ define([
|
||||||
this.btnPresetsLeft = new Common.UI.Button({
|
this.btnPresetsLeft = new Common.UI.Button({
|
||||||
cls: 'btn-text-menu-default',
|
cls: 'btn-text-menu-default',
|
||||||
caption: this.textRepeat,
|
caption: this.textRepeat,
|
||||||
style: 'width: 95px;',
|
style: 'width: 85px;',
|
||||||
menu: true
|
menu: true
|
||||||
});
|
});
|
||||||
this.btnPresetsLeft.render( $markup.findById('#advsettings-presets-left')) ;
|
this.btnPresetsLeft.render( $markup.findById('#advsettings-presets-left')) ;
|
||||||
|
|
|
@ -231,7 +231,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
|
|
||||||
this.txtRangeTop = new Common.UI.InputField({
|
this.txtRangeTop = new Common.UI.InputField({
|
||||||
el : $('#printadv-dlg-txt-top'),
|
el : $('#printadv-dlg-txt-top'),
|
||||||
style : 'width: 100%;',
|
style : 'width: 147px;',
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
validateOnChange: true
|
validateOnChange: true
|
||||||
});
|
});
|
||||||
|
@ -239,14 +239,14 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
this.btnPresetsTop = new Common.UI.Button({
|
this.btnPresetsTop = new Common.UI.Button({
|
||||||
cls: 'btn-text-menu-default',
|
cls: 'btn-text-menu-default',
|
||||||
caption: this.textRepeat,
|
caption: this.textRepeat,
|
||||||
style: 'width: 95px;',
|
style: 'width: 85px;',
|
||||||
menu: true
|
menu: true
|
||||||
});
|
});
|
||||||
this.btnPresetsTop.render( $('#printadv-dlg-presets-top')) ;
|
this.btnPresetsTop.render( $('#printadv-dlg-presets-top')) ;
|
||||||
|
|
||||||
this.txtRangeLeft = new Common.UI.InputField({
|
this.txtRangeLeft = new Common.UI.InputField({
|
||||||
el : $('#printadv-dlg-txt-left'),
|
el : $('#printadv-dlg-txt-left'),
|
||||||
style : 'width: 100%;',
|
style : 'width: 147px;',
|
||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
validateOnChange: true
|
validateOnChange: true
|
||||||
});
|
});
|
||||||
|
@ -254,7 +254,7 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template',
|
||||||
this.btnPresetsLeft = new Common.UI.Button({
|
this.btnPresetsLeft = new Common.UI.Button({
|
||||||
cls: 'btn-text-menu-default',
|
cls: 'btn-text-menu-default',
|
||||||
caption: this.textRepeat,
|
caption: this.textRepeat,
|
||||||
style: 'width: 95px;',
|
style: 'width: 85px;',
|
||||||
menu: true
|
menu: true
|
||||||
});
|
});
|
||||||
this.btnPresetsLeft.render( $('#printadv-dlg-presets-left')) ;
|
this.btnPresetsLeft.render( $('#printadv-dlg-presets-left')) ;
|
||||||
|
|
|
@ -134,6 +134,7 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var frozen = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, false, this.sheet);
|
||||||
this.btnPresetsTop = new Common.UI.Button({
|
this.btnPresetsTop = new Common.UI.Button({
|
||||||
cls: 'btn-text-menu-default',
|
cls: 'btn-text-menu-default',
|
||||||
caption: this.textRepeat,
|
caption: this.textRepeat,
|
||||||
|
@ -144,10 +145,10 @@ define([
|
||||||
additionalAlign: this.menuAddAlign,
|
additionalAlign: this.menuAddAlign,
|
||||||
items: [
|
items: [
|
||||||
{caption: this.textSelectRange, value: 'select'},
|
{caption: this.textSelectRange, value: 'select'},
|
||||||
{caption: this.textFrozenRows, value: 'frozen'},
|
{caption: this.textFrozenRows, value: 'frozen', range: frozen, disabled: !frozen},
|
||||||
{caption: this.textFirstRow, value: 'first'},
|
{caption: this.textFirstRow, value: 'first', range: this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, false, this.sheet)},
|
||||||
{caption: '--'},
|
{caption: '--'},
|
||||||
{caption: this.textNoRepeat, value: 'empty'}
|
{caption: this.textNoRepeat, value: 'empty', range: ''}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -168,6 +169,7 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frozen = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, this.sheet);
|
||||||
this.btnPresetsLeft = new Common.UI.Button({
|
this.btnPresetsLeft = new Common.UI.Button({
|
||||||
cls: 'btn-text-menu-default',
|
cls: 'btn-text-menu-default',
|
||||||
caption: this.textRepeat,
|
caption: this.textRepeat,
|
||||||
|
@ -178,10 +180,10 @@ define([
|
||||||
additionalAlign: this.menuAddAlign,
|
additionalAlign: this.menuAddAlign,
|
||||||
items: [
|
items: [
|
||||||
{caption: this.textSelectRange, value: 'select'},
|
{caption: this.textSelectRange, value: 'select'},
|
||||||
{caption: this.textFrozenCols, value: 'frozen'},
|
{caption: this.textFrozenCols, value: 'frozen', range: frozen, disabled: !frozen},
|
||||||
{caption: this.textFirstCol, value: 'first'},
|
{caption: this.textFirstCol, value: 'first', range: this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, true, this.sheet)},
|
||||||
{caption: '--'},
|
{caption: '--'},
|
||||||
{caption: this.textNoRepeat, value: 'empty'}
|
{caption: this.textNoRepeat, value: 'empty', range: ''}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -195,9 +197,26 @@ define([
|
||||||
this.setSettings();
|
this.setSettings();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isRangeValid: function() {
|
||||||
|
if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, this.txtRangeTop.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) {
|
||||||
|
this.txtRangeTop.cmpEl.find('input').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.None, this.txtRangeLeft.getValue(), false) == Asc.c_oAscError.ID.DataRangeError) {
|
||||||
|
this.txtRangeLeft.cmpEl.find('input').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
_handleInput: function(state) {
|
_handleInput: function(state) {
|
||||||
if (this.options.handler)
|
if (this.options.handler) {
|
||||||
|
if (state == 'ok') {
|
||||||
|
if (!this.isRangeValid())
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.options.handler.call(this, this, state);
|
this.options.handler.call(this, this, state);
|
||||||
|
}
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
@ -257,15 +276,11 @@ define([
|
||||||
win.setSettings({
|
win.setSettings({
|
||||||
api : me.api,
|
api : me.api,
|
||||||
range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? me.dataRangeTop : me.dataRangeLeft),
|
range : (!_.isEmpty(txtRange.getValue()) && (txtRange.checkValidate()==true)) ? txtRange.getValue() : ((type=='top') ? me.dataRangeTop : me.dataRangeLeft),
|
||||||
type : Asc.c_oAscSelectionDialogType.None
|
type : Asc.c_oAscSelectionDialogType.Chart
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var value = '';
|
var value = item.options.range || '';
|
||||||
if (item.value == 'frozen')
|
|
||||||
value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, type=='left', this.sheet);
|
|
||||||
else if (item.value == 'first')
|
|
||||||
value = this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.first, type=='left', this.sheet);
|
|
||||||
txtRange.setValue(value);
|
txtRange.setValue(value);
|
||||||
txtRange.checkValidate();
|
txtRange.checkValidate();
|
||||||
if (type=='top')
|
if (type=='top')
|
||||||
|
|
Loading…
Reference in a new issue