Commit 0fc38d3b authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

[erp5_only_office] fix parserFormula.changeOffset

parent 1528eda9
...@@ -614,8 +614,6 @@ ...@@ -614,8 +614,6 @@
new_member = level[member.level_index + offset.offsetCol + offset.offsetRow]; new_member = level[member.level_index + offset.offsetCol + offset.offsetRow];
if (new_member) { if (new_member) {
elem.value = new_member.uname; elem.value = new_member.uname;
} else {
elem.value = "";
} }
} }
} }
......
...@@ -5543,7 +5543,8 @@ parserFormula.prototype.setFormula = function(formula) { ...@@ -5543,7 +5543,8 @@ parserFormula.prototype.setFormula = function(formula) {
/* Для обратной сборки функции иногда необходимо поменять ссылки на ячейки */ /* Для обратной сборки функции иногда необходимо поменять ссылки на ячейки */
parserFormula.prototype.changeOffset = function (offset, canResize) {//offset = AscCommonExcel.CRangeOffset parserFormula.prototype.changeOffset = function (offset, canResize) {//offset = AscCommonExcel.CRangeOffset
var elemArr = [], currentElement = null, arg, var elemArr = [], currentElement = null, arg,
disable_changeOffset_run = false; disable_changeOffset_run = false,
argumentsCount;
for (var i = 0; i < this.outStack.length; i++) { for (var i = 0; i < this.outStack.length; i++) {
currentElement = this.outStack[i]; currentElement = this.outStack[i];
this.changeOffsetElem(currentElement, this.outStack, i, offset, canResize); this.changeOffsetElem(currentElement, this.outStack, i, offset, canResize);
...@@ -5553,14 +5554,24 @@ parserFormula.prototype.setFormula = function(formula) { ...@@ -5553,14 +5554,24 @@ parserFormula.prototype.setFormula = function(formula) {
if (currentElement.name == "(") { if (currentElement.name == "(") {
continue; continue;
} }
if(currentElement.type === cElementType.specialFunctionStart){
continue;
}
if(currentElement.type === cElementType.specialFunctionEnd){
continue;
}
if("number" === typeof(currentElement)){
continue;
}
if (currentElement.type === cElementType.operator || currentElement.type === cElementType.func) { if (currentElement.type === cElementType.operator || currentElement.type === cElementType.func) {
if (elemArr.length < currentElement.getArguments()) { argumentsCount = "number" === typeof(this.outStack[i - 1]) ? this.outStack[i - 1] : currentElement.argumentsCurrent;
if (elemArr.length < argumentsCount) {
disable_changeOffset_run = true; disable_changeOffset_run = true;
continue; continue;
} else { } else {
if (currentElement && currentElement.changeOffsetElem) { if (currentElement && currentElement.changeOffsetElem) {
arg = []; arg = [];
for (var ind = 0; ind < currentElement.getArguments(); ind++) { for (var ind = 0; ind < argumentsCount; ind++) {
arg.unshift(elemArr.pop()); arg.unshift(elemArr.pop());
} }
currentElement.changeOffsetElem(arg, offset); currentElement.changeOffsetElem(arg, offset);
...@@ -5569,9 +5580,9 @@ parserFormula.prototype.setFormula = function(formula) { ...@@ -5569,9 +5580,9 @@ parserFormula.prototype.setFormula = function(formula) {
elemArr.push(new cEmpty()); elemArr.push(new cEmpty());
} }
} else if (currentElement.type === cElementType.name || currentElement.type === cElementType.name3D) { } else if (currentElement.type === cElementType.name || currentElement.type === cElementType.name3D) {
elemArr.push(currentElement.Calculate(null, rangeCell)); elemArr.push(currentElement.Calculate(null, null));
} else if (currentElement.type === cElementType.table) { } else if (currentElement.type === cElementType.table) {
elemArr.push(currentElement.toRef(rangeCell.getBBox0())); elemArr.push(currentElement.toRef(null));
} else { } else {
elemArr.push(currentElement); elemArr.push(currentElement);
} }
......
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