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

fix Bug 32252 - [Copy&Paste] Не вставляется текст при копировании изображения и текста из CDE в CPE

parent 8713c78f
"use strict";
"use strict";
var historyitem_ChartFormatSetChart = 1001;
var historyitem_AutoShapes_SetDrawingBaseCoors = 1000;
......
......@@ -63,6 +63,17 @@ CGroupShape.prototype =
return this.Id;
},
Get_AllDrawingObjects: function(DrawingObjects)
{
for(var i = 0; i < this.spTree.length; ++i)
{
if(this.spTree[i].Get_AllDrawingObjects)
{
this.spTree[i].Get_AllDrawingObjects(DrawingObjects);
}
}
},
documentGetAllFontNames: function(allFonts)
{
for(var i = 0; i < this.spTree.length; ++i)
......
......@@ -646,6 +646,15 @@ CShape.prototype =
this.Id = r.GetString2();
},
Get_AllDrawingObjects: function(DrawingObjects)
{
var oContent = this.getDocContent();
if(oContent)
{
oContent.Get_AllDrawingObjects(DrawingObjects);
}
},
convertToWord: function (document) {
this.setBDeleted(true);
var c = new CShape();
......
......@@ -3742,25 +3742,15 @@ PasteProcessor.prototype =
var presentationSelectedContent = new PresentationSelectedContent();
presentationSelectedContent.DocContent = new CSelectedContent();
var elements = [], selectedElement, element, drawings, pDrawings = [], drawingCopyObject;
var elements = [], selectedElement, element, drawings = [], pDrawings = [], drawingCopyObject;
var defaultTableStyleId = presentation.DefaultTableStyleId;
for(var i = 0; i < aContent.content.length; ++i)
{
selectedElement = new CSelectedElement();
element = aContent.content[i];
//drawings
drawings = element.Get_AllDrawingObjects();
if(drawings && drawings.length)
{
for(var j = 0; j < drawings.length; j++)
{
drawingCopyObject = new DrawingCopyObject();
drawingCopyObject.Drawing = drawings[j].GraphicObj;
pDrawings.push(drawingCopyObject);
}
}
else if(type_Paragraph == element.GetType())//paragraph
element.Get_AllDrawingObjects(drawings);
if(type_Paragraph == element.GetType())//paragraph
{
selectedElement.Element = ConvertParagraphToPPTX(element);
elements.push(selectedElement);
......@@ -3791,7 +3781,16 @@ PasteProcessor.prototype =
}
}
if(drawings && drawings.length)
{
for(var j = 0; j < drawings.length; j++)
{
drawingCopyObject = new DrawingCopyObject();
drawingCopyObject.Drawing = drawings[j].GraphicObj;
pDrawings.push(drawingCopyObject);
}
}
presentationSelectedContent.DocContent.Elements = elements;
presentationSelectedContent.Drawings = pDrawings;
......
......@@ -3719,6 +3719,32 @@ CPresentation.prototype =
}, this, []);
},
CreateAndAddShapeFromSelectedContent : function(oDocContent)
{
var track_object = new NewShapeTrack("textRect", 0, 0, this.Slides[this.CurPage].Layout.Master.Theme, this.Slides[this.CurPage].Layout.Master, this.Slides[this.CurPage].Layout, this.Slides[this.CurPage], this.CurPage);
track_object.track({}, 0, 0);
var shape = track_object.getShape(false, this.DrawingDocument, this.Slides[this.CurPage]);
shape.setParent(this.Slides[this.CurPage]);
var paragraph = shape.txBody.content.Content[0];
var NearPos = { Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false) };
paragraph.Check_NearestPos(NearPos);
var old_val = oDocContent.MoveDrawing;
oDocContent.MoveDrawing = true;
shape.txBody.content.Insert_Content(oDocContent, NearPos);
oDocContent.MoveDrawing = old_val;
var body_pr = shape.getBodyPr();
var w = shape.txBody.getMaxContentWidth(this.Width/2, true) + body_pr.lIns + body_pr.rIns;
var h = shape.txBody.content.Get_SummaryHeight() + body_pr.tIns + body_pr.bIns;
shape.spPr.xfrm.setExtX(w);
shape.spPr.xfrm.setExtY(h);
shape.spPr.xfrm.setOffX((this.Width - w) / 2);
shape.spPr.xfrm.setOffY((this.Height - h) / 2);
shape.setParent(this.Slides[this.CurPage]);
shape.addToDrawingObjects();
return shape;
},
Insert_Content : function(Content)
{
var selected_slides = editor.WordControl.Thumbnails.GetSelectedArray(), i;
......@@ -3764,6 +3790,11 @@ CPresentation.prototype =
Content.Drawings[i].Drawing.checkExtentsByDocContent && Content.Drawings[i].Drawing.checkExtentsByDocContent();
this.Slides[this.CurPage].graphicObjects.selectObject(Content.Drawings[i].Drawing, 0);
}
if(Content.DocContent)
{
var shape = this.CreateAndAddShapeFromSelectedContent(Content.DocContent);
this.Slides[this.CurPage].graphicObjects.selectObject(shape, 0);
}
}
else if(Content.DocContent)
{
......@@ -3786,26 +3817,7 @@ CPresentation.prototype =
}
else
{
var track_object = new NewShapeTrack("textRect", 0, 0, this.Slides[this.CurPage].Layout.Master.Theme, this.Slides[this.CurPage].Layout.Master, this.Slides[this.CurPage].Layout, this.Slides[this.CurPage], this.CurPage);
track_object.track({}, 0, 0);
var shape = track_object.getShape(false, this.DrawingDocument, this.Slides[this.CurPage]);
shape.setParent(this.Slides[this.CurPage]);
paragraph = shape.txBody.content.Content[0];
NearPos = { Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false) };
paragraph.Check_NearestPos(NearPos);
var old_val = Content.DocContent.MoveDrawing;
Content.DocContent.MoveDrawing = true;
shape.txBody.content.Insert_Content(Content.DocContent, NearPos);
Content.DocContent.MoveDrawing = old_val;
var body_pr = shape.getBodyPr();
var w = shape.txBody.getMaxContentWidth(this.Width/2, true) + body_pr.lIns + body_pr.rIns;
var h = shape.txBody.content.Get_SummaryHeight() + body_pr.tIns + body_pr.bIns;
shape.spPr.xfrm.setExtX(w);
shape.spPr.xfrm.setExtY(h);
shape.spPr.xfrm.setOffX((this.Width - w) / 2);
shape.spPr.xfrm.setOffY((this.Height - h) / 2);
shape.setParent(this.Slides[this.CurPage]);
shape.addToDrawingObjects();
var shape = this.CreateAndAddShapeFromSelectedContent(Content.DocContent);
this.Slides[this.CurPage].graphicObjects.resetSelection();
this.Slides[this.CurPage].graphicObjects.selectObject(shape, 0);
}
......
......@@ -4194,6 +4194,18 @@ ParaDrawing.prototype =
return null;
},
Get_AllDrawingObjects: function(DrawingObjects)
{
if(null == DrawingObjects)
{
DrawingObjects = [];
}
if(this.GraphicObj.Get_AllDrawingObjects)
{
this.GraphicObj.Get_AllDrawingObjects(DrawingObjects);
}
},
canRotate: function()
{
return isRealObject(this.GraphicObj) && typeof this.GraphicObj.canRotate == "function" && this.GraphicObj.canRotate();
......
......@@ -205,7 +205,10 @@ ParaRun.prototype.Get_AllDrawingObjects = function(DrawingObjs)
var Item = this.Content[Index];
if ( para_Drawing === Item.Type )
{
DrawingObjs.push(Item);
Item.Get_AllDrawingObjects(DrawingObjs);
}
}
};
......
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