diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
index 50b3e0d5e..1dca4e59e 100644
--- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
+++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
@@ -82,7 +82,7 @@ define([
me._currentMathObj = undefined;
me._currentParaObjDisabled = false;
me._isDisabled = false;
-
+ me._state = {};
/** coauthoring begin **/
this.wrapEvents = {
apiHideComment: _.bind(this.onApiHideComment, this)
@@ -196,6 +196,10 @@ define([
view.menuSignatureEditSetup.on('click', _.bind(me.onSignatureClick, me));
view.menuImgOriginalSize.on('click', _.bind(me.onOriginalSizeClick, 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 {
view.menuViewCopy.on('click', _.bind(me.onCopyPaste, me));
view.menuViewUndo.on('click', _.bind(me.onUndo, me));
@@ -1482,6 +1486,10 @@ define([
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) {
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
'+
+ ''+
+ '
<%= caption %>
' +
+ '
' +
+ '
');
+
+ 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({
id : 'id-context-menu-cell',
items : [
@@ -427,6 +527,7 @@ define([
{caption: '--'},
me.pmiAddComment,
me.pmiCellMenuSeparator,
+ me.pmiNumFormat,
me.pmiEntriesList,
me.pmiAddNamedRange,
me.pmiInsFunction,
@@ -832,7 +933,19 @@ define([
originalSizeText: 'Default Size',
textReplace: 'Replace image',
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 || {}));
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js
index 23f6cd580..32a6b3b55 100644
--- a/apps/spreadsheeteditor/main/app/view/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js
@@ -262,6 +262,18 @@ define([
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
});
+ var formatTemplate =
+ _.template([
+ '<% _.each(items, function(item) { %>',
+ '',
+ '<%= scope.getDisplayValue(item) %>
',
+ '
<%= item.exampleval ? item.exampleval : "" %>
',
+ '
',
+ '<% }); %>',
+ '',
+ '' + me.textMoreFormats + ''
+ ].join(''));
+
me.cmbNumberFormat = new Common.UI.ComboBox({
cls : 'input-group-nr',
menuStyle : 'min-width: 180px;',
diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json
index df79a28cc..69a6b21ac 100644
--- a/apps/spreadsheeteditor/main/locale/en.json
+++ b/apps/spreadsheeteditor/main/locale/en.json
@@ -1175,6 +1175,18 @@
"SSE.Views.DocumentHolder.textReplace": "Replace image",
"SSE.Views.DocumentHolder.textFromUrl": "From URL",
"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.btnCloseMenuCaption": "Close Menu",
"SSE.Views.FileMenu.btnCreateNewCaption": "Create New",