Commit 30622193 authored by Sergey Luzyanin's avatar Sergey Luzyanin

inserting drawings in cell-builder

parent 781cb930
......@@ -174,6 +174,8 @@
"../word/Math/borderBox.js",
"../word/apiCommon.js",
"../word/apiBuilder.js",
"../slide/apiBuilder.js",
"../cell/apiBuilder.js",
"../common/clipboard_base.js",
......
......@@ -163,6 +163,7 @@
"../slide/apiCommon.js",
"../word/apiCommon.js",
"../word/apiBuilder.js",
"../slide/apiBuilder.js",
"../common/clipboard_base.js",
"../common/text_input.js",
......
This diff is collapsed.
......@@ -9690,6 +9690,26 @@ CChartSpace.prototype.Undo = function(data)
{
switch (data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.OldPr.X;
this.drawingBase.Pos.Y = data.OldPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.OldPr.cx;
this.drawingBase.ext.cy = data.OldPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = data.OldPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.oldPr;
......@@ -9826,6 +9846,26 @@ CChartSpace.prototype.Redo = function(data)
{
switch (data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.NewPr.X;
this.drawingBase.Pos.Y = data.NewPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.NewPr.cx;
this.drawingBase.ext.cy = data.NewPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = data.NewPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.newPr;
......@@ -9964,6 +10004,21 @@ CChartSpace.prototype.Save_Changes = function(data, w)
w.WriteLong(data.Type);
switch (data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
w.WriteDouble(data.NewPr.X);
w.WriteDouble(data.NewPr.Y);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
w.WriteDouble(data.NewPr.cx);
w.WriteDouble(data.NewPr.cy);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
w.WriteLong(data.NewPr);
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
w.WriteLong(data.newPr);
......@@ -10108,6 +10163,26 @@ CChartSpace.prototype.Load_Changes = function(r)
var type = r.GetLong();
switch (type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = r.GetDouble();
this.drawingBase.Pos.Y = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = r.GetDouble();
this.drawingBase.ext.cy = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = r.GetLong();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = r.GetLong();
......
......@@ -1010,6 +1010,9 @@
window['AscDFH'].historyitem_AutoShapes_RemoveFromDrawingObjects = 1004;
window['AscDFH'].historyitem_AutoShapes_SetBFromSerialize = 1009;
window['AscDFH'].historyitem_AutoShapes_SetLocks = 1010;
window['AscDFH'].historyitem_AutoShapes_SetDrawingBaseType = 1011;
window['AscDFH'].historyitem_AutoShapes_SetDrawingBaseExt = 1012;
window['AscDFH'].historyitem_AutoShapes_SetDrawingBasePos = 1013;
window['AscDFH'].historyitem_CommonChart_RemoveSeries = 1005;
window['AscDFH'].historyitem_CommonSeries_RemoveDPt = 1006;
window['AscDFH'].historyitem_CommonLit_RemoveDPt = 1007;
......
......@@ -391,6 +391,31 @@
CGraphicObjectBase.prototype.getAllFonts = function(mapUrl){
};
CGraphicObjectBase.prototype.getAllRasterImages = function(mapUrl){
};
CGraphicObjectBase.prototype.setDrawingBaseType = function(nType){
if(this.drawingBase){
History.Add(this, {Type: AscDFH.historyitem_AutoShapes_SetDrawingBaseType, OldPr: this.drawingBase.Type, NewPr: nType});
this.drawingBase.Type = nType;
}
};
CGraphicObjectBase.prototype.setDrawingBasePos = function(fPosX, fPosY){
if(this.drawingBase && this.drawingBase.Pos){
History.Add(this, {Type: AscDFH.historyitem_AutoShapes_SetDrawingBasePos, OldPr: {X: this.drawingBase.Pos.X, Y: this.drawingBase.Pos.Y}, NewPr: {X: fPosX, Y: fPosY}});
this.drawingBase.Pos.X = fPosX;
this.drawingBase.Pos.Y = fPosY;
}
};
CGraphicObjectBase.prototype.setDrawingBaseExt = function(fExtX, fExtY){
if(this.drawingBase && this.drawingBase.ext){
History.Add(this, {Type: AscDFH.historyitem_AutoShapes_SetDrawingBaseExt, OldPr: {cx: this.drawingBase.ext.cx, cy: this.drawingBase.ext.cy}, NewPr: {cx: fExtX, cy: fExtY}});
this.drawingBase.ext.cx = fExtX;
this.drawingBase.ext.cy = fExtY;
}
};
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CGraphicObjectBase = CGraphicObjectBase;
window['AscFormat'].CGraphicBounds = CGraphicBounds;
......
......@@ -1764,6 +1764,26 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
{
switch(data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.OldPr.X;
this.drawingBase.Pos.Y = data.OldPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.OldPr.cx;
this.drawingBase.ext.cy = data.OldPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = data.OldPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.oldPr;
......@@ -1861,6 +1881,26 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
{
switch(data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.NewPr.X;
this.drawingBase.Pos.Y = data.NewPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.NewPr.cx;
this.drawingBase.ext.cy = data.NewPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = data.NewPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.newPr;
......@@ -1961,6 +2001,22 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
w.WriteLong(data.Type);
switch(data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
w.WriteDouble(data.NewPr.X);
w.WriteDouble(data.NewPr.Y);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
w.WriteDouble(data.NewPr.cx);
w.WriteDouble(data.NewPr.cy);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
w.WriteLong(data.NewPr);
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
w.WriteLong(data.newPr);
......@@ -2037,6 +2093,28 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
var type = r.GetLong();
switch (type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = r.GetDouble();
this.drawingBase.Pos.Y = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = r.GetDouble();
this.drawingBase.ext.cy = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
if(this.drawingBase)
{
this.drawingBase.Type = r.GetLong();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = r.GetLong();
......
......@@ -695,6 +695,28 @@ CImageShape.prototype.Undo = function(data)
{
switch(data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.OldPr.X;
this.drawingBase.Pos.Y = data.OldPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.OldPr.cx;
this.drawingBase.ext.cy = data.OldPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
if(this.drawingBase)
{
this.drawingBase.Type = data.OldPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.oldPr;
......@@ -797,7 +819,28 @@ CImageShape.prototype.Redo = function(data)
{
switch(data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.NewPr.X;
this.drawingBase.Pos.Y = data.NewPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.NewPr.cx;
this.drawingBase.ext.cy = data.NewPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
if(this.drawingBase)
{
this.drawingBase.Type = data.NewPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.newPr;
......@@ -902,6 +945,22 @@ CImageShape.prototype.Save_Changes = function(data, w)
w.WriteLong(data.Type);
switch(data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
w.WriteDouble(data.NewPr.X);
w.WriteDouble(data.NewPr.Y);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
w.WriteDouble(data.NewPr.cx);
w.WriteDouble(data.NewPr.cy);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
w.WriteLong(data.NewPr);
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
w.WriteLong(data.newPr);
......@@ -998,6 +1057,28 @@ CImageShape.prototype.Load_Changes = function(r)
var type = r.GetLong();
switch(type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = r.GetDouble();
this.drawingBase.Pos.Y = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = r.GetDouble();
this.drawingBase.ext.cy = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
if(this.drawingBase)
{
this.drawingBase.Type = r.GetLong();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = r.GetLong();
......
......@@ -4999,6 +4999,26 @@ CShape.prototype.Undo = function (data)
{
switch (data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.OldPr.X;
this.drawingBase.Pos.Y = data.OldPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.OldPr.cx;
this.drawingBase.ext.cy = data.OldPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = data.OldPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.oldPr;
......@@ -5111,6 +5131,26 @@ CShape.prototype.Redo = function (data)
{
switch (data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = data.NewPr.X;
this.drawingBase.Pos.Y = data.NewPr.Y;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = data.NewPr.cx;
this.drawingBase.ext.cy = data.NewPr.cy;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:{
if(this.drawingBase){
this.drawingBase.Type = data.NewPr;
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = data.newPr;
......@@ -5223,6 +5263,22 @@ CShape.prototype.Save_Changes = function (data, w)
w.WriteLong(data.Type);
switch (data.Type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
w.WriteDouble(data.NewPr.X);
w.WriteDouble(data.NewPr.Y);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
w.WriteDouble(data.NewPr.cx);
w.WriteDouble(data.NewPr.cy);
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
w.WriteLong(data.NewPr);
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
w.WriteLong(data.newPr);
......@@ -5307,6 +5363,28 @@ CShape.prototype.Load_Changes = function (r)
var type = r.GetLong();
switch (type)
{
case AscDFH.historyitem_AutoShapes_SetDrawingBasePos:{
if(this.drawingBase && this.drawingBase.Pos){
this.drawingBase.Pos.X = r.GetDouble();
this.drawingBase.Pos.Y = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseExt:{
if(this.drawingBase && this.drawingBase.ext){
this.drawingBase.ext.cx = r.GetDouble();
this.drawingBase.ext.cy = r.GetDouble();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetDrawingBaseType:
{
if(this.drawingBase)
{
this.drawingBase.Type = r.GetLong();
}
break;
}
case AscDFH.historyitem_AutoShapes_SetLocks:
{
this.locks = r.GetLong();
......
This diff is collapsed.
......@@ -38,7 +38,7 @@
* @class
* @name Api
*/
var Api = window["Asc"]["asc_docs_api"];
var Api = window["Asc"]["asc_docs_api"] || window["Asc"]["spreadsheet_api"];
/**
* Class representing a container for paragraphs and tables.
......@@ -71,6 +71,16 @@
this.ParaPr = ParaPr;
}
/*
* Class representing paragraph bullet
* @constructor
* */
function ApiBullet(Bullet)
{
this.Bullet = Bullet;
}
/**
* Class representing a paragraph.
* @constructor
......@@ -347,7 +357,7 @@
*/
function ApiStroke(oLn)
{
this.Ln= oLn;
this.Ln = oLn;
}
......@@ -861,17 +871,10 @@
*/
Api.prototype.CreateLinearGradientFill = function(aGradientStop, Angle)
{
var oUniFill = new AscFormat.CUniFill();
oUniFill.fill = new AscFormat.CGradFill();
for(var i = 0; i < aGradientStop.length; ++i)
{
oUniFill.fill.colors.push(aGradientStop[i].Gs);
}
oUniFill.fill.lin = new AscFormat.GradLin();
oUniFill.fill.lin.angle = Angle;
return new ApiFill(oUniFill);
return new ApiFill(AscFormat.builder_CreateLinearGradient(aGradientStop, Angle));
};
/**
* Create a radial gradient fill
* @memberof Api
......@@ -880,14 +883,7 @@
*/
Api.prototype.CreateRadialGradientFill = function(aGradientStop)
{
var oUniFill = new AscFormat.CUniFill();
oUniFill.fill = new AscFormat.CGradFill();
for(var i = 0; i < aGradientStop.length; ++i)
{
oUniFill.fill.colors.push(aGradientStop[i].Gs);
}
oUniFill.fill.path = new AscFormat.GradPath();
return new ApiFill(oUniFill);
return new ApiFill(AscFormat.builder_CreateRadialGradient(aGradientStop));
};
/**
......@@ -898,14 +894,9 @@
* @param {ApiUniColor} FgColor
* @returns {ApiFill}
*/
Api.prototype.CreatePatternFill= function(sPatternType, BgColor, FgColor)
Api.prototype.CreatePatternFill = function(sPatternType, BgColor, FgColor)
{
var oUniFill = new AscFormat.CUniFill();
oUniFill.fill = new AscFormat.CPattFill();
oUniFill.fill.ftype = AscCommon.global_hatch_offsets[sPatternType];
oUniFill.fill.fgClr = FgColor.Unicolor;
oUniFill.fill.bgClr = BgColor.Unicolor;
return new ApiFill(oUniFill);
return new ApiFill(AscFormat.builder_CreatePatternFill(sPatternType, BgColor, FgColor));
};
/**
......@@ -915,20 +906,9 @@
* @param {BlipFillType} sBlipFillType
* @returns {ApiFill}
* */
Api.prototype.CreateBlipFill= function(sImageUrl, sBlipFillType)
Api.prototype.CreateBlipFill = function(sImageUrl, sBlipFillType)
{
var oUniFill = new AscFormat.CUniFill();
oUniFill.fill = new AscFormat.CBlipFill();
oUniFill.fill.RasterImageId = sImageUrl;
if(sBlipFillType === "tile")
{
oUniFill.fill.tile = new AscFormat.CBlipFillTile();
}
else if(sBlipFillType === "stretch")
{
oUniFill.fill.stretch = true;
}
return new ApiFill(oUniFill);
return new ApiFill(AscFormat.builder_CreateBlipFill(sImageUrl, sBlipFillType));
};
/**
......@@ -950,14 +930,7 @@
* */
Api.prototype.CreateStroke = function(nWidth, oFill)
{
if(nWidth === 0)
{
return new ApiStroke(AscFormat.CreateNoFillLine());
}
var oLn = new AscFormat.CLn();
oLn.w = nWidth;
oLn.Fill = oFill.UniFill;
return new ApiStroke(oLn);
return new ApiStroke(AscFormat.builder_CreateLine(nWidth, oFill));
};
/**
......@@ -972,6 +945,81 @@
return new ApiGradientStop(oUniColor, nPos);
};
/**
* Create a new bullet
* @memberof Api
* @returns {ApiBullet}
* */
Api.CreateBullet = function(sSymbol){
var oBullet = new AscFormat.CBullet();
oBullet.bulletType = new AscFormat.CBulletType();
if(typeof sSymbol === "string" && sSymbol.length > 0){
oBullet.bulletType.type = AscFormat.BULLET_TYPE_BULLET_CHAR;
oBullet.bulletType.Char = sSymbol[0];
}
else{
oBullet.bulletType.type = AscFormat.BULLET_TYPE_BULLET_NONE;
}
};
/**
* Create a new numbering
* @memberof Api
* @param {BulletType} sType
* @param {number} nStartAt
* @returns {ApiBullet}
* */
Api.CreateNumbering = function(sType, nStartAt){
var oBullet = new AscFormat.CBullet();
oBullet.bulletType = new AscFormat.CBulletType();
oBullet.bulletType.type = AscFormat.BULLET_TYPE_BULLET_AUTONUM;
switch(sType){
case "ArabicPeriod" :{
oBullet.bulletType.AutoNumType = 12;
break;
}
case "ArabicParenR":{
oBullet.bulletType.AutoNumType = 11;
break;
}
case "RomanUcPeriod":{
oBullet.bulletType.AutoNumType = 34;
break;
}
case "RomanLcPeriod":{
oBullet.bulletType.AutoNumType = 31;
break;
}
case "AlphaLcParenR":{
oBullet.bulletType.AutoNumType = 1;
break;
}
case "AlphaLcPeriod":{
oBullet.bulletType.AutoNumType = 2;
break;
}
case "AlphaUcParenR":{
oBullet.bulletType.AutoNumType = 4;
break;
}
case "AlphaUcPeriod":{
oBullet.bulletType.AutoNumType = 5;
break;
}
case "None":{
oBullet.bulletType.type = AscFormat.BULLET_TYPE_BULLET_NONE;
break;
}
}
if( oBullet.bulletType.type === AscFormat.BULLET_TYPE_BULLET_AUTONUM){
if(AscFormat.isRealNumber(nStartAt)){
oBullet.bulletType.startAt = nStartAt;
}
}
return new ApiBullet(oBullet);
};
//------------------------------------------------------------------------------------------------------------------
//
......@@ -2746,6 +2794,10 @@
this.private_OnChange();
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiNumbering
......@@ -4726,4 +4778,11 @@
this.private_OnChange();
};
Api.prototype.private_CreateApiParagraph = function(oParagraph){
return new ApiParagraph(oParagraph);
};
Api.prototype.private_CreateApiDocContent = function(oDocContent){
return new ApiDocumentContent(oDocContent);
};
}(window, null));
\ No newline at end of file
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