Commit 4af17cb6 authored by GoshaZotov's avatar GoshaZotov

fix bug 32892, 32891

parent 9bf1a693
...@@ -1005,8 +1005,35 @@ ...@@ -1005,8 +1005,35 @@
{ {
return ""; return "";
} }
else
{
//для слайда читаем только запись бинарника, где хранится base64
History.TurnOff();
var loader = new AscCommon.BinaryPPTYLoader();
loader.presentation = worksheet.model;
loader.Start_UseFullUrl();
loader.stream = stream;
//read base64(first slide)
var imageUrl = stream.GetString2();
loader.End_UseFullUrl()
var drawing = AscFormat.DrawingObjectsController.prototype.createImage(imageUrl, 0, 0, p_width, p_height);
var arr_shapes = [];
arr_shapes[0] = worksheet.objectRender.createDrawingObject();
arr_shapes[0].graphicObject = drawing;
History.TurnOn();
if(!(window["Asc"]["editor"] && window["Asc"]["editor"].isChartEditor))
{
t._insertImagesFromBinary(worksheet, {Drawings: arr_shapes}, isIntoShape);
}
}
break; return true;
} }
} }
......
...@@ -1151,6 +1151,8 @@ CopyProcessor.prototype = ...@@ -1151,6 +1151,8 @@ CopyProcessor.prototype =
this.oPresentationWriter.WriteString2("SlideObjects"); this.oPresentationWriter.WriteString2("SlideObjects");
this.oPresentationWriter.WriteString2(selected_slides[0].ImageUrl);
this.oPresentationWriter.WriteULong(selected_slides.length); this.oPresentationWriter.WriteULong(selected_slides.length);
var layouts_map = {}; var layouts_map = {};
var layout_count = 0; var layout_count = 0;
...@@ -2442,39 +2444,108 @@ PasteProcessor.prototype = ...@@ -2442,39 +2444,108 @@ PasteProcessor.prototype =
for(var i = 0; i < objects.arrImages.length; ++i) for(var i = 0; i < objects.arrImages.length; ++i)
{ {
var oBuilderImage = objects.arrImages[i]; var oBuilderImage = objects.arrImages[i];
if (oBuilderImage.AdditionalUrls) { if (oBuilderImage.AdditionalUrls)
for(var j = 0; j < oBuilderImage.AdditionalUrls.length; ++j) { {
for(var j = 0; j < oBuilderImage.AdditionalUrls.length; ++j)
{
aImagesToDownload.push(oBuilderImage.AdditionalUrls[j]); aImagesToDownload.push(oBuilderImage.AdditionalUrls[j]);
} }
} }
} }
AscCommon.sendImgUrls(oThis.api, aImagesToDownload, function (data) {
var image_map = {}; AscCommon.sendImgUrls(oThis.api, aImagesToDownload, function (data) {
for (var i = 0, length = Math.min(data.length, objects.arrImages.length); i < length; ++i) { var image_map = {};
var elem = data[i]; for (var i = 0, length = Math.min(data.length, objects.arrImages.length); i < length; ++i)
if (null != elem.url) { {
var name = g_oDocumentUrls.imagePath2Local(elem.path); var elem = data[i];
var imageElem = objects.arrImages[i]; if (null != elem.url)
if (null != imageElem) { {
//для вставки graphicFrame в виде картинки(если было при копировании выделено несколько графических объектов) var name = g_oDocumentUrls.imagePath2Local(elem.path);
if (imageElem.base64) { var imageElem = objects.arrImages[i];
imageElem.base64 = name; if (null != imageElem)
} else { {
imageElem.SetUrl(name); //для вставки graphicFrame в виде картинки(если было при копировании выделено несколько графических объектов)
} if (imageElem.base64)
} {
image_map[i] = name; imageElem.base64 = name;
} else { }
image_map[i] = aImagesToDownload[i]; else
} {
} imageElem.SetUrl(name);
aContent = oThis._convertExcelBinary(null, arr_shapes); }
oThis.aContent = aContent.content; }
oThis.api.pre_Paste(aContent.fonts, image_map, fPrepasteCallback); image_map[i] = name;
}); }
if(bTurnOffTrackRevisions){ else
oThis.api.WordControl.m_oLogicDocument.TrackRevisions = true; {
} image_map[i] = aImagesToDownload[i];
}
}
aContent = oThis._convertExcelBinary(null, arr_shapes);
oThis.aContent = aContent.content;
oThis.api.pre_Paste(aContent.fonts, image_map, fPrepasteCallback);
});
if(bTurnOffTrackRevisions)
{
oThis.api.WordControl.m_oLogicDocument.TrackRevisions = true;
}
return;
}
case "SlideObjects":
{
History.TurnOff();
var loader = new AscCommon.BinaryPPTYLoader();
loader.Start_UseFullUrl();
pptx_content_loader.Reader.Start_UseFullUrl();
loader.stream = stream;
loader.presentation = editor.WordControl.m_oLogicDocument;
var imageUrl = stream.GetString2();
History.TurnOn();
var aImagesToDownload = [];
aImagesToDownload.push(imageUrl);
//load image(slide base64)
AscCommon.sendImgUrls(oThis.api, aImagesToDownload, function (data) {
var image_map = {};
var elem = data[0];
if (null != elem.url)
{
imageUrl = g_oDocumentUrls.imagePath2Local(elem.path);
image_map[0] = imageUrl;
}
//create paragraph, pararun and paradrawing
var tempParagraph = new Paragraph(oThis.oDocument.DrawingDocument, oThis.oDocument, 0, 0, 0, 0, 0);
var graphicObj = AscFormat.DrawingObjectsController.prototype.createImage(imageUrl, 0, 0, p_width, p_height);
var tempParaRun = new ParaRun();
tempParaRun.Paragraph = null;
tempParaRun.Add_ToContent( 0, new ParaDrawing(), false );
tempParaRun.Content[0].Set_GraphicObject(graphicObj);
tempParaRun.Content[0].GraphicObj.setParent(tempParaRun.Content[0]);
tempParaRun.Content[0].CheckWH();
tempParagraph.Content.splice(tempParagraph.Content.length - 1, 0, tempParaRun);
aContent = [];
aContent.push(tempParagraph);
oThis.aContent = aContent;
oThis.api.pre_Paste(null, image_map, fPrepasteCallback);
});
if(bTurnOffTrackRevisions)
{
oThis.api.WordControl.m_oLogicDocument.TrackRevisions = true;
}
return; return;
} }
} }
...@@ -2718,6 +2789,7 @@ PasteProcessor.prototype = ...@@ -2718,6 +2789,7 @@ PasteProcessor.prototype =
loader.presentation = editor.WordControl.m_oLogicDocument; loader.presentation = editor.WordControl.m_oLogicDocument;
//read slides //read slides
var imageUrl = stream.GetString2();
var slide_count = stream.GetULong(); var slide_count = stream.GetULong();
var arr_arrTransforms = []; var arr_arrTransforms = [];
for(var i = 0; i < slide_count; ++i) for(var i = 0; i < slide_count; ++i)
......
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