Commit 5ce83bce authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

для Bug 20046 - При копировании картинки между вкладками не копируется url

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49918 954022d7-b5bf-4e40-9824-e11837661b57
parent 0f7f26a1
...@@ -170,8 +170,8 @@ var g_nodeAttributeEnd = 0xFB; ...@@ -170,8 +170,8 @@ var g_nodeAttributeEnd = 0xFB;
function CBuilderImages(blip_fill, full_url) function CBuilderImages(blip_fill, full_url)
{ {
this.Url = ""; this.Url = full_url;
this.BlipFill = null; this.BlipFill = blip_fill;
} }
CBuilderImages.prototype = CBuilderImages.prototype =
{ {
......
...@@ -2617,6 +2617,7 @@ PasteProcessor.prototype = ...@@ -2617,6 +2617,7 @@ PasteProcessor.prototype =
{ {
//надо сбросить то, что остался после открытия документа //надо сбросить то, что остался после открытия документа
window.global_pptx_content_loader.Clear(); window.global_pptx_content_loader.Clear();
window.global_pptx_content_loader.Start_UseFullUrl();
var openParams = {checkFileSize: false, charCount: 0, parCount: 0}; var openParams = {checkFileSize: false, charCount: 0, parCount: 0};
var oBinaryFileReader = new BinaryFileReader(this.oDocument, openParams); var oBinaryFileReader = new BinaryFileReader(this.oDocument, openParams);
...@@ -2730,10 +2731,17 @@ PasteProcessor.prototype = ...@@ -2730,10 +2731,17 @@ PasteProcessor.prototype =
for(var i in AllFonts) for(var i in AllFonts)
aPrepeareFonts.push(new CFont(i, 0, "", 0)); aPrepeareFonts.push(new CFont(i, 0, "", 0));
//создаем список используемых картинок //создаем список используемых картинок
var oPastedImagesUnique = {};
var aPastedImages = window.global_pptx_content_loader.End_UseFullUrl();
for(var i = 0, length = aPastedImages.length; i < length; ++i)
{
var elem = aPastedImages[i];
oPastedImagesUnique[elem.Url] = 1;
}
var aPrepeareImages = []; var aPrepeareImages = [];
for(var i in window.global_pptx_content_loader.ImageMapChecker) for(var i in oPastedImagesUnique)
aPrepeareImages.push(i); aPrepeareImages.push(i);
return {content: aContent, fonts: aPrepeareFonts, images: aPrepeareImages, bAddNewStyles: addNewStyles}; return {content: aContent, fonts: aPrepeareFonts, images: aPrepeareImages, bAddNewStyles: addNewStyles, aPastedImages: aPastedImages};
}, },
Start : function(node) Start : function(node)
{ {
...@@ -2773,9 +2781,7 @@ PasteProcessor.prototype = ...@@ -2773,9 +2781,7 @@ PasteProcessor.prototype =
aContent = this.ReadFromBinary(base64); aContent = this.ReadFromBinary(base64);
if(aContent) if(aContent)
{ {
this.aContent = aContent.content; var fPrepasteCallback = function(){
this.api.pre_Paste(aContent.fonts, aContent.images,
function() {
if(false == oThis.bNested) if(false == oThis.bNested)
{ {
editor.WordControl.m_oLogicDocument.DrawingObjects.calculateAfterOpen(); editor.WordControl.m_oLogicDocument.DrawingObjects.calculateAfterOpen();
...@@ -2785,7 +2791,41 @@ PasteProcessor.prototype = ...@@ -2785,7 +2791,41 @@ PasteProcessor.prototype =
if(aContent.bAddNewStyles) if(aContent.bAddNewStyles)
oThis.api.GenerateStyles(); oThis.api.GenerateStyles();
} }
}); }
this.aContent = aContent.content;
if(aContent.aPastedImages.length > 0)
{
var rData = {"id":documentId, "c":"imgurls", "data": JSON.stringify(aContent.images)};
sendCommand( this.api, function(incomeObject){
if(incomeObject && "imgurls" == incomeObject.type)
{
var aImages = JSON.parse(incomeObject.data);
var oFromTo = {};
for(var i = 0, length1 = aImages.length, length2 = aContent.images.length; i < length1 && i < length2; ++i)
{
var sFrom = aContent.images[i];
var sTo = aImages[i];
if(0 == sTo.indexOf(oThis.api.DocumentUrl + "media/"))
sTo = sTo.substring((oThis.api.DocumentUrl + "media/").length);
oFromTo[sFrom] = sTo;
aContent.images[i] = sTo;
}
for(var i = 0, length = aContent.aPastedImages.length; i < length; ++i)
{
var imageElem = aContent.aPastedImages[i];
if(null != imageElem)
{
var sNewSrc = oFromTo[imageElem.Url];
if(null != sNewSrc)
imageElem.SetUrl(sNewSrc);
}
}
}
oThis.api.pre_Paste(aContent.fonts, aContent.images, fPrepasteCallback);
}, JSON.stringify(rData) );
}
else
oThis.api.pre_Paste(aContent.fonts, aContent.images, fPrepasteCallback);
return; return;
} }
} }
...@@ -2853,7 +2893,7 @@ PasteProcessor.prototype = ...@@ -2853,7 +2893,7 @@ PasteProcessor.prototype =
for(var i = 0, length1 = aImages.length, length2 = aImagesToDownload.length; i < length1 && i < length2; ++i) for(var i = 0, length1 = aImages.length, length2 = aImagesToDownload.length; i < length1 && i < length2; ++i)
{ {
var sNewSrc = aImages[i]; var sNewSrc = aImages[i];
oThis.oImages[aImagesToDownload[i]] = sNewSrc oThis.oImages[aImagesToDownload[i]] = sNewSrc;
oPrepeareImages[i] = sNewSrc; oPrepeareImages[i] = sNewSrc;
} }
} }
......
...@@ -597,6 +597,8 @@ function BinaryFileWriter(doc) ...@@ -597,6 +597,8 @@ function BinaryFileWriter(doc)
} }
this.CopyStart = function() this.CopyStart = function()
{ {
var api = this.Document.DrawingDocument.m_oWordControl.m_oApi;
window.global_pptx_content_writer.Start_UseFullUrl(documentOrigin + api.DocumentUrl);
window.global_pptx_content_writer._Start(); window.global_pptx_content_writer._Start();
this.copyParams.bLockCopyElems = 0; this.copyParams.bLockCopyElems = 0;
this.copyParams.itemCount = 0; this.copyParams.itemCount = 0;
...@@ -669,6 +671,7 @@ function BinaryFileWriter(doc) ...@@ -669,6 +671,7 @@ function BinaryFileWriter(doc)
this.WriteMainTableEnd(); this.WriteMainTableEnd();
window.global_pptx_content_writer._End(); window.global_pptx_content_writer._End();
window.global_pptx_content_writer.End_UseFullUrl();
} }
this.WriteTable = function(type, oTableSer) this.WriteTable = function(type, oTableSer)
{ {
......
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