Commit e62ce138 authored by SergeyLuzyanin's avatar SergeyLuzyanin

connectors (coauthoring)

parent a7dbb16d
...@@ -769,7 +769,6 @@ DrawingObjectsController.prototype = ...@@ -769,7 +769,6 @@ DrawingObjectsController.prototype =
var oPreTrack; var oPreTrack;
var stId = null, endId = null, oBeginTrack = null, oEndTrack = null, oBeginShape = null, oEndShape = null; var stId = null, endId = null, oBeginTrack = null, oEndTrack = null, oBeginShape = null, oEndShape = null;
var aConnectionPreTracks = []; var aConnectionPreTracks = [];
var aAllShapes = null;
for(var i = 0; i < aAllConnectors.length; ++i){ for(var i = 0; i < aAllConnectors.length; ++i){
stId = aAllConnectors[i].nvSpPr.nvUniSpPr.stCnxId; stId = aAllConnectors[i].nvSpPr.nvUniSpPr.stCnxId;
endId = aAllConnectors[i].nvSpPr.nvUniSpPr.endCnxId; endId = aAllConnectors[i].nvSpPr.nvUniSpPr.endCnxId;
...@@ -782,10 +781,10 @@ DrawingObjectsController.prototype = ...@@ -782,10 +781,10 @@ DrawingObjectsController.prototype =
for(var j = 0; j < this.arrPreTrackObjects.length; ++j){ for(var j = 0; j < this.arrPreTrackObjects.length; ++j){
oPreTrack = this.arrPreTrackObjects[j].originalObject; oPreTrack = this.arrPreTrackObjects[j].originalObject;
if(oPreTrack.getObjectType() === AscDFH.historyitem_type_Shape && oPreTrack.nvSpPr){ if(oPreTrack.getObjectType() === AscDFH.historyitem_type_Shape && oPreTrack.nvSpPr){
if(oPreTrack.nvSpPr.cNvPr.id === stId){ if(oPreTrack.Id === stId){
oBeginTrack = this.arrPreTrackObjects[j]; oBeginTrack = this.arrPreTrackObjects[j];
} }
if(oPreTrack.nvSpPr.cNvPr.id === endId){ if(oPreTrack.Id === endId){
oEndTrack = this.arrPreTrackObjects[j]; oEndTrack = this.arrPreTrackObjects[j];
} }
} }
...@@ -798,13 +797,9 @@ DrawingObjectsController.prototype = ...@@ -798,13 +797,9 @@ DrawingObjectsController.prototype =
} }
else{ else{
if(stId !== null){ if(stId !== null){
if(!aAllShapes){ oBeginShape = AscCommon.g_oTableId.Get_ById(stId);
aAllShapes = this.getAllShapes(this.getDrawingArray()); if(oBeginShape && oBeginShape.bDeleted){
} oBeginShape = null;
for(var j = 0; j < aAllShapes.length; ++j){
if(aAllShapes[j].nvSpPr.cNvPr.id === stId){
oBeginShape = aAllShapes[j];
}
} }
} }
} }
...@@ -812,13 +807,9 @@ DrawingObjectsController.prototype = ...@@ -812,13 +807,9 @@ DrawingObjectsController.prototype =
oEndShape = oEndTrack.originalObject; oEndShape = oEndTrack.originalObject;
} }
else if(endId !== null){ else if(endId !== null){
if(!aAllShapes){ oEndShape = AscCommon.g_oTableId.Get_ById(endId);
aAllShapes = this.getAllShapes(this.getDrawingArray()); if(oEndShape && oEndShape.bDeleted){
} oEndShape = null;
for(var j = 0; j < aAllShapes.length; ++j){
if(aAllShapes[j].nvSpPr.cNvPr.id === endId){
oEndShape = aAllShapes[j];
}
} }
} }
aConnectionPreTracks.push(new AscFormat.CConnectorTrack(aAllConnectors[i], oBeginTrack, oEndTrack, oBeginShape, oEndShape)); aConnectionPreTracks.push(new AscFormat.CConnectorTrack(aAllConnectors[i], oBeginTrack, oEndTrack, oBeginShape, oEndShape));
......
...@@ -141,12 +141,13 @@ var asc_CShapeProperty = Asc.asc_CShapeProperty; ...@@ -141,12 +141,13 @@ var asc_CShapeProperty = Asc.asc_CShapeProperty;
oWordGraphicObjects.document.Api.textArtPreviewManager.clear(); oWordGraphicObjects.document.Api.textArtPreviewManager.clear();
} }
}; };
drawingsChangesMap[AscDFH.historyitem_ThemeSetFontScheme ] = function (oClass, value){oClass.themeElements.fontScheme = value;}; drawingsChangesMap[AscDFH.historyitem_ThemeSetFontScheme] = function (oClass, value){oClass.themeElements.fontScheme = value;};
drawingsChangesMap[AscDFH.historyitem_ThemeSetFmtScheme ] = function (oClass, value){oClass.themeElements.fmtScheme = value;}; drawingsChangesMap[AscDFH.historyitem_ThemeSetFmtScheme ] = function (oClass, value){oClass.themeElements.fmtScheme = value;};
drawingsChangesMap[AscDFH.historyitem_HF_SetDt ] = function (oClass, value){oClass.dt = value;}; drawingsChangesMap[AscDFH.historyitem_HF_SetDt ] = function (oClass, value){oClass.dt = value;};
drawingsChangesMap[AscDFH.historyitem_HF_SetFtr ] = function (oClass, value){oClass.ftr = value;}; drawingsChangesMap[AscDFH.historyitem_HF_SetFtr ] = function (oClass, value){oClass.ftr = value;};
drawingsChangesMap[AscDFH.historyitem_HF_SetHdr ] = function (oClass, value){oClass.hdr = value;}; drawingsChangesMap[AscDFH.historyitem_HF_SetHdr ] = function (oClass, value){oClass.hdr = value;};
drawingsChangesMap[AscDFH.historyitem_HF_SetSldNum ] = function (oClass, value){oClass.sldNum = value;}; drawingsChangesMap[AscDFH.historyitem_HF_SetSldNum ] = function (oClass, value){oClass.sldNum = value;};
drawingsChangesMap[AscDFH.historyitem_UniNvPr_SetUniSpPr] = function (oClass, value){oClass.nvUniSpPr = value;};
drawingContentChanges[AscDFH.historyitem_ClrMap_SetClr] = function(oClass){return oClass.color_map}; drawingContentChanges[AscDFH.historyitem_ClrMap_SetClr] = function(oClass){return oClass.color_map};
...@@ -4857,19 +4858,18 @@ function CNvUniSpPr() ...@@ -4857,19 +4858,18 @@ function CNvUniSpPr()
else { else {
w.WriteBool(false); w.WriteBool(false);
} }
w.WriteLong(this.locks); if(AscFormat.isRealNumber(this.stCnxIdx) && typeof (this.stCnxId) === "string" && this.stCnxId.length > 0){
if(AscFormat.isRealNumber(this.stCnxIdx) && AscFormat.isRealNumber(this.stCnxId)){
w.WriteBool(true); w.WriteBool(true);
w.WriteLong(this.stCnxIdx); w.WriteLong(this.stCnxIdx);
w.WriteLong(this.stCnxId); w.WriteString2(this.stCnxId);
} }
else { else {
w.WriteBool(false); w.WriteBool(false);
} }
if(AscFormat.isRealNumber(this.endCnxIdx) && AscFormat.isRealNumber(this.endCnxId)){ if(AscFormat.isRealNumber(this.endCnxIdx) && typeof (this.endCnxId) === "string" && this.endCnxId.length > 0){
w.WriteBool(true); w.WriteBool(true);
w.WriteLong(this.endCnxIdx); w.WriteLong(this.endCnxIdx);
w.WriteLong(this.endCnxId); w.WriteString2(this.endCnxId);
} }
else { else {
w.WriteBool(false); w.WriteBool(false);
...@@ -4886,7 +4886,7 @@ function CNvUniSpPr() ...@@ -4886,7 +4886,7 @@ function CNvUniSpPr()
bCnx = r.GetBool(); bCnx = r.GetBool();
if(bCnx){ if(bCnx){
this.stCnxIdx = r.GetLong(); this.stCnxIdx = r.GetLong();
this.stCnxId = r.GetLong(); this.stCnxId = r.GetString2();
} }
else{ else{
this.stCnxIdx = null; this.stCnxIdx = null;
...@@ -4895,7 +4895,7 @@ function CNvUniSpPr() ...@@ -4895,7 +4895,7 @@ function CNvUniSpPr()
bCnx = r.GetBool(); bCnx = r.GetBool();
if(bCnx){ if(bCnx){
this.endCnxIdx = r.GetLong(); this.endCnxIdx = r.GetLong();
this.endCnxId = r.GetLong(); this.endCnxId = r.GetString2();
} }
else{ else{
this.endCnxIdx = null; this.endCnxIdx = null;
...@@ -4935,7 +4935,7 @@ UniNvPr.prototype = ...@@ -4935,7 +4935,7 @@ UniNvPr.prototype =
}, },
setUniSpPr: function(pr){ setUniSpPr: function(pr){
History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_UniNvPr_SetUniSpPr, this.UniPr, pr)); History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_UniNvPr_SetUniSpPr, this.nvUniSpPr, pr));
this.nvUniSpPr = pr; this.nvUniSpPr = pr;
}, },
......
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
var _endConnectionParams = null; var _endConnectionParams = null;
if(this.beginTrack){ if(this.beginTrack){
track_bounds = this.convertTrackBounds(this.beginTrack.getBounds()); track_bounds = this.convertTrackBounds(this.beginTrack.getBounds());
_rot = AscFormat.isRealNumber(this.beginTrack.rot) ? this.beginTrack.rot : this.beginTrack.originalObject.rot; _rot = AscFormat.isRealNumber(this.beginTrack.angle) ? this.beginTrack.angle : this.beginTrack.originalObject.rot;
oConectionObject = this.beginTrack.overlayObject.geometry.cnxLst[oConnectorInfo.stCnxIdx]; oConectionObject = this.beginTrack.overlayObject.geometry.cnxLst[oConnectorInfo.stCnxIdx];
g_conn_info = {idx: oConnectorInfo.stCnxIdx, ang: oConectionObject.ang, x: oConectionObject.x, y: oConectionObject.y}; g_conn_info = {idx: oConnectorInfo.stCnxIdx, ang: oConectionObject.ang, x: oConectionObject.x, y: oConectionObject.y};
_startConnectionParams = this.connector.convertToConnectionParams(_rot, this.beginTrack.overlayObject.TransformMatrix, track_bounds, g_conn_info) _startConnectionParams = this.connector.convertToConnectionParams(_rot, this.beginTrack.overlayObject.TransformMatrix, track_bounds, g_conn_info)
} }
if(this.endTrack){ if(this.endTrack){
track_bounds = this.convertTrackBounds(this.endTrack.getBounds()); track_bounds = this.convertTrackBounds(this.endTrack.getBounds());
_rot = AscFormat.isRealNumber(this.endTrack.rot) ? this.endTrack.rot : this.endTrack.originalObject.rot; _rot = AscFormat.isRealNumber(this.endTrack.angle) ? this.endTrack.angle : this.endTrack.originalObject.rot;
oConectionObject = this.endTrack.overlayObject.geometry.cnxLst[oConnectorInfo.endCnxIdx]; oConectionObject = this.endTrack.overlayObject.geometry.cnxLst[oConnectorInfo.endCnxIdx];
g_conn_info = {idx: oConnectorInfo.endCnxIdx, ang: oConectionObject.ang, x: oConectionObject.x, y: oConectionObject.y}; g_conn_info = {idx: oConnectorInfo.endCnxIdx, ang: oConectionObject.ang, x: oConectionObject.x, y: oConectionObject.y};
_endConnectionParams = this.connector.convertToConnectionParams(_rot, this.endTrack.overlayObject.TransformMatrix, track_bounds, g_conn_info) _endConnectionParams = this.connector.convertToConnectionParams(_rot, this.endTrack.overlayObject.TransformMatrix, track_bounds, g_conn_info)
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
} }
} }
this.oSpPr = AscFormat.fCalculateSpPr(_startConnectionParams, _endConnectionParams, this.connector.spPr.geometry.preset, this.overlayObject.pen.w); this.oSpPr = AscFormat.fCalculateSpPr(_startConnectionParams, _endConnectionParams, this.connector.spPr.geometry.preset, this.overlayObject.pen.w);
this.geometry = this.oSpPr.geometry;
this.overlayObject.geometry = this.geometry;
} }
this.geometry.Recalculate(this.oSpPr.xfrm.extX, this.oSpPr.xfrm.extY); this.geometry.Recalculate(this.oSpPr.xfrm.extX, this.oSpPr.xfrm.extY);
...@@ -96,8 +98,16 @@ ...@@ -96,8 +98,16 @@
CConnectorTrack.prototype.trackEnd = function() CConnectorTrack.prototype.trackEnd = function()
{ {
this.connector.setSpPr(this.oSpPr.createDuplicate()); var _xfrm = this.connector.spPr.xfrm;
this.connector.spPr.setParent(this.connector); var _xfrm2 = this.oSpPr.xfrm;
_xfrm.setOffX(_xfrm2.offX);
_xfrm.setOffY(_xfrm2.offY);
_xfrm.setExtX(_xfrm2.extX);
_xfrm.setExtY(_xfrm2.extY);
_xfrm.setFlipH(_xfrm2.flipH);
_xfrm.setFlipV(_xfrm2.flipV);
_xfrm.setRot(_xfrm2.rot);
this.connector.spPr.setGeometry(this.oSpPr.geometry.createDuplicate());
}; };
CConnectorTrack.prototype.convertTrackBounds = function(trackBounds) CConnectorTrack.prototype.convertTrackBounds = function(trackBounds)
{ {
......
...@@ -578,13 +578,12 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -578,13 +578,12 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
if(this.startShape && this.startConnectionInfo) if(this.startShape && this.startConnectionInfo)
{ {
nvUniSpPr.stCnxIdx = this.startConnectionInfo.idx; nvUniSpPr.stCnxIdx = this.startConnectionInfo.idx;
nvUniSpPr.stCnxId = this.startShape.nvSpPr.cNvPr.id; nvUniSpPr.stCnxId = this.startShape.Id;
} }
if(this.endShape && this.endConnectionInfo) if(this.endShape && this.endConnectionInfo)
{ {
nvUniSpPr.endCnxIdx = this.endConnectionInfo.idx; nvUniSpPr.endCnxIdx = this.endConnectionInfo.idx;
nvUniSpPr.endCnxId = this.endShape.nvSpPr.cNvPr.id; nvUniSpPr.endCnxId = this.endShape.Id;
} }
shape.nvSpPr.setUniSpPr(nvUniSpPr); shape.nvSpPr.setUniSpPr(nvUniSpPr);
} }
......
...@@ -241,6 +241,7 @@ ...@@ -241,6 +241,7 @@
this.m_oFactoryClass[AscDFH.historyitem_type_SerAx] = AscFormat.CSerAx; this.m_oFactoryClass[AscDFH.historyitem_type_SerAx] = AscFormat.CSerAx;
this.m_oFactoryClass[AscDFH.historyitem_type_Title] = AscFormat.CTitle; this.m_oFactoryClass[AscDFH.historyitem_type_Title] = AscFormat.CTitle;
this.m_oFactoryClass[AscDFH.historyitem_type_OleObject] = AscFormat.COleObject; this.m_oFactoryClass[AscDFH.historyitem_type_OleObject] = AscFormat.COleObject;
this.m_oFactoryClass[AscDFH.historyitem_type_Cnx] = AscFormat.CConnectionShape;
this.m_oFactoryClass[AscDFH.historyitem_type_DrawingContent] = AscFormat.CDrawingDocContent; this.m_oFactoryClass[AscDFH.historyitem_type_DrawingContent] = AscFormat.CDrawingDocContent;
this.m_oFactoryClass[AscDFH.historyitem_type_Math] = AscCommonWord.ParaMath; this.m_oFactoryClass[AscDFH.historyitem_type_Math] = AscCommonWord.ParaMath;
this.m_oFactoryClass[AscDFH.historyitem_type_MathContent] = AscCommonWord.CMathContent; this.m_oFactoryClass[AscDFH.historyitem_type_MathContent] = AscCommonWord.CMathContent;
...@@ -262,6 +263,7 @@ ...@@ -262,6 +263,7 @@
this.m_oFactoryClass[AscDFH.historyitem_type_deg] = AscCommonWord.CDegree; this.m_oFactoryClass[AscDFH.historyitem_type_deg] = AscCommonWord.CDegree;
this.m_oFactoryClass[AscDFH.historyitem_type_BlockLevelSdt] = AscCommonWord.CBlockLevelSdt; this.m_oFactoryClass[AscDFH.historyitem_type_BlockLevelSdt] = AscCommonWord.CBlockLevelSdt;
if (window['AscCommonSlide']) if (window['AscCommonSlide'])
{ {
this.m_oFactoryClass[AscDFH.historyitem_type_Slide] = AscCommonSlide.Slide; this.m_oFactoryClass[AscDFH.historyitem_type_Slide] = AscCommonSlide.Slide;
......
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