Commit 5b267a8e authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49645 954022d7-b5bf-4e40-9824-e11837661b57
parent d9ca6c73
......@@ -269,6 +269,33 @@ function CColorModifiers()
CColorModifiers.prototype =
{
Write_ToBinary2 : function(Writer)
{
var count = this.Mods.length;
Writer.WriteLong(count);
for(var i = 0; i < count; ++i)
{
var cur_mod = this.Mods[i];
Writer.WriteString2(cur_mod.name);
Writer.WriteLong(cur_mod.val);
}
},
Read_FromBinary2 : function(Reader)
{
var count = Reader.GetLong();
for(var i = 0; i < count; ++i)
{
var cur_mod = {};
cur_mod.name = Reader.GetString2();
cur_mod.val = Reader.GetLong();
this.Mods.push(cur_mod);
}
return this;
},
IsIdentical : function(mods)
{
if(mods == null)
......@@ -561,6 +588,20 @@ function CSysColor()
CSysColor.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
Writer.WriteString2(this.id);
WriteObjectLong(Writer, this.RGBA);
},
Read_FromBinary2 : function(Reader)
{
this.id = Reader.GetString2();
this.RGBA = ReadObjectLong(Reader);
},
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_SYS && color.id == this.id;
......@@ -589,6 +630,18 @@ function CPrstColor()
CPrstColor.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
Writer.WriteString2(this.id);
WriteObjectLong(Writer, this.RGBA);
},
Read_FromBinary2 : function(Reader)
{
this.id = Reader.GetString2();
this.RGBA = ReadObjectLong(Reader);
},
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_PRST && color.id == this.id;
......@@ -621,6 +674,18 @@ function CRGBColor()
CRGBColor.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
WriteObjectLong(Writer, this.RGBA);
},
Read_FromBinary2 : function(Reader)
{
this.RGBA = ReadObjectLong(Reader);
},
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_SRGB && color.RGBA.R == this.RGBA.R && color.RGBA.G == this.RGBA.G && color.RGBA.B == this.RGBA.B && color.RGBA.A == this.RGBA.A;
......@@ -651,6 +716,19 @@ function CSchemeColor()
CSchemeColor.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
Writer.WriteLong(this.id);
WriteObjectLong(Writer, this.RGBA);
},
Read_FromBinary2 : function(Reader)
{
this.id = Reader.GetLong();
this.RGBA = ReadObjectLong(Reader);
},
IsIdentical : function(color)
{
return color && color.type == COLOR_TYPE_SCHEME && color.id == this.id;
......@@ -709,6 +787,55 @@ function CUniColor()
CUniColor.prototype =
{
Write_ToBinary2 : function(Writer)
{
var flag = this.color != null;
Writer.WriteBool(flag);
if(flag)
this.color.Write_ToBinary2(Writer);
this.Mods.Write_ToBinary2(Writer);
WriteObjectLong(Writer, this.RGBA);
},
Read_FromBinary2 : function(Reader)
{
var flag = Reader.GetBool();
if(flag)
{
var color_type = Reader.GetLong();
switch(color_type)
{
case COLOR_TYPE_SCHEME:
{
this.color = new CSchemeColor();
this.color.Read_FromBinary2(Reader);
break;
}
case COLOR_TYPE_SRGB:
{
this.color = new CRGBColor();
this.color.Read_FromBinary2(Reader);
break;
}
case COLOR_TYPE_PRST:
{
this.color = new CPrstColor();
this.color.Read_FromBinary2(Reader);
break;
}
case COLOR_TYPE_SYS:
{
this.color = new CSysColor();
this.color.Read_FromBinary2(Reader);
break;
}
}
}
this.Mods.Read_FromBinary2(Reader);
this.RGBA = ReadObjectLong(Reader);
},
createDuplicate : function()
{
var duplicate = new CUniColor();
......@@ -929,6 +1056,75 @@ function CBlipFill()
CBlipFill.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
var flag = typeof this.RasterImageId === "string";
Writer.WriteBool(flag);
if(flag)
{
var string_to_write = _getFullImageSrc(this.RasterImageId);
if(string_to_write.indexOf(documentOrigin) !== 0
&& string_to_write.indexOf("http:") !== 0
&& string_to_write.indexOf("https:") !== 0
&& string_to_write.indexOf("ftp:") !== 0
&& string_to_write.indexOf("data:") !== 0)
{
string_to_write = documentOrigin + string_to_write;
}
Writer.WriteString2(string_to_write);
}
flag = this.stretch !== null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteBool(this.stretch);
}
flag = this.tile !== null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteBool(this.tile);
}
Writer.WriteBool(this.rotWithShape);
},
Read_FromBinary2 : function(Reader)
{
var flag = Reader.GetBool();
if(flag)
{
var imageId = Reader.GetString2();
if(typeof imageId === "string" && isRealObject(Reader.oImages) && typeof Reader.oImages[imageId] === "string" && Reader.oImages[imageId] !== "error")
this.RasterImageId = Reader.oImages[imageId];
else
this.RasterImageId = imageId;
if(typeof this.RasterImageId === "string" && isRealObject(Reader.oImages))
{
editor.WordControl.m_oLogicDocument.DrawingObjects.urlMap.push(this.RasterImageId);
}
}
flag = Reader.GetBool();
if(flag)
{
this.stretch = Reader.GetBool();
}
flag = Reader.GetBool();
if(flag)
{
this.tile = Reader.GetBool();
}
this.rotWithShape = Reader.GetBool();
},
createDuplicate : function()
{
var duplicate = new CBlipFill();
......@@ -1021,6 +1217,18 @@ function CSolidFill()
CSolidFill.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
this.color.Write_ToBinary2(Writer);
},
Read_FromBinary2 : function(Reader)
{
this.color.Read_FromBinary2(Reader);
},
IsIdentical : function(fill)
{
if(fill == null)
......@@ -1063,6 +1271,22 @@ function CGs()
CGs.prototype =
{
Write_ToBinary2 : function(Writer)
{
this.color.Write_ToBinary2(Writer);
Writer.WriteLong(this.pos);
},
Read_FromBinary2 : function(Reader)
{
this.color = new CUniColor();
this.color.Read_FromBinary2(Reader);
this.pos = Reader.GetLong();
},
IsIdentical : function(fill)
{
return false;
......@@ -1084,6 +1308,20 @@ function GradLin()
}
GradLin.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.angle);
Writer.WriteBool(this.scale);
},
Read_FromBinary2 : function(Reader)
{
this.angle = Reader.GetLong();
this.scale = Reader.GetBool();
},
IsIdentical : function(lin)
{
if (this.angle != lin.angle)
......@@ -1115,6 +1353,17 @@ function GradPath()
}
GradPath.prototype =
{
Write_ToBinary2 : function(Writer)
{
},
Read_FromBinary2 : function(Reader)
{
},
IsIdentical : function(path)
{
if (this.path != path.path)
......@@ -1147,6 +1396,51 @@ function CGradFill()
CGradFill.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
var colors_count = this.colors.length;
Writer.WriteLong(colors_count);
for(var i = 0; i < colors_count; ++i)
{
this.colors[i].Write_ToBinary2(Writer);
}
Writer.WriteBool(isRealObject(this.lin));
if(isRealObject(this.lin))
{
this.lin.Write_ToBinary2(Writer);
}
Writer.WriteBool(isRealObject(this.path));
if(isRealObject(this.path))
{
this.path.Write_ToBinary2(Writer);
}
},
Read_FromBinary2 : function(Reader)
{
var colors_count = Reader.GetLong();
for(var i = 0; i< colors_count; ++i)
{
this.colors[i] = new CGs();
this.colors[i].Read_FromBinary2(Reader);
}
if(Reader.GetBool())
{
this.lin = new GradLin();
this.lin.Read_FromBinary2(Reader);
}
if(Reader.GetBool())
{
this.path = new GradPath();
this.path.Read_FromBinary2(Reader);
}
},
IsIdentical : function(fill)
{
if(fill == null)
......@@ -1209,6 +1503,22 @@ function CPattFill()
CPattFill.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
Writer.WriteString2(this.ftype);
this.fgClr.Write_ToBinary2(Writer);
this.bgClr.Write_ToBinary2(Writer);
},
Read_FromBinary2 : function(Reader)
{
this.ftype = Reader.GetString2();
this.fgClr.Read_FromBinary2(Reader);
this.bgClr.Read_FromBinary2(Reader);
},
IsIdentical : function(fill)
{
if(fill == null)
......@@ -1259,6 +1569,16 @@ function CNoFill()
CNoFill.prototype =
{
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
},
Read_FromBinary2 : function(Reader)
{
},
createDuplicate : function()
{
return new CNoFill();
......@@ -1295,6 +1615,73 @@ function CUniFill()
CUniFill.prototype =
{
Write_ToBinary2 : function(Writer)
{
var flag = isRealObject(this.fill);
Writer.WriteBool(flag);
if(flag)
{
this.fill.Write_ToBinary2(Writer);
}
flag = this.transparent != null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteDouble(this.transparent);
},
Read_FromBinary2 : function(reader)
{
var flag = reader.GetBool();
if(flag)
{
var fill_type = reader.GetLong();
switch (fill_type)
{
case FILL_TYPE_SOLID:
{
this.fill = new CSolidFill();
this.fill.Read_FromBinary2(reader);
break;
}
case FILL_TYPE_GRAD:
{
this.fill = new CGradFill();
this.fill.Read_FromBinary2(reader);
break;
}
case FILL_TYPE_BLIP:
{
this.fill = new CBlipFill();
this.fill.Read_FromBinary2(reader);
break;
}
case FILL_TYPE_NOFILL:
{
this.fill = new CNoFill();
this.fill.Read_FromBinary2(reader);
break;
}
case FILL_TYPE_PATT:
{
this.fill = new CPattFill();
this.fill.Read_FromBinary2(reader);
break;
}
}
}
flag = reader.GetBool();
if(flag)
{
this.transparent = reader.GetDouble();
}
},
calculate : function(theme, slide, layout, masterSlide, RGBA)
{
if(this.fill )
......@@ -1499,6 +1886,48 @@ function EndArrow()
this.len = null;
this.w = null;
this.Write_ToBinary2 = function(Writer)
{
var flag = this.type != null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteLong(this.type);
flag = this.len != null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteLong(this.len);
flag = this.w != null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteLong(this.w);
};
this.Read_FromBinary2 = function(Reader)
{
var flag = Reader.GetBool();
if(flag)
{
this.type = Reader.GetLong();
}
flag = Reader.GetBool();
if(flag)
{
this.len = Reader.GetLong();
}
flag = Reader.GetBool();
if(flag)
{
this.w = Reader.GetLong();
}
};
this.compare = function(end_arrow)
{
if(end_arrow == null)
......@@ -1595,6 +2024,38 @@ function LineJoin()
this.type = null;
this.limit = null;
this.Write_ToBinary2 = function(Writer)
{
var flag = this.type != null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteLong(this.type);
}
flag = this.limit != null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteLong(this.limit);
}
};
this.Read_FromBinary2 = function(Reader)
{
var flag = Reader.GetBool();
if(flag)
{
this.type = Reader.GetLong();
}
flag = Reader.GetBool();
if(flag)
{
this.limit = Reader.GetLong();
}
return this;
};
this.createDuplicate = function()
{
var duplicate = new LineJoin();
......@@ -1618,6 +2079,121 @@ function CLn()
this.cmpd = null;
this.w = null;
this.Write_ToBinary2 = function(Writer)
{
var flag = this.Fill != null;
Writer.WriteBool(flag);
if(flag)
{
this.Fill.Write_ToBinary2(Writer);
}
//TODO: PRST DASH
flag = this.Join != null;
Writer.WriteBool(flag);
if(flag)
{
this.Join.Write_ToBinary2(Writer);
}
flag = this.headEnd != null;
Writer.WriteBool(flag);
if(flag)
{
this.headEnd.Write_ToBinary2(Writer);
}
flag = this.tailEnd != null;
Writer.WriteBool(flag);
if(flag)
{
this.tailEnd.Write_ToBinary2(Writer);
}
flag = this.algn != null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteLong(this.algn);
}
flag = this.cap != null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteLong(this.cap);
}
flag = this.cmpd!= null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteLong(this.cmpd);
}
flag = this.w != null;
Writer.WriteBool(flag);
if(flag)
{
Writer.WriteLong(this.w);
}
};
this.Read_FromBinary2 = function(Reader)
{
var flag = Reader.GetBool();
if(flag)
{
this.Fill = new CUniFill();
this.Fill.Read_FromBinary2(Reader);
}
//TODO: PRST DASH
flag = Reader.GetBool();
if(flag)
{
this.Join = new LineJoin();
this.Join.Read_FromBinary2(Reader);
}
flag = Reader.GetBool();
if(flag)
{
this.headEnd = new EndArrow();
this.headEnd.Read_FromBinary2(Reader);
}
flag = Reader.GetBool();
if(flag)
{
this.tailEnd = new EndArrow();
this.tailEnd.Read_FromBinary2(Reader);
}
flag = Reader.GetBool();
if(flag)
{
this.algn = Reader.GetLong();
}
flag = Reader.GetBool();
if(flag)
{
this.cap = Reader.GetLong();
}
flag = Reader.GetBool();
if(flag)
{
this.cmpd = Reader.GetLong();
}
flag = Reader.GetBool();
if(flag)
{
this.w = Reader.GetLong();
}
};
this.compare = function(line)
{
if(line == null)
......@@ -3502,6 +4078,296 @@ function CBodyPr()
this.textFit = null;
this.Write_ToBinary2 = function(w)
{
var flag = this.flatTx != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.flatTx);
}
flag = this.anchor != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.anchor);
}
flag = this.anchorCtr != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.anchorCtr);
}
flag = this.bIns != null;
w.WriteBool(flag);
if(flag)
{
w.WriteDouble(this.bIns);
}
flag = this.compatLnSpc != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.compatLnSpc);
}
flag = this.forceAA != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.forceAA);
}
flag = this.fromWordArt != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.fromWordArt);
}
flag = this.horzOverflow != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.horzOverflow);
}
flag = this.lIns != null;
w.WriteBool(flag);
if(flag)
{
w.WriteDouble(this.lIns);
}
flag = this.numCol != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.numCol);
}
flag = this.rIns != null;
w.WriteBool(flag);
if(flag)
{
w.WriteDouble(this.rIns);
}
flag = this.rot != null;
w.WriteBool(flag);
if(flag)
{
w.WriteDouble(this.rot);
}
flag = this.rtlCol != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.rtlCol);
}
flag = this.spcCol != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.spcCol);
}
flag = this.spcFirstLastPara != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.spcFirstLastPara);
}
flag = this.tIns != null;
w.WriteBool(flag);
if(flag)
{
w.WriteDouble(this.tIns);
}
flag = this.upright != null;
w.WriteBool(flag);
if(flag)
{
w.WriteBool(this.upright);
}
flag = this.vert != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.vert);
}
flag = this.vertOverflow != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.vertOverflow);
}
flag = this.wrap != null;
w.WriteBool(flag);
if(flag)
{
w.WriteLong(this.wrap);
}
};
this.Read_FromBinary2 = function(r)
{
var flag = r.GetBool();
if(flag)
{
this.flatTx = r.GetLong();
}
flag = r.GetBool();
if(flag)
{
this.anchor = r.GetLong();
}
flag = r.GetBool();
if(flag)
{
this.anchorCtr = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.bIns = r.GetDouble();
}
flag = r.GetBool();
if(flag)
{
this.compatLnSpc = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.forceAA = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.fromWordArt = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.horzOverflow = r.GetLong();
}
flag = r.GetBool();
if(flag)
{
this.lIns = r.GetDouble();
}
flag = r.GetBool();
if(flag)
{
this.numCol = r.GetLong();
}
flag = r.GetBool();
if(flag)
{
this.rIns = r.GetDouble();
}
flag = r.GetBool();
if(flag)
{
this.rot = r.GetDouble();
}
flag = r.GetBool();
if(flag)
{
this.rtlCol = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.spcCol = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.spcFirstLastPara = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.tIns = r.GetDouble();
}
flag = r.GetBool();
if(flag)
{
this.upright = r.GetBool();
}
flag = r.GetBool();
if(flag)
{
this.vert = r.GetLong();
}
flag = r.GetBool();
if(flag)
{
this.vertOverflow = r.GetLong();
}
flag = r.GetBool();
if(flag)
{
this.wrap = r.GetLong();
}
};
this.setDefault = function()
{
this.flatTx = null;
......
......@@ -42,6 +42,7 @@ function CChartAsGroup(parent/*(WordGraphicObject)*/, document, drawingDocument,
[];
this.selected = false;
this.mainGroup = null;
this.Lock = new CLock();
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
......@@ -356,32 +357,114 @@ CChartAsGroup.prototype =
recalculatePosExt: function()
{
var xfrm;
xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
/* if(isRealObject(this.parent))
if(this.spPr.xfrm.isNotNull())
{
var ext = this.parent.Extent;
this.extX = ext.W;
this.extY = ext.H;
var xfrm = this.spPr.xfrm;
this.x = xfrm.offX;
this.y = xfrm.offY;
this.extX = xfrm.extX;
this.extY = xfrm.extY;
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
}
else
{ */
//this.x = 0;
//this.y = 0;
{
if(this.isPlaceholder())
{
var hierarchy = this.getHierarchy();
for(var i = 0; i < hierarchy.length; ++i)
{
var hierarchy_sp = hierarchy[i];
if(isRealObject(hierarchy_sp) && hierarchy_sp.spPr.xfrm.isNotNull())
{
var xfrm = hierarchy_sp.spPr.xfrm;
this.x = xfrm.offX;
this.y = xfrm.offY;
this.extX = xfrm.extX;
this.extY = xfrm.extY;
//}
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
break;
}
}
if(i === hierarchy.length)
{
this.x = 0;
this.y = 0;
this.extX = 5;
this.extY = 5;
this.rot = 0;
this.flipH = false;
this.flipV = false;
}
}
else
{
this.x = 0;
this.y = 0;
this.extX = 5;
this.extY = 5;
this.rot = 0;
this.flipH = false;
this.flipV = false;
}
}
}
else
{
var xfrm;
if(this.spPr.xfrm.isNotNull())
{
xfrm = this.spPr.xfrm;
}
else
{
if(this.isPlaceholder())
{
var hierarchy = this.getHierarchy();
for(var i = 0; i < hierarchy.length; ++i)
{
var hierarchy_sp = hierarchy[i];
if(isRealObject(hierarchy_sp) && hierarchy_sp.spPr.xfrm.isNotNull())
{
xfrm = hierarchy_sp.spPr.xfrm;
break;
}
}
if(i === hierarchy.length)
{
xfrm = new CXfrm();
xfrm.offX = 0;
xfrm.offX = 0;
xfrm.extX = 5;
xfrm.extY = 5;
}
}
else
{
xfrm = new CXfrm();
xfrm.offX = 0;
xfrm.offY = 0;
xfrm.extX = 5;
xfrm.extY = 5;
}
}
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
this.x = scale_scale_coefficients.cx*(xfrm.offX - this.group.spPr.xfrm.chOffX);
this.y = scale_scale_coefficients.cy*(xfrm.offY - this.group.spPr.xfrm.chOffY);
this.extX = scale_scale_coefficients.cx*xfrm.extX;
this.extY = scale_scale_coefficients.cy*xfrm.extY;
this.rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
this.flipH = xfrm.flipH === true;
this.flipV = xfrm.flipV === true;
}
this.transform.Reset();
var hc = this.extX*0.5;
var vc = this.extY*0.5;
this.spPr.geometry.Recalculate(this.extX, this.extY);
},
......@@ -396,19 +479,24 @@ CChartAsGroup.prototype =
return this.transform;
},
recalculateMatrix: function()
{
this.transform.Reset();
var hc, vc;
hc = this.extX*0.5;
vc = this.extY*0.5;
this.spPr.geometry.Recalculate(this.extX, this.extY);
var hc = this.extX*0.5;
var vc = this.extY*0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if(this.flipH)
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
if(this.flipV)
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
global_MatrixTransformer.RotateRadAppend(this.transform, -this.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
if(isRealObject(this.group))
{
global_MatrixTransformer.MultiplyAppend(this.transform, this.group.getTransform());
global_MatrixTransformer.MultiplyAppend(this.transform, this.group.getTransformMatrix());
}
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
......@@ -1061,7 +1149,7 @@ CChartAsGroup.prototype =
{
var options = {theme: parents.theme, slide: parents.slide, layout: parents.layout, master: parents.master};
this.brush.fill.canvas = (new ChartRender(options)).insertChart(this.chart, null, editor.WordControl.m_oDrawingDocument.GetDotsPerMM(this.extX), editor.WordControl.m_oDrawingDocument.GetDotsPerMM(this.extY), undefined, undefined, parents.theme, colorMap);
this.brush.fill.canvas = (new ChartRender(options)).insertChart(this.chart, null, editor.WordControl.m_oDrawingDocument.GetDotsPerMM(this.extX), editor.WordControl.m_oDrawingDocument.GetDotsPerMM(this.extY), undefined, undefined, options);
this.brush.fill.RasterImageId = "";
//editor.WordControl.m_oLogicDocument.DrawingObjects.urlMap.push(this.brush.fill.RasterImageId);
}
......
......@@ -76,6 +76,17 @@ CChartTitle.prototype =
return CHART_TITLE_TYPE_V_AXIS;
},
getParentObjects: function()
{
return this.chartGroup.getParentObjects();
},
isPlaceholder: function()
{
return false;
},
isEmpty: function()
{
return isRealObject(this.txBody) ? this.txBody.isEmpty() : true;
......
......@@ -1530,6 +1530,7 @@ CPresentation.prototype =
{
this.Slides[this.CurPage].graphicObjects.shapeApply(shapeProps);
this.Recalculate();
this.Document_UpdateInterfaceState();
},
changeShapeType : function(shapeType)
......
......@@ -624,6 +624,7 @@ CShape.prototype =
{
if(this.txBody)
{
var old_body_pr = this.txBody.bodyPr.createDuplicate();
if(isRealNumber(paddings.Left))
{
this.txBody.bodyPr.lIns = paddings.Left;
......@@ -642,6 +643,8 @@ CShape.prototype =
{
this.txBody.bodyPr.bIns = paddings.Bottom;
}
var new_body_pr = this.txBody.bodyPr.createDuplicate();
History.Add(this, {Type: historyitem_SetShapeBodyPr, oldBodyPr: old_body_pr, newBodyPr: new_body_pr});
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalculateContent();
this.recalculateTransformText();
......@@ -2659,11 +2662,17 @@ CShape.prototype =
if(this.txBody)
{
var old_body_pr = this.txBody.bodyPr.createDuplicate();
this.txBody.bodyPr.anchor = align;
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
var new_body_pr = this.txBody.bodyPr.createDuplicate();
History.Add(this, {Type: historyitem_SetShapeBodyPr, oldBodyPr: old_body_pr, newBodyPr: new_body_pr});
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalculateContent();
this.recalculateTransformText();
}
},
......@@ -2671,6 +2680,7 @@ CShape.prototype =
{
var _final_preset = sPreset;
var old_geometry = isRealObject(this.spPr.geometry) ? this.spPr.geometry : null;
if(_final_preset!=null)
{
this.spPr.geometry = CreateGeometry(_final_preset);
......@@ -2680,6 +2690,8 @@ CShape.prototype =
{
this.spPr.geometry = null;
}
var new_geometry = isRealObject(this.spPr.geometry) ? this.spPr.geometry : null;
History.Add(this, {Type: historyitem_SetShapeSetGeometry, oldGeometry: old_geometry, newGeometry: new_geometry});
this.recalcInfo.recalculateGeometry = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
......@@ -2687,12 +2699,17 @@ CShape.prototype =
changeFill : function(unifill)
{
var old_fill = this.spPr.Fill ? this.spPr.Fill.createDuplicate() : null;
if(this.spPr.Fill == null )
{
this.spPr.Fill = new CUniFill();
}
this.spPr.Fill = CorrectUniFill(unifill, this.spPr.Fill);
var new_fill = this.spPr.Fill.createDuplicate();
History.Add(this, {Type: historyitem_SetShapeSetFill, oldFill: old_fill, newFill: new_fill});
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
......@@ -2701,7 +2718,17 @@ CShape.prototype =
changeLine : function(line)
{
var old_line = this.spPr.ln ? this.spPr.ln.createDuplicate() : null;
if(!isRealObject(this.spPr.ln))
{
this.spPr.ln = new CLn();
}
this.spPr.ln = CorrectUniStroke(line, this.spPr.ln);
var new_line = this.spPr.ln.createDuplicate();
History.Add(this, {Type: historyitem_SetShapeSetLine, oldLine: old_line, newLine: new_line});
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
......@@ -2988,6 +3015,61 @@ CShape.prototype =
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if(isRealObject(data.oldFill))
{
this.spPr.Fill = data.oldFill.createDuplicate();
}
else
{
this.spPr.Fill = null;
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if(isRealObject(data.oldLine))
{
this.spPr.ln = data.oldLine.createDuplicate();
}
else
{
this.spPr.ln = null;
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_SetShapeSetGeometry:
{
if(isRealObject(data.oldGeometry))
{
this.spPr.geometry = data.oldGeometry.createDuplicate();
this.spPr.geometry.Init(5, 5);
}
else
{
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = data.oldBodyPr.createDuplicate();
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
......@@ -3031,6 +3113,56 @@ CShape.prototype =
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if(isRealObject(data.newFill))
{
this.spPr.Fill = data.newFill.createDuplicate();
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if(isRealObject(data.newLine))
{
this.spPr.ln = data.newLine.createDuplicate();
}
else
{
this.spPr.ln = null;
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
break;
}
case historyitem_SetShapeSetGeometry:
{
if(isRealObject(data.newGeometry))
{
this.spPr.geometry = data.newGeometry.createDuplicate();
this.spPr.geometry.Init(5, 5);
}
else
{
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = data.newBodyPr.createDuplicate();
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
......@@ -3065,6 +3197,41 @@ CShape.prototype =
{
w.WriteBool(data.newFlipH);
w.WriteBool(data.newFlipV);
break;
}
case historyitem_SetShapeSetFill:
{
w.WriteBool(isRealObject(data.newFill));
if(isRealObject(data.newFill))
{
data.newFill.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeSetLine:
{
w.WriteBool(isRealObject(data.newLine));
if(isRealObject(data.newLine))
{
data.newLine.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeSetGeometry:
{
w.WriteBool(isRealObject(data.newGeometry));
if(isRealObject(data.newGeometry))
{
data.newGeometry.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeBodyPr:
{
data.newBodyPr.Write_ToBinary2(w);
break;
}
}
},
......@@ -3109,7 +3276,57 @@ CShape.prototype =
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if(r.GetBool())
{
this.spPr.Fill = new CUniFill();
this.spPr.Fill.Read_FromBinary2(r);
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if(r.GetBool())
{
this.spPr.ln = new CLn();
this.spPr.ln.Read_FromBinary2(r);
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
break;
}
case historyitem_SetShapeSetGeometry:
{
if(r.GetBool())
{
this.spPr.geometry = new Geometry();
this.spPr.geometry.Read_FromBinary2(r);
this.spPr.geometry.Init(5, 5);
}
else
{
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = new CBodyPr();
this.txBody.bodyPr.Read_FromBinary2(r);
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
}
......
......@@ -389,5 +389,37 @@ CTextBody.prototype =
{},
Refresh_RecalcData2: function()
{}
{},
getRectWidth: function(maxWidth)
{
var body_pr = this.getBodyPr();
var r_ins = body_pr.rIns;
var l_ins = body_pr.lIns;
var max_content_width = maxWidth - r_ins - l_ins;
this.content.Reset(0, 0, max_content_width, 20000);
this.content.Recalculate_Page(0, true);
var max_width = 0;
for(var i = 0; i < this.content.Content.length; ++i)
{
var par = this.content.Content[i];
for(var j = 0; j < par.Lines.length; ++j)
{
if(par.Lines[j].Ranges[0].W + 1> max_width)
{
max_width = par.Lines[j].Ranges[0].W;
}
}
}
return max_width + r_ins + l_ins;
},
getRectHeight: function(maxHeight, width)
{
this.content.Reset(0, 0, width, 20000);
this.content.Recalculate_Page(0, true);
var content_height = this.getSummaryHeight();
var t_ins = isRealNumber(this.bodyPr.tIns) ? this.bodyPr.tIns : 1.27;
var b_ins = isRealNumber(this.bodyPr.bIns) ? this.bodyPr.bIns : 1.27;
return content_height + t_ins + b_ins;
}
};
......@@ -267,6 +267,14 @@ var historyitem_SetShapeFlips = 3;
var historyitem_SetShapeParent = 4;
var historyitem_SetShapeChildOffset = 5;
var historyitem_SetShapeChildExtents = 6;
var historyitem_SetShapeSetFill = 7;
var historyitem_SetShapeSetLine= 8;
var historyitem_SetShapeSetGeometry = 9;
var historyitem_SetShapeBodyPr = 10;
......
......@@ -108,6 +108,8 @@ function asc_docs_api(name)
this.chartStyleManager = new ChartStyleManager();
this.chartPreviewManager = new ChartPreviewManager();
this.chartTranslate = new asc_CChartTranslate();
// объекты, нужные для отправки в тулбар (шрифты, стили)
this._gui_fonts = null;
this._gui_editor_themes = null;
......@@ -1906,13 +1908,14 @@ asc_docs_api.prototype.ShapeApply = function(prop)
}
else
{
if(!this.noCreatePoint)
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.ShapeApply(prop);
}
}
asc_docs_api.prototype.setStartPointHistory = function(){this.noCreatePoint = true; History.Create_NewPoint();};
asc_docs_api.prototype.setEndPointHistory = function(){this.noCreatePoint = false;};
asc_docs_api.prototype.setEndPointHistory = function(){this.noCreatePoint = false; };
asc_docs_api.prototype.SetSlideProps = function(prop)
{
if (null == prop)
......@@ -3509,6 +3512,7 @@ asc_docs_api.prototype.AddShape = function(shapetype)
}
asc_docs_api.prototype.ChangeShapeType = function(shapetype)
{
History.Create_NewPoint();
this.WordControl.m_oLogicDocument.changeShapeType(shapetype);
}
asc_docs_api.prototype.AddText = function()
......@@ -3517,16 +3521,19 @@ asc_docs_api.prototype.AddText = function()
asc_docs_api.prototype.groupShapes = function()
{
History.Create_NewPoint();
this.WordControl.m_oLogicDocument.groupShapes();
}
asc_docs_api.prototype.unGroupShapes = function()
{
History.Create_NewPoint();
this.WordControl.m_oLogicDocument.unGroupShapes();
}
asc_docs_api.prototype.setVerticalAlign = function(align)
{
History.Create_NewPoint();
this.WordControl.m_oLogicDocument.setVerticalAlign(align);
}
......
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