Commit 1f731062 authored by Sergey Konovalov's avatar Sergey Konovalov

relative references in def names; getRangeByRef activeCell; table convertToRange errors;

parent 14b892ad
...@@ -615,7 +615,7 @@ ...@@ -615,7 +615,7 @@
parseReference(); parseReference();
if (found_operand) { if (found_operand) {
if (cElementType.name === found_operand.type) { if (cElementType.name === found_operand.type) {
found_operand = found_operand.toRef(); found_operand = found_operand.toRef(arguments[1]);
} }
ret = found_operand; ret = found_operand;
......
...@@ -632,13 +632,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -632,13 +632,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
/** @constructor */ /** @constructor */
function cBaseType(val) { function cBaseType(val) {
this.needRecalc = false;
this.numFormat = null; this.numFormat = null;
this.value = val; this.value = val;
} }
cBaseType.prototype.cloneTo = function (oRes) { cBaseType.prototype.cloneTo = function (oRes) {
oRes.needRecalc = this.needRecalc;
oRes.numFormat = this.numFormat; oRes.numFormat = this.numFormat;
oRes.value = this.value; oRes.value = this.value;
}; };
...@@ -1548,12 +1546,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1548,12 +1546,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this.cloneTo(oRes); this.cloneTo(oRes);
return oRes; return oRes;
}; };
cName.prototype.toRef = function () { cName.prototype.toRef = function (opt_bbox) {
var defName = this.getDefName(); var defName = this.getDefName();
if (!defName || !defName.ref) { if (!defName || !defName.ref) {
return new cError(cErrorType.wrong_name); return new cError(cErrorType.wrong_name);
} }
return this.Calculate(); return this.Calculate(undefined, opt_bbox);
}; };
cName.prototype.toString = function () { cName.prototype.toString = function () {
var defName = this.getDefName(); var defName = this.getDefName();
...@@ -1576,9 +1574,13 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1576,9 +1574,13 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return new cError(cErrorType.wrong_name); return new cError(cErrorType.wrong_name);
} }
//defName not linked to cell, use inherit range //defName not linked to cell, use inherit range
var r1 = arguments[1]; var offset;
return defName.parsedRef.calculate(this, r1); var bbox = arguments[1];
if (bbox) {
//offset - to support relative references in def names
offset = {offsetRow: bbox.r1, offsetCol: bbox.c1};
}
return defName.parsedRef.calculate(this, bbox, offset);
}; };
cName.prototype.getDefName = function () { cName.prototype.getDefName = function () {
return this.ws ? this.ws.workbook.getDefinesNames(this.value, this.ws.getId()) : null; return this.ws ? this.ws.workbook.getDefinesNames(this.value, this.ws.getId()) : null;
...@@ -1666,7 +1668,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1666,7 +1668,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return val; return val;
} }
}; };
cStrucTable.prototype.toRef = function (opt_bbox) { cStrucTable.prototype.toRef = function (opt_bbox, opt_bConvertTableFormulaToRef) {
//opt_bbox usefull only for #This row //opt_bbox usefull only for #This row
//case null == opt_bbox works like FormulaTablePartInfo.data //case null == opt_bbox works like FormulaTablePartInfo.data
var table = this.wb.getDefinesNames(this.tableName, this.ws ? this.ws.getId() : null); var table = this.wb.getDefinesNames(this.tableName, this.ws ? this.ws.getId() : null);
...@@ -1674,7 +1676,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1674,7 +1676,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return new cError(cErrorType.wrong_name); return new cError(cErrorType.wrong_name);
} }
if (!this.area || this.isDynamic) { if (!this.area || this.isDynamic) {
this._updateArea(opt_bbox, true); this._updateArea(opt_bbox, true, opt_bConvertTableFormulaToRef);
} }
return this.area; return this.area;
}; };
...@@ -1786,8 +1788,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1786,8 +1788,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
} }
return bRes; return bRes;
}; };
cStrucTable.prototype._updateArea = function (opt_bbox, opt_toRef) { cStrucTable.prototype._updateArea = function (bbox, toRef, bConvertTableFormulaToRef) {
var paramObj = {param: null, startCol: null, endCol: null, cell: opt_bbox, toRef: opt_toRef}; var paramObj = {param: null, startCol: null, endCol: null, cell: bbox, toRef: toRef, bConvertTableFormulaToRef: bConvertTableFormulaToRef};
var isThisRow = false; var isThisRow = false;
var tableData; var tableData;
if (this.oneColumnIndex) { if (this.oneColumnIndex) {
...@@ -1832,7 +1834,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1832,7 +1834,12 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return this._createAreaError(isThisRow); return this._createAreaError(isThisRow);
} }
if (range) { if (range) {
var r1Abs = range.isAbsR1();
var c1Abs = data.range.isAbsC1();
var r2Abs = range.isAbsR2();
var c2Abs = data.range.isAbsC2();
range = new Asc.Range(data.range.c1, range.r1, data.range.c2, range.r2); range = new Asc.Range(data.range.c1, range.r1, data.range.c2, range.r2);
range.setAbs(r1Abs, c1Abs, r2Abs, c2Abs);
} else { } else {
range = data.range; range = data.range;
} }
...@@ -1850,7 +1857,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1850,7 +1857,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
} }
} }
if (tableData.range) { if (tableData.range) {
var refName = tableData.range.getAbsName(); var refName = tableData.range.getName();
var wsFrom = this.wb.getWorksheetById(tableData.wsID); var wsFrom = this.wb.getWorksheetById(tableData.wsID);
if (tableData.range.isOneCell()) { if (tableData.range.isOneCell()) {
this.area = new cRef3D(refName, wsFrom); this.area = new cRef3D(refName, wsFrom);
...@@ -3054,6 +3061,8 @@ var cFormulaOperators = { ...@@ -3054,6 +3061,8 @@ var cFormulaOperators = {
if (ref[ref.length - 1] === ')') { if (ref[ref.length - 1] === ')') {
ref = ref.slice(0, -1); ref = ref.slice(0, -1);
} }
var activeCell = ws.selectionRange.activeCell;
var bbox = new Asc.Range(activeCell.col, activeCell.row, activeCell.col, activeCell.row);
// ToDo in parser formula // ToDo in parser formula
var ranges = []; var ranges = [];
var arrRefs = ref.split(','); var arrRefs = ref.split(',');
...@@ -3072,7 +3081,7 @@ var cFormulaOperators = { ...@@ -3072,7 +3081,7 @@ var cFormulaOperators = {
case cElementType.table: case cElementType.table:
case cElementType.name: case cElementType.name:
case cElementType.name3D: case cElementType.name3D:
ref = item.oper.toRef(); ref = item.oper.toRef(bbox);
break; break;
case cElementType.cell: case cElementType.cell:
case cElementType.cell3D: case cElementType.cell3D:
...@@ -4858,7 +4867,7 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4858,7 +4867,7 @@ parserFormula.prototype.parse = function(local, digitDelim) {
} }
}; };
parserFormula.prototype.calculate = function (opt_defName, opt_bbox) { parserFormula.prototype.calculate = function (opt_defName, opt_bbox, opt_offset) {
if (this.isCalculate) { if (this.isCalculate) {
this.value = new cError(cErrorType.bad_reference); this.value = new cError(cErrorType.bad_reference);
this._endCalculate(); this._endCalculate();
...@@ -4909,6 +4918,35 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4909,6 +4918,35 @@ parserFormula.prototype.parse = function(local, digitDelim) {
elemArr.push(currentElement.Calculate(arg, bbox)); elemArr.push(currentElement.Calculate(arg, bbox));
} else if (currentElement.type === cElementType.table) { } else if (currentElement.type === cElementType.table) {
elemArr.push(currentElement.toRef(bbox)); elemArr.push(currentElement.toRef(bbox));
} else if (opt_offset) {
var cloneElem = null;
var bbox = null;
var ws;
if (cElementType.cell === currentElement.type || cElementType.cell3D === currentElement.type ||
cElementType.cellsRange === currentElement.type) {
var range = currentElement.getRange();
if (range) {
bbox = range.getBBox0();
ws = range.getWorksheet();
if (!bbox.isAbsAll()) {
cloneElem = currentElement.clone();
bbox = cloneElem.getRange().getBBox0();
}
}
} else if (cElementType.cellsRange3D === currentElement.type) {
bbox = currentElement.getBBox0();
if (!bbox.isAbsAll()) {
cloneElem = currentElement.clone();
bbox = cloneElem.getBBox0();
}
}
if(cloneElem){
bbox.setOffsetWithAbs(opt_offset, false, true);
this.changeOffsetBBox(cloneElem, bbox, ws);
elemArr.push(cloneElem);
} else {
elemArr.push(currentElement);
}
} else { } else {
elemArr.push(currentElement); elemArr.push(currentElement);
} }
...@@ -4936,13 +4974,14 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4936,13 +4974,14 @@ parserFormula.prototype.parse = function(local, digitDelim) {
}; };
parserFormula.prototype.changeOffsetElem = function(elem, container, index, offset, canResize) {//offset = parserFormula.prototype.changeOffsetElem = function(elem, container, index, offset, canResize) {//offset =
// AscCommonExcel.CRangeOffset // AscCommonExcel.CRangeOffset
var range, bbox = null, isErr = false; var range, bbox = null, ws, isErr = false;
if (cElementType.cell === elem.type || cElementType.cell3D === elem.type || if (cElementType.cell === elem.type || cElementType.cell3D === elem.type ||
cElementType.cellsRange === elem.type) { cElementType.cellsRange === elem.type) {
isErr = true; isErr = true;
range = elem.getRange(); range = elem.getRange();
if (range) { if (range) {
bbox = range.getBBox0(); bbox = range.getBBox0();
ws = range.getWorksheet();
} }
} else if (cElementType.cellsRange3D === elem.type) { } else if (cElementType.cellsRange3D === elem.type) {
isErr = true; isErr = true;
...@@ -4951,12 +4990,7 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4951,12 +4990,7 @@ parserFormula.prototype.parse = function(local, digitDelim) {
if (bbox) { if (bbox) {
if (bbox.setOffsetWithAbs(offset, canResize)) { if (bbox.setOffsetWithAbs(offset, canResize)) {
isErr = false; isErr = false;
if (cElementType.cellsRange3D === elem.type) { this.changeOffsetBBox(elem, bbox, ws);
elem.bbox = bbox;
} else {
elem.range = AscCommonExcel.Range.prototype.createFromBBox(range.getWorksheet(), bbox);
}
elem.value = bbox.getName();
} }
} }
if (isErr) { if (isErr) {
...@@ -4964,6 +4998,14 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4964,6 +4998,14 @@ parserFormula.prototype.parse = function(local, digitDelim) {
} }
return elem; return elem;
}; };
parserFormula.prototype.changeOffsetBBox = function(elem, bbox, ws) {
if (cElementType.cellsRange3D === elem.type) {
elem.bbox = bbox;
} else {
elem.range = AscCommonExcel.Range.prototype.createFromBBox(ws, bbox);
}
elem.value = bbox.getName();
};
parserFormula.prototype.changeDefName = function(from, to) { parserFormula.prototype.changeDefName = function(from, to) {
var i, elem; var i, elem;
for (i = 0; i < this.outStack.length; i++) { for (i = 0; i < this.outStack.length; i++) {
...@@ -4975,12 +5017,17 @@ parserFormula.prototype.parse = function(local, digitDelim) { ...@@ -4975,12 +5017,17 @@ parserFormula.prototype.parse = function(local, digitDelim) {
}; };
parserFormula.prototype.removeTableName = function(defName, bConvertTableFormulaToRef) { parserFormula.prototype.removeTableName = function(defName, bConvertTableFormulaToRef) {
var i, elem; var i, elem;
var bbox;
if (this.parent && this.parent.onFormulaEvent) {
bbox= this.parent.onFormulaEvent(AscCommon.c_oNotifyParentType.GetRangeCell);
}
for (i = 0; i < this.outStack.length; i++) { for (i = 0; i < this.outStack.length; i++) {
elem = this.outStack[i]; elem = this.outStack[i];
if (elem.type == cElementType.table && elem.tableName == defName.name) { if (elem.type == cElementType.table && elem.tableName == defName.name) {
if(bConvertTableFormulaToRef) if(bConvertTableFormulaToRef)
{ {
this.outStack[i] = this.outStack[i].toRef(); this.outStack[i] = this.outStack[i].toRef(bbox, bConvertTableFormulaToRef);
} }
else else
{ {
......
...@@ -5482,7 +5482,7 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam) ...@@ -5482,7 +5482,7 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam)
{ {
if(this.HeaderRowCount === null) { if(this.HeaderRowCount === null) {
res = new Asc.Range(this.Ref.c1, this.Ref.r1, this.Ref.c2, this.Ref.r1); res = new Asc.Range(this.Ref.c1, this.Ref.r1, this.Ref.c2, this.Ref.r1);
} else if(!objectParam.toRef) { } else if(!objectParam.toRef || objectParam.bConvertTableFormulaToRef) {
res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow); res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow);
} }
break; break;
...@@ -5491,7 +5491,7 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam) ...@@ -5491,7 +5491,7 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam)
{ {
if(this.TotalsRowCount) { if(this.TotalsRowCount) {
res = new Asc.Range(this.Ref.c1, this.Ref.r2, this.Ref.c2, this.Ref.r2); res = new Asc.Range(this.Ref.c1, this.Ref.r2, this.Ref.c2, this.Ref.r2);
} else if(!objectParam.toRef) { } else if(!objectParam.toRef || objectParam.bConvertTableFormulaToRef) {
res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow); res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow);
} }
break; break;
...@@ -5501,10 +5501,16 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam) ...@@ -5501,10 +5501,16 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam)
if (objectParam.cell) { if (objectParam.cell) {
if (startRow <= objectParam.cell.r1 && objectParam.cell.r1 <= endRow) { if (startRow <= objectParam.cell.r1 && objectParam.cell.r1 <= endRow) {
res = new Asc.Range(this.Ref.c1, objectParam.cell.r1, this.Ref.c2, objectParam.cell.r1); res = new Asc.Range(this.Ref.c1, objectParam.cell.r1, this.Ref.c2, objectParam.cell.r1);
} else if (objectParam.bConvertTableFormulaToRef) {
res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow);
} }
} else {
if (objectParam.bConvertTableFormulaToRef) {
res = new Asc.Range(this.Ref.c1, 0, this.Ref.c2, 0);
} else { } else {
res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow); res = new Asc.Range(this.Ref.c1, startRow, this.Ref.c2, endRow);
} }
}
break; break;
} }
case FormulaTablePartInfo.columns: case FormulaTablePartInfo.columns:
...@@ -5521,6 +5527,13 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam) ...@@ -5521,6 +5527,13 @@ TablePart.prototype.getTableRangeForFormula = function(objectParam)
break; break;
} }
} }
if (res) {
if (objectParam.param === FormulaTablePartInfo.thisRow) {
res.setAbs(false, true, false, true);
} else {
res.setAbs(true, true, true, true);
}
}
return res; return res;
}; };
......
...@@ -502,7 +502,7 @@ ...@@ -502,7 +502,7 @@
this.r1 = Math.min(this.r1, r); this.r1 = Math.min(this.r1, r);
this.r2 = Math.max(this.r2, r); this.r2 = Math.max(this.r2, r);
}; };
Range.prototype.setOffsetWithAbs = function(offset, canResize) { Range.prototype.setOffsetWithAbs = function(offset, opt_canResize, opt_circle) {
var temp; var temp;
var offsetRow = offset.offsetRow; var offsetRow = offset.offsetRow;
var offsetCol = offset.offsetCol; var offsetCol = offset.offsetCol;
...@@ -519,55 +519,87 @@ ...@@ -519,55 +519,87 @@
if (!isAbsRow1) { if (!isAbsRow1) {
this.r1 += offsetRow; this.r1 += offsetRow;
if (this.r1 < 0) { if (this.r1 < 0) {
if (opt_circle) {
this.r1 += gc_nMaxRow0 + 1;
} else {
this.r1 = 0; this.r1 = 0;
if (!canResize) { if (!opt_canResize) {
return false; return false;
} }
} }
}
if (this.r1 > gc_nMaxRow0) { if (this.r1 > gc_nMaxRow0) {
if (opt_circle) {
this.r1 -= gc_nMaxRow0 + 1;
} else {
this.r1 = gc_nMaxRow0; this.r1 = gc_nMaxRow0;
return false; return false;
} }
} }
}
if (!isAbsCol1) { if (!isAbsCol1) {
this.c1 += offsetCol; this.c1 += offsetCol;
if (this.c1 < 0) { if (this.c1 < 0) {
if (opt_circle) {
this.c1 += gc_nMaxCol0 + 1;
} else {
this.c1 = 0; this.c1 = 0;
if (!canResize) { if (!opt_canResize) {
return false; return false;
} }
} }
}
if (this.c1 > gc_nMaxCol0) { if (this.c1 > gc_nMaxCol0) {
if (opt_circle) {
this.c1 -= gc_nMaxCol0 + 1;
} else {
this.c1 = gc_nMaxCol0; this.c1 = gc_nMaxCol0;
return false; return false;
} }
} }
}
if (!isAbsRow2) { if (!isAbsRow2) {
this.r2 += offsetRow; this.r2 += offsetRow;
if (this.r2 < 0) { if (this.r2 < 0) {
if (opt_circle) {
this.r2 += gc_nMaxRow0 + 1;
} else {
this.r2 = 0; this.r2 = 0;
return false; return false;
} }
}
if (this.r2 > gc_nMaxRow0) { if (this.r2 > gc_nMaxRow0) {
if (opt_circle) {
this.r2 -= gc_nMaxRow0 + 1;
} else {
this.r2 = gc_nMaxRow0; this.r2 = gc_nMaxRow0;
if (!canResize) { if (!opt_canResize) {
return false; return false;
} }
} }
} }
}
if (!isAbsCol2) { if (!isAbsCol2) {
this.c2 += offsetCol; this.c2 += offsetCol;
if (this.c2 < 0) { if (this.c2 < 0) {
if (opt_circle) {
this.c2 += gc_nMaxCol0 + 1;
} else {
this.c2 = 0; this.c2 = 0;
return false; return false;
} }
}
if (this.c2 > gc_nMaxCol0) { if (this.c2 > gc_nMaxCol0) {
if (opt_circle) {
this.c2 -= gc_nMaxCol0 + 1;
} else {
this.c2 = gc_nMaxCol0; this.c2 = gc_nMaxCol0;
if (!canResize) { if (!opt_canResize) {
return false; return false;
} }
} }
} }
}
//switch abs flag //switch abs flag
if (this.r1 > this.r2) { if (this.r1 > this.r2) {
temp = this.r1; temp = this.r1;
...@@ -784,6 +816,21 @@ ...@@ -784,6 +816,21 @@
Range.prototype.isAbsRow = function (refType) { Range.prototype.isAbsRow = function (refType) {
return (refType === referenceType.A || refType === referenceType.ARRC); return (refType === referenceType.A || refType === referenceType.ARRC);
}; };
Range.prototype.isAbsR1 = function () {
return this.isAbsRow(this.refType1);
};
Range.prototype.isAbsC1 = function () {
return this.isAbsCol(this.refType1);
};
Range.prototype.isAbsR2 = function () {
return this.isAbsRow(this.refType2);
};
Range.prototype.isAbsC2 = function () {
return this.isAbsCol(this.refType2);
};
Range.prototype.isAbsAll = function () {
return this.isAbsR1() && this.isAbsC1() && this.isAbsR2() && this.isAbsC2();
};
Range.prototype.switchReference = function () { Range.prototype.switchReference = function () {
this.refType1 = (this.refType1 + 1) % 4; this.refType1 = (this.refType1 + 1) % 4;
this.refType2 = (this.refType2 + 1) % 4; this.refType2 = (this.refType2 + 1) % 4;
...@@ -1393,6 +1440,8 @@ ...@@ -1393,6 +1440,8 @@
} }
if (null == oRes && null != oCacheVal.first && null != oCacheVal.last) { if (null == oRes && null != oCacheVal.first && null != oCacheVal.last) {
var r1 = oCacheVal.first.getRow0(), r2 = oCacheVal.last.getRow0(), c1 = oCacheVal.first.getCol0(), c2 = oCacheVal.last.getCol0(); var r1 = oCacheVal.first.getRow0(), r2 = oCacheVal.last.getRow0(), c1 = oCacheVal.first.getCol0(), c2 = oCacheVal.last.getCol0();
var r1Abs = oCacheVal.first.getRowAbs(), r2Abs = oCacheVal.last.getRowAbs(),
c1Abs = oCacheVal.first.getColAbs(), c2Abs = oCacheVal.first.getColAbs();
if (oCacheVal.first.getIsRow() && oCacheVal.last.getIsRow()) { if (oCacheVal.first.getIsRow() && oCacheVal.last.getIsRow()) {
c1 = 0; c1 = 0;
c2 = gc_nMaxCol0; c2 = gc_nMaxCol0;
...@@ -1405,18 +1454,23 @@ ...@@ -1405,18 +1454,23 @@
var temp = r1; var temp = r1;
r1 = r2; r1 = r2;
r2 = temp; r2 = temp;
temp = r1Abs;
r1Abs = r2Abs;
r2Abs = temp;
} }
if (c1 > c2) { if (c1 > c2) {
var temp = c1; var temp = c1;
c1 = c2; c1 = c2;
c2 = temp; c2 = temp;
temp = c1Abs;
c1Abs = c2Abs;
c2Abs = temp;
} }
if (1 == type) { if (1 == type) {
if (null == oCacheVal.ascRange) { if (null == oCacheVal.ascRange) {
var oAscRange = new Range(c1, r1, c2, r2); var oAscRange = new Range(c1, r1, c2, r2);
oAscRange.setAbs(oCacheVal.first.getRowAbs(), oCacheVal.first.getColAbs(), oCacheVal.last.getRowAbs(), oAscRange.setAbs(r1Abs, c1Abs, r2Abs, c2Abs);
oCacheVal.last.getColAbs());
oCacheVal.ascRange = oAscRange; oCacheVal.ascRange = oAscRange;
} }
...@@ -1424,8 +1478,7 @@ ...@@ -1424,8 +1478,7 @@
} else if (2 == type) { } else if (2 == type) {
if (null == oCacheVal.activeRange) { if (null == oCacheVal.activeRange) {
var oActiveRange = new ActiveRange(c1, r1, c2, r2); var oActiveRange = new ActiveRange(c1, r1, c2, r2);
oActiveRange.setAbs(oCacheVal.first.getRowAbs(), oCacheVal.first.getColAbs(), oCacheVal.last.getRowAbs(), oActiveRange.setAbs(r1Abs, c1Abs, r2Abs, c2Abs);
oCacheVal.last.getColAbs());
var bCol = 0 == r1 && gc_nMaxRow0 == r2; var bCol = 0 == r1 && gc_nMaxRow0 == r2;
var bRow = 0 == c1 && gc_nMaxCol0 == c2; var bRow = 0 == c1 && gc_nMaxCol0 == c2;
...@@ -1446,8 +1499,7 @@ ...@@ -1446,8 +1499,7 @@
} else { } else {
if (null == oCacheVal.formulaRange) { if (null == oCacheVal.formulaRange) {
var oFormulaRange = new FormulaRange(c1, r1, c2, r2); var oFormulaRange = new FormulaRange(c1, r1, c2, r2);
oFormulaRange.setAbs(oCacheVal.first.getRowAbs(), oCacheVal.first.getColAbs(), oCacheVal.last.getRowAbs(), oFormulaRange.setAbs(r1Abs, c1Abs, r2Abs, c2Abs);
oCacheVal.last.getColAbs());
oCacheVal.formulaRange = oFormulaRange; oCacheVal.formulaRange = oFormulaRange;
} }
......
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