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

fix bug 33540

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