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

Поправлены баги с загрузкой картинок из свойств текста при вставке. Удален...

Поправлены баги с загрузкой картинок из свойств текста при вставке. Удален неиспользуемый метод getSrc у CopyProcessor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64812 954022d7-b5bf-4e40-9824-e11837661b57
parent 0c146744
......@@ -9,7 +9,7 @@ function CheckObjectLine(obj)
function CheckWordArtTextPr(oTextPr)
{
if(oTextPr.TextFill || oTextPr.TextOutline || (oTextPr.Unifill && oTextPr.Unifill.fill.type !== FILL_TYPE_SOLID))
if(oTextPr.TextFill || oTextPr.TextOutline || (oTextPr.Unifill && oTextPr.Unifill.fill && oTextPr.Unifill.fill.type !== FILL_TYPE_SOLID))
return true;
return false;
}
......@@ -4091,13 +4091,26 @@ CShape.prototype =
{
if(this.spPr && this.spPr.Fill && this.spPr.Fill.fill && typeof this.spPr.Fill.fill.RasterImageId === "string" && this.spPr.Fill.fill.RasterImageId.length > 0)
images.push(this.spPr.Fill.fill.RasterImageId);
if(this.textBoxContent)
var oContent = this.getDocContent();
if(oContent)
{
var drawings = this.textBoxContent.Get_AllDrawingObjects();
for(var i = 0; i < drawings.length; ++i)
if(this.bWordShape)
{
var drawings = oContent.Get_AllDrawingObjects();
for(var i = 0; i < drawings.length; ++i)
{
drawings[i].GraphicObj && drawings[i].GraphicObj.getAllRasterImages && drawings[i].GraphicObj.getAllRasterImages(images);
}
}
var fCallback = function(oTextPr)
{
drawings[i].GraphicObj && drawings[i].GraphicObj.getAllRasterImages && drawings[i].GraphicObj.getAllRasterImages(images);
if( (oTextPr.Unifill && oTextPr.Unifill.fill && oTextPr.Unifill.fill.type == FILL_TYPE_BLIP))
{
images.push(oTextPr.Unifill.fill.RasterImageId);
}
return false;
}
this.checkContentByCallback(oContent, fCallback);
}
},
......@@ -4991,20 +5004,20 @@ CShape.prototype =
this.bounds.h = this.bounds.b - this.bounds.t;
},
checkRunWordArtContent: function(aContent)
checkRunWordArtContent: function(aContent, fCallback)
{
for(var j = 0; j < aContent.length; ++j)
{
if(aContent[j].Type === para_Run)
{
if( CheckWordArtTextPr(aContent[j].Get_CompiledPr()))
if(fCallback(aContent[j].Get_CompiledPr()))
{
return true;
}
}
else if(aContent[j].Type === para_Hyperlink)
{
if(this.checkRunWordArtContent(aContent[j].Content))
if(this.checkRunWordArtContent(aContent[j].Content, fCallback))
{
return true;
}
......@@ -5013,8 +5026,7 @@ CShape.prototype =
return false;
},
checkContentWordArt: function(oContent)
checkContentByCallback: function(oContent, fCallback)
{
if(!oContent)
return false;
......@@ -5024,7 +5036,7 @@ CShape.prototype =
oElement = oContent.Content[i];
if(oElement.Get_Type() === type_Paragraph)
{
if(this.checkRunWordArtContent(oElement.Content))
if(this.checkRunWordArtContent(oElement.Content, fCallback))
{
return true;
}
......@@ -5037,7 +5049,7 @@ CShape.prototype =
oRow = aRows[j];
for(k = 0; k < oRow.Content.length; ++k)
{
if(this.checkContentWordArt(oRow.Content[k].Content))
if(this.checkContentByCallback(oRow.Content[k].Content, fCallback))
{
return true;
}
......@@ -5048,6 +5060,11 @@ CShape.prototype =
return false;
},
checkContentWordArt: function(oContent)
{
return this.checkContentByCallback(oContent, CheckWordArtTextPr);
},
checkNeedRecalcDocContentForTxWarp: function(oBodyPr)
{
return oBodyPr && oBodyPr.prstTxWarp && (oBodyPr.prstTxWarp.pathLst.length / 2 - ((oBodyPr.prstTxWarp.pathLst.length / 2) >> 0) > 0);
......
......@@ -3,7 +3,6 @@
function OverlayObject(geometry, extX, extY, brush, pen, transform )
//({check_bounds: function(){},brush: this.originalShape.brush, pen: this.originalShape.pen, ext:{cx:this.originalShape.absExtX, cy:this.originalShape.absExtY}, geometry: this.geometry, TransformMatrix: this.originalShape.transform})
{
this.geometry = geometry;
this.ext = {};
......
......@@ -188,13 +188,19 @@ function FileStream(data, size)
var g_nodeAttributeStart = 0xFA;
var g_nodeAttributeEnd = 0xFB;
function CBuilderImages(blip_fill, full_url, image_shape, sp_pr, ln)
function CBuilderImages(blip_fill, full_url, image_shape, sp_pr, ln, text_pr, para_text_pr, run, paragraph)
{
this.Url = full_url;
this.BlipFill = blip_fill;
this.ImageShape = image_shape;
this.SpPr = sp_pr;
this.Ln = ln;
this.TextPr = text_pr;
this.ParaTextPr = para_text_pr;
this.Run = run;
this.Paragraph = paragraph;
}
CBuilderImages.prototype =
{
......@@ -224,6 +230,34 @@ CBuilderImages.prototype =
oCopyBlipFill.setRasterImageId(url);
this.ImageShape.setBlipFill(oCopyBlipFill);
}
if(this.TextPr && !this.Ln)
{
if(this.Paragraph)
{
var oPr = this.Paragraph.Pr;
if(oPr.DefaultRunPr && oPr.DefaultRunPr.Unifill && oPr.DefaultRunPr.Unifill.fill && oPr.DefaultRunPr.Unifill.fill.type === FILL_TYPE_BLIP)
{
var Pr = this.Paragraph.Pr.Copy();
Pr.DefaultRunPr.Unifill.fill.setRasterImageId(url);
this.Paragraph.Set_Pr(Pr);
}
}
else if(this.ParaTextPr || this.Run)
{
if(this.ParaTextPr && this.ParaTextPr.Value && this.ParaTextPr.Value.Unifill && this.ParaTextPr.Value.Unifill.fill && this.ParaTextPr.Value.Unifill.fill.type === FILL_TYPE_BLIP)
{
oCopyFill = this.ParaTextPr.Value.Unifill.createDuplicate();
oCopyFill.fill.setRasterImageId(url);
this.ParaTextPr.Set_Unifill(oCopyFill);
}
if(this.Run && this.Run.Pr && this.Run.Pr.Unifill && this.Run.Pr.Unifill.fill && this.Run.Pr.Unifill.fill.type === FILL_TYPE_BLIP)
{
oCopyFill = this.Run.Pr.Unifill.createDuplicate();
oCopyFill.fill.setRasterImageId(url);
this.Run.Set_Unifill(oCopyFill);
}
}
}
this.BlipFill.RasterImageId = url;
}
}
......@@ -6450,7 +6484,7 @@ function BinaryPPTYLoader()
return bodyPr;
}
this.ReadTextParagraphPr = function()
this.ReadTextParagraphPr = function(par)
{
var para_pr = new CParaPr();
......@@ -6836,6 +6870,11 @@ function BinaryPPTYLoader()
}
case 8:
{
var OldBlipCount = 0;
if (this.IsUseFullUrl && par)
OldBlipCount = this.RebuildImages.length;
var r_pr = this.ReadRunProperties();
if(r_pr)
{
......@@ -6846,6 +6885,24 @@ function BinaryPPTYLoader()
r_pr.Unifill = undefined;
}
para_pr.DefaultRunPr.Set_FromObject(r_pr);
if (this.IsUseFullUrl && par)
{
if(this.RebuildImages.length > OldBlipCount)
{
for(var _t = OldBlipCount; _t < this.RebuildImages.length; ++_t)
{
var oTextPr = new CTextPr();
oTextPr.Set_FromObject(r_pr);
this.RebuildImages[_t].TextPr = oTextPr;
this.RebuildImages[_t].Paragraph = par;
}
}
}
}
break;
}
......@@ -7134,11 +7191,16 @@ function BinaryPPTYLoader()
{
case 0:
{
par.Set_Pr(this.ReadTextParagraphPr());
par.Set_Pr(this.ReadTextParagraphPr(par));
break;
}
case 1:
{
var OldImgCount = 0;
if(this.IsUseFullUrl)
{
OldImgCount = this.RebuildImages.length;
}
var endRunPr = this.ReadRunProperties();
var _value_text_pr = new CTextPr();
if(endRunPr.Unifill && !endRunPr.Unifill.fill)
......@@ -7148,8 +7210,23 @@ function BinaryPPTYLoader()
_value_text_pr.Set_FromObject(endRunPr);
par.TextPr.Apply_TextPr(_value_text_pr);//endRunProperties
var oTextPrEnd = new CTextPr();
oTextPrEnd.Set_FromObject(oTextPrEnd);
oTextPrEnd.Set_FromObject(endRunPr);
par.Content[0].Set_Pr(oTextPrEnd);
if(this.IsUseFullUrl)
{
if(this.RebuildImages.length > OldImgCount)
{
for(var _t = OldImgCount; _t < this.RebuildImages.length; ++_t)
{
var _text_pr = new CTextPr();
_text_pr.Set_FromObject(endRunPr);
this.RebuildImages[_t].TextPr = _text_pr;
this.RebuildImages[_t].ParaTextPr = par.TextPr;
this.RebuildImages[_t].Run = par.Content[0];
}
}
}
break;
}
case 2:
......@@ -7181,6 +7258,12 @@ function BinaryPPTYLoader()
_text = s.GetString2();
}
var OldImgCount = 0;
if(this.IsUseFullUrl)
{
OldImgCount = this.RebuildImages.length;
}
var _run = null;
while (s.cur < _end)
{
......@@ -7215,7 +7298,21 @@ function BinaryPPTYLoader()
_run.Underline = true;
}
text_pr.Set_FromObject(_run);
new_run.Set_Pr(text_pr)
new_run.Set_Pr(text_pr);
if(this.IsUseFullUrl)
{
if(this.RebuildImages.length > OldImgCount)
{
for(var _t = OldImgCount; _t < this.RebuildImages.length; ++_t)
{
var _text_pr = new CTextPr();
_text_pr.Set_FromObject(text_pr);
this.RebuildImages[_t].TextPr = _text_pr;
this.RebuildImages[_t].Run = new_run;
}
}
}
}
var pos = 0;
......
......@@ -518,16 +518,6 @@ CopyProcessor.prototype =
{
return this.oRoot.getInnerText();
},
getSrc : function(src)
{
//������� ����������� �� �� ��� editor.DocumentUrl ������������� ����.
//���������� ����� ����� ��� ����������� � word � docs.google
var start = src.substring(0, 6);
if(0 != src.indexOf("http:") && 0 != src.indexOf("data:") && 0 != src.indexOf("https:") && 0 != src.indexOf("ftp:") && 0 != src.indexOf("file:"))
return documentOrigin + src;
else
return src;
},
RGBToCSS : function(rgb, unifill)
{
if (null == rgb && null != unifill) {
......@@ -741,7 +731,6 @@ CopyProcessor.prototype =
var sSrc = oGraphicObj.getBase64Img();
if(sSrc.length > 0)
{
//sSrc = this.getSrc(sSrc);
var _w = ParaItem.Extent.W;
var _h = ParaItem.Extent.H;
......@@ -1648,7 +1637,6 @@ CopyProcessor.prototype =
var sSrc = slide.getBase64Img();
//if(sSrc.length > 0)
{
// sSrc = this.getSrc(sSrc);
var _bounds_cheker = new CSlideBoundsChecker();
slide.draw(_bounds_cheker, 0);
var oImg = new CopyElement("img");
......@@ -1892,7 +1880,6 @@ CopyProcessor.prototype =
var sSrc = oGraphicObj.getBase64Img();
if(sSrc.length > 0)
{
//sSrc = this.getSrc(sSrc);
var _bounds_cheker = new CSlideBoundsChecker();
oGraphicObj.draw(_bounds_cheker, 0);
......
......@@ -1880,7 +1880,7 @@
{
var src = aPastedImages[k].Url;
if(false == (/*0 == src.indexOf("data:") ||*/ 0 == src.indexOf(api.documentUrl) || 0 == src.indexOf(api.documentUrl)))
if(!g_oDocumentUrls.getImageLocal(src))
aImagesToDownload.push(src);
}
......@@ -2173,7 +2173,7 @@
this.oImages[image] = "local";
else*/
//TODO не вставляется картинка из EXCEL - стоит base64 грузить на сервер bug 22957
if(false == (/*0 == src.indexOf("data:") ||*/ 0 == src.indexOf(api.documentUrl) || 0 == src.indexOf(api.documentUrl)))
if(!g_oDocumentUrls.getImageLocal(src))
aImagesToDownload.push(src);
}
......@@ -4698,16 +4698,6 @@
}
CopyProcessor.prototype =
{
getSrc : function(src)
{
//������� ����������� �� �� ��� editor.DocumentUrl ������������� ����.
//���������� ����� ����� ��� ����������� � word � docs.google
var start = src.substring(0, 6);
if(0 != src.indexOf("http:") && 0 != src.indexOf("data:") && 0 != src.indexOf("https:") && 0 != src.indexOf("ftp:") && 0 != src.indexOf("file:"))
return documentOrigin + src;
else
return src;
},
RGBToCSS : function(rgb)
{
var sResult = "#";
......@@ -4933,7 +4923,6 @@
var sSrc = oGraphicObj.getBase64Img();
if(sSrc.length > 0)
{
sSrc = this.getSrc(sSrc);
sRes += "<img style=\"max-width:100%;\" width=\""+Math.round(ParaItem.Extent.W * g_dKoef_mm_to_pix)+"\" height=\""+Math.round(ParaItem.Extent.H * g_dKoef_mm_to_pix)+"\" src=\""+sSrc+"\" />";
break;
}
......@@ -5336,8 +5325,8 @@
this.oBinaryFileWriter.CopyParagraph(tempParagraph);
};
var src = this.getSrc(base64_img);
this.Para.innerHTML += "<img style=\"max-width:100%;\" width=\""+Math.round(paraDrawing.absExtX * g_dKoef_mm_to_pix)+"\" height=\""+Math.round(paraDrawing.absExtY * g_dKoef_mm_to_pix)+"\" src=\""+src+"\" />";
var src = base64_img;
this.Para.innerHTML += "<img style=\"max-width:100%;\" width=\""+Math.round(paraDrawing.Extent.W * g_dKoef_mm_to_pix)+"\" height=\""+Math.round(paraDrawing.Extent.H * g_dKoef_mm_to_pix)+"\" src=\""+src+"\" />";
this.ElemToSelect.appendChild( this.Para );
}
......@@ -5369,7 +5358,7 @@
{
var cur_element = selection_array[i].parent;
var base64_img = cur_element.getBase64Img();
var src = this.getSrc(base64_img);
var src = base64_img;
this.Para.innerHTML = "<img style=\"max-width:100%;\" width=\""+Math.round(cur_element.Extent.W * g_dKoef_mm_to_pix)+"\" height=\""+Math.round(cur_element.Extent.H * g_dKoef_mm_to_pix)+"\" src=\""+src+"\" />";
......
......@@ -8259,6 +8259,15 @@ ParaRun.prototype.Load_Changes = function(Reader, Reader2, Color)
this.Pr = new CTextPr();
this.Pr.Read_FromBinary( Reader );
var unifill = this.Pr.Unifill;
if(typeof CollaborativeEditing !== "undefined")
{
if(unifill && unifill.fill && unifill.fill.type === FILL_TYPE_BLIP && typeof unifill.fill.RasterImageId === "string" && unifill.fill.RasterImageId.length > 0)
{
CollaborativeEditing.Add_NewImage(getFullImageSrc2(unifill.fill.RasterImageId));
}
}
this.Recalc_CompiledPr(true);
this.private_UpdateTrackRevisionOnChangeTextPr(false);
break;
......
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