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) { ...@@ -5706,10 +5706,18 @@ Woorksheet.prototype.updateSparklineCache = function(sheet, ranges) {
} }
return null; return null;
}; };
Woorksheet.prototype.removeSparkline = function (range) { Woorksheet.prototype.removeSparklines = function (range) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) { for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (this.aSparklineGroups[i].remove(range)) { 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); this.aSparklineGroups.splice(i--, 1);
} }
} }
......
...@@ -5257,6 +5257,14 @@ CellArea.prototype = { ...@@ -5257,6 +5257,14 @@ CellArea.prototype = {
} }
return -1; 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) { sparklineGroup.prototype.remove = function (range) {
for (var i = 0; i < this.arrSparklines.length; ++i) { for (var i = 0; i < this.arrSparklines.length; ++i) {
if (this.arrSparklines[i].checkInRange(range)) { if (this.arrSparklines[i].checkInRange(range)) {
...@@ -5599,6 +5607,9 @@ CellArea.prototype = { ...@@ -5599,6 +5607,9 @@ CellArea.prototype = {
sparkline.prototype.contains = function (c, r) { sparkline.prototype.contains = function (c, r) {
return this.sqref ? this.sqref.contains(c, r) : false; 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 // For Auto Filters
/** @constructor */ /** @constructor */
......
...@@ -8588,20 +8588,33 @@ ...@@ -8588,20 +8588,33 @@
t.model.autoFilters.cleanFormat(arn); t.model.autoFilters.cleanFormat(arn);
} }
if (val === c_oAscCleanOptions.All) { switch(val) {
range.cleanAll(); case c_oAscCleanOptions.All:
t.model.removeSparkline(arn); range.cleanAll();
// Удаляем комментарии t.model.removeSparklines(arn);
t.cellCommentator.deleteCommentsRange(arn); // Удаляем комментарии
} else if (val === c_oAscCleanOptions.Text || val === c_oAscCleanOptions.Formula) { t.cellCommentator.deleteCommentsRange(arn);
range.cleanText(); break;
} else if (val === c_oAscCleanOptions.Format) { case c_oAscCleanOptions.Text:
range.cleanFormat(); case c_oAscCleanOptions.Formula:
} else if (val === c_oAscCleanOptions.Comments) { range.cleanText();
t.cellCommentator.deleteCommentsRange(arn); break;
} else if (val === c_oAscCleanOptions.Hyperlinks) { case c_oAscCleanOptions.Format:
range.cleanHyperlinks(); 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) { 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