Commit b6dc82c7 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

copy/paste изображение, автофигур, групп автофигур(с помощью нажатия клавиш на тулбаре)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49004 954022d7-b5bf-4e40-9824-e11837661b57
parent f8bb7a3f
......@@ -1445,7 +1445,7 @@
{
if(t.copyText && t.copyText.isImage)
{
if(t._insertImages(worksheet,t.lStorage))
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
return;
}
else
......@@ -1462,7 +1462,7 @@
{
if(t.copyText.isImage)
{
if(t._insertImages(worksheet,t.lStorage))
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
return;
}
else
......@@ -2092,7 +2092,7 @@
isChart.height = curImage.height;
isChart.width = curImage.width;
}
/*else
else
{
t.lStorage[nLoc] = {};
t.lStorage[nLoc].image = curImage;
......@@ -2100,11 +2100,9 @@
t.lStorage[nLoc].fromRow = cloneImg.from.row;
nLoc++;
isImage = true;
}*/
}
if(image.graphicObject.isChart())
t._addLocalStorage(isImage,isChart,range.worksheet.getCell( new CellAddress(row, col, 0) ),bbox.r1,bbox.c1, image.from.row, image.from.col);
t._addLocalStorage(isImage,isChart,range.worksheet.getCell( new CellAddress(row, col, 0) ),bbox.r1,bbox.c1, image.from.row, image.from.col);
}
}
......@@ -2521,9 +2519,9 @@
return arrImages;
},
_insertImages: function (ws, array) {
_insertImages: function (ws, array, onlyFromLocalStorage) {
//object{images:,fromCol,fromRow}
if(!array || array && array.length == 0)
if(!array || array && array.length == 0 || !onlyFromLocalStorage)
return false;
var firstRange = ws.activeRange.clone(true);
......@@ -2545,11 +2543,60 @@
}
else
{
var curCell = {
col: firstRange.c1 + (array[i].fromCol - array[0].fromCol),
row: firstRange.r1 + (array[i].fromRow - array[0].fromRow)
var binary_shape = array[i].image.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 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(ws.cols && firstRange && firstRange.c1 != undefined && ws.cols[firstRange.c1].left != undefined)
positionX = ws.cols[firstRange.c1].left;
if(ws.rows && firstRange && firstRange.r1 != undefined && ws.rows[firstRange.r1].top != undefined)
positionY = ws.rows[firstRange.r1].top
var Drawing;
switch(first_string)
{
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 && ws.objectRender)
Drawing.readFromBinaryForCopyPaste(reader,null, ws.objectRender,ws.objectRender.convertMetric(positionX,1,3),ws.objectRender.convertMetric(positionY,1,3));
else
Drawing.readFromBinaryForCopyPaste(reader,null, ws.objectRender);
Drawing.drawingObjects = ws.objectRender;
Drawing.addToDrawingObjects();
}
ws.objectRender.addImageDrawingObject(array[i].image.src, { cell: curCell, width: array[i].image.width, height: array[i].image.height });
}
}
return true;
......
......@@ -7134,6 +7134,7 @@
if(typeof binary_shape === "string" &&( sub === "TeamLabShape" || sub === "TeamLabImage" /*|| sub === "TeamLabChart" */|| sub === "TeamLabGroup"))
{
var reader = CreateBinaryReader(binary_shape, 12, binary_shape.length);
reader.GetLong();
if(isRealObject(reader))
reader.oImages = this.oImages;
var first_string = null;
......@@ -7144,9 +7145,9 @@
var positionX = null
var positionY = null;
if(t.cols && val.addImages[im].curCell && val.addImages[im].curCell.col && t.cols[val.addImages[im].curCell.col].left)
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 && t.rows[val.addImages[im].curCell.row].top)
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;
......
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