Commit b388cd4c authored by Alexander.Trofimov's avatar Alexander.Trofimov

update 'si' param check

parent d07d5a60
...@@ -3451,36 +3451,27 @@ Woorksheet.prototype.initPostOpen = function(handlers){ ...@@ -3451,36 +3451,27 @@ Woorksheet.prototype.initPostOpen = function(handlers){
var oCell = elem.cell; var oCell = elem.cell;
var sCellId = g_oCellAddressUtils.getCellId(oCell.nRow, oCell.nCol); var sCellId = g_oCellAddressUtils.getCellId(oCell.nRow, oCell.nCol);
var oFormulaExt = elem.ext; var oFormulaExt = elem.ext;
if (oFormulaExt.t == Asc.ECellFormulaType.cellformulatypeShared) { if (oFormulaExt.t === Asc.ECellFormulaType.cellformulatypeShared && null !== oFormulaExt.si) {
if(null != oFormulaExt.si){ if (null !== oFormulaExt.ref) {
if(null != oFormulaExt.ref){ if (oFormulaExt.v.length <= AscCommon.c_oAscMaxFormulaLength) {
if (oFormulaExt.v.length <= AscCommon.c_oAscMaxFormulaLength) { formulaShared[oFormulaExt.si] = {
formulaShared[oFormulaExt.si] = { fVal: new parserFormula(oFormulaExt.v, "", this),
fVal: new parserFormula(oFormulaExt.v, "", this), fRef: function(t) { fRef: AscCommonExcel.g_oRangeCache.getAscRange(oFormulaExt.ref)
var r = t.getRange2(oFormulaExt.ref); };
return { formulaShared[oFormulaExt.si].fVal.parse();
c: r, first: r.first
};
}(this)
};
formulaShared[oFormulaExt.si].fVal.parse();
}
} }
else{ } else {
if( formulaShared[oFormulaExt.si] ){ var fs = formulaShared[oFormulaExt.si];
var fr = formulaShared[oFormulaExt.si].fRef; if (fs && fs.fRef.contains(oCell.nCol, oCell.nRow)) {
if( fr.c.containCell2(oCell) ){ if (false && fs.fVal.isParsed) {
if( formulaShared[oFormulaExt.si].fVal.isParsed ){ var off = oCell.getOffset3(fs.fRef.c1, fs.fRef.r1);
var off = oCell.getOffset3(fr.first); fs.fVal.changeOffset(off);
formulaShared[oFormulaExt.si].fVal.changeOffset(off); oFormulaExt.v = fs.fVal.assemble();
oFormulaExt.v = formulaShared[oFormulaExt.si].fVal.assemble(); off.offsetCol *= -1;
off.offsetCol *=-1; off.offsetRow *= -1;
off.offsetRow *=-1; fs.fVal.changeOffset(off);
formulaShared[oFormulaExt.si].fVal.changeOffset(off);
}
cwf[sCellId] = sCellId;
}
} }
cwf[sCellId] = sCellId;
} }
} }
} }
...@@ -3804,7 +3795,7 @@ Woorksheet.prototype.setName=function(name, bFromUndoRedo){ ...@@ -3804,7 +3795,7 @@ Woorksheet.prototype.setName=function(name, bFromUndoRedo){
//перестраиваем формулы, если у них были ссылки на лист со старым именем. //перестраиваем формулы, если у них были ссылки на лист со старым именем.
for(var id in this.workbook.cwf) { for(var id in this.workbook.cwf) {
this.workbook.getWorksheetById(id)._ReBuildFormulas(this.workbook.cwf[id],lastName,this.sName); this.workbook.getWorksheetById(id)._ReBuildFormulas(this.workbook.cwf[id]);
} }
this.workbook.dependencyFormulas.relinkDefNameByWorksheet(lastName, name); this.workbook.dependencyFormulas.relinkDefNameByWorksheet(lastName, name);
...@@ -6175,15 +6166,14 @@ Cell.prototype.moveVer=function(val){ ...@@ -6175,15 +6166,14 @@ Cell.prototype.moveVer=function(val){
this.nRow += val; this.nRow += val;
}; };
Cell.prototype.getOffset=function(cell){ Cell.prototype.getOffset=function(cell){
return {offsetCol:(this.nCol - cell.nCol), offsetRow:(this.nRow - cell.nRow)}; return this.getOffset3(cell.nCol - 1, cell.nRow - 1);
}; };
Cell.prototype.getOffset2=function(cellId){ Cell.prototype.getOffset2=function(cellId){
var cAddr2 = new CellAddress(cellId); var cAddr2 = new CellAddress(cellId);
return {offsetCol:(this.nCol - cAddr2.col + 1), offsetRow:(this.nRow - cAddr2.row + 1)}; return this.getOffset3(cAddr2.col, cAddr2.row);
}; };
Cell.prototype.getOffset3=function(cellAddr){ Cell.prototype.getOffset3=function(col, row){
var cAddr2 = cellAddr; return new AscCommonExcel.CRangeOffset((this.nCol - col + 1), (this.nRow - row + 1));
return {offsetCol:(this.nCol - cAddr2.col + 1), offsetRow:(this.nRow - cAddr2.row + 1)};
}; };
Cell.prototype.getValueData = function(){ Cell.prototype.getValueData = function(){
return new UndoRedoData_CellValueData(this.sFormula, this.oValue.clone()); return new UndoRedoData_CellValueData(this.sFormula, this.oValue.clone());
...@@ -8517,7 +8507,7 @@ Range.prototype._shiftUpDown = function (bUp, preDeleteAction, displayNameFormat ...@@ -8517,7 +8507,7 @@ Range.prototype._shiftUpDown = function (bUp, preDeleteAction, displayNameFormat
this.worksheet.workbook.buildRecalc(); this.worksheet.workbook.buildRecalc();
return true; return true;
}; };
Range.prototype.setOffset=function(offset){//offset = {offsetCol:intNumber, offsetRow:intNumber} Range.prototype.setOffset=function(offset){//offset = AscCommonExcel.CRangeOffset
this.bbox.c1 += offset.offsetCol; this.bbox.c1 += offset.offsetCol;
if( this.bbox.c1 < 0 ) if( this.bbox.c1 < 0 )
this.bbox.c1 = 0; this.bbox.c1 = 0;
......
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