Commit 176bd907 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 35894

clear grid for pivot tables with outline and compact layout
parent 2ca6fa09
......@@ -2003,6 +2003,7 @@ function CT_pivotTableDefinition() {
this.cacheDefinition = null;
this.pageFieldsPositions = null;
this.clearGrid = false;
}
CT_pivotTableDefinition.prototype.readAttributes = function(attr, uq) {
if (attr()) {
......@@ -2719,6 +2720,20 @@ CT_pivotTableDefinition.prototype.init = function () {
}
this.location.setPageCount(rowPageCount, colPageCount);
this.updatePivotType();
};
CT_pivotTableDefinition.prototype.updatePivotType = function () {
this.clearGrid = false;
var field;
var pivotFields = this.asc_getPivotFields();
var rowFields = this.asc_getRowFields();
for (var i = 0; i < rowFields.length; ++i) {
field = pivotFields[rowFields[i].asc_getIndex()];
if (false !== field.outline) {
this.clearGrid = true;
break;
}
}
};
CT_pivotTableDefinition.prototype.intersection = function (range) {
return (this.location && this.location.intersection(range)) || this.pageFieldsIntersection(range);
......
......@@ -5486,6 +5486,21 @@
}
return res;
};
Worksheet.prototype.getPivotTablesClearRanges = function (range) {
// For outline and compact pivot tables layout we need clear the grid
var pivotTable, pivotRange, intersection, res = [];
for (var i = 0; i < this.pivotTables.length; ++i) {
pivotTable = this.pivotTables[i];
if (pivotTable.clearGrid) {
pivotRange = pivotTable.getRange();
if (intersection = pivotRange.intersectionSimple(range)) {
res.push(intersection);
res.push(pivotRange);
}
}
}
return res;
};
Worksheet.prototype.excludeHiddenRows = function (bExclude) {
this.bExcludeHiddenRows = bExclude;
};
......
......@@ -2384,6 +2384,22 @@
}
ctx.stroke();
// Clear grid for pivot tables with classic and outline layout
var clearRange, pivotRange, clearRanges = this.model.getPivotTablesClearRanges(range);
ctx.setFillStyle(this.settings.cells.defaultState.background);
for (i = 0; i < clearRanges.length; i += 2) {
clearRange = clearRanges[i];
pivotRange = clearRanges[i + 1];
x1 = c[clearRange.c1].left - offsetX + (clearRange.c1 === pivotRange.c1 ? this.width_1px : 0);
y1 = r[clearRange.r1].top - offsetY + (clearRange.r1 === pivotRange.r1 ? this.height_1px : 0);
x2 = Math.min(c[clearRange.c2].left - offsetX + c[clearRange.c2].width -
(clearRange.c2 === pivotRange.c2 ? this.width_1px : 0), widthCtx);
y2 = Math.min(r[clearRange.r2].top - offsetY + r[clearRange.r2].height -
(clearRange.r2 === pivotRange.r2 ? this.height_1px : 0), heightCtx);
ctx.fillRect(x1, y1, x2 - x1, y2 - y1);
}
};
WorksheetView.prototype._drawCellsAndBorders = function ( drawingCtx, range, offsetXForDraw, offsetYForDraw ) {
......
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