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 = { ...@@ -529,29 +529,14 @@ asc_CChart.prototype = {
var baseColors = api.chartStyleManager.getBaseColors( parseInt(this.styleId) ); var baseColors = api.chartStyleManager.getBaseColors( parseInt(this.styleId) );
var colors = generateColors(count, baseColors, true); 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; for ( var i = 0; i < colors.length; i++ ) {
RGBA = {R: 0, G: 0, B: 0, A: 255}; var rgbColor = new RGBColor(colors[i]);
var uniColor = CreateUniColorRGB(rgbColor.r, rgbColor.g, rgbColor.b);
if ( api_sheet ) { uniColors.push(uniColor);
theme = api_sheet.wbModel.theme;
colorMap = GenerateDefaultColorMap().color_map;
} }
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; return uniColors;
}, },
......
...@@ -1816,7 +1816,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart) { ...@@ -1816,7 +1816,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart) {
} }
function arrReverse(arr) { function arrReverse(arr) {
if(!arr) if(!arr || !arr.length)
return; return;
var newarr = []; var newarr = [];
for (i = 0; i < arr[0].length; ++i) { for (i = 0; i < arr[0].length; ++i) {
......
...@@ -7153,70 +7153,80 @@ ...@@ -7153,70 +7153,80 @@
pasteExec(); pasteExec();
if(val.addImages && val.addImages.length != 0) 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; aImagesSync.push(val.addImages[im].tag.src);
if(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 src = val.addImages[im].tag.src;
var sub; if(src)
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 reader = CreateBinaryReader(binary_shape, 12, binary_shape.length); var binary_shape = val.addImages[im].tag.getAttribute("alt");
reader.GetLong(); var sub;
if(isRealObject(reader)) if(typeof binary_shape === "string")
reader.oImages = this.oImages; sub = binary_shape.substr(0, 12);
var first_string = null; if(typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" /*|| sub === "TeamLabChart" */|| sub === "TeamLabGroup"))
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)
{ {
case "TeamLabImage": var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length);
{ reader.GetLong();
Drawing = new CImageShape(); if(isRealObject(reader))
break; reader.oImages = this.oImages;
} var first_string = null;
case "TeamLabShape": if(reader !== null && typeof reader === "object")
{ {
Drawing = new CShape(); first_string = sub;
break;
} }
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(); case "TeamLabImage":
break; {
} Drawing = new CImageShape();
default : break;
{ }
Drawing = CreateImageFromBinary(src); case "TeamLabShape":
break; {
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) else if(0 != src.indexOf("file://"))
Drawing.readFromBinaryForCopyPaste(reader,null, t.objectRender,t.objectRender.convertMetric(positionX,1,3),t.objectRender.convertMetric(positionY,1,3)); {
else t.objectRender.addImageDrawingObject(src, { cell: val.addImages[im].curCell, width: val.addImages[im].tag.width, height: val.addImages[im].tag.height });
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 });
}
}
} }
} }
}); });
......
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