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

Fixed issues #31775,#31774

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68551 954022d7-b5bf-4e40-9824-e11837661b57
parent 086f115f
......@@ -558,12 +558,15 @@ function test_defName(){
}
var cStrucTableLocalColumns = {"h": "Headers", "d": "Data", "a": "All", "tr": "This row", "t": "Totals"},
cBoolLocal = {"t":"TRUE","f":"FALSE"};
cBoolLocal = {"t":"TRUE","f":"FALSE"},
cErrorLocal = {nil:"#NULL!",div:"#DIV\/0!",value:"#VALUE!",ref:"#REF!",name:"#NAME\\?",num:"#NUM!",na:"#N\/A",getdata:"#GETTING_DATA",uf:"#UNSUPPORTED_FUNCTION!"};
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)
build_rx_error_local(data?data["CONST_ERROR"]:null);
}
function build_rx_table_local(local){
......@@ -607,6 +610,24 @@ function build_rx_bool(local){
build_rx_array_local(local)
return new RegExp( "^("+t+"|"+f+")","i" );
}
function build_rx_error_local(local){
rx_error_local = build_rx_error(null/*local*/);
}
function build_rx_error(local){
cErrorLocal = ( local ? local : {nil:"#NULL!",div:"#DIV\/0!",value:"#VALUE!",ref:"#REF!",name:"#NAME\\?",num:"#NUM!",na:"#N\/A",getdata:"#GETTING_DATA",uf:"#UNSUPPORTED_FUNCTION!"} );
return new RegExp( "^(" + cErrorLocal["nil"] + "|" +
cErrorLocal["div"] + "|" +
cErrorLocal["value"] + "|" +
cErrorLocal["ref"] + "|" +
cErrorLocal["name"] + "|" +
cErrorLocal["num"] + "|" +
cErrorLocal["na"] + "|" +
cErrorLocal["getdata"] + "|" +
cErrorLocal["uf"] + ")", "i" );
}
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);
......@@ -942,7 +963,7 @@ var str_namedRanges = "A-Za-z\u005F\u0080-\u0081\u0083\u0085-\u0087\u0089-\u008A
rgRows = /^\$?\d+:\$?\d+/,
rx_ref = /^ *(\$?[A-Za-z]{1,3}\$?(\d{1,7}))([-+*\/^&%<=>: ;),]|$)/,
rx_refAll = /^(\$?[A-Za-z]+\$?(\d+))([-+*\/^&%<=>: ;),]|$)/,
rx_ref3D_non_quoted = new XRegExp( "^(?<name_from>["+str_namedRanges+"]["+str_namedRanges+"\\d.]+)(:(?<name_to>["+str_namedRanges+"]["+str_namedRanges+"\\d.]+))?!","i" ),
rx_ref3D_non_quoted = new XRegExp( "^(?<name_from>["+str_namedRanges+"]["+str_namedRanges+"\\d.]*)(:(?<name_to>["+str_namedRanges+"]["+str_namedRanges+"\\d.]*))?!","i" ),
rx_ref3D_quoted = new XRegExp( "^'(?<name_from>(?:''|[^\\[\\]'\\/*?:])*)(?::(?<name_to>(?:''|[^\\[\\]'\\/*?:])*))?'!" ),
rx_ref3D = new XRegExp( "^(?<name_from>[^:]+)(:(?<name_to>[^:]+))?!" ),
rx_before_operators = /^ *[,()]/,
......@@ -951,7 +972,10 @@ var str_namedRanges = "A-Za-z\u005F\u0080-\u0081\u0083\u0085-\u0087\u0089-\u008A
rx_RightParentheses = /^ *\)/,
rx_Comma = /^ *[,;] */,
rx_arraySeparators = /^ *[,;] */,
rx_error = /^(#NULL!|#DIV\/0!|#VALUE!|#REF!|#NAME\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\/A|#GETTING_DATA)/i,
rx_error = build_rx_error(null ),// /^(#NULL!|#DIV\/0!|#VALUE!|#REF!|#NAME\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\/A|#GETTING_DATA)/i,
rx_error_local = build_rx_error_local(null),// /^(#NULL!|#DIV\/0!|#VALUE!|#REF!|#NAME\?|#NUM!|#UNSUPPORTED_FUNCTION!|#N\/A|#GETTING_DATA)/i,
rx_bool = build_rx_bool(null),
rx_bool_local = build_rx_bool(null),
rx_string = /^\"((\"\"|[^\"])*)\"/,
......@@ -1198,12 +1222,12 @@ parserHelper.prototype.isArraySeparator = function ( formula, start_pos, digitDe
}
return false;
};
parserHelper.prototype.isError = function ( formula, start_pos ) {
parserHelper.prototype.isError = function ( formula, start_pos, local ) {
if ( this instanceof parserHelper ) {
this._reset();
}
var match = (formula.substring( start_pos )).match( rx_error );
var match = (formula.substring( start_pos )).match( local?rx_error_local:rx_error );
if (match != null) {
this.operand_str = match[0];
this.pCurrPos += match[0].length;
......@@ -1423,7 +1447,7 @@ parserHelper.prototype.setDigitSeparator = function( sep ){
functionArgumentSeparator = ";";
rx_number = new RegExp("^ *[+-]?\\d*(\\d|\\"+ digitSeparator +")\\d*([eE][+-]?\\d+)?");
rx_Comma = new RegExp("^ *["+functionArgumentSeparator+"] *");
build_rx_array_local( cBoolLocal, digitSeparator, null);
// build_rx_array_local( cBoolLocal, digitSeparator, null);
rx_arraySeparators = new RegExp("^ *["+arrayRowSeparator+"\\"+arrayColSeparator+"] *");
}
else{
......@@ -1433,7 +1457,7 @@ parserHelper.prototype.setDigitSeparator = function( sep ){
functionArgumentSeparator = functionArgumentSeparatorDef;
rx_number = new RegExp("^ *[+-]?\\d*(\\d|\\"+ digitSeparatorDef +")\\d*([eE][+-]?\\d+)?");
rx_Comma = new RegExp("^ *["+functionArgumentSeparatorDef+"] *");
build_rx_array_local( cBoolLocal, digitSeparatorDef, null);
// build_rx_array_local( cBoolLocal, digitSeparatorDef, null);
rx_arraySeparators = new RegExp("^ *["+arrayRowSeparatorDef+"\\"+arrayColSeparatorDef+"] *");
}
};
......
......@@ -439,6 +439,7 @@ function cError( val ) {
this.errorType = -1;
switch ( val ) {
case cErrorLocal["value"]:
case "#VALUE!":
case cErrorType.wrong_value_type:
{
......@@ -446,6 +447,7 @@ function cError( val ) {
this.errorType = cErrorType.wrong_value_type;
break;
}
case cErrorLocal["nil"]:
case "#NULL!":
case cErrorType.null_value:
{
......@@ -453,6 +455,7 @@ function cError( val ) {
this.errorType = cErrorType.null_value;
break;
}
case cErrorLocal["div"]:
case "#DIV/0!":
case cErrorType.division_by_zero:
{
......@@ -460,6 +463,7 @@ function cError( val ) {
this.errorType = cErrorType.division_by_zero;
break;
}
case cErrorLocal["ref"]:
case "#REF!":
case cErrorType.bad_reference:
{
......@@ -467,6 +471,7 @@ function cError( val ) {
this.errorType = cErrorType.bad_reference;
break;
}
case cErrorLocal["name"]:
case "#NAME?":
case cErrorType.wrong_name:
{
......@@ -474,6 +479,7 @@ function cError( val ) {
this.errorType = cErrorType.wrong_name;
break;
}
case cErrorLocal["num"]:
case "#NUM!":
case cErrorType.not_numeric:
{
......@@ -481,6 +487,7 @@ function cError( val ) {
this.errorType = cErrorType.not_numeric;
break;
}
case cErrorLocal["na"]:
case "#N/A":
case cErrorType.not_available:
{
......@@ -488,6 +495,7 @@ function cError( val ) {
this.errorType = cErrorType.not_available;
break;
}
case cErrorLocal["getdata"]:
case "#GETTING_DATA":
case cErrorType.getting_data:
{
......@@ -495,6 +503,7 @@ function cError( val ) {
this.errorType = cErrorType.getting_data;
break;
}
case cErrorLocal["uf"]:
case "#UNSUPPORTED_FUNCTION!":
case cErrorType.unsupported_function:
{
......
......@@ -270,7 +270,8 @@ DependencyGraph.prototype = {
for (var i in oSlaves) {
slave = oSlaves[i];
if( slave instanceof DefNameVertex ){
this.wb.delDefinesNames(slave.getAscCDefName());
if(!slave.isTable)
this.wb.delDefinesNames(slave.getAscCDefName());
continue;
}
if (null == toDelete || slave != toDelete[slave.nodeId]) {
......@@ -1102,6 +1103,7 @@ DependencyGraph.prototype = {
newRefClone = newRef.clone(true);
newRefClone.r1++;
table.Ref = table.Ref.split("!")[0]+"!"+newRefClone.getAbsName();
table.rebuild();
// table.Ref = parserHelp.getEscapeSheetName(ws.getName())+"!"+newRef.getAbsName();
},
delTableName:function(name,ws){
......@@ -1685,6 +1687,7 @@ DefNameVertex.prototype = {
rebuild:function(){
if(this.Ref){
this.deleteAllMasterEdges();
this.parsedRef = new parserFormula(this.Ref, "", this.wb.getWorksheet(0));
this.parsedRef.parse();
this.parsedRef.buildDependencies(null,this);
......
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