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

fix: Bug 30401 - [Undo&Redo][NamedRanges]Не отображается имя диапазона в...

fix: Bug 30401 - [Undo&Redo][NamedRanges]Не отображается имя диапазона в диспетчере имен после отмены Delete Cells (http://bugzserver/show_bug.cgi?id=30401)
Bug 30403 - [NamedRanges][Undo&Redo][CoEdit]Ошибка в консоли после после Delete Cells и использования диапазона в формуле (http://bugzserver/show_bug.cgi?id=30403)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64909 954022d7-b5bf-4e40-9824-e11837661b57
parent e0e3aafe
...@@ -1328,38 +1328,22 @@ cName.prototype.reParse = function () { ...@@ -1328,38 +1328,22 @@ cName.prototype.reParse = function () {
} }
}; };
cName.prototype.addDefinedNameNode = function ( nameReParse ) { cName.prototype.addDefinedNameNode = function ( nameReParse ) {
if ( nameReParse ) {
this.reParse();
}
if ( !this.defName || !this.defName.Ref ) { if ( !this.defName || !this.defName.Ref ) {
return this.wb.dependencyFormulas.addDefinedNameNode( this.value, null ); return this.wb.dependencyFormulas.addDefinedNameNode( this.value, null );
} }
return this.wb.getDefinesNames( this.defName.Name, this.ws.getId() );
};
cName.prototype.Calculate = function(){
if ( !this.defName || !this.defName.Ref ) {
return new cError( cErrorType.wrong_name );
}
var node = this.wb.getDefinesNames( this.defName.Name, this.ws.getId() ), wsR, ref, nTo;
if(!this.defName.parsedRef){ if(!this.defName.parsedRef){
this.defName.parsedRef = new parserFormula( this.defName.Ref, "", this.ws ); return new cError( cErrorType.wrong_name );
this.defName.parsedRef.parse();
} }
for ( var i = 0; i < this.defName.parsedRef.outStack.length; i++ ) {
ref = this.defName.parsedRef.outStack[i];
if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea) && ref.isValid() ) { return this.defName.parsedRef.calculate();
nTo = this.wb.dependencyFormulas.addNode( ref.getWsId(), ref._cells.replace( this.regSpace, "" ) );
this.wb.dependencyFormulas.addEdge2( node, nTo );
}
else if ( ref instanceof cArea3D && ref.isValid() ) {
wsR = ref.wsRange();
for ( var j = 0; j < wsR.length; j++ ) {
nTo = this.wb.dependencyFormulas.addNode( wsR[j].Id, ref._cells.replace( this.regSpace, "" ) );
this.wb.dependencyFormulas.addEdge2( node, nTo );
}
}
else if ( ref instanceof cName ){
this.wb.dependencyFormulas.addEdge2( node, this.defName );
}
}
return node;
}; };
/** @constructor */ /** @constructor */
...@@ -3750,17 +3734,9 @@ parserFormula.prototype = { ...@@ -3750,17 +3734,9 @@ parserFormula.prototype = {
if ( this.outStack.length < 1 ) { if ( this.outStack.length < 1 ) {
return this.value = new cError( cErrorType.wrong_name ); return this.value = new cError( cErrorType.wrong_name );
} }
var elemArr = [], stack = [], _tmp, numFormat = -1; var elemArr = [], _tmp, numFormat = -1, currentElement = null;
for ( var i = 0; i < this.outStack.length; i++ ) { for ( var i = 0; i < this.outStack.length; i++ ) {
_tmp = this.outStack[i]; currentElement = this.outStack[i];
if ( _tmp instanceof cName ) {
_tmp = _tmp.toRef( this.ws.getId() );
}
stack[i] = _tmp;
}
var currentElement = null;
while ( stack.length != 0 ) {
currentElement = stack.shift();
if ( currentElement.name == "(" ) { if ( currentElement.name == "(" ) {
continue; continue;
} }
...@@ -3784,6 +3760,9 @@ parserFormula.prototype = { ...@@ -3784,6 +3760,9 @@ parserFormula.prototype = {
elemArr.push( _tmp ); elemArr.push( _tmp );
} }
} }
else if( currentElement.type == cElementType.name ){
elemArr.push( currentElement.Calculate() );
}
else { else {
elemArr.push( currentElement ); elemArr.push( currentElement );
} }
...@@ -4243,14 +4222,6 @@ parserFormula.prototype = { ...@@ -4243,14 +4222,6 @@ parserFormula.prototype = {
for ( var i = 0; i < this.outStack.length; i++ ) { for ( var i = 0; i < this.outStack.length; i++ ) {
ref = this.outStack[i]; ref = this.outStack[i];
if ( ref instanceof cName ) {
nTo = ref.addDefinedNameNode( nameReParse );
this.wb.dependencyFormulas.addEdge2( node, nTo );
// ref = ref.toRef( this.ws.getId() );
// if ( ref instanceof cError )
// continue;
}
if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea || ref instanceof cArea3D) && if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea || ref instanceof cArea3D) &&
ref.isValid() && this.outStack[i + 1] && this.outStack[i + 1] instanceof cBaseFunction && ref.isValid() && this.outStack[i + 1] && this.outStack[i + 1] instanceof cBaseFunction &&
this.reRowCol.test( this.outStack[i + 1].name ) ) { this.reRowCol.test( this.outStack[i + 1].name ) ) {
...@@ -4258,12 +4229,12 @@ parserFormula.prototype = { ...@@ -4258,12 +4229,12 @@ parserFormula.prototype = {
continue; continue;
} }
if ( ref instanceof cName ) {
if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea) && ref.isValid() ) { nTo = ref.addDefinedNameNode( /*nameReParse*/ );
this.wb.dependencyFormulas.addEdge2( node, nTo );
}
else if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea) && ref.isValid() ) {
nTo = this.wb.dependencyFormulas.addNode( ref.getWsId(), ref._cells.replace( this.regSpace, "" ) ); nTo = this.wb.dependencyFormulas.addNode( ref.getWsId(), ref._cells.replace( this.regSpace, "" ) );
// ref.setNode( nTo );
this.wb.dependencyFormulas.addEdge2( node, nTo ); this.wb.dependencyFormulas.addEdge2( node, nTo );
} }
else if ( ref instanceof cArea3D && ref.isValid() ) { else if ( ref instanceof cArea3D && ref.isValid() ) {
......
...@@ -2866,7 +2866,7 @@ UndoRedoWorkbook.prototype = { ...@@ -2866,7 +2866,7 @@ UndoRedoWorkbook.prototype = {
} }
else if(historyitem_Workbook_DefinedNamesAdd === Type ){ else if(historyitem_Workbook_DefinedNamesAdd === Type ){
if(bUndo){ if(bUndo){
this.wb.delDefinesNames( Data.newName ); this.wb.delDefinesNames( Data.newName, true );
this.wb.handlers.trigger("asc_onDelDefName") this.wb.handlers.trigger("asc_onDelDefName")
} }
else{ else{
...@@ -2879,7 +2879,7 @@ UndoRedoWorkbook.prototype = { ...@@ -2879,7 +2879,7 @@ UndoRedoWorkbook.prototype = {
oConflictDefName.renameDefNameToCollaborate(this.wb.getUniqueDefinedNameFrom(oConflictDefName, true)); oConflictDefName.renameDefNameToCollaborate(this.wb.getUniqueDefinedNameFrom(oConflictDefName, true));
} }
} }
this.wb.editDefinesNames( null, Data.newName, !bUndo ); this.wb.editDefinesNames( null, Data.newName, true );
this.wb.handlers.trigger("asc_onEditDefName", null, Data.newName); this.wb.handlers.trigger("asc_onEditDefName", null, Data.newName);
} }
/*TODO /*TODO
...@@ -2898,12 +2898,12 @@ UndoRedoWorkbook.prototype = { ...@@ -2898,12 +2898,12 @@ UndoRedoWorkbook.prototype = {
oldName = Data.oldName; oldName = Data.oldName;
newName = Data.newName; newName = Data.newName;
} }
res = this.wb.editDefinesNames( oldName, newName, bUndo ); res = this.wb.editDefinesNames( oldName, newName, true );
this.wb.handlers.trigger("asc_onEditDefName", oldName, newName); this.wb.handlers.trigger("asc_onEditDefName", oldName, newName);
} }
else if(historyitem_Workbook_DefinedNamesDelete === Type ){ else if(historyitem_Workbook_DefinedNamesDelete === Type ){
if(bUndo){ if(bUndo){
this.wb.editDefinesNames( null, Data, bUndo ); this.wb.editDefinesNames( null, Data, true );
if( Data.slaveEdge ){ if( Data.slaveEdge ){
var n; var n;
for(var i = 0; i < Data.slaveEdge.length; i++){ for(var i = 0; i < Data.slaveEdge.length; i++){
...@@ -2913,19 +2913,16 @@ UndoRedoWorkbook.prototype = { ...@@ -2913,19 +2913,16 @@ UndoRedoWorkbook.prototype = {
this.wb.needRecalc.length++; this.wb.needRecalc.length++;
n = n.returnCell(); n = n.returnCell();
n ? function(){ if(n){
n.formulaParsed = new parserFormula( n.formulaParsed.Formula, n.formulaParsed.cellId, n.formulaParsed.ws ) n.formulaParsed = new parserFormula( n.formulaParsed.Formula, n.formulaParsed.cellId, n.formulaParsed.ws )
n.formulaParsed.parse(); }
n.formulaParsed.buildDependencies();
}() : null;
} }
} }
sortDependency(this.wb);
} }
this.wb.handlers.trigger("asc_onEditDefName", null, Data); this.wb.handlers.trigger("asc_onEditDefName", null, Data);
} }
else{ else{
this.wb.delDefinesNames( Data ); this.wb.delDefinesNames( Data, true );
} }
} }
} }
......
This diff is collapsed.
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