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