public void NotifyDeleteCell(int bookIndex, int sheetIndex, IEvaluationCell cell) { if (cell.CellType == Zephyr.Utils.NPOI.SS.UserModel.CellType.FORMULA) { FormulaCellCacheEntry fcce = _formulaCellCache.Remove(cell); if (fcce == null) { // formula cell Has not been evaluated yet } else { fcce.SetSensitiveInputCells(null); fcce.RecurseClearCachedFormulaResults(_evaluationListener); } } else { Loc loc = new Loc(bookIndex, sheetIndex, cell.RowIndex, cell.ColumnIndex); PlainValueCellCacheEntry pcce = _plainCellCache.Get(loc); if (pcce == null) { // cache entry doesn't exist. nothing To do } else { pcce.RecurseClearCachedFormulaResults(_evaluationListener); } } }
/** * Calls formulaCell.SetFormulaResult(null, null) recursively all the way up the tree of * dependencies. Calls usedCell.ClearConsumingCell(fc) for each child of a cell that Is * Cleared along the way. * @param formulaCells */ protected void RecurseClearCachedFormulaResults() { FormulaCellCacheEntry[] formulaCells = GetConsumingCells(); for (int i = 0; i < formulaCells.Length; i++) { FormulaCellCacheEntry fc = formulaCells[i]; fc.ClearFormulaEntry(); fc.RecurseClearCachedFormulaResults(); } }
/** * Identical To {@link #RecurseClearCachedFormulaResults()} except for the listener call-backs */ protected void RecurseClearCachedFormulaResults(IEvaluationListener listener, int depth) { FormulaCellCacheEntry[] formulaCells = GetConsumingCells(); listener.SortDependentCachedValues(formulaCells); for (int i = 0; i < formulaCells.Length; i++) { FormulaCellCacheEntry fc = formulaCells[i]; listener.OnClearDependentCachedValue(fc, depth); fc.ClearFormulaEntry(); fc.RecurseClearCachedFormulaResults(listener, depth + 1); } }