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

fix: Bug 21067 - Не пересчитывается функция INDIRECT если значение в ячейке было изменено

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50611 954022d7-b5bf-4e40-9824-e11837661b57
parent 9a918271
......@@ -389,10 +389,10 @@ cFormulaFunction.LookupAndReference = {
},
'INDIRECT':function () {
var r = new cBaseFunction( "INDIRECT" );
r.setArgumentsMin( 0 );
r.setArgumentsMax( 1 );
r.setArgumentsMin( 1 );
r.setArgumentsMax( 2 );
r.Calculate = function ( arg ) {
var arg0 = arg[0].tocString(), r = arguments[1], wb = r.worksheet.workbook, o = { Formula:"", pCurrPos:0 }, ref, found_operand;
var arg0 = arg[0].tocString(), arg1 = arg[1] ? arg[1] : new cBool( true ), r = arguments[1], wb = r.worksheet.workbook, o = { Formula:"", pCurrPos:0 }, ref, found_operand;
function parseReference() {
if ( (ref = parserHelp.is3DRef.call( o, o.Formula, o.pCurrPos ))[0] ) {
......@@ -450,7 +450,24 @@ cFormulaFunction.LookupAndReference = {
if ( found_operand ){
if( found_operand instanceof cName )
found_operand = found_operand.toRef()
found_operand = found_operand.toRef();
var cellName = r.getCells()[0].getName(), wsId = r.worksheet.getId();
if ( (found_operand instanceof cRef || found_operand instanceof cRef3D || found_operand instanceof cArea) && found_operand.isValid() ) {
var nFrom = new Vertex( wsId, cellName.replace( /\$/g, "" ), this.wb ),
nTo = new Vertex( found_operand.getWsId(), found_operand._cells.replace( /\$/g, "" ), this.wb );
found_operand.setNode(nTo);
wb.dependencyFormulas.addEdge2( nFrom, nTo );
}
else if ( found_operand instanceof cArea3D && found_operand.isValid() ) {
var wsR = found_operand.wsRange();
for ( var j = 0; j < wsR.length; j++ )
wb.dependencyFormulas.addEdge( wsId, cellName.replace( /\$/g, "" ), wsR[j].Id, found_operand._cells.replace( /\$/g, "" ) );
}
return this.value = found_operand;
}
......
......@@ -3060,7 +3060,7 @@ parserFormula.prototype = {
buildDependencies:function () {
var node = new Vertex( this.ws.Id, this.cellId, this.wb );
var node = new Vertex( this.ws.Id, this.cellId.replace( /\$/g, "" ), this.wb );
this.wb.dependencyFormulas.addNode2( node );
this.wb.dependencyFormulas.addN( this.ws.Id, this.cellId );
......@@ -3083,9 +3083,9 @@ parserFormula.prototype = {
if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea) && ref.isValid() ) {
var nFrom = new Vertex( this.ws.Id, this.cellId.replace( /\$/g, "" ), this.wb ),
nTo = new Vertex( ref.getWsId(), ref._cells.replace( /\$/g, "" ), this.wb );
ref.setNode(nTo);
// this.wb.dependencyFormulas.addEdge( this.ws.Id, this.cellId.replace( /\$/g, "" ), ref.getWsId(), ref._cells.replace( /\$/g, "" ) );
this.wb.dependencyFormulas.addEdge2( nFrom, nTo );
}
else if ( ref instanceof cArea3D && ref.isValid() ) {
......
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