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