Commit 3584698b authored by Sergey Luzyanin's avatar Sergey Luzyanin

Merge branch 'release/v4.1.0' into develop

parents 50c031ae f2c65d52
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
*/ */
function ApiShape(oShape){ function ApiShape(oShape){
ApiShape.superclass.constructor.call(this, oShape); ApiShape.superclass.constructor.call(this, oShape);
this.Shape = oShape;
} }
AscCommon.extendClass(ApiShape, ApiDrawing); AscCommon.extendClass(ApiShape, ApiDrawing);
...@@ -91,6 +92,7 @@ ...@@ -91,6 +92,7 @@
*/ */
function ApiChart(oChart){ function ApiChart(oChart){
ApiChart.superclass.constructor.call(this, oChart); ApiChart.superclass.constructor.call(this, oChart);
this.Chart = oChart;
} }
AscCommon.extendClass(ApiChart, ApiDrawing); AscCommon.extendClass(ApiChart, ApiDrawing);
...@@ -316,7 +318,16 @@ ...@@ -316,7 +318,16 @@
settings.inColumns = !bInRows; settings.inColumns = !bInRows;
settings.range = sDataRange; settings.range = sDataRange;
var oChart = AscFormat.DrawingObjectsController.prototype.getChartSpace(this.worksheet, settings); var oChart = AscFormat.DrawingObjectsController.prototype.getChartSpace(this.worksheet, settings);
if(arguments.length === 8){//support old variant
oChart.setBDeleted(false);
oChart.setWorksheet(this.worksheet);
oChart.setBFromSerialize(true);
oChart.addToDrawingObjects();
oChart.setDrawingBaseCoords(arguments[4], 0, arguments[5], 0, arguments[6], 0, arguments[7], 0, 0, 0, 0, 0);
}
else{
private_SetCoords(oChart, this.worksheet, nExtX, nExtY, nFromCol, nColOffset, nFromRow, nRowOffset); private_SetCoords(oChart, this.worksheet, nExtX, nExtY, nFromCol, nColOffset, nFromRow, nRowOffset);
}
if (AscFormat.isRealNumber(nStyleIndex)) { if (AscFormat.isRealNumber(nStyleIndex)) {
oChart.setStyle(nStyleIndex); oChart.setStyle(nStyleIndex);
} }
...@@ -475,8 +486,26 @@ ...@@ -475,8 +486,26 @@
* @param {EMU} nRowOffset * @param {EMU} nRowOffset
* */ * */
ApiDrawing.prototype.SetPosition = function(nFromCol, nColOffset, nFromRow, nRowOffset){ ApiDrawing.prototype.SetPosition = function(nFromCol, nColOffset, nFromRow, nRowOffset){
var extX = null, extY = null;
if(this.Drawing.drawingBase){
if(this.Drawing.drawingBase.Type === AscCommon.c_oAscCellAnchorType.cellanchorOneCell ||
this.Drawing.drawingBase.Type === AscCommon.c_oAscCellAnchorType.cellanchorAbsolute){
extX = this.Drawing.drawingBase.ext.cx;
extY = this.Drawing.drawingBase.ext.cy;
}
}
if(!AscFormat.isRealNumber(extX) || !AscFormat.isRealNumber(extY)){
if(this.Drawing.spPr && this.Drawing.spPr.xfrm){
extX = this.Drawing.spPr.xfrm.extX;
extY = this.Drawing.spPr.xfrm.extY;
}
else{
extX = 5;
extY = 5;
}
}
this.Drawing.setDrawingBaseType(AscCommon.c_oAscCellAnchorType.cellanchorOneCell); this.Drawing.setDrawingBaseType(AscCommon.c_oAscCellAnchorType.cellanchorOneCell);
this.Drawing.setDrawingBaseCoords(nFromCol, nColOffset/36000.0, nFromRow, nRowOffset/36000.0, 0, 0, 0, 0, 0, 0, 0, 0); this.Drawing.setDrawingBaseCoords(nFromCol, nColOffset/36000.0, nFromRow, nRowOffset/36000.0, 0, 0, 0, 0, 0, 0, extX, extY);
}; };
...@@ -517,7 +546,7 @@ ...@@ -517,7 +546,7 @@
*/ */
ApiShape.prototype.GetDocContent = function() ApiShape.prototype.GetDocContent = function()
{ {
var oApi = Asc.editor; var oApi = Asc["editor"];
if(oApi && this.Drawing && this.Drawing.txBody && this.Drawing.txBody.content) if(oApi && this.Drawing && this.Drawing.txBody && this.Drawing.txBody.content)
{ {
return oApi.private_CreateApiDocContent(this.Drawing.txBody.content); return oApi.private_CreateApiDocContent(this.Drawing.txBody.content);
......
...@@ -12314,6 +12314,24 @@ function CorrectUniColor(asc_color, unicolor, flag) ...@@ -12314,6 +12314,24 @@ function CorrectUniColor(asc_color, unicolor, flag)
} }
function builder_CreateTitle(sTitle, nFontSize, oChartSpace)
{
if(typeof sTitle === "string" && sTitle.length > 0){
var oTitle = new AscFormat.CTitle();
oTitle.setOverlay(false);
oTitle.setTx(new AscFormat.CChartText());
var oTextBody = AscFormat.CreateTextBodyFromString(sTitle, oChartSpace.getDrawingDocument(), oTitle.tx);
if(AscFormat.isRealNumber(nFontSize)){
oTextBody.content.Set_ApplyToAll(true);
oTextBody.content.Paragraph_Add(new ParaTextPr({ FontSize : nFontSize}));
oTextBody.content.Set_ApplyToAll(false);
}
oTitle.tx.setRich(oTextBody);
return oTitle;
}
return null;
}
function builder_SetChartTitle(oChartSpace, sTitle, nFontSize){ function builder_SetChartTitle(oChartSpace, sTitle, nFontSize){
if(oChartSpace){ if(oChartSpace){
oChartSpace.chart.setTitle(builder_CreateChartTitle(sTitle, nFontSize, oChartSpace.getDrawingDocument())); oChartSpace.chart.setTitle(builder_CreateChartTitle(sTitle, nFontSize, oChartSpace.getDrawingDocument()));
...@@ -12324,7 +12342,7 @@ function CorrectUniColor(asc_color, unicolor, flag) ...@@ -12324,7 +12342,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
if(oChartSpace){ if(oChartSpace){
var horAxis = oChartSpace.chart.plotArea.getHorizontalAxis(); var horAxis = oChartSpace.chart.plotArea.getHorizontalAxis();
if(horAxis){ if(horAxis){
horAxis.setTitle(this.CreateTitle(sTitle, nFontSize)); horAxis.setTitle(builder_CreateTitle(sTitle, nFontSize, oChartSpace));
} }
} }
} }
...@@ -12336,7 +12354,7 @@ function CorrectUniColor(asc_color, unicolor, flag) ...@@ -12336,7 +12354,7 @@ function CorrectUniColor(asc_color, unicolor, flag)
{ {
if(typeof sTitle === "string" && sTitle.length > 0) if(typeof sTitle === "string" && sTitle.length > 0)
{ {
verAxis.setTitle(this.CreateTitle(sTitle, nFontSize)); verAxis.setTitle(builder_CreateTitle(sTitle, nFontSize, oChartSpace));
if(verAxis.title){ if(verAxis.title){
var _body_pr = new AscFormat.CBodyPr(); var _body_pr = new AscFormat.CBodyPr();
_body_pr.reset(); _body_pr.reset();
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
*/ */
function ApiShape(oShape){ function ApiShape(oShape){
ApiShape.superclass.constructor.call(this, oShape); ApiShape.superclass.constructor.call(this, oShape);
this.Shape = oShape;
} }
AscCommon.extendClass(ApiShape, ApiDrawing); AscCommon.extendClass(ApiShape, ApiDrawing);
...@@ -89,6 +90,7 @@ ...@@ -89,6 +90,7 @@
*/ */
function ApiChart(oChart){ function ApiChart(oChart){
ApiChart.superclass.constructor.call(this, oChart); ApiChart.superclass.constructor.call(this, oChart);
this.Chart = oChart;
} }
AscCommon.extendClass(ApiChart, ApiDrawing); AscCommon.extendClass(ApiChart, ApiDrawing);
......
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