Commit ff48f83c 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@49704 954022d7-b5bf-4e40-9824-e11837661b57
parent a6d5a305
...@@ -400,7 +400,7 @@ CHistory.prototype = ...@@ -400,7 +400,7 @@ CHistory.prototype =
this.workbook.handlers.trigger("drawWS"); this.workbook.handlers.trigger("drawWS");
/* возвращаем отрисовку. и перерисовываем ячейки с предварительным пересчетом */ /* возвращаем отрисовку. и перерисовываем ячейки с предварительным пересчетом */
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
if(bIsOn) if(bIsOn)
this.TurnOn(); this.TurnOn();
...@@ -490,7 +490,7 @@ CHistory.prototype = ...@@ -490,7 +490,7 @@ CHistory.prototype =
this.workbook.handlers.trigger("drawWS"); this.workbook.handlers.trigger("drawWS");
/* возвращаем отрисовку. и перерисовываем ячейки с предварительным пересчетом */ /* возвращаем отрисовку. и перерисовываем ячейки с предварительным пересчетом */
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
if(oRedoObjectParam.bIsOn) if(oRedoObjectParam.bIsOn)
this.TurnOn(); this.TurnOn();
......
...@@ -10,7 +10,7 @@ var g_nAllColIndex = -1; ...@@ -10,7 +10,7 @@ var g_nAllColIndex = -1;
var History; var History;
var aStandartNumFormats; var aStandartNumFormats;
var aStandartNumFormatsId; var aStandartNumFormatsId;
var start, end, dep, cCharDelimiter = String.fromCharCode(5), arrRecalc = {}, lc = 0; var start, end, cCharDelimiter = String.fromCharCode(5), arrRecalc = {}, lc = 0;
var c_oRangeType = var c_oRangeType =
{ {
...@@ -1109,8 +1109,8 @@ function unLockDraw(wb){ ...@@ -1109,8 +1109,8 @@ function unLockDraw(wb){
arrRecalc = {}; arrRecalc = {};
} }
} }
function helpFunction(_wb){ function buildRecalc(_wb){
var wb = _wb, dep, sr1, sr2, sr, ws, ar; var wb = _wb, ws, ar;
for( var id in arrRecalc ){ for( var id in arrRecalc ){
ws = wb.getWorksheetById(id); ws = wb.getWorksheetById(id);
...@@ -1122,7 +1122,7 @@ function helpFunction(_wb){ ...@@ -1122,7 +1122,7 @@ function helpFunction(_wb){
recalc(wb) recalc(wb)
} }
function helpMinMax(o1,o2){ function searchCleenCacheArea(o1,o2){
var o3 = {}; var o3 = {};
for (var _item in o2){ for (var _item in o2){
if (o1 && o1.hasOwnProperty(_item)){ if (o1 && o1.hasOwnProperty(_item)){
...@@ -1177,7 +1177,7 @@ function helpRecalc(dep1, nR, calculatedCells, wb){ ...@@ -1177,7 +1177,7 @@ function helpRecalc(dep1, nR, calculatedCells, wb){
nR.length--; nR.length--;
} }
} }
sr1 = recalcDependency.call(wb, dep1.badF,true); sr1 = wb.recalcDependency(dep1.badF,true);
for(var k = 0; k < dep1.depF.length; k++){ for(var k = 0; k < dep1.depF.length; k++){
if(dep1.depF[k].nodeId in calculatedCells){ if(dep1.depF[k].nodeId in calculatedCells){
...@@ -1185,39 +1185,14 @@ function helpRecalc(dep1, nR, calculatedCells, wb){ ...@@ -1185,39 +1185,14 @@ function helpRecalc(dep1, nR, calculatedCells, wb){
k--; k--;
} }
} }
sr2 = recalcDependency.call(wb, dep1.depF,false); sr2 = wb.recalcDependency(dep1.depF,false);
for(var k = 0; k < dep1.depF.length; k++){ for(var k = 0; k < dep1.depF.length; k++){
calculatedCells[dep1.depF[k].nodeId] = dep1.depF[k].nodeId calculatedCells[dep1.depF[k].nodeId] = dep1.depF[k].nodeId
} }
return helpMinMax(sr1,sr2); return searchCleenCacheArea(sr1,sr2);
} }
function recalcDependency(f,bad,notRecalc){
if(f.length > 0){
var max, min, sr = {}, _ws = this.getWorksheetById( f[0].sheetId );
for(var i = 0; i < f.length; i++){
if( f[i].cellId.indexOf(":") > -1 ) continue;
if( !(f[i].sheetId in sr) ){
sr[f[i].sheetId] = {max:new CellAddress(f[i].cellId),min:new CellAddress(f[i].cellId)}
}
var l = new CellAddress(f[i].cellId);
if(sr[f[i].sheetId].min.getRow() > l.getRow()) sr[f[i].sheetId].min = new CellAddress(l.getRow(),sr[f[i].sheetId].min.getCol());
if(sr[f[i].sheetId].min.getCol() > l.getCol()) sr[f[i].sheetId].min = new CellAddress(sr[f[i].sheetId].min.getRow(),l.getCol());
if(sr[f[i].sheetId].max.getRow() < l.getRow()) sr[f[i].sheetId].max = new CellAddress(l.getRow(),sr[f[i].sheetId].max.getCol());
if(sr[f[i].sheetId].max.getCol() < l.getCol()) sr[f[i].sheetId].max = new CellAddress(sr[f[i].sheetId].max.getRow(),l.getCol());
if( !notRecalc )
this.getWorksheetById( f[i].sheetId )._RecalculatedFunctions( f[i].cellId, bad );
}
return sr;
}
}
function sortDependency(ws, ar){ function sortDependency(ws, ar){
var wb = ws.workbook, dep, sr1, sr2, sr; var wb = ws.workbook, dep, sr1, sr2, sr;
/* /*
...@@ -1235,9 +1210,9 @@ function sortDependency(ws, ar){ ...@@ -1235,9 +1210,9 @@ function sortDependency(ws, ar){
} }
} }
} }
sr1 = recalcDependency.call(wb,dep.badF,true); sr1 = wb.recalcDependency(dep.badF,true);
sr2 = recalcDependency.call(wb,dep.depF,false); sr2 = wb.recalcDependency(dep.depF,false);
sr = helpMinMax( sr, helpMinMax( sr1, sr2 ) ); sr = searchCleenCacheArea( sr, searchCleenCacheArea( sr1, sr2 ) );
} }
for(var _item in sr){ for(var _item in sr){
...@@ -1246,7 +1221,8 @@ function sortDependency(ws, ar){ ...@@ -1246,7 +1221,8 @@ function sortDependency(ws, ar){
} }
function recalc(wb){ function recalc(wb){
var nR = wb.needRecalc, thas = wb, calculatedCells = {}, nRLength = nR.length, first = true, startActionOn = false, timerID, timeStart, timeEnd, timeCurrent, timeCount = 0, timeoutID1, timeoutID2, sr = {}; var nR = wb.needRecalc, thas = wb, calculatedCells = {}, nRLength = nR.length, first = true,
startActionOn = false, timerID, timeStart, timeEnd, timeCount = 0, timeoutID1, timeoutID2, sr = {};
function R(){ function R(){
if( nR.length > 0 ){ if( nR.length > 0 ){
...@@ -1263,14 +1239,14 @@ function recalc(wb){ ...@@ -1263,14 +1239,14 @@ function recalc(wb){
if( id === undefined ) nR.length = 0; if( id === undefined ) nR.length = 0;
if( id in nR){ if( id in nR){
var nRId0 = nR[id][0], nRId1 = nR[id][1], sr1,sr2,sr4; var nRId0 = nR[id][0], nRId1 = nR[id][1], sr1,sr2;
dep1 = thas.dependencyFormulas.t_sort_master( nRId0, nRId1 ); dep1 = thas.dependencyFormulas.t_sort_master( nRId0, nRId1 );
sr1 = helpRecalc(dep1, nR, calculatedCells, thas); sr1 = helpRecalc(dep1, nR, calculatedCells, thas);
dep1 = thas.dependencyFormulas.t_sort_slave( nRId0, nRId1 ); dep1 = thas.dependencyFormulas.t_sort_slave( nRId0, nRId1 );
sr2 = helpRecalc(dep1, nR, calculatedCells, thas); sr2 = helpRecalc(dep1, nR, calculatedCells, thas);
sr = helpMinMax(sr,helpMinMax(sr1,sr2)); sr = searchCleenCacheArea(sr,searchCleenCacheArea(sr1,sr2));
if( nR[id] ){ if( nR[id] ){
delete nR[id]; delete nR[id];
nR.length--; nR.length--;
...@@ -1479,7 +1455,7 @@ Workbook.prototype.init=function(){ ...@@ -1479,7 +1455,7 @@ Workbook.prototype.init=function(){
nR.length--; nR.length--;
} }
} }
sr1 = recalcDependency.call(thas, dep1.badF,true,true); sr1 = thas.recalcDependency(dep1.badF,true,true);
for(var k = 0; k < dep1.depF.length; k++){ for(var k = 0; k < dep1.depF.length; k++){
if(dep1.depF[k].nodeId in calculatedCells){ if(dep1.depF[k].nodeId in calculatedCells){
...@@ -1487,12 +1463,12 @@ Workbook.prototype.init=function(){ ...@@ -1487,12 +1463,12 @@ Workbook.prototype.init=function(){
k--; k--;
} }
} }
sr2 = recalcDependency.call(thas, dep1.depF,false); sr2 = thas.recalcDependency(dep1.depF,false);
for(var k = 0; k < dep1.depF.length; k++){ for(var k = 0; k < dep1.depF.length; k++){
calculatedCells[dep1.depF[k].nodeId] = dep1.depF[k].nodeId calculatedCells[dep1.depF[k].nodeId] = dep1.depF[k].nodeId
} }
sr = helpMinMax( sr, helpMinMax(sr1,sr2) ); sr = searchCleenCacheArea( sr, searchCleenCacheArea(sr1,sr2) );
} }
clearTimeout(timerID); clearTimeout(timerID);
...@@ -1753,7 +1729,7 @@ Workbook.prototype.replaceWorksheet=function(indexFrom, indexTo){ ...@@ -1753,7 +1729,7 @@ Workbook.prototype.replaceWorksheet=function(indexFrom, indexTo){
History.TurnOn(); History.TurnOn();
History.Create_NewPoint(); History.Create_NewPoint();
History.Add(g_oUndoRedoWorkbook, historyitem_Workbook_SheetMove, null, null, new UndoRedoData_FromTo(indexFrom, indexTo), true); History.Add(g_oUndoRedoWorkbook, historyitem_Workbook_SheetMove, null, null, new UndoRedoData_FromTo(indexFrom, indexTo), true);
helpFunction(this); buildRecalc(this);
unLockDraw(this); unLockDraw(this);
} }
}; };
...@@ -1838,7 +1814,7 @@ Workbook.prototype.removeWorksheet=function(nIndex, outputParams){ ...@@ -1838,7 +1814,7 @@ Workbook.prototype.removeWorksheet=function(nIndex, outputParams){
} }
this._updateWorksheetIndexes(); this._updateWorksheetIndexes();
this.nActive = nNewActive; this.nActive = nNewActive;
helpFunction(this); buildRecalc(this);
unLockDraw(this); unLockDraw(this);
return nNewActive; return nNewActive;
} }
...@@ -1923,7 +1899,7 @@ Workbook.prototype.generateFontMap=function(){ ...@@ -1923,7 +1899,7 @@ Workbook.prototype.generateFontMap=function(){
aRes.push(i); aRes.push(i);
return aRes; return aRes;
}; };
Workbook.prototype.recalc = function(is3D){ Workbook.prototype.recalcWB = function(is3D){
var dep1, thas = this, sr, sr1, sr2; var dep1, thas = this, sr, sr1, sr2;
if( this.dependencyFormulas.getNodesLength() > 0){ if( this.dependencyFormulas.getNodesLength() > 0){
if(is3D){ if(is3D){
...@@ -1933,18 +1909,18 @@ Workbook.prototype.recalc = function(is3D){ ...@@ -1933,18 +1909,18 @@ Workbook.prototype.recalc = function(is3D){
var c = new CellAddress(id); var c = new CellAddress(id);
if( __ws._getCellNoEmpty(c.getRow0(),c.getCol0()).formulaParsed.is3D ){ if( __ws._getCellNoEmpty(c.getRow0(),c.getCol0()).formulaParsed.is3D ){
dep1 = this.dependencyFormulas.t_sort_slave( __ws.Id, id ); dep1 = this.dependencyFormulas.t_sort_slave( __ws.Id, id );
sr1 = recalcDependency.call(thas,dep1.badF,true); sr1 = thas.recalcDependency(dep1.badF,true);
sr2 = recalcDependency.call(thas,dep1.depF,false); sr2 = thas.recalcDependency(dep1.depF,false);
sr = helpMinMax( sr, helpMinMax( sr1, sr2 ) ); sr = searchCleenCacheArea( sr, searchCleenCacheArea( sr1, sr2 ) );
} }
} }
} }
} }
else{ else{
dep = this.dependencyFormulas.t_sort(); dep1 = this.dependencyFormulas.t_sort();
sr1 = recalcDependency.call(thas,dep.badF,true); sr1 = thas.recalcDependency(dep1.badF,true);
sr2 = recalcDependency.call(thas,dep.depF,false); sr2 = thas.recalcDependency(dep1.depF,false);
sr = helpMinMax( sr, helpMinMax( sr1, sr2 ) ); sr = searchCleenCacheArea( sr, searchCleenCacheArea( sr1, sr2 ) );
} }
for(var _item in sr){ for(var _item in sr){
this.handlers.trigger("cleanCellCache",_item,new Asc.Range(0, sr[_item].min.getRow0(), this.getWorksheetById(_item).getColsCount()-1, sr[_item].max.getRow0()), c_oAscCanChangeColWidth.numbers); this.handlers.trigger("cleanCellCache",_item,new Asc.Range(0, sr[_item].min.getRow0(), this.getWorksheetById(_item).getColsCount()-1, sr[_item].max.getRow0()), c_oAscCanChangeColWidth.numbers);
...@@ -1999,6 +1975,39 @@ Workbook.prototype.buildDependency = function(){ ...@@ -1999,6 +1975,39 @@ Workbook.prototype.buildDependency = function(){
this.getWorksheetById(i)._BuildDependencies(this.cwf[i].cells); this.getWorksheetById(i)._BuildDependencies(this.cwf[i].cells);
} }
} }
Workbook.prototype.recalcDependency = function(f,bad,notRecalc){
if(f.length > 0){
var sr = {};
for(var i = 0; i < f.length; i++){
if( f[i].cellId.indexOf(":") > -1 ) continue;
var l = new CellAddress(f[i].cellId);
if( !(f[i].sheetId in sr) ){
sr[f[i].sheetId] = {max:new CellAddress(f[i].cellId),min:new CellAddress(f[i].cellId)}
}
if ( sr[f[i].sheetId].min.getRow() > l.getRow() )
sr[f[i].sheetId].min = new CellAddress( l.getRow(), sr[f[i].sheetId].min.getCol() );
if ( sr[f[i].sheetId].min.getCol() > l.getCol() )
sr[f[i].sheetId].min = new CellAddress( sr[f[i].sheetId].min.getRow(), l.getCol() );
if ( sr[f[i].sheetId].max.getRow() < l.getRow() )
sr[f[i].sheetId].max = new CellAddress( l.getRow(), sr[f[i].sheetId].max.getCol() );
if ( sr[f[i].sheetId].max.getCol() < l.getCol() )
sr[f[i].sheetId].max = new CellAddress( sr[f[i].sheetId].max.getRow(), l.getCol() );
if( !notRecalc )
this.getWorksheetById( f[i].sheetId )._RecalculatedFunctions( f[i].cellId, bad );
}
return sr;
}
}
Workbook.prototype.SerializeHistory = function(){ Workbook.prototype.SerializeHistory = function(){
var aRes = new Array(); var aRes = new Array();
//соединяем изменения, которые были до приема данных с теми, что получились после. //соединяем изменения, которые были до приема данных с теми, что получились после.
...@@ -2438,7 +2447,6 @@ Woorksheet.prototype.setName=function(name){ ...@@ -2438,7 +2447,6 @@ Woorksheet.prototype.setName=function(name){
History.Create_NewPoint(); History.Create_NewPoint();
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_Rename, this.getId(), null, new UndoRedoData_FromTo(lastName, name)); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_Rename, this.getId(), null, new UndoRedoData_FromTo(lastName, name));
dep = null;
//перестраиваем формулы, если у них были ссылки на лист со старым именем. //перестраиваем формулы, если у них были ссылки на лист со старым именем.
for(var id in this.workbook.cwf) { for(var id in this.workbook.cwf) {
this.workbook.getWorksheetById(id)._ReBuildFormulas(this.workbook.cwf[id].cells,lastName,this.sName); this.workbook.getWorksheetById(id)._ReBuildFormulas(this.workbook.cwf[id].cells,lastName,this.sName);
...@@ -2606,7 +2614,7 @@ Woorksheet.prototype._removeRows=function(start, stop){ ...@@ -2606,7 +2614,7 @@ Woorksheet.prototype._removeRows=function(start, stop){
} }
var oActualRange = {r1: start, c1: 0, r2: stop, c2: gc_nMaxCol0}; var oActualRange = {r1: start, c1: 0, r2: stop, c2: gc_nMaxCol0};
var res = this.renameDependencyNodes( {offsetRow:nDif,offsetCol:0}, oActualRange ); var res = this.renameDependencyNodes( {offsetRow:nDif,offsetCol:0}, oActualRange );
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
// for(var id in res) // for(var id in res)
...@@ -2661,7 +2669,7 @@ Woorksheet.prototype._insertRowsBefore=function(index, count){ ...@@ -2661,7 +2669,7 @@ Woorksheet.prototype._insertRowsBefore=function(index, count){
} }
} }
var res = this.renameDependencyNodes({offsetRow:count,offsetCol:0},oActualRange); var res = this.renameDependencyNodes({offsetRow:count,offsetCol:0},oActualRange);
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
this.nRowsCount += count; this.nRowsCount += count;
...@@ -2718,7 +2726,7 @@ Woorksheet.prototype._removeCols=function(start, stop){ ...@@ -2718,7 +2726,7 @@ Woorksheet.prototype._removeCols=function(start, stop){
} }
var oActualRange = {r1: 0, c1: start, r2: gc_nMaxRow0, c2: stop}; var oActualRange = {r1: 0, c1: start, r2: gc_nMaxRow0, c2: stop};
var res = this.renameDependencyNodes( {offsetRow:0,offsetCol:nDif}, oActualRange ); var res = this.renameDependencyNodes( {offsetRow:0,offsetCol:nDif}, oActualRange );
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
this.aCols.splice(start, stop - start + 1); this.aCols.splice(start, stop - start + 1);
...@@ -2762,7 +2770,7 @@ Woorksheet.prototype._insertColsBefore=function(index, count){ ...@@ -2762,7 +2770,7 @@ Woorksheet.prototype._insertColsBefore=function(index, count){
} }
var res = this.renameDependencyNodes({offsetRow:0,offsetCol:count},oActualRange); var res = this.renameDependencyNodes({offsetRow:0,offsetCol:count},oActualRange);
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
var oPrevCol = null; var oPrevCol = null;
...@@ -3522,7 +3530,7 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){ ...@@ -3522,7 +3530,7 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
} }
var res = this.renameDependencyNodes( {offsetRow:0,offsetCol:dif}, oBBox ); var res = this.renameDependencyNodes( {offsetRow:0,offsetCol:dif}, oBBox );
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
//todo проверить не уменьшились ли границы таблицы //todo проверить не уменьшились ли границы таблицы
...@@ -3568,7 +3576,7 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){ ...@@ -3568,7 +3576,7 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
} }
var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox ); var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox );
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
//todo проверить не уменьшились ли границы таблицы //todo проверить не уменьшились ли границы таблицы
...@@ -3611,7 +3619,7 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){ ...@@ -3611,7 +3619,7 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){
} }
var res = this.renameDependencyNodes({offsetRow:0,offsetCol:dif}, oBBox);; var res = this.renameDependencyNodes({offsetRow:0,offsetCol:dif}, oBBox);;
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
// for(var id in res) // for(var id in res)
...@@ -3650,7 +3658,7 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){ ...@@ -3650,7 +3658,7 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){
} }
var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox); var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox);
helpFunction(this.workbook); buildRecalc(this.workbook);
unLockDraw(this.workbook); unLockDraw(this.workbook);
// for(var id in res) // for(var id in res)
...@@ -3754,7 +3762,7 @@ Woorksheet.prototype._RecalculatedFunctions=function(cell,bad){ ...@@ -3754,7 +3762,7 @@ Woorksheet.prototype._RecalculatedFunctions=function(cell,bad){
} }
} }
} }
Woorksheet.prototype._ReBuildFormulas=function(cellRange,lastSheetName,newSheetName){ Woorksheet.prototype._ReBuildFormulas=function(cellRange){
/* /*
Если существуют трехмерные ссылки на ячейки, то у них необходимо поменять имя листа на новое после переименования листа. Если существуют трехмерные ссылки на ячейки, то у них необходимо поменять имя листа на новое после переименования листа.
*/ */
...@@ -3778,14 +3786,14 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete ...@@ -3778,14 +3786,14 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
var cell = _sn[_id].returnCell(), cellName = cell.getName(); var cell = _sn[_id].returnCell(), cellName = cell.getName();
if( undefined == cell ) { continue; } if( undefined == cell ) { continue; }
if( cell.formulaParsed ){ if( cell.formulaParsed ){
var oUndoRedoData_CellData = new UndoRedoData_CellData(cell.getValueData(), null); /*var oUndoRedoData_CellData = new UndoRedoData_CellData(cell.getValueData(), null);
if(null != cell.xfs) if(null != cell.xfs)
oUndoRedoData_CellData.style = cell.xfs.clone(); oUndoRedoData_CellData.style = cell.xfs.clone();
ret[cellName] = {}; ret[cellName] = {};
ret[cellName].data = oUndoRedoData_CellData; ret[cellName].data = oUndoRedoData_CellData;
ret[cellName].id = this.getId(); ret[cellName].id = this.getId();
ret[cellName].nRow = cell.getCellAddress().getRow0(); ret[cellName].nRow = cell.getCellAddress().getRow0();
ret[cellName].nCol = cell.getCellAddress().getCol0(); ret[cellName].nCol = cell.getCellAddress().getCol0();*/
cell.formulaParsed.shiftCells( objForRebuldFormula.move[id].offset, oBBox, n, this.Id, objForRebuldFormula.move[id].toDelete ); cell.formulaParsed.shiftCells( objForRebuldFormula.move[id].offset, oBBox, n, this.Id, objForRebuldFormula.move[id].toDelete );
cell.setFormula(cell.formulaParsed.assemble()); cell.setFormula(cell.formulaParsed.assemble());
...@@ -3811,7 +3819,7 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete ...@@ -3811,7 +3819,7 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
for( var _id in _sn ){ for( var _id in _sn ){
var cell = _sn[_id].returnCell(), cellName = cell.getName(); var cell = _sn[_id].returnCell(), cellName = cell.getName();
if( cell && cell.formulaParsed ){ if( cell && cell.formulaParsed ){
if( !(cell.getName() in ret) ){ /*if( !(cell.getName() in ret) ){
var oUndoRedoData_CellData = new UndoRedoData_CellData(cell.getValueData(), null); var oUndoRedoData_CellData = new UndoRedoData_CellData(cell.getValueData(), null);
if(null != cell.xfs) if(null != cell.xfs)
oUndoRedoData_CellData.style = cell.xfs.clone(); oUndoRedoData_CellData.style = cell.xfs.clone();
...@@ -3820,7 +3828,7 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete ...@@ -3820,7 +3828,7 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
ret[cellName].id = this.getId(); ret[cellName].id = this.getId();
ret[cellName].nRow = cell.getCellAddress().getRow0(); ret[cellName].nRow = cell.getCellAddress().getRow0();
ret[cellName].nCol = cell.getCellAddress().getCol0(); ret[cellName].nCol = cell.getCellAddress().getCol0();
} }*/
cell.formulaParsed.stretchArea( objForRebuldFormula.stretch[id].offset, oBBox, n, this.Id ); cell.formulaParsed.stretchArea( objForRebuldFormula.stretch[id].offset, oBBox, n, this.Id );
cell.setFormula(cell.formulaParsed.assemble()); cell.setFormula(cell.formulaParsed.assemble());
c[cellName] = cell; c[cellName] = cell;
...@@ -3836,12 +3844,15 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete ...@@ -3836,12 +3844,15 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
} }
for( var i in c ){ for( var i in c ){
var ws = c[i].ws;
if( ws.getCell2(c[i].getName()).getCells()[0].formulaParsed ){
var n = c[i].getName(); var n = c[i].getName();
c[i].formulaParsed.setCellId(n); c[i].formulaParsed.setCellId( n );
this.workbook.cwf[c[i].ws.Id].cells[n] = n; this.workbook.cwf[c[i].ws.Id].cells[n] = n;
c[i].formulaParsed.buildDependencies(); c[i].formulaParsed.buildDependencies();
this.workbook.needRecalc[ getVertexId(c[i].ws.Id,n) ] = [ c[i].ws.Id, n ]; this.workbook.needRecalc[ getVertexId( c[i].ws.Id, n ) ] = [ c[i].ws.Id, n ];
this.workbook.needRecalc.length++; this.workbook.needRecalc.length++;
}
c[i] = null; c[i] = null;
delete c[i]; delete c[i];
} }
...@@ -3860,9 +3871,9 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete ...@@ -3860,9 +3871,9 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
if ( false !== rec ) if ( false !== rec )
recalc(this.workbook); recalc(this.workbook);
return ret; // return ret;
} }
Woorksheet.prototype.helperRebuildFormulas = function(cell,lastName,newName){ Woorksheet.prototype.helperRebuildFormulas = function(cell,lastName){
if( cell.sFormula ){ if( cell.sFormula ){
this.workbook.cwf[this.Id].cells[lastName] = null; this.workbook.cwf[this.Id].cells[lastName] = null;
delete this.workbook.cwf[this.Id].cells[lastName]; delete this.workbook.cwf[this.Id].cells[lastName];
...@@ -7799,7 +7810,7 @@ Range.prototype.cleanAll=function(){ ...@@ -7799,7 +7810,7 @@ Range.prototype.cleanAll=function(){
},function(cell, nRow0, nCol0, nRowStart, nColStart){ },function(cell, nRow0, nCol0, nRowStart, nColStart){
oThis.worksheet._removeCell(nRow0, nCol0); oThis.worksheet._removeCell(nRow0, nCol0);
}); });
helpFunction(this.worksheet.workbook); buildRecalc(this.worksheet.workbook);
History.EndTransaction(); History.EndTransaction();
} }
Range.prototype.sort=function(nOption, nStartCol){ Range.prototype.sort=function(nOption, nStartCol){
...@@ -8517,7 +8528,7 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){ ...@@ -8517,7 +8528,7 @@ Range.prototype.promote=function(bCtrl, bVertical, nIndex){
} }
} }
History.EndTransaction(); History.EndTransaction();
helpFunction(this.worksheet.workbook); buildRecalc(this.worksheet.workbook);
unLockDraw(this.worksheet.workbook); unLockDraw(this.worksheet.workbook);
} }
Range.prototype.createCellOnRowColCross=function(){ Range.prototype.createCellOnRowColCross=function(){
......
...@@ -7062,7 +7062,7 @@ ...@@ -7062,7 +7062,7 @@
t.autoFilters._renameTableColumn(t, arn); t.autoFilters._renameTableColumn(t, arn);
/* возвращаем отрисовку. и перерисовываем ячейки с предварительным пересчетом */ /* возвращаем отрисовку. и перерисовываем ячейки с предварительным пересчетом */
helpFunction(t.model.workbook); buildRecalc(t.model.workbook);
unLockDraw(t.model.workbook); unLockDraw(t.model.workbook);
// Должны обновить больший range, т.к. мы продолжаем строки в ячейках... // Должны обновить больший range, т.к. мы продолжаем строки в ячейках...
...@@ -7123,7 +7123,7 @@ ...@@ -7123,7 +7123,7 @@
t.model._getCell(oBBox.r1, oBBox.c1).setValue(valF); t.model._getCell(oBBox.r1, oBBox.c1).setValue(valF);
} }
} }
helpFunction(t.model.workbook); buildRecalc(t.model.workbook);
unLockDraw(t.model.workbook); unLockDraw(t.model.workbook);
arn = selectData[0]; arn = selectData[0];
selectionRange = arn.clone(true); selectionRange = arn.clone(true);
......
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