Commit 88b9ff1b authored by GoshaZotov's avatar GoshaZotov

_waitRecalFormulasAfterTableRowHidden -> lockRecal/unlockRecal

parent de5df82f
...@@ -3970,8 +3970,7 @@ ...@@ -3970,8 +3970,7 @@
{ {
this.getRange3(start,0,stop, 0)._foreachRow(fProcessRow); this.getRange3(start,0,stop, 0)._foreachRow(fProcessRow);
} }
//todo возможно стоит вызывать эту функцию только в случае открытия строк this.workbook.dependencyFormulas.calcTree();
this.autoFilters.recalFormulasAfterTableRowHidden(start, stop);
}; };
Worksheet.prototype.getRowHidden=function(index){ Worksheet.prototype.getRowHidden=function(index){
var res; var res;
...@@ -4026,7 +4025,7 @@ ...@@ -4026,7 +4025,7 @@
History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide, oThis.getId(),updateRange, new UndoRedoData_FromToRowCol(bHidden, startIndex, endIndex)); History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide, oThis.getId(),updateRange, new UndoRedoData_FromToRowCol(bHidden, startIndex, endIndex));
} }
} }
this.autoFilters.recalFormulasAfterTableRowHidden(start, stop); this.workbook.dependencyFormulas.calcTree();
}; };
Worksheet.prototype.setRowBestFit=function(bBestFit, height, start, stop){ Worksheet.prototype.setRowBestFit=function(bBestFit, height, start, stop){
//start, stop 0 based //start, stop 0 based
...@@ -4060,6 +4059,7 @@ ...@@ -4060,6 +4059,7 @@
range._foreachRow(fProcessRow); range._foreachRow(fProcessRow);
} }
} }
this.workbook.dependencyFormulas.calcTree();
}; };
Worksheet.prototype.getCell=function(oCellAdd){ Worksheet.prototype.getCell=function(oCellAdd){
return this.getRange(oCellAdd, oCellAdd); return this.getRange(oCellAdd, oCellAdd);
......
...@@ -370,9 +370,6 @@ ...@@ -370,9 +370,6 @@
this.worksheet = currentSheet; this.worksheet = currentSheet;
this.changeFilters = null; this.changeFilters = null;
this.needRecalcFormulas = false;
this.doNotRecalcFormulas = false;
this.m_oColor = new AscCommon.CColor(120, 120, 120); this.m_oColor = new AscCommon.CColor(120, 120, 120);
return this; return this;
} }
...@@ -601,7 +598,7 @@ ...@@ -601,7 +598,7 @@
if(filterObj.filter === null) if(filterObj.filter === null)
return; return;
this._waitRecalFormulasAfterTableRowHidden(true); worksheet.workbook.dependencyFormulas.lockRecal();
//if apply a/f from context menu //if apply a/f from context menu
if(autoFiltersObject && null === autoFiltersObject.automaticRowCount && currentFilter.isAutoFilter() && currentFilter.isApplyAutoFilter() === false) if(autoFiltersObject && null === autoFiltersObject.automaticRowCount && currentFilter.isAutoFilter() && currentFilter.isApplyAutoFilter() === false)
...@@ -764,7 +761,7 @@ ...@@ -764,7 +761,7 @@
{ {
this._resetTablePartStyle(); this._resetTablePartStyle();
} }
this._waitRecalFormulasAfterTableRowHidden(false); worksheet.workbook.dependencyFormulas.unlockRecal();
return {minChangeRow: minChangeRow, rangeOldFilter: rangeOldFilter, nOpenRowsCount: nOpenRowsCount, nAllRowsCount: nAllRowsCount}; return {minChangeRow: minChangeRow, rangeOldFilter: rangeOldFilter, nOpenRowsCount: nOpenRowsCount, nAllRowsCount: nAllRowsCount};
}, },
...@@ -776,7 +773,7 @@ ...@@ -776,7 +773,7 @@
var bRedoChanges = worksheet.workbook.bRedoChanges; var bRedoChanges = worksheet.workbook.bRedoChanges;
var minChangeRow; var minChangeRow;
this._waitRecalFormulasAfterTableRowHidden(true); worksheet.workbook.dependencyFormulas.lockRecal();
//**get filter** //**get filter**
var filter = this._getFilterByDisplayName(displayName); var filter = this._getFilterByDisplayName(displayName);
...@@ -819,7 +816,7 @@ ...@@ -819,7 +816,7 @@
History.EndTransaction(); History.EndTransaction();
this._waitRecalFormulasAfterTableRowHidden(false); worksheet.workbook.dependencyFormulas.unlockRecal();
return {minChangeRow: minChangeRow, updateRange: filter.Ref, filter: filter}; return {minChangeRow: minChangeRow, updateRange: filter.Ref, filter: filter};
}, },
...@@ -1294,7 +1291,7 @@ ...@@ -1294,7 +1291,7 @@
return bRes; return bRes;
}; };
this._waitRecalFormulasAfterTableRowHidden(true); worksheet.workbook.dependencyFormulas.lockRecal();
if(worksheet.AutoFilter && !bNotDeleteAutoFilter) if(worksheet.AutoFilter && !bNotDeleteAutoFilter)
{ {
...@@ -1309,7 +1306,7 @@ ...@@ -1309,7 +1306,7 @@
} }
} }
this._waitRecalFormulasAfterTableRowHidden(false); worksheet.workbook.dependencyFormulas.unlockRecal();
t._setStyleTablePartsAfterOpenRows(activeCells); t._setStyleTablePartsAfterOpenRows(activeCells);
History.EndTransaction(); History.EndTransaction();
...@@ -1370,40 +1367,6 @@ ...@@ -1370,40 +1367,6 @@
return false; return false;
}, },
recalFormulasAfterTableRowHidden: function (start, stop) {
var worksheet = this.worksheet;
var tableParts = worksheet.TableParts;
var tablePart;
for (var i = 0; i < tableParts.length; i++) {
tablePart = tableParts[i];
if (tablePart && tablePart.isTotalsRow() && start >= tablePart.Ref.r1 && stop <= tablePart.Ref.r2) {
if(this.doNotRecalcFormulas){
this.needRecalcFormulas = true;
}else{
this._recalcFormulas();
}
break;
}
}
},
_waitRecalFormulasAfterTableRowHidden: function(bWait){
if(bWait){
this.doNotRecalcFormulas = true;
} else {
if(this.needRecalcFormulas){
this._recalcFormulas();
}
this.needRecalcFormulas = false;
this.doNotRecalcFormulas = false;
}
},
_recalcFormulas: function(){
this.worksheet.workbook.dependencyFormulas.calcTree();
},
_cleanStylesTables: function(redrawTablesArr) { _cleanStylesTables: function(redrawTablesArr) {
for(var i = 0; i < redrawTablesArr.length; i++) { for(var i = 0; i < redrawTablesArr.length; i++) {
this._cleanStyleTable(redrawTablesArr[i].oldfilterRef); this._cleanStyleTable(redrawTablesArr[i].oldfilterRef);
...@@ -2131,7 +2094,7 @@ ...@@ -2131,7 +2094,7 @@
var bUndoChanges = worksheet.workbook.bUndoChanges; var bUndoChanges = worksheet.workbook.bUndoChanges;
var bRedoChanges = worksheet.workbook.bRedoChanges; var bRedoChanges = worksheet.workbook.bRedoChanges;
this._waitRecalFormulasAfterTableRowHidden(true); worksheet.workbook.dependencyFormulas.lockRecal();
if(arnTo == null && arnFrom == null && data) if(arnTo == null && arnFrom == null && data)
{ {
...@@ -2233,7 +2196,7 @@ ...@@ -2233,7 +2196,7 @@
} }
} }
this._waitRecalFormulasAfterTableRowHidden(false); worksheet.workbook.dependencyFormulas.unlockRecal();
return isUpdate ? range : null; return isUpdate ? range : null;
}, },
...@@ -4066,7 +4029,7 @@ ...@@ -4066,7 +4029,7 @@
if(isOpenHiddenRows) if(isOpenHiddenRows)
{ {
this._waitRecalFormulasAfterTableRowHidden(true); worksheet.workbook.dependencyFormulas.lockRecal();
} }
var maxFilterRow = ref.r2; var maxFilterRow = ref.r2;
...@@ -4169,7 +4132,7 @@ ...@@ -4169,7 +4132,7 @@
if(isOpenHiddenRows) if(isOpenHiddenRows)
{ {
this._waitRecalFormulasAfterTableRowHidden(false); worksheet.workbook.dependencyFormulas.unlockRecal();
} }
return {values: this._sortArrayMinMax(values), automaticRowCount: automaticRowCount}; return {values: this._sortArrayMinMax(values), automaticRowCount: automaticRowCount};
}, },
...@@ -4273,7 +4236,7 @@ ...@@ -4273,7 +4236,7 @@
if(colId === null) if(colId === null)
return; return;
this._waitRecalFormulasAfterTableRowHidden(true); worksheet.workbook.dependencyFormulas.lockRecal();
for(var i = ref.r1 + 1; i <= ref.r2; i++) for(var i = ref.r1 + 1; i <= ref.r2; i++)
{ {
if(worksheet.getRowHidden(i) === false) if(worksheet.getRowHidden(i) === false)
...@@ -4284,7 +4247,7 @@ ...@@ -4284,7 +4247,7 @@
worksheet.setRowHidden(false, i, i); worksheet.setRowHidden(false, i, i);
} }
} }
this._waitRecalFormulasAfterTableRowHidden(false); worksheet.workbook.dependencyFormulas.unlockRecal();
}, },
_openAllHiddenRowsByFilter: function(filter) _openAllHiddenRowsByFilter: function(filter)
......
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