Skip to content

Commit

Permalink
[se] Remove unused
Browse files Browse the repository at this point in the history
  • Loading branch information
GoshaZotov committed Oct 2, 2024
1 parent 8b2f0eb commit c249f56
Showing 1 changed file with 1 addition and 97 deletions.
98 changes: 1 addition & 97 deletions cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5352,103 +5352,7 @@
let oPortalData = _arrAfterPromise[i].data;
let path = oPortalData && oPortalData["path"];
//if after update get short path, check on added such link
let eR = t.model.getExternalReferenceById(eRId);
let eRIndex = t.model.getExternalReferenceById(eRId, true);

let existedER = t.model.getExternalReferenceById(path);
let existedERIndex = t.model.getExternalReferenceById(path, true);


if (false && path && eRId !== path && existedER) {
// if there is already an external link along the shortcut, you need to use the data from it
// all dependencies from the current reference need to be moved to the existing one, and then the reference itself removed

let dependencyGraph = t.model.dependencyFormulas;

for (let ws in eR.worksheets) {
let currentWs = eR.worksheets[ws];
let currentWsID = currentWs.getId();
let currentWsName = currentWs.getName();

let existedWs = existedER.worksheets[currentWsName];

if (existedWs) {
// collect all the dependencies from this sheet and transfer them to the sheet of the same name in an already existing link
let sheetListeners = dependencyGraph.sheetListeners[currentWsID];

// through cells
for (let i in sheetListeners.cellMap) {
let cellListeners = sheetListeners.cellMap[i].listeners;
let cellIndex = sheetListeners.cellMap[i].cellIndex;

for (let listenerId in cellListeners) {
let listener = cellListeners[listenerId];
// dependencyGraph.startListeningCell(existedWs.getId(), cellIndex, listener);

let activeWs = t.model.getActiveWs();
activeWs && activeWs._getCellNoEmpty(listener.parent.nRow, listener.parent.nCol, function(cell) {
if (cell) {
// we go through the outstack and update all 3D elements
let fP = cell.formulaParsed;

for (let k = 0; k < fP.outStack.length; k++) {
// create a new element and write it to outstack
let elem = fP.outStack[k];
if (elem.type === AscCommonExcel.cElementType.cell3D) {
fP.outStack[k] = new AscCommonExcel.cRef3D(elem.value, existedWs, existedERIndex + 1);
} else if (elem.type === AscCommonExcel.cElementType.cellsRange3D) {
fP.outStack[k] = new AscCommonExcel.cArea3D(elem.value, existedWs, existedERIndex + 1);
}
}

dependencyGraph.addToBuildDependencyCell(cell);
// cell._BuildDependencies(true, true);
}
});
}
}

// through areas
for (let i in sheetListeners.areaMap) {
let areaListeners = sheetListeners.areaMap[i].listeners;
let bbox = sheetListeners.areaMap[i].bbox;

for (let listenerId in areaListeners) {
let listener = areaListeners[listenerId];

let activeWs = t.model.getActiveWs();
activeWs && activeWs._getCellNoEmpty(listener.parent.nRow, listener.parent.nCol, function(cell) {
if (cell) {
// we go through the outstack and update all 3D elements
let fP = cell.formulaParsed;

for (let k = 0; k < fP.outStack.length; k++) {
// create a new element and write it to outstack
let elem = fP.outStack[k];
if (elem.type === AscCommonExcel.cElementType.cell3D) {
fP.outStack[k] = new AscCommonExcel.cRef3D(elem.value, existedWs, existedERIndex + 1);
} else if (elem.type === AscCommonExcel.cElementType.cellsRange3D) {
fP.outStack[k] = new AscCommonExcel.cArea3D(elem.value, existedWs, existedWs, existedERIndex + 1);
}
}

dependencyGraph.addToChangedRange2(fP.getWs().getId(), bbox);

// todo addToBuildArea - if we pass the current formula, we will not be able to get the ref and add it to changedArea
// dependencyGraph.addToBuildDependencyArray(fP);
}
});
}
}

delete dependencyGraph.sheetListeners[currentWsID];
}
}
t.model.removeExternalReference(eRIndex + 1, /*addToHistory*/false);

// eR = existedER;
continue
}
let eR = t.model.getExternalReferenceById(eRId);

let externalReferenceId = eRId;
if (path && externalReferenceId !== path) {
Expand Down

0 comments on commit c249f56

Please sign in to comment.