Commit 1f2d3062 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

правка бага 21090 - [CoEdit] Не вставляется копия автофигуры добавленная другим пользователем

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51079 954022d7-b5bf-4e40-9824-e11837661b57
parent e50289ea
...@@ -502,6 +502,16 @@ CGeometry.prototype= ...@@ -502,6 +502,16 @@ CGeometry.prototype=
Write_ToBinary2: function(Writer) Write_ToBinary2: function(Writer)
{ {
var w = Writer; var w = Writer;
var count = 0;
for(var key in this.avLst)
{
++count;
}
w.WriteLong(count);
for(key in this.avLst)
{
w.WriteString2(key);
}
var gd_lst_info_count = this.gdLstInfo.length; var gd_lst_info_count = this.gdLstInfo.length;
Writer.WriteLong(gd_lst_info_count); Writer.WriteLong(gd_lst_info_count);
...@@ -530,16 +540,7 @@ CGeometry.prototype= ...@@ -530,16 +540,7 @@ CGeometry.prototype=
} }
WriteObjectLong(w, this.gdLst); WriteObjectLong(w, this.gdLst);
var count = 0;
for(var key in this.avLst)
{
++count;
}
w.WriteLong(count);
for(key in this.avLst)
{
w.WriteString2(key);
}
var cnx_lst_count = this.cnxLstInfo.length; var cnx_lst_count = this.cnxLstInfo.length;
...@@ -762,6 +763,11 @@ CGeometry.prototype= ...@@ -762,6 +763,11 @@ CGeometry.prototype=
Read_FromBinary2: function(Reader) Read_FromBinary2: function(Reader)
{ {
var r = Reader; var r = Reader;
var count = r.GetLong();
for(index = 0; index < count; ++index)
{
this.avLst[r.GetString2()] = true;
}
var gd_lst_info_count = Reader.GetLong(); var gd_lst_info_count = Reader.GetLong();
for(var index = 0; index < gd_lst_info_count; ++index) for(var index = 0; index < gd_lst_info_count; ++index)
{ {
...@@ -777,18 +783,19 @@ CGeometry.prototype= ...@@ -777,18 +783,19 @@ CGeometry.prototype=
if(r.GetBool()) if(r.GetBool())
gd_info.z = r.GetString2(); gd_info.z = r.GetString2();
this.gdLstInfo.push(gd_info); if(this.avLst[gd_info.name])
{
this.AddAdj(gd_info.name, gd_info.formula, gd_info.x, gd_info.y, gd_info.z)
}
else
{
this.AddGuide(gd_info.name, gd_info.formula, gd_info.x, gd_info.y, gd_info.z)
}
} }
this.gdLst = ReadObjectLong(r); this.gdLst = ReadObjectLong(r);
var count = r.GetLong();
for(index = 0; index < count; ++index)
{
this.avLst[r.GetString2()] = true;
}
var cnx_lst_count = Reader.GetLong(); var cnx_lst_count = Reader.GetLong();
for(index = 0; index < cnx_lst_count; ++index) for(index = 0; index < cnx_lst_count; ++index)
{ {
...@@ -823,7 +830,7 @@ CGeometry.prototype= ...@@ -823,7 +830,7 @@ CGeometry.prototype=
if(r.GetBool()) if(r.GetBool())
o.posY = r.GetString2(); o.posY = r.GetString2();
this.ahXYLstInfo.push(o); this.AddHandleXY(o.gdRefX, o.minX, o.maxX, o.gdRefY, o.minY, o.maxY, o.posX, o.posY);
} }
for(index = 0; index < ah_xy_count; ++index) for(index = 0; index < ah_xy_count; ++index)
...@@ -884,7 +891,8 @@ CGeometry.prototype= ...@@ -884,7 +891,8 @@ CGeometry.prototype=
if(r.GetBool()) if(r.GetBool())
o.posY = r.GetString2(); o.posY = r.GetString2();
this.ahPolarLstInfo.push(o); this.AddHandlePolar(o.gdRefAng, o.minAng, o.maxAng, o.gdRefR, o.minR, o.maxR, o.posX, o.posY);
} }
for(index = 0; index < ah_polar_count; ++index) for(index = 0; index < ah_polar_count; ++index)
...@@ -920,14 +928,16 @@ CGeometry.prototype= ...@@ -920,14 +928,16 @@ CGeometry.prototype=
var path_count = Reader.GetLong(); var path_count = Reader.GetLong();
for(index = 0; index < path_count; ++index) for(index = 0; index < path_count; ++index)
{ {
this.pathLst[index] = new Path(); var new_path = new Path();
this.pathLst[index].Read_FromBinary2(Reader); new_path.Read_FromBinary2(Reader);
this.AddPath(new_path);
} }
if(r.GetBool()) if(r.GetBool())
{ {
this.preset = r.GetString2(); this.preset = r.GetString2();
} }
this.rectS = ReadObjectString(r); var rectS = ReadObjectString(r);
this.AddRect(rectS.l, rectS.t, rectS.r, rectS.b);
this.rect = ReadObjectDouble(r); this.rect = ReadObjectDouble(r);
}, },
......
...@@ -148,9 +148,9 @@ Path.prototype = { ...@@ -148,9 +148,9 @@ Path.prototype = {
Read_FromBinary2: function(Reader) Read_FromBinary2: function(Reader)
{ {
this.stroke = Reader.GetBool(); this.setStroke( Reader.GetBool());
this.extrusionOk = Reader.GetBool(); this.extrusionOk = Reader.GetBool();
this.fill = Reader.GetString2(); this.setFill(Reader.GetString2());
var flag = Reader.GetBool(); var flag = Reader.GetBool();
if(flag) if(flag)
...@@ -160,6 +160,10 @@ Path.prototype = { ...@@ -160,6 +160,10 @@ Path.prototype = {
if(flag) if(flag)
this.pathH = Reader.GetLong(); this.pathH = Reader.GetLong();
if(isRealNumber(this.pathH && this.pathW))
{
this.setWH(this.pathW, this.pathH);
}
flag = Reader.GetBool(); flag = Reader.GetBool();
if(flag) if(flag)
this.divPW = Reader.GetDouble(); this.divPW = Reader.GetDouble();
...@@ -189,7 +193,19 @@ Path.prototype = { ...@@ -189,7 +193,19 @@ Path.prototype = {
{ {
c.X = read_function.call(Reader); c.X = read_function.call(Reader);
c.Y = read_function.call(Reader); c.Y = read_function.call(Reader);
for(var key in c)
{
if(!isNaN(parseInt(c[key], 10)))
c[key] = parseInt(c[key], 10);
}
if(id === moveTo)
{
this.moveTo(c.X, c.Y);
}
else
{
this.lnTo(c.X, c.Y);
}
break; break;
} }
case bezier3: case bezier3:
...@@ -198,6 +214,12 @@ Path.prototype = { ...@@ -198,6 +214,12 @@ Path.prototype = {
c.Y0 = read_function.call(Reader); c.Y0 = read_function.call(Reader);
c.X1 = read_function.call(Reader); c.X1 = read_function.call(Reader);
c.Y1 = read_function.call(Reader); c.Y1 = read_function.call(Reader);
for(var key in c)
{
if(!isNaN(parseInt(c[key], 10)))
c[key] = parseInt(c[key], 10);
}
this.quadBezTo(c.X0, c.Y0, c.X1, c.Y1);
break; break;
} }
case bezier4: case bezier4:
...@@ -208,6 +230,12 @@ Path.prototype = { ...@@ -208,6 +230,12 @@ Path.prototype = {
c.Y1 = read_function.call(Reader); c.Y1 = read_function.call(Reader);
c.X2 = read_function.call(Reader); c.X2 = read_function.call(Reader);
c.Y2 = read_function.call(Reader); c.Y2 = read_function.call(Reader);
for(var key in c)
{
if(!isNaN(parseInt(c[key], 10)))
c[key] = parseInt(c[key], 10);
}
this.cubicBezTo(c.X0, c.Y0, c.X1, c.Y1, c.X2, c.Y2);
break; break;
} }
case arcTo: case arcTo:
...@@ -216,20 +244,22 @@ Path.prototype = { ...@@ -216,20 +244,22 @@ Path.prototype = {
c.wR = read_function.call(Reader); c.wR = read_function.call(Reader);
c.stAng = read_function.call(Reader); c.stAng = read_function.call(Reader);
c.swAng = read_function.call(Reader); c.swAng = read_function.call(Reader);
for(var key in c)
{
if(!isNaN(parseInt(c[key], 10)))
c[key] = parseInt(c[key], 10);
}
this.arcTo(c.wR, c.hR, c.stAng, c.swAng);
break; break;
} }
case close: case close:
{ {
this.close();
break; break;
} }
} }
for(var key in c)
{ //this.ArrPathCommandInfo.push(c);
if(!isNaN(parseInt(c[key], 10)))
c[key] = parseInt(c[key], 10);
}
this.ArrPathCommandInfo.push(c);
} }
for(index = 0; index < path_command_count; ++index) for(index = 0; index < path_command_count; ++index)
{ {
......
...@@ -140,7 +140,8 @@ function CShape(drawingBase, drawingObjects, legendEntry) ...@@ -140,7 +140,8 @@ function CShape(drawingBase, drawingObjects, legendEntry)
{ {
recalculateTransform: true, recalculateTransform: true,
recalculateBrush: true, recalculateBrush: true,
recalculatePen: true recalculatePen: true,
recalculateGeometry: true
}; };
this.x = null; this.x = null;
...@@ -1124,6 +1125,15 @@ CShape.prototype = ...@@ -1124,6 +1125,15 @@ CShape.prototype =
this.spPr.geometry.Init(5, 5); this.spPr.geometry.Init(5, 5);
}, },
setGeometry: function(geometry)
{
var oldId = this.spPr.geometry ? this.spPr.geometry.Get_Id() : null;
this.spPr.geometry = geometry;
var newId = this.spPr.geometry.Get_Id();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetPresetGeometry, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldId, newId)));
},
setRecalculateAll: function() setRecalculateAll: function()
{ {
this.recalcInfo = this.recalcInfo =
...@@ -2858,6 +2868,7 @@ CShape.prototype = ...@@ -2858,6 +2868,7 @@ CShape.prototype =
case historyitem_AutoShapes_SetPresetGeometry: case historyitem_AutoShapes_SetPresetGeometry:
{ {
this.spPr.geometry = g_oTableId.Get_ById(data.newValue); this.spPr.geometry = g_oTableId.Get_ById(data.newValue);
this.spPr.geometry.Init(5, 5);
break; break;
} }
case historyitem_AutoShapes_RecalculateTransformRedo: case historyitem_AutoShapes_RecalculateTransformRedo:
...@@ -3087,7 +3098,8 @@ CShape.prototype = ...@@ -3087,7 +3098,8 @@ CShape.prototype =
{ {
var geometry = new CGeometry(); var geometry = new CGeometry();
geometry.Read_FromBinary2(Reader); geometry.Read_FromBinary2(Reader);
this.setPresetGeometry(geometry.preset); geometry.Init(5, 5);
this.setGeometry(geometry);
} }
flag = Reader.GetBool(); flag = Reader.GetBool();
......
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