public boolean updateFormulasAfterCellShift(FormulaShifter shifter, int currentExternSheetIx) {CellRangeAddress[] cellRanges = header.getCellRanges();boolean changed = false;List<CellRangeAddress> temp = new ArrayList<>();for (CellRangeAddress craOld : cellRanges) {CellRangeAddress craNew = BaseRowColShifter.shiftRange(shifter, craOld, currentExternSheetIx);if (craNew == null) {changed = true;continue;}temp.add(craNew);if (craNew != craOld) {changed = true;}}if (changed) {int nRanges = temp.size();if (nRanges == 0) {return false;}CellRangeAddress[] newRanges = new CellRangeAddress[nRanges];temp.toArray(newRanges);header.setCellRanges(newRanges);}for (CFRuleBase rule : rules) {Ptg[] ptgs;ptgs = rule.getParsedExpression1();if (ptgs != null && shifter.adjustFormula(ptgs, currentExternSheetIx)) {rule.setParsedExpression1(ptgs);}ptgs = rule.getParsedExpression2();if (ptgs != null && shifter.adjustFormula(ptgs, currentExternSheetIx)) {rule.setParsedExpression2(ptgs);}if (rule instanceof CFRule12Record) {CFRule12Record rule12 = (CFRule12Record)rule;ptgs = rule12.getParsedExpressionScale();if (ptgs != null && shifter.adjustFormula(ptgs, currentExternSheetIx)) {rule12.setParsedExpressionScale(ptgs);}}}return true;}

public bool UpdateFormulasAfterCellShift(FormulaShifter shifter, int currentExternSheetIx){CellRangeAddress[] cellRanges = header.CellRanges;bool changed = false;List<CellRangeAddress> temp = new List<CellRangeAddress>();for (int i = 0; i < cellRanges.Length; i++){CellRangeAddress craOld = cellRanges[i];CellRangeAddress craNew = ShiftRange(shifter, craOld, currentExternSheetIx);if (craNew == null){changed = true;continue;}temp.Add(craNew);if (craNew != craOld){changed = true;}}if (changed){int nRanges = temp.Count;if (nRanges == 0){return false;}CellRangeAddress[] newRanges = new CellRangeAddress[nRanges];newRanges = temp.ToArray();header.CellRanges = (newRanges);}for (int i = 0; i < rules.Count; i++){CFRuleRecord rule = rules[i];Ptg[] ptgs;ptgs = rule.ParsedExpression1;if (ptgs != null && shifter.AdjustFormula(ptgs, currentExternSheetIx)){rule.ParsedExpression1 = (ptgs);}ptgs = rule.ParsedExpression2;if (ptgs != null && shifter.AdjustFormula(ptgs, currentExternSheetIx)){rule.ParsedExpression2 = (ptgs);}}return true;}
