Merge pull request #149 from ONLYOFFICE/feature/sse-print-area-translate

[SSE] Add parameter to get translated print area name
This commit is contained in:
Julia Radzhabova 2019-03-07 11:08:44 +03:00 committed by GitHub
commit 7d13e2d110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 18 deletions

View file

@ -280,16 +280,16 @@ define([
rangesMenu.removeItems(2, rangesMenu.items.length-1); rangesMenu.removeItems(2, rangesMenu.items.length-1);
names.sort(function(item1, item2) { names.sort(function(item1, item2) {
var n1 = item1.asc_getName().toLowerCase(), var n1 = item1.asc_getName(true).toLowerCase(),
n2 = item2.asc_getName().toLowerCase(); n2 = item2.asc_getName(true).toLowerCase();
if (n1==n2) return 0; if (n1==n2) return 0;
return (n1<n2) ? -1 : 1; return (n1<n2) ? -1 : 1;
}); });
_.each(names, function(field, index) { _.each(names, function(field, index) {
var name = field.asc_getName(); var name = field.asc_getName(true);
if (prev_name !== name) { if (prev_name !== name) {
rangesMenu.addItem(new Common.UI.MenuItem({ rangesMenu.addItem(new Common.UI.MenuItem({
caption : field.asc_getName() caption : name
})); }));
} }
prev_name = name; prev_name = name;

View file

@ -1905,15 +1905,15 @@ define([
i--; i--;
} }
funcarr.sort(function (a,b) { funcarr.sort(function (a,b) {
var aname = a.asc_getName().toLocaleUpperCase(), var aname = a.asc_getName(true).toLocaleUpperCase(),
bname = b.asc_getName().toLocaleUpperCase(); bname = b.asc_getName(true).toLocaleUpperCase();
if (aname < bname) return -1; if (aname < bname) return -1;
if (aname > bname) return 1; if (aname > bname) return 1;
return 0; return 0;
}); });
_.each(funcarr, function(menuItem, index) { _.each(funcarr, function(menuItem, index) {
var type = menuItem.asc_getType(), var type = menuItem.asc_getType(),
name = menuItem.asc_getName(), name = menuItem.asc_getName(true),
origname = me.api.asc_getFormulaNameByLocale(name), origname = me.api.asc_getFormulaNameByLocale(name),
mnu = new Common.UI.MenuItem({ mnu = new Common.UI.MenuItem({
iconCls: (type==Asc.c_oAscPopUpSelectorType.Func) ? 'mnu-popup-func': ((type==Asc.c_oAscPopUpSelectorType.Table) ? 'mnu-popup-table' : 'mnu-popup-range') , iconCls: (type==Asc.c_oAscPopUpSelectorType.Func) ? 'mnu-popup-func': ((type==Asc.c_oAscPopUpSelectorType.Table) ? 'mnu-popup-table' : 'mnu-popup-range') ,

View file

@ -1190,7 +1190,7 @@ define([
(new SSE.Views.NamedRangePasteDlg({ (new SSE.Views.NamedRangePasteDlg({
handler: function(result, settings) { handler: function(result, settings) {
if (result == 'ok' && settings) { if (result == 'ok' && settings) {
me.api.asc_insertFormula(settings.asc_getName(), settings.asc_getIsTable() ? Asc.c_oAscPopUpSelectorType.Table : Asc.c_oAscPopUpSelectorType.Range, false); me.api.asc_insertFormula(settings.asc_getName(true), settings.asc_getIsTable() ? Asc.c_oAscPopUpSelectorType.Table : Asc.c_oAscPopUpSelectorType.Range, false);
Common.component.Analytics.trackEvent('ToolBar', 'Paste Named Range'); Common.component.Analytics.trackEvent('ToolBar', 'Paste Named Range');
} }
Common.NotificationCenter.trigger('edit:complete', me.toolbar); Common.NotificationCenter.trigger('edit:complete', me.toolbar);

View file

@ -190,7 +190,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
var scope = this.ranges[i].asc_getScope(), var scope = this.ranges[i].asc_getScope(),
id = this.ranges[i].asc_getIsLock(); id = this.ranges[i].asc_getIsLock();
arr.push({ arr.push({
name: this.ranges[i].asc_getName(), name: this.ranges[i].asc_getName(true),
scope: scope, scope: scope,
scopeName: (scope===null) ? this.textWorkbook: this.sheetNames[scope], scopeName: (scope===null) ? this.textWorkbook: this.sheetNames[scope],
range: this.ranges[i].asc_getRef(), range: this.ranges[i].asc_getRef(),
@ -233,7 +233,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
}, 50); }, 50);
} else if (selectedItem){ // object } else if (selectedItem){ // object
var rec = store.findWhere({name: selectedItem.asc_getName(), scope: selectedItem.asc_getScope()}); var rec = store.findWhere({name: selectedItem.asc_getName(true), scope: selectedItem.asc_getScope()});
if (rec) { if (rec) {
this.rangeList.selectRecord(rec); this.rangeList.selectRecord(rec);
setTimeout(function() { setTimeout(function() {
@ -285,7 +285,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
xy = me.$window.offset(), xy = me.$window.offset(),
rec = this.rangeList.getSelectedRec(), rec = this.rangeList.getSelectedRec(),
idx = _.indexOf(this.rangeList.store.models, rec[0]), idx = _.indexOf(this.rangeList.store.models, rec[0]),
oldname = (isEdit && rec.length>0) ? new Asc.asc_CDefName(rec[0].get('name'), rec[0].get('range'), rec[0].get('scope'), rec[0].get('isTable')) : null; oldname = (isEdit && rec.length>0) ? new Asc.asc_CDefName(rec[0].get('name'), rec[0].get('range'), rec[0].get('scope'), rec[0].get('isTable'), undefined, undefined, undefined, true) : null;
var win = new SSE.Views.NamedRangeEditDlg({ var win = new SSE.Views.NamedRangeEditDlg({
api: me.api, api: me.api,
@ -319,7 +319,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
var rec = this.rangeList.getSelectedRec(); var rec = this.rangeList.getSelectedRec();
if (rec.length>0) { if (rec.length>0) {
this.currentNamedRange = _.indexOf(this.rangeList.store.models, rec[0]); this.currentNamedRange = _.indexOf(this.rangeList.store.models, rec[0]);
this.api.asc_delDefinedNames(new Asc.asc_CDefName(rec[0].get('name'), rec[0].get('range'), rec[0].get('scope'), rec[0].get('isTable'))); this.api.asc_delDefinedNames(new Asc.asc_CDefName(rec[0].get('name'), rec[0].get('range'), rec[0].get('scope'), rec[0].get('isTable'), undefined, undefined, undefined, true));
} }
}, },

View file

@ -137,7 +137,7 @@ define([
return me.textIsLocked; return me.textIsLocked;
break; break;
case Asc.c_oAscDefinedNameReason.Existed: case Asc.c_oAscDefinedNameReason.Existed:
return (me.isEdit && me.props.asc_getName().toLowerCase() == value.toLowerCase()) ? true : me.textExistName; return (me.isEdit && me.props.asc_getName(true).toLowerCase() == value.toLowerCase()) ? true : me.textExistName;
case Asc.c_oAscDefinedNameReason.NameReserved: case Asc.c_oAscDefinedNameReason.NameReserved:
return (me.isEdit) ? me.textReservedName : true; return (me.isEdit) ? me.textReservedName : true;
default: default:
@ -204,7 +204,7 @@ define([
var val = props.asc_getScope(); var val = props.asc_getScope();
this.cmbScope.setValue((val===null) ? -255 : val); this.cmbScope.setValue((val===null) ? -255 : val);
val = props.asc_getName(); val = props.asc_getName(true);
if ( !_.isEmpty(val) ) this.inputName.setValue(val); if ( !_.isEmpty(val) ) this.inputName.setValue(val);
val = props.asc_getRef(); val = props.asc_getRef();
@ -248,7 +248,7 @@ define([
}, },
getSettings: function() { getSettings: function() {
return (new Asc.asc_CDefName(this.inputName.getValue(), this.txtDataRange.getValue(), (this.cmbScope.getValue()==-255) ? null : this.cmbScope.getValue(), this.props.asc_getIsTable())); return (new Asc.asc_CDefName(this.inputName.getValue(), this.txtDataRange.getValue(), (this.cmbScope.getValue()==-255) ? null : this.cmbScope.getValue(), this.props.asc_getIsTable(), undefined, undefined, undefined, true));
}, },
onPrimary: function() { onPrimary: function() {
@ -295,7 +295,7 @@ define([
onRefreshDefNameList: function(name) { onRefreshDefNameList: function(name) {
var me = this; var me = this;
if (this.isEdit && Common.Utils.InternalSettings.get("sse-settings-coauthmode")) { // fast co-editing if (this.isEdit && Common.Utils.InternalSettings.get("sse-settings-coauthmode")) { // fast co-editing
if (name && name.asc_getIsLock() && name.asc_getName().toLowerCase() == this.props.asc_getName().toLowerCase() && if (name && name.asc_getIsLock() && name.asc_getName(true).toLowerCase() == this.props.asc_getName(true).toLowerCase() &&
(name.asc_getScope() === null && this.props.asc_getScope() === null || name.asc_getScope().toLowerCase() == this.props.asc_getScope().toLowerCase()) && !this._listRefreshed) { (name.asc_getScope() === null && this.props.asc_getScope() === null || name.asc_getScope().toLowerCase() == this.props.asc_getScope().toLowerCase()) && !this._listRefreshed) {
this._listRefreshed = true; this._listRefreshed = true;
Common.UI.alert({ Common.UI.alert({

View file

@ -125,7 +125,7 @@ define([
if (this.ranges) { if (this.ranges) {
var me = this, arr = [], prev_name=''; var me = this, arr = [], prev_name='';
for (var i=0; i<this.ranges.length; i++) { for (var i=0; i<this.ranges.length; i++) {
var name = this.ranges[i].asc_getName(); var name = this.ranges[i].asc_getName(true);
if (name !== prev_name) { if (name !== prev_name) {
arr.push({ arr.push({
name: name, name: name,
@ -150,7 +150,7 @@ define([
getSettings: function() { getSettings: function() {
var rec = this.rangeList.getSelectedRec(); var rec = this.rangeList.getSelectedRec();
return (rec.length>0) ? (new Asc.asc_CDefName(rec[0].get('name'), rec[0].get('range'), rec[0].get('scope'), rec[0].get('isTable'))) : null; return (rec.length>0) ? (new Asc.asc_CDefName(rec[0].get('name'), rec[0].get('range'), rec[0].get('scope'), rec[0].get('isTable'), undefined, undefined, undefined, true)) : null;
}, },
onPrimary: function() { onPrimary: function() {