Commit 082674b0 authored by konovalovsergey's avatar konovalovsergey

lookupandreference unused, remove read calcchain, defnames changes

parent 277b65fc
...@@ -636,37 +636,6 @@ ...@@ -636,37 +636,6 @@
found_operand = found_operand.toRef(); found_operand = found_operand.toRef();
} }
var cellName = r1.getFirst().getID(), wsId = r1.worksheet.getId();
if ((cElementType.cell === found_operand.type || cElementType.cell3D === found_operand.type ||
cElementType.cellsRange === found_operand.type) && found_operand.isValid()) {
var nFrom, nTo;
if (r2) {
nFrom = r2.defName;
} else {
nFrom = wb.dependencyFormulas.addNode(wsId, cellName);
}
nTo = wb.dependencyFormulas.addNode(found_operand.getWsId(), found_operand._cells);
found_operand.setNode(nTo);
wb.dependencyFormulas.addEdge2(nFrom, nTo);
} else if (cElementType.cellsRange3D === found_operand.type && found_operand.isValid()) {
var wsR = found_operand.wsRange(), nTo, _cell = found_operand._cells.replace(/\$/g, "");
for (var j = 0; j < wsR.length; j++) {
if (r2) {
nTo = wb.dependencyFormulas.addNode(wsR[j].Id, _cell);
wb.dependencyFormulas.addEdge2(r2.defName, nTo);
} else {
wb.dependencyFormulas.addEdge(wsId, cellName.replace(/\$/g, ""), wsR[j].Id, _cell);
}
}
}
return this.value = found_operand; return this.value = found_operand;
} }
...@@ -1043,38 +1012,6 @@ ...@@ -1043,38 +1012,6 @@
this.value = new cError(cErrorType.wrong_value_type); this.value = new cError(cErrorType.wrong_value_type);
} }
if (cElementType.cellsRange === this.value.type || cElementType.cell === this.value.type ||
cElementType.cell3D === this.value.type || cElementType.cellsRange3D === this.value.type) {
var r1 = arguments[1], r2 = arguments[2], wb = r1.worksheet.workbook, cellName = r1.getFirst()
.getID(), wsId = r1.worksheet.getId();
if ((cElementType.cell === this.value.type || cElementType.cell3D === this.value.type ||
cElementType.cellsRange === this.value.type) && this.value.isValid()) {
var nFrom, nTo;
if (r2) {
nFrom = r2.defName;
} else {
nFrom = wb.dependencyFormulas.addNode(wsId, cellName);
}
nTo = wb.dependencyFormulas.addNode(this.value.getWsId(), this.value._cells.replace(/\$/g, ""));
this.value.setNode(nTo);
wb.dependencyFormulas.addEdge2(nFrom, nTo);
} else if (cElementType.cellsRange3D === this.value.type && this.value.isValid()) {
var wsR = this.value.wsRange(), nTo, _cell = this.value._cells.replace(/\$/g, "");
for (var j = 0; j < wsR.length; j++) {
if (r2) {
nTo = wb.dependencyFormulas.addNode(wsR[j].Id, _cell);
wb.dependencyFormulas.addEdge2(r2.defName, nTo);
} else {
wb.dependencyFormulas.addEdge(wsId, cellName.replace(/\$/g, ""), wsR[j].Id, _cell);
}
}
}
}
return this.value; return this.value;
}; };
......
This diff is collapsed.
...@@ -48,10 +48,7 @@ function (window, undefined) { ...@@ -48,10 +48,7 @@ function (window, undefined) {
window['AscCH'].historyitem_Workbook_SheetPositions = 4; window['AscCH'].historyitem_Workbook_SheetPositions = 4;
window['AscCH'].historyitem_Workbook_ChangeColorScheme = 5; window['AscCH'].historyitem_Workbook_ChangeColorScheme = 5;
window['AscCH'].historyitem_Workbook_AddFont = 6; window['AscCH'].historyitem_Workbook_AddFont = 6;
window['AscCH'].historyitem_Workbook_DefinedNamesAdd = 7; window['AscCH'].historyitem_Workbook_DefinedNamesChange = 7;
window['AscCH'].historyitem_Workbook_DefinedNamesChange = 8;
window['AscCH'].historyitem_Workbook_DefinedNamesDelete = 9;
window['AscCH'].historyitem_Workbook_DefinedNamesChangeRef = 10;
window['AscCH'].historyitem_Worksheet_RemoveCell = 1; window['AscCH'].historyitem_Worksheet_RemoveCell = 1;
window['AscCH'].historyitem_Worksheet_RemoveRows = 2; window['AscCH'].historyitem_Worksheet_RemoveRows = 2;
......
...@@ -7191,9 +7191,9 @@ ...@@ -7191,9 +7191,9 @@
case c_oSerTableTypes.Worksheets: case c_oSerTableTypes.Worksheets:
res = (new Binary_WorksheetTableReader(this.stream, wb, aSharedStrings, aCellXfs, aDxfs, oMediaArray, this.copyPasteObj)).Read(); res = (new Binary_WorksheetTableReader(this.stream, wb, aSharedStrings, aCellXfs, aDxfs, oMediaArray, this.copyPasteObj)).Read();
break; break;
case c_oSerTableTypes.CalcChain: // case c_oSerTableTypes.CalcChain:
res = (new Binary_CalcChainTableReader(this.stream, wb.calcChain)).Read(); // res = (new Binary_CalcChainTableReader(this.stream, wb.calcChain)).Read();
break; // break;
// case c_oSerTableTypes.Other: // case c_oSerTableTypes.Other:
// res = (new Binary_OtherTableReader(this.stream, oMediaArray)).Read(); // res = (new Binary_OtherTableReader(this.stream, oMediaArray)).Read();
// break; // break;
......
...@@ -2962,76 +2962,25 @@ UndoRedoWorkbook.prototype = { ...@@ -2962,76 +2962,25 @@ UndoRedoWorkbook.prototype = {
this.wb.theme.themeElements.clrScheme = Data.newVal; this.wb.theme.themeElements.clrScheme = Data.newVal;
this.wb.oApi.asc_AfterChangeColorScheme(); this.wb.oApi.asc_AfterChangeColorScheme();
} }
else if(AscCH.historyitem_Workbook_DefinedNamesAdd === Type ){ else if (AscCH.historyitem_Workbook_DefinedNamesChange === Type) {
if(bUndo){
this.wb.delDefinesNames( Data.newName, true );
this.wb.handlers.trigger("asc_onDelDefName")
}
else{
if(this.wb.bCollaborativeChanges){
var name = Data.newName.Name, lsID = this.wb.getWorksheet(Data.newName.LocalSheetId);
lsID === null || lsID === undefined ? null : lsID = this.wb.getWorksheet(Data.newName.LocalSheetId).getId();
var oConflictDefName = this.wb.getDefinesNames(name, lsID);
if (oConflictDefName)
oConflictDefName.renameDefNameToCollaborate(this.wb.getUniqueDefinedNameFrom(oConflictDefName, true));
this.wb.handlers.trigger("asc_onLockDefNameManager",Asc.c_oAscDefinedNameReason.OK);
}
this.wb.editDefinesNames( null, Data.newName, true );
this.wb.handlers.trigger("asc_onEditDefName", null, Data.newName);
}
/*TODO
* Ввели формулу в которой есть именованный диапазон, но ИД нет в списке ИД. Результат формулы #NAME!.
* Создаем ИД с таким же именем, что и в функции. Необходимо пересчитать функцию. Предварительно перестроив
* граф зависимостей.
* */
}
else if(AscCH.historyitem_Workbook_DefinedNamesChange === Type ){
var oldName, newName; var oldName, newName;
if(bUndo){ if (bUndo) {
oldName = Data.newName; oldName = Data.newName;
newName= Data.oldName; newName = Data.oldName;
} } else {
else{ if (this.wb.bCollaborativeChanges) {
if(this.wb.bCollaborativeChanges){ this.wb.handlers.trigger("asc_onLockDefNameManager", Asc.c_oAscDefinedNameReason.OK);
var name = Data.newName.Name, lsID = this.wb.getWorksheet(Data.newName.LocalSheetId);
lsID === null || lsID === undefined ? null : lsID = this.wb.getWorksheet(Data.newName.LocalSheetId).getId();
// if( this.wb.isDefinedNamesExists(name,lsID) ){
// var oConflictDefName = this.wb.getDefinesNames(name,lsID);
// if(oConflictDefName)
// oConflictDefName.renameDefNameToCollaborate(this.wb.getUniqueDefinedNameFrom(oConflictDefName, true));
// }
this.wb.handlers.trigger("asc_onLockDefNameManager",Asc.c_oAscDefinedNameReason.OK);
} }
oldName = Data.oldName; oldName = Data.oldName;
newName = Data.newName; newName = Data.newName;
} }
this.wb.editDefinesNames( oldName, newName, true ); if (null == newName) {
this.wb.delDefinesNames(oldName);
this.wb.handlers.trigger("asc_onDelDefName")
} else {
this.wb.editDefinesNames(oldName, newName);
this.wb.handlers.trigger("asc_onEditDefName", oldName, newName); this.wb.handlers.trigger("asc_onEditDefName", oldName, newName);
} }
else if(AscCH.historyitem_Workbook_DefinedNamesDelete === Type ){
if(bUndo){
this.wb.editDefinesNames( null, Data, true );
if( Data.slaveEdge ){
var n;
for(var i = 0; i < Data.slaveEdge.length; i++){
n = this.wb.dependencyFormulas.getNode3(Data.slaveEdge[i]);
if( n ){
this.wb.needRecalc.nodes[n.nodeId] = [n.sheetId, n.cellId ];
this.wb.needRecalc.length++;
n = n.returnCell();
if(n){
n.formulaParsed = new AscCommonExcel.parserFormula( n.formulaParsed.Formula, n.formulaParsed.cellId, n.formulaParsed.ws )
}
}
}
}
this.wb.handlers.trigger("asc_onEditDefName", null, Data);
}
else{
this.wb.delDefinesNames( Data, true );
}
} }
} }
}; };
......
This diff is collapsed.
...@@ -5427,6 +5427,8 @@ ...@@ -5427,6 +5427,8 @@
}; };
WorksheetView.prototype.prepareDepCells = function ( se ) { WorksheetView.prototype.prepareDepCells = function ( se ) {
//todo
return;
var activeCell = this.activeRange, mc = this.model.getMergedByCell( activeCell.startRow, activeCell.startCol ), c1 = mc ? mc.c1 : activeCell.startCol, r1 = mc ? mc.r1 : activeCell.startRow, c = this._getVisibleCell( c1, r1 ), nodes = (se == AscCommonExcel.c_oAscDrawDepOptions.Master) ? this.model.workbook.dependencyFormulas.getMasterNodes( this.model.getId(), c.getName() ) : this.model.workbook.dependencyFormulas.getSlaveNodes( this.model.getId(), c.getName() ); var activeCell = this.activeRange, mc = this.model.getMergedByCell( activeCell.startRow, activeCell.startCol ), c1 = mc ? mc.c1 : activeCell.startCol, r1 = mc ? mc.r1 : activeCell.startRow, c = this._getVisibleCell( c1, r1 ), nodes = (se == AscCommonExcel.c_oAscDrawDepOptions.Master) ? this.model.workbook.dependencyFormulas.getMasterNodes( this.model.getId(), c.getName() ) : this.model.workbook.dependencyFormulas.getSlaveNodes( this.model.getId(), c.getName() );
if ( !nodes ) { if ( !nodes ) {
......
...@@ -816,7 +816,9 @@ var c_oAscPrintDefaultSettings = { ...@@ -816,7 +816,9 @@ var c_oAscPrintDefaultSettings = {
Shift: 1, Shift: 1,
Move: 2, Move: 2,
Delete: 3, Delete: 3,
ChangeDefName: 4 ChangeDefName: 4,
Rebuild: 5,
ChangeSheet: 6
}; };
var c_oDashType = { var c_oDashType = {
......
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