Merge pull request #203 from ONLYOFFICE/feature/sse-currency-formats

Feature/sse currency formats
This commit is contained in:
Julia Radzhabova 2019-07-08 12:15:50 +03:00 committed by GitHub
commit 599d2a2838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 9 deletions

View file

@ -1089,13 +1089,30 @@ define([
onNumberFormatMenu: function(menu, item) {
if (this.api) {
var info = new Asc.asc_CFormatCellsInfo();
info.asc_setType(Asc.c_oAscNumFormatType.Accounting);
info.asc_setSeparator(false);
info.asc_setSymbol(item.value);
var format = this.api.asc_getFormatCells(info);
if (format && format.length>0)
this.api.asc_setCellFormat(format[0]);
if (item.value == -1) {
// show more formats
if (this._state.numformatinfo && this._state.numformatinfo.asc_getType()==Asc.c_oAscNumFormatType.Accounting)
this.onCustomNumberFormat();
else {
var value = this.api.asc_getLocale();
(!value) && (value = ((this.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)) : 0x0409));
var info = new Asc.asc_CFormatCellsInfo();
info.asc_setType(Asc.c_oAscNumFormatType.Accounting);
info.asc_setSeparator(false);
info.asc_setSymbol(value);
var format = this.api.asc_getFormatCells(info);
this.onCustomNumberFormat((format && format.length>0) ? format[0] : undefined, info);
}
} else {
var info = new Asc.asc_CFormatCellsInfo();
info.asc_setType(Asc.c_oAscNumFormatType.Accounting);
info.asc_setSeparator(false);
info.asc_setSymbol(item.value);
var format = this.api.asc_getFormatCells(info);
if (format && format.length>0)
this.api.asc_setCellFormat(format[0]);
}
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
@ -1113,7 +1130,7 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Number Format');
},
onCustomNumberFormat: function() {
onCustomNumberFormat: function(format, formatInfo) {
var me = this,
value = me.api.asc_getLocale();
(!value) && (value = ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409));
@ -1126,7 +1143,7 @@ define([
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
props : {format: me._state.numformat, formatInfo: me._state.numformatinfo, langId: value}
props : {format: format ? format : me._state.numformat, formatInfo: formatInfo ? formatInfo : me._state.numformatinfo, langId: value}
})).show();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Number Format');

View file

@ -833,6 +833,10 @@ define([
{
caption : me.txtYen,
value : 0x0411 // ¥ ja-JP
},{caption: '--'},
{
caption : me.textMoreFormats,
value : -1
}
]
})