Commit d327b3a2 authored by konovalovsergey's avatar konovalovsergey

add PivotRecords to store CT_PivotCacheRecords records

parent 2a3e0367
......@@ -943,6 +943,97 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
return cErrorLocal["na"];
};
cError.prototype.getErrorTypeFromString = function(val) {
var res;
switch (val) {
case cErrorOrigin["value"]: {
res = cErrorType.wrong_value_type;
break;
}
case cErrorOrigin["nil"]: {
res = cErrorType.null_value;
break;
}
case cErrorOrigin["div"]: {
res = cErrorType.division_by_zero;
break;
}
case cErrorOrigin["ref"]: {
res = cErrorType.bad_reference;
break;
}
case cErrorOrigin["name"]: {
res = cErrorType.wrong_name;
break;
}
case cErrorOrigin["num"]: {
res = cErrorType.not_numeric;
break;
}
case cErrorOrigin["na"]: {
res = cErrorType.not_available;
break;
}
case cErrorOrigin["getdata"]: {
res = cErrorType.getting_data;
break;
}
case cErrorOrigin["uf"]: {
res = cErrorType.unsupported_function;
break;
}
default: {
res = cErrorType.not_available;
break;
}
}
return res;
};
cError.prototype.getStringFromErrorType = function(type) {
var res;
switch (type) {
case cErrorType.wrong_value_type: {
res = cErrorOrigin["value"];
break;
}
case cErrorType.null_value: {
res = cErrorOrigin["nil"];
break;
}
case cErrorType.division_by_zero: {
res = cErrorOrigin["div"];
break;
}
case cErrorType.bad_reference: {
res = cErrorOrigin["ref"];
break;
}
case cErrorType.wrong_name: {
res = cErrorOrigin["name"];
break;
}
case cErrorType.not_numeric: {
res = cErrorOrigin["num"];
break;
}
case cErrorType.not_available: {
res = cErrorOrigin["na"];
break;
}
case cErrorType.getting_data: {
res = cErrorOrigin["getdata"];
break;
}
case cErrorType.unsupported_function: {
res = cErrorOrigin["uf"];
break;
}
default:
res = cErrorType.not_available;
break;
}
return res;
};
/**
* @constructor
......
This diff is collapsed.
......@@ -5044,7 +5044,7 @@
};
Worksheet.prototype._updatePivotTable = function (pivotTable, cleanRanges) {
var pos, cells, index, i, j, k, r, c1, r1, field, indexField, cacheIndex, sharedItem, item, items, setName,
oCellValue, cacheRecord, last;
oCellValue, rowIndexes, last;
for (i = 0; i < cleanRanges.length; ++i) {
cleanRanges[i].cleanAll();
}
......@@ -5088,7 +5088,7 @@
for (i = 0; i < items.length; ++i) {
item = items[i];
r = item.getR();
cacheRecord = cacheRecords;
rowIndexes = undefined;
if (countC) {
for (j = 0; j < item.x.length; ++j) {
if (AscCommonExcel.c_oAscItemType.Grand === item.t) {
......@@ -5111,7 +5111,7 @@
}
if (countD) {
cacheRecord = pivotTable.getValues(cacheRecord, indexField, cacheIndex.x);
rowIndexes = pivotTable.getValues(cacheRecords, rowIndexes, indexField, cacheIndex.x);
}
}
......@@ -5132,7 +5132,7 @@
cacheFields[index].asc_getName());
}
if (countD) {
cacheValuesCol.push(cacheRecord);
cacheValuesCol.push(rowIndexes);
}
}
}
......@@ -5207,20 +5207,19 @@
last = r === countR - 1 || null !== item.t;
if (countD && (last || (field && field.asc_getSubtotalTop()))) {
for (j = 0; j < cacheValuesCol.length; ++j) {
if (cacheRecord = cacheValuesCol[j]) {
for (k = 0; k < cacheValuesRow.length && 0 !== cacheRecord.length; k += 2) {
cacheRecord =
pivotTable.getValues(cacheRecord, cacheValuesRow[k], cacheValuesRow[k + 1]);
}
if (0 !== cacheRecord.length) {
cells = this.getRange4(r1 + i, rowFieldsPos[r] + 1 + j);
oCellValue = new AscCommonExcel.CCellValue();
oCellValue.number = pivotTable.getValue(cacheRecord, dataFields[0].asc_getIndex(),
(null !== item.t && c_oAscItemType.Grand !== item.t) ? item.t :
dataFields[0].asc_getSubtotal());
oCellValue.type = AscCommon.CellValueType.Number;
cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null, oCellValue));
}
rowIndexes = cacheValuesCol[j];
for (k = 0; k < cacheValuesRow.length && (!rowIndexes || 0 !== rowIndexes.length); k += 2) {
rowIndexes =
pivotTable.getValues(cacheRecords, rowIndexes, cacheValuesRow[k], cacheValuesRow[k + 1]);
}
if (0 !== rowIndexes.length) {
cells = this.getRange4(r1 + i, rowFieldsPos[r] + 1 + j);
oCellValue = new AscCommonExcel.CCellValue();
oCellValue.number = pivotTable.getValue(cacheRecords, rowIndexes, dataFields[0].asc_getIndex(),
(null !== item.t && c_oAscItemType.Grand !== item.t) ? item.t :
dataFields[0].asc_getSubtotal());
oCellValue.type = AscCommon.CellValueType.Number;
cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null, oCellValue));
}
}
if (last) {
......
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