Commit bb932d03 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Added sparkline clearing

parent 24a3a693
......@@ -5706,10 +5706,18 @@ Woorksheet.prototype.updateSparklineCache = function(sheet, ranges) {
}
return null;
};
Woorksheet.prototype.removeSparkline = function (range) {
Woorksheet.prototype.removeSparklines = function (range) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (this.aSparklineGroups[i].remove(range)) {
History.Add(this.aSparklineGroups[i], AscCH.historyitem_Sparkline_Remove_Sparkline, this.getId(), null, null);
History.Add(this.aSparklineGroups[i], {Type: AscCH.historyitem_Sparkline_Remove_Sparkline, oldPr: null, newPr: null});
this.aSparklineGroups.splice(i--, 1);
}
}
};
Woorksheet.prototype.removeSparklineGroups = function (range) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (-1 !== this.aSparklineGroups[i].intersectionSimple(range)) {
History.Add(this.aSparklineGroups[i], {Type: AscCH.historyitem_Sparkline_Remove_Sparkline, oldPr: null, newPr: null});
this.aSparklineGroups.splice(i--, 1);
}
}
......
......@@ -5257,6 +5257,14 @@ CellArea.prototype = {
}
return -1;
};
sparklineGroup.prototype.intersectionSimple = function (range) {
for (var j = 0; j < this.arrSparklines.length; ++j) {
if (this.arrSparklines[j].intersectionSimple(range)) {
return j;
}
}
return -1;
};
sparklineGroup.prototype.remove = function (range) {
for (var i = 0; i < this.arrSparklines.length; ++i) {
if (this.arrSparklines[i].checkInRange(range)) {
......@@ -5599,6 +5607,9 @@ CellArea.prototype = {
sparkline.prototype.contains = function (c, r) {
return this.sqref ? this.sqref.contains(c, r) : false;
};
sparkline.prototype.intersectionSimple = function (range) {
return this.sqref ? this.sqref.intersectionSimple(range) : false;
};
// For Auto Filters
/** @constructor */
......
......@@ -8588,20 +8588,33 @@
t.model.autoFilters.cleanFormat(arn);
}
if (val === c_oAscCleanOptions.All) {
range.cleanAll();
t.model.removeSparkline(arn);
// Удаляем комментарии
t.cellCommentator.deleteCommentsRange(arn);
} else if (val === c_oAscCleanOptions.Text || val === c_oAscCleanOptions.Formula) {
range.cleanText();
} else if (val === c_oAscCleanOptions.Format) {
range.cleanFormat();
} else if (val === c_oAscCleanOptions.Comments) {
t.cellCommentator.deleteCommentsRange(arn);
} else if (val === c_oAscCleanOptions.Hyperlinks) {
range.cleanHyperlinks();
}
switch(val) {
case c_oAscCleanOptions.All:
range.cleanAll();
t.model.removeSparklines(arn);
// Удаляем комментарии
t.cellCommentator.deleteCommentsRange(arn);
break;
case c_oAscCleanOptions.Text:
case c_oAscCleanOptions.Formula:
range.cleanText();
break;
case c_oAscCleanOptions.Format:
range.cleanFormat();
break;
case c_oAscCleanOptions.Comments:
t.cellCommentator.deleteCommentsRange(arn);
break;
case c_oAscCleanOptions.Hyperlinks:
range.cleanHyperlinks();
break;
case c_oAscCleanOptions.Sparklines:
t.model.removeSparklines(arn);
break;
case c_oAscCleanOptions.SparklineGroups:
t.model.removeSparklineGroups(arn);
break;
}
// Вызываем функцию пересчета для заголовков форматированной таблицы
if (val === c_oAscCleanOptions.All || val === c_oAscCleanOptions.Text) {
......
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