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

add method insertSparkline

add method setWorksheet
parent 30a7fd0c
......@@ -5605,7 +5605,7 @@
});
} else if (c_oSerWorksheetsTypes.SparklineGroups === type) {
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadSparklineGroups(t, l, oWorksheet.aSparklineGroups);
return oThis.ReadSparklineGroups(t, l, oWorksheet);
});
} else
res = c_oSerConstants.ReadUnknown;
......@@ -6620,15 +6620,16 @@
return res;
};
this.ReadSparklineGroups = function (type, length, aSparklineGroups) {
this.ReadSparklineGroups = function (type, length, oWorksheet) {
var oThis = this;
var res = c_oSerConstants.ReadOk;
if (c_oSer_Sparkline.SparklineGroup === type) {
var newSparklineGroup = new AscCommonExcel.sparklineGroup(true);
newSparklineGroup.setWorksheet(oWorksheet);
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadSparklineGroup(t, l, newSparklineGroup);
});
aSparklineGroups.push(newSparklineGroup);
oWorksheet.aSparklineGroups.push(newSparklineGroup);
} else
res = c_oSerConstants.ReadUnknown;
return res;
......
......@@ -3479,9 +3479,6 @@ Woorksheet.prototype.clone=function(sNewId, sName, tableNames){
for (i = 0; i < this.aConditionalFormatting.length; ++i) {
oNewWs.aConditionalFormatting.push(this.aConditionalFormatting[i].clone());
}
for (i = 0; i < this.aSparklineGroups.length; ++i) {
oNewWs.aSparklineGroups.push(this.aSparklineGroups[i].clone());
}
if (this.sheetPr)
oNewWs.sheetPr = this.sheetPr.clone();
......@@ -3489,28 +3486,37 @@ Woorksheet.prototype.clone=function(sNewId, sName, tableNames){
return oNewWs;
};
Woorksheet.prototype.copyDrawingObjects=function(oNewWs, wsFrom)
{
if(null != this.Drawings && this.Drawings.length > 0)
{
Woorksheet.prototype.copyDrawingObjects = function (oNewWs, wsFrom) {
var i;
if (null != this.Drawings && this.Drawings.length > 0) {
var drawingObjects = new AscFormat.DrawingObjects();
oNewWs.Drawings = [];
AscFormat.NEW_WORKSHEET_DRAWING_DOCUMENT = oNewWs.DrawingDocument;
for(var i = 0; i < this.Drawings.length; ++i)
{
for (i = 0; i < this.Drawings.length; ++i) {
var drawingObject = drawingObjects.cloneDrawingObject(this.Drawings[i]);
drawingObject.graphicObject = this.Drawings[i].graphicObject.copy();
drawingObject.graphicObject.setWorksheet(oNewWs);
drawingObject.graphicObject.addToDrawingObjects();
var drawingBase = this.Drawings[i];
drawingObject.graphicObject.setDrawingBaseCoords(drawingBase.from.col, drawingBase.from.colOff, drawingBase.from.row, drawingBase.from.rowOff, drawingBase.to.col, drawingBase.to.colOff, drawingBase.to.row, drawingBase.to.rowOff, drawingBase.Pos.X, drawingBase.Pos.Y, drawingBase.ext.cx, drawingBase.ext.cy);
drawingObject.graphicObject.setDrawingBaseCoords(drawingBase.from.col, drawingBase.from.colOff,
drawingBase.from.row, drawingBase.from.rowOff, drawingBase.to.col, drawingBase.to.colOff,
drawingBase.to.row, drawingBase.to.rowOff, drawingBase.Pos.X, drawingBase.Pos.Y, drawingBase.ext.cx,
drawingBase.ext.cy);
oNewWs.Drawings[oNewWs.Drawings.length - 1] = drawingObject;
}
AscFormat.NEW_WORKSHEET_DRAWING_DOCUMENT = null;
drawingObjects.pushToAObjects(oNewWs.Drawings);
drawingObjects.updateChartReferences2(parserHelp.getEscapeSheetName(wsFrom.sName), parserHelp.getEscapeSheetName(oNewWs.sName));
drawingObjects.updateChartReferences2(parserHelp.getEscapeSheetName(wsFrom.sName),
parserHelp.getEscapeSheetName(oNewWs.sName));
}
};
var newSparkline;
for (i = 0; i < this.aSparklineGroups.length; ++i) {
newSparkline = this.aSparklineGroups[i].clone();
newSparkline.setWorksheet(oNewWs);
oNewWs.aSparklineGroups.push(newSparkline);
}
};
Woorksheet.prototype.initPostOpen = function (handlers) {
var cwf = this.workbook.cwf[this.Id] = {};
if (this.aFormulaExt) {
......@@ -5693,11 +5699,14 @@ Woorksheet.prototype.updateSparklineCache = function(sheet, ranges) {
Woorksheet.prototype.getSparklineGroup = function(c, r) {
for (var i = 0; i < this.aSparklineGroups.length; ++i) {
if (-1 !== this.aSparklineGroups[i].contains(c, r)) {
return this.aSparklineGroups[i].clone(true);
return this.aSparklineGroups[i];
}
}
return null;
};
Woorksheet.prototype.insertSparkline = function (sparkline) {
this.aSparklineGroups.push(sparkline);
};
//-------------------------------------------------------------------------------------------------
/**
* @constructor
......
......@@ -4721,6 +4721,7 @@ CellArea.prototype = {
//for drawing preview
this.canvas = null;
this.worksheet = null;
this.Id = null;
if (addId) {
this.Id = AscCommon.g_oIdCounter.Get_NewId();
......@@ -5077,6 +5078,9 @@ CellArea.prototype = {
this.colorHigh = new RgbColor(defaultOtherColor);
this.colorLow = new RgbColor(defaultOtherColor);
};
sparklineGroup.prototype.setWorksheet = function (worksheet) {
this.worksheet = worksheet;
};
sparklineGroup.prototype.set = function (val) {
var t = this;
var checkProperty = function(propOld, propNew, type) {
......
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