Commit 866271a5 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Отрисовка диапазонов формул для pane (+ очистка)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53124 954022d7-b5bf-4e40-9824-e11837661b57
parent 4b34edff
...@@ -5006,7 +5006,7 @@ function DrawingObjects() { ...@@ -5006,7 +5006,7 @@ function DrawingObjects() {
worksheet.arrActiveChartsRanges.push(range); worksheet.arrActiveChartsRanges.push(range);
worksheet.isChartAreaEditMode = true; worksheet.isChartAreaEditMode = true;
worksheet._drawFormulaRange(worksheet.arrActiveChartsRanges); worksheet._drawFormulaRanges(worksheet.arrActiveChartsRanges);
bRaise = true; bRaise = true;
} }
} }
......
...@@ -2888,7 +2888,7 @@ ...@@ -2888,7 +2888,7 @@
isFrozen = !!isFrozen; isFrozen = !!isFrozen;
if (asc["editor"].isStartAddShape || this.objectRender.selectedGraphicObjectsExists()) { if (asc["editor"].isStartAddShape || this.objectRender.selectedGraphicObjectsExists()) {
if (this.isChartAreaEditMode) { if (this.isChartAreaEditMode) {
this._drawFormulaRange(this.arrActiveChartsRanges); this._drawFormulaRanges(this.arrActiveChartsRanges);
} }
return; return;
} }
...@@ -3154,15 +3154,15 @@ ...@@ -3154,15 +3154,15 @@
ctx.stroke(); ctx.stroke();
} }
if (this.isFormulaEditMode) { if (!isFrozen && this.isFormulaEditMode) {
this._drawFormulaRange(this.arrActiveFormulaRanges); this._drawFormulaRanges(this.arrActiveFormulaRanges);
} }
if (this.isChartAreaEditMode) { if (!isFrozen && this.isChartAreaEditMode) {
this._drawFormulaRange(this.arrActiveChartsRanges); this._drawFormulaRanges(this.arrActiveChartsRanges);
} }
if (this.isSelectionDialogMode) { if (!isFrozen && this.isSelectionDialogMode) {
this._drawSelectRange(this.activeRange.clone(true)); this._drawSelectRange(this.activeRange.clone(true));
} }
...@@ -3201,46 +3201,31 @@ ...@@ -3201,46 +3201,31 @@
} }
}, },
_drawFormulaRange: function(arr){ _drawFormulaRange: function (index, oFormulaRange, oFormulaRangeIntersection, visibleRange, offsetX, offsetY) {
var ctx = this.overlayCtx, if (!oFormulaRangeIntersection)
opt = this.settings, return;
offsetX = this.cols[this.visibleRange.c1].left - this.cellsLeft, var ctx = this.overlayCtx, opt = this.settings;
offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop;
if (this.topLeftFrozenCell) {
var cFrozen = this.topLeftFrozenCell.getCol0();
var rFrozen = this.topLeftFrozenCell.getRow0();
offsetX -= this.cols[cFrozen].left - this.cols[0].left;
offsetY -= this.rows[rFrozen].top - this.rows[0].top;
}
ctx.setLineWidth(1);
for (var i in arr) {
var arFormulaTmp = arr[i].clone(true);
var aFormulaIntersection = arFormulaTmp.intersection(this.visibleRange);
if (aFormulaIntersection) {
ctx.beginPath() ctx.beginPath()
.setStrokeStyle(opt.formulaRangeBorderColor[i%opt.formulaRangeBorderColor.length]) .setStrokeStyle(opt.formulaRangeBorderColor[index%opt.formulaRangeBorderColor.length])
.setFillStyle(opt.formulaRangeBorderColor[i%opt.formulaRangeBorderColor.length]); .setFillStyle(opt.formulaRangeBorderColor[index%opt.formulaRangeBorderColor.length]);
var drawLeftSideFormula = aFormulaIntersection.c1 === arFormulaTmp.c1; var drawLeftSideFormula = oFormulaRangeIntersection.c1 === oFormulaRange.c1;
var drawRightSideFormula = aFormulaIntersection.c2 === arFormulaTmp.c2; var drawRightSideFormula = oFormulaRangeIntersection.c2 === oFormulaRange.c2;
var drawTopSideFormula = aFormulaIntersection.r1 === arFormulaTmp.r1; var drawTopSideFormula = oFormulaRangeIntersection.r1 === oFormulaRange.r1;
var drawBottomSideFormula = aFormulaIntersection.r2 === arFormulaTmp.r2; var drawBottomSideFormula = oFormulaRangeIntersection.r2 === oFormulaRange.r2;
var xFormula1 = this.cols[aFormulaIntersection.c1].left - offsetX - this.width_1px; var xFormula1 = this.cols[oFormulaRangeIntersection.c1].left - offsetX - this.width_1px;
var xFormula2 = this.cols[aFormulaIntersection.c2].left + this.cols[aFormulaIntersection.c2].width - offsetX - this.width_1px; var xFormula2 = this.cols[oFormulaRangeIntersection.c2].left + this.cols[oFormulaRangeIntersection.c2].width - offsetX - this.width_1px;
var yFormula1 = this.rows[aFormulaIntersection.r1].top - offsetY; var yFormula1 = this.rows[oFormulaRangeIntersection.r1].top - offsetY;
var yFormula2 = this.rows[aFormulaIntersection.r2].top + this.rows[aFormulaIntersection.r2].height - offsetY - this.height_1px; var yFormula2 = this.rows[oFormulaRangeIntersection.r2].top + this.rows[oFormulaRangeIntersection.r2].height - offsetY - this.height_1px;
if ( drawTopSideFormula && aFormulaIntersection.r1 != this.visibleRange.r1 ) { if ( drawTopSideFormula && oFormulaRangeIntersection.r1 != visibleRange.r1 ) {
ctx.lineHor( xFormula1 + this.width_1px, yFormula1 - this.height_1px, xFormula2 + this.width_1px ); ctx.lineHor( xFormula1 + this.width_1px, yFormula1 - this.height_1px, xFormula2 + this.width_1px );
} }
if ( drawBottomSideFormula ) { if ( drawBottomSideFormula ) {
ctx.lineHor( xFormula1 + this.width_1px, yFormula2, xFormula2 + this.width_1px ); ctx.lineHor( xFormula1 + this.width_1px, yFormula2, xFormula2 + this.width_1px );
} }
if ( drawLeftSideFormula && aFormulaIntersection.c1 != this.visibleRange.c1 ) { if ( drawLeftSideFormula && oFormulaRangeIntersection.c1 != visibleRange.c1 ) {
ctx.lineVer( xFormula1, yFormula1 - this.width_1px * (aFormulaIntersection.r1 != this.visibleRange.r1), yFormula2 + this.width_1px ); ctx.lineVer( xFormula1, yFormula1 - this.width_1px * (oFormulaRangeIntersection.r1 != visibleRange.r1), yFormula2 + this.width_1px );
} }
if (drawRightSideFormula) {ctx.lineVer(xFormula2, yFormula1, yFormula2);} if (drawRightSideFormula) {ctx.lineVer(xFormula2, yFormula1, yFormula2);}
...@@ -3257,6 +3242,52 @@ ...@@ -3257,6 +3242,52 @@
ctx.fillRect(xFormula1 + this.width_1px, yFormula2 - this.height_4px, this.width_4px, this.height_4px); ctx.fillRect(xFormula1 + this.width_1px, yFormula2 - this.height_4px, this.width_4px, this.height_4px);
ctx.closePath().stroke(); ctx.closePath().stroke();
},
_drawFormulaRanges: function(arr){
var ctx = this.overlayCtx, cFrozen = 0, rFrozen = 0,
offsetX = this.cols[this.visibleRange.c1].left - this.cellsLeft,
offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop;
var arrFrozenRanges = [], arrOffsetsX = [], arrOffsetsY = [];
if (this.topLeftFrozenCell) {
cFrozen = this.topLeftFrozenCell.getCol0();
rFrozen = this.topLeftFrozenCell.getRow0();
offsetX -= this.cols[cFrozen].left - this.cols[0].left;
offsetY -= this.rows[rFrozen].top - this.rows[0].top;
var oFrozenRange;
cFrozen -= 1; rFrozen -= 1;
if (0 <= cFrozen && 0 <= rFrozen) {
oFrozenRange = new asc_Range(0, 0, cFrozen, rFrozen);
arrFrozenRanges.push(oFrozenRange);
arrOffsetsX.push(this.cols[0].left - this.cellsLeft);
arrOffsetsY.push(this.rows[0].top - this.cellsTop);
}
if (0 <= cFrozen) {
oFrozenRange = new asc_Range(0, this.visibleRange.r1, cFrozen, this.visibleRange.r2);
arrFrozenRanges.push(oFrozenRange);
arrOffsetsX.push(this.cols[0].left - this.cellsLeft);
arrOffsetsY.push(offsetY);
}
if (0 <= rFrozen) {
oFrozenRange = new asc_Range(this.visibleRange.c1, 0, this.visibleRange.c2, rFrozen);
arrFrozenRanges.push(oFrozenRange);
arrOffsetsX.push(offsetX);
arrOffsetsY.push(this.rows[0].top - this.cellsTop);
}
}
ctx.setLineWidth(1);
for (var i in arr) {
if (!arr.hasOwnProperty(i))
continue;
var oFormulaTmp = arr[i].clone(true);
var oFormulaIntersection = oFormulaTmp.intersection(this.visibleRange);
this._drawFormulaRange(i, oFormulaTmp, oFormulaIntersection, this.visibleRange, offsetX, offsetY);
for (var j = 0; j < arrFrozenRanges.length; ++j) {
oFormulaIntersection = oFormulaTmp.intersection(arrFrozenRanges[j]);
this._drawFormulaRange(i, oFormulaTmp, oFormulaIntersection, arrFrozenRanges[j], arrOffsetsX[j], arrOffsetsY[j]);
} }
} }
}, },
...@@ -3500,7 +3531,7 @@ ...@@ -3500,7 +3531,7 @@
for (i = 0; i < arrayElements.length; ++i) { for (i = 0; i < arrayElements.length; ++i) {
var arFormulaTmp = asc_Range (arrayElements[i].c1, arrayElements[i].r1, arrayElements[i].c2, arrayElements[i].r2); var arFormulaTmp = asc_Range (arrayElements[i].c1, arrayElements[i].r1, arrayElements[i].c2, arrayElements[i].r2);
var aFormulaIntersection = arFormulaTmp.intersection(this.visibleRange); var aFormulaIntersection = arFormulaTmp.intersection(range ? range : this.visibleRange);
if (aFormulaIntersection) { if (aFormulaIntersection) {
// Координаты для автозаполнения // Координаты для автозаполнения
...@@ -3523,7 +3554,7 @@ ...@@ -3523,7 +3554,7 @@
for (i = 0; i < this.arrActiveFormulaRanges.length; ++i) { for (i = 0; i < this.arrActiveFormulaRanges.length; ++i) {
var activeFormula = this.arrActiveFormulaRanges[i].clone(true); var activeFormula = this.arrActiveFormulaRanges[i].clone(true);
activeFormula = this.visibleRange.intersection(activeFormula); activeFormula = activeFormula.intersection(range ? range : activeFormula);
if (null === activeFormula) { if (null === activeFormula) {
// это ссылка из формулы на еще не добавленный рэндж // это ссылка из формулы на еще не добавленный рэндж
continue; continue;
...@@ -3552,7 +3583,7 @@ ...@@ -3552,7 +3583,7 @@
for (i in this.arrActiveChartsRanges ) { for (i in this.arrActiveChartsRanges ) {
var activeFormula = this.arrActiveChartsRanges[i].clone(true); var activeFormula = this.arrActiveChartsRanges[i].clone(true);
activeFormula = this.visibleRange.intersection(activeFormula); activeFormula = activeFormula.intersection(range ? range : activeFormula);
if (null === activeFormula) { if (null === activeFormula) {
// это ссылка из формулы на еще не добавленный рэндж // это ссылка из формулы на еще не добавленный рэндж
continue; continue;
......
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