Commit 0b22f49a authored by SergeyLuzyanin's avatar SergeyLuzyanin

save connectors

parent 1e619946
...@@ -258,7 +258,7 @@ function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){ ...@@ -258,7 +258,7 @@ function CChangesDrawingObjectsRemoveFromDrawingObjects(Class, Pos){
AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects; AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects] = CChangesDrawingObjectsRemoveFromDrawingObjects;
CShape.prototype.addToDrawingObjects = function(pos) CShape.prototype.addToDrawingObjects = function(pos, type)
{ {
var position = addToDrawings(this.worksheet, this, pos, /*lockByDefault*/undefined, undefined); var position = addToDrawings(this.worksheet, this, pos, /*lockByDefault*/undefined, undefined);
//var data = {Type: AscDFH.historyitem_AutoShapes_AddToDrawingObjects, Pos: position}; //var data = {Type: AscDFH.historyitem_AutoShapes_AddToDrawingObjects, Pos: position};
......
...@@ -1165,6 +1165,8 @@ CShapeDrawer.prototype = ...@@ -1165,6 +1165,8 @@ CShapeDrawer.prototype =
drawFillStroke : function(bIsFill, fill_mode, bIsStroke) drawFillStroke : function(bIsFill, fill_mode, bIsStroke)
{ {
if(this.Graphics.IsSlideBoundsCheckerType)
return;
if (this.Graphics.RENDERER_PDF_FLAG === undefined) if (this.Graphics.RENDERER_PDF_FLAG === undefined)
{ {
if (bIsFill) if (bIsFill)
......
...@@ -2885,6 +2885,8 @@ ...@@ -2885,6 +2885,8 @@
this.WriteDrawings = function(aDrawings) this.WriteDrawings = function(aDrawings)
{ {
var oThis = this; var oThis = this;
var oPPTXWriter = pptx_content_writer.BinaryFileWriter;
oPPTXWriter.ClearIdMap();
for(var i = 0, length = aDrawings.length; i < length; ++i) for(var i = 0, length = aDrawings.length; i < length; ++i)
{ {
//write only active drawing, if copy/paste //write only active drawing, if copy/paste
...@@ -2935,6 +2937,7 @@ ...@@ -2935,6 +2937,7 @@
} }
} }
} }
oPPTXWriter.ClearIdMap();
}; };
this.WriteDrawing = function(oDrawing, curDrawing) this.WriteDrawing = function(oDrawing, curDrawing)
{ {
......
...@@ -731,14 +731,14 @@ DrawingArea.prototype.drawSelection = function(drawingDocument) { ...@@ -731,14 +731,14 @@ DrawingArea.prototype.drawSelection = function(drawingDocument) {
this.worksheet.objectRender.controller.drawSelection(drawingDocument); this.worksheet.objectRender.controller.drawSelection(drawingDocument);
if ( this.worksheet.objectRender.controller.needUpdateOverlay() ) { if ( this.worksheet.objectRender.controller.needUpdateOverlay() ) {
trackOverlay.Show(); trackOverlay.Show();
shapeOverlayCtx.put_GlobalAlpha(true, 0.5); autoShapeTrack.Graphics.put_GlobalAlpha(true, 0.5);
this.worksheet.objectRender.controller.drawTracks(shapeOverlayCtx); this.worksheet.objectRender.controller.drawTracks(autoShapeTrack);
shapeOverlayCtx.put_GlobalAlpha(true, 1); autoShapeTrack.Graphics.put_GlobalAlpha(true, 1);
} }
} }
// Restore // Restore
this.frozenPlaces[i].restore(shapeOverlayCtx); this.frozenPlaces[i].restore(autoShapeTrack);
} }
}; };
......
...@@ -176,7 +176,7 @@ StartAddNewShape.prototype = ...@@ -176,7 +176,7 @@ StartAddNewShape.prototype =
shape.setParent(oThis.drawingObjects.drawingObjects); shape.setParent(oThis.drawingObjects.drawingObjects);
shape.setRecalculateInfo(); shape.setRecalculateInfo();
} }
shape.addToDrawingObjects(); shape.addToDrawingObjects(undefined, AscCommon.c_oAscCellAnchorType.cellanchorAbsolute);
shape.checkDrawingBaseCoords(); shape.checkDrawingBaseCoords();
oThis.drawingObjects.checkChartTextSelection(); oThis.drawingObjects.checkChartTextSelection();
oThis.drawingObjects.resetSelection(); oThis.drawingObjects.resetSelection();
......
...@@ -108,6 +108,8 @@ ...@@ -108,6 +108,8 @@
_xfrm.setFlipV(_xfrm2.flipV); _xfrm.setFlipV(_xfrm2.flipV);
_xfrm.setRot(_xfrm2.rot); _xfrm.setRot(_xfrm2.rot);
this.connector.spPr.setGeometry(this.oSpPr.geometry.createDuplicate()); this.connector.spPr.setGeometry(this.oSpPr.geometry.createDuplicate());
this.connector.checkDrawingBaseCoords();
}; };
CConnectorTrack.prototype.convertTrackBounds = function(trackBounds) CConnectorTrack.prototype.convertTrackBounds = function(trackBounds)
{ {
......
...@@ -124,12 +124,17 @@ function CBinaryFileWriter() ...@@ -124,12 +124,17 @@ function CBinaryFileWriter()
this.IsUseFullUrl = false; this.IsUseFullUrl = false;
this.PresentationThemesOrigin = ""; this.PresentationThemesOrigin = "";
this.arr_connectors_pos = []; this.max_shape_id = 3;
this.max_shape_id = 1; this.arr_map_shapes_id = {};
this.DocSaveParams = null; this.DocSaveParams = null;
var oThis = this; var oThis = this;
this.ClearIdMap = function(){
this.max_shape_id = 3;
this.arr_map_shapes_id = {};
};
this.Start_UseFullUrl = function() this.Start_UseFullUrl = function()
{ {
this.IsUseFullUrl = true; this.IsUseFullUrl = true;
...@@ -1542,7 +1547,7 @@ function CBinaryFileWriter() ...@@ -1542,7 +1547,7 @@ function CBinaryFileWriter()
oThis.StartRecord(2); oThis.StartRecord(2);
oThis.WriteULong(_len); oThis.WriteULong(_len);
oThis.arr_connectors_pos.length = 0; oThis.ClearIdMap();
for (var i = 0; i < _len; i++) for (var i = 0; i < _len; i++)
{ {
oThis.StartRecord(0); oThis.StartRecord(0);
...@@ -1582,18 +1587,7 @@ function CBinaryFileWriter() ...@@ -1582,18 +1587,7 @@ function CBinaryFileWriter()
oThis.EndRecord(); oThis.EndRecord();
} }
var _oldPos = oThis.pos; oThis.ClearIdMap();
for(var i = 0; i < oThis.arr_connectors_pos.length; ++i){
var oPos = oThis.arr_connectors_pos[i];
var oShape = AscCommon.g_oTableId.Get_ById(oPos.shapeId);
if(oShape && oShape.nvSpPr && oShape.nvSpPr.cNvPr){
oThis.Seek(oPos.pos);
oThis._WriteInt2(oPos.type, oShape.nvSpPr.cNvPr.id);
}
}
oThis.arr_connectors_pos.length = 0;
oThis.Seek(_oldPos);
oThis.EndRecord(); oThis.EndRecord();
} }
...@@ -2936,6 +2930,9 @@ function CBinaryFileWriter() ...@@ -2936,6 +2930,9 @@ function CBinaryFileWriter()
} }
nvSpPr.locks = shape.locks; nvSpPr.locks = shape.locks;
nvSpPr.objectType = shape.getObjectType(); nvSpPr.objectType = shape.getObjectType();
if(nvSpPr.cNvPr){
nvSpPr.cNvPr.shapeId = shape.Id;
}
oThis.WriteRecord2(0, nvSpPr, oThis.WriteUniNvPr); oThis.WriteRecord2(0, nvSpPr, oThis.WriteUniNvPr);
oThis.WriteRecord1(1, shape.spPr, oThis.WriteSpPr); oThis.WriteRecord1(1, shape.spPr, oThis.WriteSpPr);
...@@ -2975,6 +2972,10 @@ function CBinaryFileWriter() ...@@ -2975,6 +2972,10 @@ function CBinaryFileWriter()
} }
nvPicPr.locks = image.locks; nvPicPr.locks = image.locks;
nvPicPr.objectType = image.getObjectType(); nvPicPr.objectType = image.getObjectType();
if(nvPicPr.cNvPr){
nvPicPr.cNvPr.shapeId = image.Id;
}
oThis.WriteRecord1(0, nvPicPr, this.WriteUniNvPr); oThis.WriteRecord1(0, nvPicPr, this.WriteUniNvPr);
image.spPr.WriteXfrm = image.spPr.xfrm; image.spPr.WriteXfrm = image.spPr.xfrm;
...@@ -3032,6 +3033,10 @@ function CBinaryFileWriter() ...@@ -3032,6 +3033,10 @@ function CBinaryFileWriter()
} }
nvGraphicFramePr.locks = grObj.locks; nvGraphicFramePr.locks = grObj.locks;
nvGraphicFramePr.objectType = grObj.getObjectType(); nvGraphicFramePr.objectType = grObj.getObjectType();
if(nvGraphicFramePr.cNvPr){
nvGraphicFramePr.cNvPr.shapeId = grObj.Id;
}
oThis.WriteRecord1(0, nvGraphicFramePr, oThis.WriteUniNvPr); oThis.WriteRecord1(0, nvGraphicFramePr, oThis.WriteUniNvPr);
if (grObj.spPr.xfrm && grObj.spPr.xfrm.isNotNull()) if (grObj.spPr.xfrm && grObj.spPr.xfrm.isNotNull())
...@@ -3060,6 +3065,10 @@ function CBinaryFileWriter() ...@@ -3060,6 +3065,10 @@ function CBinaryFileWriter()
nvGraphicFramePr.locks = grObj.locks; nvGraphicFramePr.locks = grObj.locks;
nvGraphicFramePr.objectType = grObj.getObjectType(); nvGraphicFramePr.objectType = grObj.getObjectType();
if(nvGraphicFramePr.cNvPr){
nvGraphicFramePr.cNvPr.shapeId = grObj.Id;
}
oThis.WriteRecord1(0, nvGraphicFramePr, oThis.WriteUniNvPr); oThis.WriteRecord1(0, nvGraphicFramePr, oThis.WriteUniNvPr);
if (grObj.spPr && grObj.spPr.xfrm && grObj.spPr.xfrm.isNotNull()) if (grObj.spPr && grObj.spPr.xfrm && grObj.spPr.xfrm.isNotNull())
...@@ -3441,6 +3450,7 @@ function CBinaryFileWriter() ...@@ -3441,6 +3450,7 @@ function CBinaryFileWriter()
group.nvGrpSpPr.nvPr.ph = null; group.nvGrpSpPr.nvPr.ph = null;
group.nvGrpSpPr.locks = group.locks; group.nvGrpSpPr.locks = group.locks;
group.nvGrpSpPr.objectType = group.getObjectType(); group.nvGrpSpPr.objectType = group.getObjectType();
group.nvGrpSpPr.cNvPr.shapeId = group.Id;
oThis.WriteRecord1(0, group.nvGrpSpPr, oThis.WriteUniNvPr); oThis.WriteRecord1(0, group.nvGrpSpPr, oThis.WriteUniNvPr);
group.nvGrpSpPr.nvPr.ph = _old_ph; group.nvGrpSpPr.nvPr.ph = _old_ph;
} }
...@@ -3749,13 +3759,18 @@ function CBinaryFileWriter() ...@@ -3749,13 +3759,18 @@ function CBinaryFileWriter()
oThis._WriteBool2(9, !!(locks & (AscFormat.LOCKS_MASKS.noSelect << 1))); oThis._WriteBool2(9, !!(locks & (AscFormat.LOCKS_MASKS.noSelect << 1)));
if(pr.stCnxId && AscFormat.isRealNumber(pr.stCnxIdx)){ if(pr.stCnxId && AscFormat.isRealNumber(pr.stCnxIdx)){
oThis.arr_connectors_pos.push({pos: oThis.pos, shapeId: pr.stCnxId, type: 10});
oThis._WriteInt2(10, -1); if(!AscFormat.isRealNumber(oThis.arr_map_shapes_id[pr.stCnxId])){
oThis.arr_map_shapes_id[pr.stCnxId] = ++oThis.max_shape_id;
}
oThis._WriteInt2(10, oThis.arr_map_shapes_id[pr.stCnxId]);
oThis._WriteInt2(11, pr.stCnxIdx); oThis._WriteInt2(11, pr.stCnxIdx);
} }
if(pr.endCnxId && AscFormat.isRealNumber(pr.endCnxIdx)){ if(pr.endCnxId && AscFormat.isRealNumber(pr.endCnxIdx)){
oThis.arr_connectors_pos.push({pos: oThis.pos, shapeId: pr.endCnxId, type: 12}); if(!AscFormat.isRealNumber(oThis.arr_map_shapes_id[pr.endCnxId])){
oThis._WriteInt2(12, -1); oThis.arr_map_shapes_id[pr.endCnxId] = ++oThis.max_shape_id;
}
oThis._WriteInt2(12, oThis.arr_map_shapes_id[pr.endCnxId]);
oThis._WriteInt2(13, pr.endCnxIdx); oThis._WriteInt2(13, pr.endCnxIdx);
} }
...@@ -3806,7 +3821,15 @@ function CBinaryFileWriter() ...@@ -3806,7 +3821,15 @@ function CBinaryFileWriter()
this.Write_cNvPr = function(cNvPr) this.Write_cNvPr = function(cNvPr)
{ {
oThis.WriteUChar(g_nodeAttributeStart); oThis.WriteUChar(g_nodeAttributeStart);
cNvPr.id = ++oThis.max_shape_id; if(cNvPr.shapeId){
if(AscFormat.isRealNumber(oThis.arr_map_shapes_id[cNvPr.shapeId])){
cNvPr.id = oThis.arr_map_shapes_id[cNvPr.shapeId];
}
else{
oThis.arr_map_shapes_id[cNvPr.shapeId] = ++oThis.max_shape_id;
}
cNvPr.id = oThis.arr_map_shapes_id[cNvPr.shapeId];
}
oThis._WriteInt1(0, cNvPr.id); oThis._WriteInt1(0, cNvPr.id);
oThis._WriteString1(1, cNvPr.name); oThis._WriteString1(1, cNvPr.name);
oThis._WriteBool1(2, cNvPr.isHidden); oThis._WriteBool1(2, cNvPr.isHidden);
...@@ -4701,6 +4724,7 @@ function CBinaryFileWriter() ...@@ -4701,6 +4724,7 @@ function CBinaryFileWriter()
switch(grObject.getObjectType()) switch(grObject.getObjectType())
{ {
case AscDFH.historyitem_type_Shape: case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_Cnx:
{ {
if(grObject.bWordShape) if(grObject.bWordShape)
{ {
......
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