Commit 0b22f49a authored by SergeyLuzyanin's avatar SergeyLuzyanin

save connectors

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