Commit 0610c954 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

Fixed issue #30564

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68430 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f17bdbb
......@@ -559,6 +559,13 @@ function test_defName(){
var cStrucTableLocalColumns = {"h": "Headers", "d": "Data", "a": "All", "tr": "This row", "t": "Totals"},
cBoolLocal = {"t":"TRUE","f":"FALSE"};
function build_local_rx(data){
build_rx_table_local(data?data["StructureTables"]:null);
build_rx_bool_local(data?data["CONST_TRUE_FALSE"]:null);
// build_rx_array_local(localBool)
}
function build_rx_table_local(local){
rx_table_local = build_rx_table(local);
}
......@@ -590,19 +597,6 @@ function build_rx_table(local){
} )
} )
}, 'i' );
/*
structured_tables_headata = new XRegExp('(?:\\[\\#'+getStructureTableLocaleHeadersNames('headers')+'\\]\\,\\[\\#'+getStructureTableLocaleHeadersNames('data')+'\\])');
structured_tables_datals = new XRegExp('(?:\\[\\+#'+getStructureTableLocaleHeadersNames('data')+'\\]\\,\\[\\#'+getStructureTableLocaleHeadersNames('totals')+'\\])' );
structured_tables_reservedColumn = new XRegExp('\\#(?:'+
getStructureTableLocaleHeadersNames('all')+'|'
getStructureTableLocaleHeadersNames('headers')+'|'
getStructureTableLocaleHeadersNames('totals')+'|'
getStructureTableLocaleHeadersNames('data')+'|'
getStructureTableLocaleHeadersNames('this_row')+
')|@')
*/
}
function build_rx_bool_local(local){
rx_bool_local = build_rx_bool(local);
......@@ -610,13 +604,17 @@ function build_rx_bool_local(local){
function build_rx_bool(local){
cBoolLocal = ( local ? local : {"t":"TRUE","f":"FALSE"} );
var f = cBoolLocal['f'], t = cBoolLocal['t'];
return new RegExp( "^("+t+"|"+f+")([-+*\\/^&%<=>: ;),]|$)","i" );
build_rx_array_local(local)
return new RegExp( "^("+t+"|"+f+")","i" );
}
function build_rx_array_local(){
'^\\{(([+-]?\\d*(\\d|\\.)\\d*([eE][+-]?\\d+)?)?(\\"((\\"\\"|[^\\"])*)\\")?(#NULL!|#DIV\\/0!|#VALUE!|#REF!|#NAME\\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\\/A|#GETTING_DATA|FALSE|TRUE)?[,;]?)*\\}'
function build_rx_array_local(localBool, digitSepar, localError){
var localBool = ( localBool ? localBool : {"t":"TRUE","f":"FALSE"} );
rx_array_local = build_rx_array(localBool, digitSepar, localError);
}
function build_rx_array(local){
function build_rx_array(localBool, digitSepar, localError){
return new RegExp("^\\{(([+-]?\\d*(\\d|\\"+digitSepar+")\\d*([eE][+-]?\\d+)?)?(\"((\"\"|[^\"])*)\")?"+
"(#NULL!|#DIV\/0!|#VALUE!|#REF!|#NAME\\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\/A|#GETTING_DATA|"+
localBool["t"]+"|"+localBool["f"]+")?["+arrayRowSeparator+"\\"+arrayColSeparator +"]?)*\\}","i");
}
var c_oEditorId = {
......@@ -1249,7 +1247,7 @@ parserHelper.prototype.isName = function ( formula, start_pos, wb, ws ) {
if (match != null) {
var name = match["name"];
if ( name && name.length != 0 /*&& wb.DefinedNames && wb.isDefinedNamesExists( name, ws ? ws.getId() : null )*/ ) {
if ( name && name.length != 0 && name != cBoolLocal["t"] && name != cBoolLocal["f"]/*&& wb.DefinedNames && wb.isDefinedNamesExists( name, ws ? ws.getId() : null )*/ ) {
this.pCurrPos += name.length;
this.operand_str = name;
return [ true, name ];
......@@ -1425,7 +1423,7 @@ parserHelper.prototype.setDigitSeparator = function( sep ){
functionArgumentSeparator = ";";
rx_number = new RegExp("^ *[+-]?\\d*(\\d|\\"+ digitSeparator +")\\d*([eE][+-]?\\d+)?");
rx_Comma = new RegExp("^ *["+functionArgumentSeparator+"] *");
rx_array_local = new RegExp("^\\{(([+-]?\\d*(\\d|\\"+digitSeparator+")\\d*([eE][+-]?\\d+)?)?(\"((\"\"|[^\"])*)\")?(#NULL!|#DIV\/0!|#VALUE!|#REF!|#NAME\\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\/A|#GETTING_DATA|FALSE|TRUE)?["+arrayRowSeparator+"\\"+arrayColSeparator +"]?)*\\}","i");
build_rx_array_local( cBoolLocal, digitSeparator, null);
rx_arraySeparators = new RegExp("^ *["+arrayRowSeparator+"\\"+arrayColSeparator+"] *");
}
else{
......@@ -1435,7 +1433,7 @@ parserHelper.prototype.setDigitSeparator = function( sep ){
functionArgumentSeparator = functionArgumentSeparatorDef;
rx_number = new RegExp("^ *[+-]?\\d*(\\d|\\"+ digitSeparatorDef +")\\d*([eE][+-]?\\d+)?");
rx_Comma = new RegExp("^ *["+functionArgumentSeparatorDef+"] *");
rx_array_local = new RegExp("^\\{(([+-]?\\d*(\\d|\\"+digitSeparatorDef+")\\d*([eE][+-]?\\d+)?)?(\"((\"\"|[^\"])*)\")?(#NULL!|#DIV\/0!|#VALUE!|#REF!|#NAME\\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\/A|#GETTING_DATA|FALSE|TRUE)?["+arrayRowSeparatorDef+"\\"+arrayColSeparatorDef +"]?)*\\}","i");
build_rx_array_local( cBoolLocal, digitSeparatorDef, null);
rx_arraySeparators = new RegExp("^ *["+arrayRowSeparatorDef+"\\"+arrayColSeparatorDef+"] *");
}
};
......
......@@ -423,7 +423,7 @@ var editor;
spreadsheet_api.prototype.asc_setLocale = function(val) {
g_oDefaultCultureInfo = g_aCultureInfos[val];
parserHelp.setDigitSeparator( g_oDefaultCultureInfo.NumberDecimalSeparator );
if (this.wbModel) {
if (this.wbModel) {
oGeneralEditFormatCache.cleanCache();
oNumFormatCache.cleanCache();
this.wbModel.rebuildColors();
......@@ -3043,7 +3043,7 @@ var editor;
cFormulaFunctionToLocale[i] = localName;
}
}
build_rx_table_local(oLocalizedData?oLocalizedData["StructureTables"]:null);
build_local_rx(oLocalizedData?oLocalizedData["LocalFormulaOperands"]:null);
if (this.wb) {
this.wb.initFormulasList();
}
......
......@@ -16,7 +16,7 @@ var cElementType = {
cell3D : 12,
cellsRange3D: 13,
table : 14,
name3D : 15
name3D : 15
},
/** @enum */
cErrorType = {
......@@ -379,7 +379,7 @@ cString.prototype.tocNumber = function () {
cString.prototype.tocBool = function () {
var res;
if ( parserHelp.isBoolean( this.value, 0 ) ) {
res = new cBool( parserHelp.operand_str === "TRUE" );
res = new cBool( parserHelp.operand_str.toUpperCase() === cBoolLocal["t"].toUpperCase() );
}
else {
res = this;
......@@ -401,7 +401,12 @@ cString.prototype.tryConvert = function () {
/** @constructor */
function cBool( val ) {
this.constructor.call( this, val.toString().toUpperCase() === "TRUE", cElementType.bool );
var v = false;
switch(val.toString().toUpperCase()){
case "TRUE":
case cBoolLocal["t"].toUpperCase(): v = true;
}
this.constructor.call( this, v, cElementType.bool );
}
cBool.prototype = Object.create( cBaseType.prototype );
......@@ -417,9 +422,8 @@ cBool.prototype.tocNumber = function () {
cBool.prototype.tocString = function () {
return new cString( this.value ? "TRUE" : "FALSE" );
};
cBool.prototype.toLocaleString = function ( digitDelim ) {
return this.toString();
// return new cString( this.value ? "TRUE" : "FALSE" );
cBool.prototype.toLocaleString = function () {
return new cString( this.value ? cBoolLocal["t"].toUpperCase() : cBoolLocal["f"].toUpperCase() );
};
cBool.prototype.tocBool = function () {
return this;
......@@ -4125,7 +4129,7 @@ parserFormula.prototype = {
arr.addRow();
}
}
else if ( pH.isBoolean.call( tO, tO.Formula, tO.pCurrPos ) ) {
else if ( pH.isBoolean.call( tO, tO.Formula, tO.pCurrPos, local ) ) {
arr.addElement( new cBool( tO.operand_str ) );
}
else if ( pH.isString.call( tO, tO.Formula, tO.pCurrPos ) ) {
......@@ -4183,7 +4187,7 @@ parserFormula.prototype = {
}
/* Booleans */
if ( parserHelp.isBoolean.call( this, this.Formula, this.pCurrPos ) ) {
if ( parserHelp.isBoolean.call( this, this.Formula, this.pCurrPos, local ) ) {
found_operand = new cBool( this.operand_str );
}
......
......@@ -10,7 +10,7 @@ var g_nAllColIndex = -1;
var g_nAllRowIndex = -1;
var aStandartNumFormats;
var aStandartNumFormatsId;
var start, end, arrRecalc = {}, arrDefNameRecalc = {}, lc = 0;
var start, end, arrRecalc = {}, arrDefNameRecalc = {}, lc = 0, gFormulaLocaleParse = true, gFormulaLocaleDigetSep = true;
var c_oRangeType =
{
......@@ -2857,6 +2857,8 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
wsViews[i].objectRender.controller.resetSelection();
}
}
gFormulaLocaleParse = false;
gFormulaLocaleDigetSep = false;
History.Clear();
History.Create_NewPoint();
......@@ -2895,6 +2897,8 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
}
}
}
gFormulaLocaleParse = true;
gFormulaLocaleDigetSep = true;
History.UndoRedoEnd(null, oRedoObjectParam, false);
oThis.bCollaborativeChanges = false;
......@@ -5337,7 +5341,7 @@ Cell.prototype.setValue=function(val,callback, isCopyPaste){
oldFP = this.formulaParsed;
var cellId = g_oCellAddressUtils.getCellId(this.nRow, this.nCol);
this.formulaParsed = new parserFormula(val.substring(1),cellId,this.ws);
if( !this.formulaParsed.parse(true,true) ){
if( !this.formulaParsed.parse( gFormulaLocaleParse, gFormulaLocaleDigetSep ) ){
switch( this.formulaParsed.error[this.formulaParsed.error.length-1] ){
case c_oAscError.ID.FrmlWrongFunctionName:
break;
......
......@@ -2853,7 +2853,7 @@ CCellValue.prototype =
if(null != this.number)
{
if(CellValueType.Bool == this.type)
sResult = this.number == 1 ? "TRUE" : "FALSE";
sResult = this.number == 1 ? cBoolLocal["t"].toUpperCase() : cBoolLocal["f"].toUpperCase();
else
sResult = this.number.toString();
}
......@@ -2989,7 +2989,7 @@ CCellValue.prototype =
else if(CellValueType.Bool == this.type)
{
if(null != this.number)
sText = (0 != this.number) ? "TRUE" : "FALSE";
sText = (0 != this.number) ? cBoolLocal["t"].toUpperCase(): cBoolLocal["f"].toUpperCase();
}
else if(CellValueType.Error == this.type)
{
......@@ -3038,7 +3038,7 @@ CCellValue.prototype =
if(null != this.text || null != this.number)
{
if (CellValueType.Bool == this.type && null != this.number)
oValueText = (this.number == 1) ? "TRUE" : "FALSE";
oValueText = (this.number == 1) ? cBoolLocal["t"].toUpperCase() : cBoolLocal["f"].toUpperCase();
else
{
if(null != this.text)
......@@ -3215,10 +3215,10 @@ CCellValue.prototype =
else
{
var sUpText = val.toUpperCase();
if("TRUE" == sUpText || "FALSE" == sUpText)
if(cBoolLocal["t"].toUpperCase() == sUpText || cBoolLocal["f"].toUpperCase() == sUpText)
{
this.type = CellValueType.Bool;
this.number = ("TRUE" == sUpText) ? 1 : 0;
this.number = (cBoolLocal["t"].toUpperCase() == sUpText) ? 1 : 0;
}
else if("#NULL!" == sUpText || "#DIV/0!" == sUpText || "#NAME?" == sUpText || "#NUM!" == sUpText ||
"#N/A" == sUpText || "#REF!" == sUpText || "#VALUE!" == sUpText)
......
......@@ -175,7 +175,7 @@
// Флаг о подписке на эвенты о смене позиции документа (скролл) для меню
this.isDocumentPlaceChangedEnabled = false;
// Константы для подстановке формулы (что не нужно добавлять скобки)
this.arrExcludeFormulas = ['TRUE', 'FALSE'];
this.arrExcludeFormulas = [cBoolLocal["t"].toUpperCase(), cBoolLocal["f"].toUpperCase()];
// Максимальная ширина числа из 0,1,2...,9, померенная в нормальном шрифте(дефалтовый для книги) в px(целое)
// Ecma-376 Office Open XML Part 1, пункт 18.3.1.13
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment