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

пересчет формул ы если создается именованный диапазон с приоритетом на листе.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63191 954022d7-b5bf-4e40-9824-e11837661b57
parent 8fcf0aa9
......@@ -1298,7 +1298,7 @@ cName.prototype.getRef = function () {
cName.prototype.reParse = function () {
var dN = this.wb.getDefinesNames( this.defName.Name, this.ws.getId() );
if ( dN ) {
this.ref = new parserFormula( dN, "", this.ws );
this.ref = new parserFormula( dN.Ref, "", this.ws );
this.ref.parse();
}
else {
......@@ -3179,11 +3179,12 @@ parserFormula.prototype = {
this.Formula = formula;
this.value = null;
this.pCurrPos = 0;
this.pCurrPos = 0;
this.elemArr = [];
this.outStack = [];
this.RefPos = [];
this.operand_str = null;
this.isParsed = false;
},
setCellId:function ( cellId ) {
......@@ -3482,8 +3483,11 @@ parserFormula.prototype = {
this.is3D = true;
var _wsFrom = _3DRefTmp[1],
_wsTo = ( (_3DRefTmp[2] !== null) && (_3DRefTmp[2] !== undefined) ) ? _3DRefTmp[2] : _wsFrom;
if ( !(this.wb.getWorksheetByName( _wsFrom ) && this.wb.getWorksheetByName( _wsTo )) ) {
_wsTo = ( (_3DRefTmp[2] !== null) && (_3DRefTmp[2] !== undefined) ) ? _3DRefTmp[2] : _wsFrom,
wsF = this.wb.getWorksheetByName( _wsFrom ),
wsT = this.wb.getWorksheetByName( _wsTo );
if ( !(wsF && wsT) ) {
this.error.push( c_oAscError.ID.FrmlAnotherParsingError );
this.outStack = [];
this.elemArr = [];
......@@ -3508,6 +3512,9 @@ parserFormula.prototype = {
found_operand.isAbsolute = true;
}
}
/*else if ( parserHelp.isName.call( this, this.Formula, this.pCurrPos ) ) {
found_operand = new cName3D( this.operand_str, this.wb, wsF );
}*/
this.countRef++;
}
......
......@@ -834,14 +834,14 @@ DependencyGraph.prototype = {
if ( sheetNodeList ) {
nodeId = getDefNameVertexId( sheetId, name );
oRes = sheetNodeList[nodeId];
if ( oRes ) return oRes;
if ( oRes && oRes.Ref ) return oRes;
}
}
sheetNodeList = this.defNameSheets["WB"];
nodeId = getDefNameVertexId( null, name );
oRes = sheetNodeList[nodeId];
if ( oRes ) return oRes;
if ( oRes && !oRes.Ref ) oRes = false;
return oRes;
},
......@@ -2374,7 +2374,7 @@ Workbook.prototype.getDefinesNames = function ( name, sheetId ) {
};
Workbook.prototype.delDefinesNames = function ( defName ) {
History.Create_NewPoint();
var retRes = false, res = null;
var retRes = false;
retRes = this.dependencyFormulas.removeDefName( defName.LocalSheetId, defName.Name );
......@@ -2401,7 +2401,7 @@ Workbook.prototype.delDefinesNames = function ( defName ) {
se = se.returnCell();
if( se ){
se.setFormula( se.formulaParsed.assemble() );
// se.setFormula( se.formulaParsed.assemble() );
se.formulaParsed.isParsed = false;
se.formulaParsed.parse();
se.formulaParsed.buildDependencies();
......@@ -2418,7 +2418,7 @@ Workbook.prototype.delDefinesNames = function ( defName ) {
};
Workbook.prototype.editDefinesNames = function ( oldName, newName, bUndo ) {
var newN = newName.Name.toLowerCase(), retRes = null, rename = false;
var newN = newName.Name.toLowerCase(), retRes = null, rename = false, nSE, se;
if ( !rx_defName.test( newN ) ) {
return retRes;
......@@ -2450,10 +2450,15 @@ Workbook.prototype.editDefinesNames = function ( oldName, newName, bUndo ) {
* удаляем старые master и добавляем новые, которые получились в результате разбора новой ссылки; пересчитываем формулу.
* */
if ( rename ) {
var nSE = retRes.getSlaveEdges(), se;
if( !rename ){
retRes.deleteAllMasterEdges();
retRes = this.dependencyFormulas.getDefNameNodeByName(newName.Name)
}
if(retRes){
nSE = retRes.getSlaveEdges();
}
for ( var id in nSE ) {
se = nSE[id];
......@@ -2463,19 +2468,29 @@ Workbook.prototype.editDefinesNames = function ( oldName, newName, bUndo ) {
this.needRecalc.length++;
se = se.returnCell();
se ? function () {
if ( se ) {
se.setFormula( se.formulaParsed.assemble() );
se.formulaParsed.buildDependencies( true );
}() : null;
if ( !rename ) {
se.formulaParsed.setFormula(se.sFormula)
se.formulaParsed.parse();
}
sortDependency( this );
se.formulaParsed.buildDependencies( true );
}
}
if(retRes){
retRes.deleteAllSlaveEdges();
retRes = retRes.getAscCDefName();
}
sortDependency( this );
}
return retRes;
};
......
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