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

fix bug 33540

parent d2f6e6f5
......@@ -170,7 +170,7 @@ function (window, undefined) {
window['AscCH'].historyitem_Sparkline_ColorHigh = 24;
window['AscCH'].historyitem_Sparkline_ColorLow = 25;
window['AscCH'].historyitem_Sparkline_F = 26;
window['AscCH'].historyitem_Sparkline_CloneSparklines = 27;
window['AscCH'].historyitem_Sparkline_ChangeData = 27;
window['AscCH'].historyitem_Sparkline_RemoveData = 28;
window['AscCH'].historyitem_Sparkline_RemoveSparkline = 29;
......
......@@ -3516,7 +3516,7 @@ Woorksheet.prototype.clone=function(sNewId, sName, tableNames){
var newSparkline;
for (i = 0; i < this.aSparklineGroups.length; ++i) {
newSparkline = this.aSparklineGroups[i].clone();
newSparkline.setWorksheet(oNewWs);
newSparkline.setWorksheet(oNewWs, wsFrom);
oNewWs.aSparklineGroups.push(newSparkline);
}
};
......
......@@ -4785,7 +4785,7 @@ CellArea.prototype = {
w.WriteString2(data.newPr);
}
break;
case AscCH.historyitem_Sparkline_CloneSparklines:
case AscCH.historyitem_Sparkline_ChangeData:
if (data.newPr) {
w.WriteLong(data.newPr.length);
data.newPr.forEach(function (item) {
......@@ -4902,7 +4902,8 @@ CellArea.prototype = {
case AscCH.historyitem_Sparkline_F:
this.f = r.GetBool() ? r.GetString2() : null;
break;
case AscCH.historyitem_Sparkline_CloneSparklines:
case AscCH.historyitem_Sparkline_ChangeData:
this.arrSparklines = [];
var count = r.GetLong(), oSparkline;
for (var i = 0; i < count; ++i) {
oSparkline = new sparkline();
......@@ -4942,6 +4943,7 @@ CellArea.prototype = {
}
};
sparklineGroup.prototype.Undo = function (data) {
var t = this;
switch (data.Type) {
case AscCH.historyitem_Sparkline_Type:
this.type = data.oldPr;
......@@ -5021,6 +5023,14 @@ CellArea.prototype = {
case AscCH.historyitem_Sparkline_F:
this.f = data.oldPr;
break;
case AscCH.historyitem_Sparkline_ChangeData:
this.arrSparklines = [];
if (data.oldPr) {
data.oldPr.forEach(function (item) {
t.arrSparklines.push(item.clone());
});
}
break;
case AscCH.historyitem_Sparkline_RemoveData:
this.arrSparklines.push(data.oldPr);
break;
......@@ -5034,6 +5044,7 @@ CellArea.prototype = {
this.cleanCache();
};
sparklineGroup.prototype.Redo = function (data) {
var t = this;
switch (data.Type) {
case AscCH.historyitem_Sparkline_Type:
this.type = data.newPr;
......@@ -5113,6 +5124,14 @@ CellArea.prototype = {
case AscCH.historyitem_Sparkline_F:
this.f = data.newPr;
break;
case AscCH.historyitem_Sparkline_ChangeData:
this.arrSparklines = [];
if (data.newPr) {
data.newPr.forEach(function (item) {
t.arrSparklines.push(item.clone());
});
}
break;
case AscCH.historyitem_Sparkline_RemoveData:
this.remove(data.oldPr.sqref);
break;
......@@ -5156,8 +5175,18 @@ CellArea.prototype = {
this.colorHigh = new RgbColor(defaultOtherColor);
this.colorLow = new RgbColor(defaultOtherColor);
};
sparklineGroup.prototype.setWorksheet = function (worksheet) {
sparklineGroup.prototype.setWorksheet = function (worksheet, oldWorksheet) {
this.worksheet = worksheet;
if (oldWorksheet) {
var oldSparklines = [];
var newSparklines = [];
for (var i = 0; i < this.arrSparklines.length; ++i) {
oldSparklines.push(this.arrSparklines[i].clone());
this.arrSparklines[i].updateWorksheet(worksheet.sName, oldWorksheet.sName);
newSparklines.push(this.arrSparklines[i].clone());
}
History.Add(this, {Type: AscCH.historyitem_Sparkline_ChangeData, oldPr: oldSparklines, newPr: newSparklines});
}
};
sparklineGroup.prototype.set = function (val) {
var t = this;
......@@ -5214,7 +5243,7 @@ CellArea.prototype = {
res.arrSparklines.push(this.arrSparklines[i].clone());
newSparklines.push(this.arrSparklines[i].clone());
}
History.Add(res, {Type: AscCH.historyitem_Sparkline_CloneSparklines, oldPr: null, newPr: newSparklines});
History.Add(res, {Type: AscCH.historyitem_Sparkline_ChangeData, oldPr: null, newPr: newSparklines});
}
return res;
......@@ -5601,6 +5630,12 @@ CellArea.prototype = {
this.f = f;
this._f = AscCommonExcel.g_oRangeCache.getRange3D(this.f);
};
sparkline.prototype.updateWorksheet = function (sheet, oldSheet) {
if (this._f && oldSheet === this._f.sheet && (null === this._f.sheet2 || oldSheet === this._f.sheet2)) {
this._f.setSheet(sheet);
this.f = this._f.getName();
}
};
sparkline.prototype.checkInRange = function (range) {
return this.sqref ? range.isIntersect(this.sqref) : false;
};
......
......@@ -585,6 +585,7 @@
*/
function Range3D() {
this.sheet = '';
this.sheet2 = '';
if (3 == arguments.length) {
var range = arguments[0];
......@@ -613,6 +614,13 @@
Range3D.prototype.clone = function () {
return new Range3D(ActiveRange.superclass.clone.apply(this, arguments), this.sheet, this.sheet2);
};
Range3D.prototype.setSheet = function (sheet, sheet2) {
this.sheet = sheet;
this.sheet2 = sheet2 ? sheet2 : sheet;
};
Range3D.prototype.getName = function () {
return AscCommon.parserHelp.get3DRef(this.sheet, Range3D.superclass.getName.apply(this));
};
/**
* @constructor
......
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