[SSE] Fix Bug 16272
This commit is contained in:
parent
7089d63f34
commit
2575bbd3ec
|
@ -82,7 +82,7 @@ define([
|
||||||
me._currentMathObj = undefined;
|
me._currentMathObj = undefined;
|
||||||
me._currentParaObjDisabled = false;
|
me._currentParaObjDisabled = false;
|
||||||
me._isDisabled = false;
|
me._isDisabled = false;
|
||||||
|
me._state = {};
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
this.wrapEvents = {
|
this.wrapEvents = {
|
||||||
apiHideComment: _.bind(this.onApiHideComment, this)
|
apiHideComment: _.bind(this.onApiHideComment, this)
|
||||||
|
@ -196,6 +196,10 @@ define([
|
||||||
view.menuSignatureEditSetup.on('click', _.bind(me.onSignatureClick, me));
|
view.menuSignatureEditSetup.on('click', _.bind(me.onSignatureClick, me));
|
||||||
view.menuImgOriginalSize.on('click', _.bind(me.onOriginalSizeClick, me));
|
view.menuImgOriginalSize.on('click', _.bind(me.onOriginalSizeClick, me));
|
||||||
view.menuImgReplace.menu.on('item:click', _.bind(me.onImgReplace, me));
|
view.menuImgReplace.menu.on('item:click', _.bind(me.onImgReplace, me));
|
||||||
|
view.pmiNumFormat.menu.on('item:click', _.bind(me.onNumberFormatSelect, me));
|
||||||
|
view.pmiNumFormat.menu.on('show:after', _.bind(me.onNumberFormatOpenAfter, me));
|
||||||
|
view.pmiAdvancedNumFormat.on('click', _.bind(me.onCustomNumberFormat, me));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me));
|
view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me));
|
||||||
view.menuViewUndo.on('click', _.bind(me.onUndo, me));
|
view.menuViewUndo.on('click', _.bind(me.onUndo, me));
|
||||||
|
@ -1482,6 +1486,10 @@ define([
|
||||||
|
|
||||||
documentHolder.pmiEntriesList.setVisible(!iscelledit && !inPivot);
|
documentHolder.pmiEntriesList.setVisible(!iscelledit && !inPivot);
|
||||||
|
|
||||||
|
documentHolder.pmiNumFormat.setVisible(!iscelledit);
|
||||||
|
documentHolder.pmiAdvancedNumFormat.options.numformatinfo = documentHolder.pmiNumFormat.menu.options.numformatinfo = cellinfo.asc_getNumFormatInfo();
|
||||||
|
documentHolder.pmiAdvancedNumFormat.options.numformat = cellinfo.asc_getNumFormat();
|
||||||
|
|
||||||
_.each(documentHolder.ssMenu.items, function(item) {
|
_.each(documentHolder.ssMenu.items, function(item) {
|
||||||
item.setDisabled(isCellLocked);
|
item.setDisabled(isCellLocked);
|
||||||
});
|
});
|
||||||
|
@ -2653,6 +2661,61 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onNumberFormatSelect: function(menu, item) {
|
||||||
|
if (item.value !== undefined && item.value !== 'advanced') {
|
||||||
|
if (this.api)
|
||||||
|
this.api.asc_setCellFormat(item.options.format);
|
||||||
|
}
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
|
||||||
|
},
|
||||||
|
|
||||||
|
onCustomNumberFormat: function(item) {
|
||||||
|
var me = this,
|
||||||
|
value = me.api.asc_getLocale();
|
||||||
|
(!value) && (value = ((me.permissions.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.permissions.lang)) : 0x0409));
|
||||||
|
|
||||||
|
(new SSE.Views.FormatSettingsDialog({
|
||||||
|
api: me.api,
|
||||||
|
handler: function(result, settings) {
|
||||||
|
if (settings) {
|
||||||
|
me.api.asc_setCellFormat(settings.format);
|
||||||
|
}
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', me.documentHolder);
|
||||||
|
},
|
||||||
|
props : {format: item.options.numformat, formatInfo: item.options.numformatinfo, langId: value}
|
||||||
|
})).show();
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
|
||||||
|
},
|
||||||
|
|
||||||
|
onNumberFormatOpenAfter: function(menu) {
|
||||||
|
if (this.api) {
|
||||||
|
var me = this,
|
||||||
|
value = me.api.asc_getLocale();
|
||||||
|
(!value) && (value = ((me.permissions.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.permissions.lang)) : 0x0409));
|
||||||
|
|
||||||
|
if (this._state.langId !== value) {
|
||||||
|
this._state.langId = value;
|
||||||
|
|
||||||
|
var info = new Asc.asc_CFormatCellsInfo();
|
||||||
|
info.asc_setType(Asc.c_oAscNumFormatType.None);
|
||||||
|
info.asc_setSymbol(this._state.langId);
|
||||||
|
var arr = this.api.asc_getFormatCells(info); // all formats
|
||||||
|
for (var i=0; i<menu.items.length-2; i++) {
|
||||||
|
menu.items[i].options.format = arr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var val = menu.options.numformatinfo;
|
||||||
|
val = (val) ? val.asc_getType() : -1;
|
||||||
|
for (var i=0; i<menu.items.length-2; i++) {
|
||||||
|
var mnu = menu.items[i];
|
||||||
|
mnu.options.exampleval = me.api.asc_getLocaleExample(mnu.options.format);
|
||||||
|
$(mnu.el).find('label').text(mnu.options.exampleval);
|
||||||
|
mnu.setChecked(val == mnu.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
SetDisabled: function(state, canProtect) {
|
SetDisabled: function(state, canProtect) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this._canProtect = canProtect;
|
this._canProtect = canProtect;
|
||||||
|
|
|
@ -404,6 +404,106 @@ define([
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var numFormatTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem">'+
|
||||||
|
'<div style="position: relative;">'+
|
||||||
|
'<div style="position: absolute; left: 0; width: 100px;"><%= caption %></div>' +
|
||||||
|
'<label style="width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;cursor: pointer;"><%= options.exampleval ? options.exampleval : "" %></label>' +
|
||||||
|
'</div></a>');
|
||||||
|
|
||||||
|
me.pmiNumFormat = new Common.UI.MenuItem({
|
||||||
|
caption: me.txtNumFormat,
|
||||||
|
menu: new Common.UI.Menu({
|
||||||
|
menuAlign: 'tl-tr',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
caption: this.txtGeneral,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: 'General',
|
||||||
|
exampleval: '100',
|
||||||
|
value: Asc.c_oAscNumFormatType.General
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtNumber,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '0.00',
|
||||||
|
exampleval: '100,00',
|
||||||
|
value: Asc.c_oAscNumFormatType.Number
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtScientific,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '0.00E+00',
|
||||||
|
exampleval: '1,00E+02',
|
||||||
|
value: Asc.c_oAscNumFormatType.Scientific
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtAccounting,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
|
||||||
|
exampleval: '100,00 $',
|
||||||
|
value: Asc.c_oAscNumFormatType.Accounting
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtCurrency,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '$#,##0.00',
|
||||||
|
exampleval: '100,00 $',
|
||||||
|
value: Asc.c_oAscNumFormatType.Currency
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtDate,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: 'MM-dd-yyyy',
|
||||||
|
exampleval: '04-09-1900',
|
||||||
|
value: Asc.c_oAscNumFormatType.Date
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtTime,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: 'HH:MM:ss',
|
||||||
|
exampleval: '00:00:00',
|
||||||
|
value: Asc.c_oAscNumFormatType.Time
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtPercentage,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '0.00%',
|
||||||
|
exampleval: '100,00%',
|
||||||
|
value: Asc.c_oAscNumFormatType.Percent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtFraction,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '# ?/?',
|
||||||
|
exampleval: '100',
|
||||||
|
value: Asc.c_oAscNumFormatType.Fraction
|
||||||
|
},
|
||||||
|
{
|
||||||
|
caption: this.txtText,
|
||||||
|
template: numFormatTemplate,
|
||||||
|
checkable: true,
|
||||||
|
format: '@',
|
||||||
|
exampleval: '100',
|
||||||
|
value: Asc.c_oAscNumFormatType.Text
|
||||||
|
},
|
||||||
|
{caption: '--'},
|
||||||
|
me.pmiAdvancedNumFormat = new Common.UI.MenuItem({
|
||||||
|
caption: me.textMoreFormats,
|
||||||
|
value: 'advanced'
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
me.ssMenu = new Common.UI.Menu({
|
me.ssMenu = new Common.UI.Menu({
|
||||||
id : 'id-context-menu-cell',
|
id : 'id-context-menu-cell',
|
||||||
items : [
|
items : [
|
||||||
|
@ -427,6 +527,7 @@ define([
|
||||||
{caption: '--'},
|
{caption: '--'},
|
||||||
me.pmiAddComment,
|
me.pmiAddComment,
|
||||||
me.pmiCellMenuSeparator,
|
me.pmiCellMenuSeparator,
|
||||||
|
me.pmiNumFormat,
|
||||||
me.pmiEntriesList,
|
me.pmiEntriesList,
|
||||||
me.pmiAddNamedRange,
|
me.pmiAddNamedRange,
|
||||||
me.pmiInsFunction,
|
me.pmiInsFunction,
|
||||||
|
@ -832,7 +933,19 @@ define([
|
||||||
originalSizeText: 'Default Size',
|
originalSizeText: 'Default Size',
|
||||||
textReplace: 'Replace image',
|
textReplace: 'Replace image',
|
||||||
textFromUrl: 'From URL',
|
textFromUrl: 'From URL',
|
||||||
textFromFile: 'From File'
|
textFromFile: 'From File',
|
||||||
|
txtNumFormat: 'Number Format',
|
||||||
|
txtGeneral: 'General',
|
||||||
|
txtNumber: 'Number',
|
||||||
|
txtScientific: 'Scientific',
|
||||||
|
txtAccounting: 'Accounting',
|
||||||
|
txtCurrency: 'Currency',
|
||||||
|
txtDate: 'Date',
|
||||||
|
txtTime: 'Time',
|
||||||
|
txtPercentage: 'Percentage',
|
||||||
|
txtFraction: 'Fraction',
|
||||||
|
txtText: 'Text',
|
||||||
|
textMoreFormats: 'More formats'
|
||||||
|
|
||||||
}, SSE.Views.DocumentHolder || {}));
|
}, SSE.Views.DocumentHolder || {}));
|
||||||
});
|
});
|
|
@ -262,6 +262,18 @@ define([
|
||||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var formatTemplate =
|
||||||
|
_.template([
|
||||||
|
'<% _.each(items, function(item) { %>',
|
||||||
|
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',
|
||||||
|
'<div style="position: relative;"><div style="position: absolute; left: 0; width: 100px;"><%= scope.getDisplayValue(item) %></div>',
|
||||||
|
'<div style="display: inline-block; width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;"><%= item.exampleval ? item.exampleval : "" %></div>',
|
||||||
|
'</div></a></li>',
|
||||||
|
'<% }); %>',
|
||||||
|
'<li class="divider">',
|
||||||
|
'<li id="id-toolbar-mnu-item-more-formats" data-value="-1"><a tabindex="-1" type="menuitem">' + me.textMoreFormats + '</a></li>'
|
||||||
|
].join(''));
|
||||||
|
|
||||||
me.cmbNumberFormat = new Common.UI.ComboBox({
|
me.cmbNumberFormat = new Common.UI.ComboBox({
|
||||||
cls : 'input-group-nr',
|
cls : 'input-group-nr',
|
||||||
menuStyle : 'min-width: 180px;',
|
menuStyle : 'min-width: 180px;',
|
||||||
|
|
|
@ -1175,6 +1175,18 @@
|
||||||
"SSE.Views.DocumentHolder.textReplace": "Replace image",
|
"SSE.Views.DocumentHolder.textReplace": "Replace image",
|
||||||
"SSE.Views.DocumentHolder.textFromUrl": "From URL",
|
"SSE.Views.DocumentHolder.textFromUrl": "From URL",
|
||||||
"SSE.Views.DocumentHolder.textFromFile": "From File",
|
"SSE.Views.DocumentHolder.textFromFile": "From File",
|
||||||
|
"SSE.Views.DocumentHolder.txtNumFormat": "Number Format",
|
||||||
|
"SSE.Views.DocumentHolder.txtGeneral": "General",
|
||||||
|
"SSE.Views.DocumentHolder.txtNumber": "Number",
|
||||||
|
"SSE.Views.DocumentHolder.txtScientific": "Scientific",
|
||||||
|
"SSE.Views.DocumentHolder.txtAccounting": "Accounting",
|
||||||
|
"SSE.Views.DocumentHolder.txtCurrency": "Currency",
|
||||||
|
"SSE.Views.DocumentHolder.txtDate": "Date",
|
||||||
|
"SSE.Views.DocumentHolder.txtTime": "Time",
|
||||||
|
"SSE.Views.DocumentHolder.txtPercentage": "Percentage",
|
||||||
|
"SSE.Views.DocumentHolder.txtFraction": "Fraction",
|
||||||
|
"SSE.Views.DocumentHolder.txtText": "Text",
|
||||||
|
"SSE.Views.DocumentHolder.textMoreFormats": "More formats",
|
||||||
"SSE.Views.FileMenu.btnBackCaption": "Go to Documents",
|
"SSE.Views.FileMenu.btnBackCaption": "Go to Documents",
|
||||||
"SSE.Views.FileMenu.btnCloseMenuCaption": "Close Menu",
|
"SSE.Views.FileMenu.btnCloseMenuCaption": "Close Menu",
|
||||||
"SSE.Views.FileMenu.btnCreateNewCaption": "Create New",
|
"SSE.Views.FileMenu.btnCreateNewCaption": "Create New",
|
||||||
|
|
Loading…
Reference in a new issue