Commit a0a476ae authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Если в формуле 2 одинаковые ссылки на ячейки, то они должны быть одним цветом....

Если в формуле 2 одинаковые ссылки на ячейки, то они должны быть одним цветом. Поправил часть бага http://bugzserver/show_bug.cgi?id=25525 (пункт 2. часть 1 На листе Sheet1 переходим в режим редактирования ячейки C5 двойным кликом)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57388 954022d7-b5bf-4e40-9824-e11837661b57
parent d30bd1f0
......@@ -59,6 +59,17 @@
return -1;
}
function getUniqueRangeColor (arrRanges, curElem, tmpColors) {
var colorIndex, j, range = arrRanges[curElem];
for (j = 0; j < curElem; ++j) {
if (range.isEqual(arrRanges[j])) {
colorIndex = tmpColors[j];
break;
}
}
return colorIndex;
}
function round(x) {
var y = x + (x >= 0 ? .5 : -.4);
......@@ -1473,6 +1484,7 @@
window["Asc"].typeOf = typeOf;
window["Asc"].lastIndexOf = lastIndexOf;
window["Asc"].search = search;
window["Asc"].getUniqueRangeColor = getUniqueRangeColor;
window["Asc"].round = round;
window["Asc"].floor = floor;
window["Asc"].ceil = ceil;
......
......@@ -783,7 +783,8 @@
};
CellEditor.prototype._getRenderFragments = function () {
var opt = this.options, fragments = opt.fragments, i, j, first, last, val, lengthColors;
var opt = this.options, fragments = opt.fragments, i, j, first, last, val, lengthColors,
tmpColors, colorIndex, uniqueColorIndex;
if (this.isFormula()) {
var arrRanges = this.handlers.trigger("getFormulaRanges");
if (0 < arrRanges.length) {
......@@ -792,16 +793,23 @@
fragments.push(opt.fragments[i].clone());
lengthColors = c_oAscFormulaRangeBorderColor.length;
tmpColors = [];
uniqueColorIndex = 0;
for (i = 0; i < arrRanges.length; ++i) {
val = arrRanges[i];
colorIndex = asc.getUniqueRangeColor(arrRanges, i, tmpColors);
if (null == colorIndex)
colorIndex = uniqueColorIndex++;
tmpColors.push(colorIndex);
this._extractFragments(val.cursorePos, val.formulaRangeLength, fragments);
first = this._findFragment(val.cursorePos, fragments);
last = this._findFragment(val.cursorePos + val.formulaRangeLength - 1, fragments);
if (first && last) {
for (j = first.index; j <= last.index; ++j)
fragments[j].format.c = c_oAscFormulaRangeBorderColor[i % lengthColors];
fragments[j].format.c = c_oAscFormulaRangeBorderColor[colorIndex % lengthColors];
}
}
}
......
......@@ -3716,10 +3716,16 @@
WorksheetView.prototype._drawFormulaRanges = function (arrRanges){
var i, lineWidth = 1, isDashLine = false, length = c_oAscFormulaRangeBorderColor.length;
var strokeColor, fillColor;
var strokeColor, fillColor, colorIndex, uniqueColorIndex = 0, tmpColors = [];
for (i = 0; i < arrRanges.length; ++i) {
var oFormulaRange = arrRanges[i].clone(true);
strokeColor = fillColor = c_oAscFormulaRangeBorderColor[i % length];
colorIndex = asc.getUniqueRangeColor(arrRanges, i, tmpColors);
if (null == colorIndex)
colorIndex = uniqueColorIndex++;
tmpColors.push(colorIndex);
strokeColor = fillColor = c_oAscFormulaRangeBorderColor[colorIndex % length];
this._drawElements(this, this._drawSelectionElement, oFormulaRange, isDashLine, lineWidth,
strokeColor, fillColor);
}
......
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