Commit 3f139e2e authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

Исправлен баг с copy/paste нескольких картинок

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49471 954022d7-b5bf-4e40-9824-e11837661b57
parent 92ed73d6
......@@ -529,29 +529,14 @@ asc_CChart.prototype = {
var baseColors = api.chartStyleManager.getBaseColors( parseInt(this.styleId) );
var colors = generateColors(count, baseColors, true);
}
for ( var i = 0; i < colors.length; i++ ) {
var rgbColor = new RGBColor(colors[i]);
var uniColor = CreateUniColorRGB(rgbColor.r, rgbColor.g, rgbColor.b);
/*var theme, colorMap;
RGBA = {R: 0, G: 0, B: 0, A: 255};
if ( api_sheet ) {
theme = api_sheet.wbModel.theme;
colorMap = GenerateDefaultColorMap().color_map;
for ( var i = 0; i < colors.length; i++ ) {
var rgbColor = new RGBColor(colors[i]);
var uniColor = CreateUniColorRGB(rgbColor.r, rgbColor.g, rgbColor.b);
uniColors.push(uniColor);
}
else {
theme = api_doc.WordControl.m_oLogicDocument.theme;
colorMap = api_doc.WordControl.m_oLogicDocument.clrSchemeMap.color_map;
if ( colorMap == null )
colorMap = GenerateDefaultColorMap().color_map;
}
uniColor.Calculate(theme, colorMap, RGBA);*/
uniColors.push(uniColor);
}
return uniColors;
},
......
......@@ -1816,7 +1816,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart) {
}
function arrReverse(arr) {
if(!arr)
if(!arr || !arr.length)
return;
var newarr = [];
for (i = 0; i < arr[0].length; ++i) {
......
......@@ -7153,70 +7153,80 @@
pasteExec();
if(val.addImages && val.addImages.length != 0)
{
for(var im = 0; im < val.addImages.length; im++)//вставляем изображения
var api = asc["editor"];
var aImagesSync = [];
for(var im = 0; im < val.addImages.length; im++)
{
var src = val.addImages[im].tag.src;
if(src)
aImagesSync.push(val.addImages[im].tag.src);
}
api.ImageLoader.LoadDocumentImages(aImagesSync);
t.objectRender.asyncImagesDocumentEndLoaded = function() {
for(var im = 0; im < val.addImages.length; im++)//вставляем изображения
{
var binary_shape = val.addImages[im].tag.getAttribute("alt");
var sub;
if(typeof binary_shape === "string")
sub = binary_shape.substr(0, 12);
if(typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" /*|| sub === "TeamLabChart" */|| sub === "TeamLabGroup"))
var src = val.addImages[im].tag.src;
if(src)
{
var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length);
reader.GetLong();
if(isRealObject(reader))
reader.oImages = this.oImages;
var first_string = null;
if(reader !== null && typeof reader === "object")
{
first_string = sub;
}
var positionX = null
var positionY = null;
if(t.cols && val.addImages[im].curCell && val.addImages[im].curCell.col != undefined && t.cols[val.addImages[im].curCell.col].left != undefined)
positionX = t.cols[val.addImages[im].curCell.col].left;
if(t.rows && val.addImages[im].curCell && val.addImages[im].curCell.row != undefined && t.rows[val.addImages[im].curCell.row].top != undefined)
positionY = t.rows[val.addImages[im].curCell.row].top
var Drawing;
switch(first_string)
var binary_shape = val.addImages[im].tag.getAttribute("alt");
var sub;
if(typeof binary_shape === "string")
sub = binary_shape.substr(0, 12);
if(typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" /*|| sub === "TeamLabChart" */|| sub === "TeamLabGroup"))
{
case "TeamLabImage":
{
Drawing = new CImageShape();
break;
}
case "TeamLabShape":
var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length);
reader.GetLong();
if(isRealObject(reader))
reader.oImages = this.oImages;
var first_string = null;
if(reader !== null && typeof reader === "object")
{
Drawing = new CShape();
break;
first_string = sub;
}
case "TeamLabGroup":
var positionX = null
var positionY = null;
if(t.cols && val.addImages[im].curCell && val.addImages[im].curCell.col != undefined && t.cols[val.addImages[im].curCell.col].left != undefined)
positionX = t.cols[val.addImages[im].curCell.col].left;
if(t.rows && val.addImages[im].curCell && val.addImages[im].curCell.row != undefined && t.rows[val.addImages[im].curCell.row].top != undefined)
positionY = t.rows[val.addImages[im].curCell.row].top
var Drawing;
switch(first_string)
{
Drawing = new CGroupShape();
break;
}
default :
{
Drawing = CreateImageFromBinary(src);
break;
case "TeamLabImage":
{
Drawing = new CImageShape();
break;
}
case "TeamLabShape":
{
Drawing = new CShape();
break;
}
case "TeamLabGroup":
{
Drawing = new CGroupShape();
break;
}
default :
{
Drawing = CreateImageFromBinary(src);
break;
}
}
if(positionX && positionY && t.objectRender)
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3));
else
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender);
Drawing.drawingObjects = t.objectRender;
Drawing.addToDrawingObjects();
}
if(positionX && positionY && t.objectRender)
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3));
else
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender);
Drawing.drawingObjects = t.objectRender;
Drawing.addToDrawingObjects();
}
else if(0 != src.indexOf("file://"))
{
t.objectRender.addImageDrawingObject(src, { cell: val.addImages[im].curCell, width: val.addImages[im].tag.width, height: val.addImages[im].tag.height });
}
}
else if(0 != src.indexOf("file://"))
{
t.objectRender.addImageDrawingObject(src, { cell: val.addImages[im].curCell, width: val.addImages[im].tag.width, height: val.addImages[im].tag.height });
}
}
}
}
}
});
......
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