Commit 941187f5 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@52294 954022d7-b5bf-4e40-9824-e11837661b57
parent 4423617a
......@@ -2610,7 +2610,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
for(var i in oHyperlinks)
{
var elem = oHyperlinks[i];
//write only active hyperlink, else copy/paste
//write only active hyperlink, if copy/paste
if(!this.isCopyPaste || (this.isCopyPaste && elem && elem.bbox && this.isCopyPaste.r1 <= elem.bbox.r1 && this.isCopyPaste.r2 >= elem.bbox.r2 && this.isCopyPaste.c1 <= elem.bbox.c1 && this.isCopyPaste.c2 >= elem.bbox.c2))
this.bs.WriteItem(c_oSerWorksheetsTypes.Hyperlink, function(){oThis.WriteHyperlink(elem.data);});
}
......@@ -2643,7 +2643,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var bbox = elem.bbox;
if(bbox.r1 != bbox.r2 || bbox.c1 != bbox.c2)
{
//write only active merge, else copy/paste
//write only active merge, if copy/paste
if(!this.isCopyPaste || (this.isCopyPaste && this.isCopyPaste.r1 <= bbox.r1 && this.isCopyPaste.r2 >= bbox.r2 && this.isCopyPaste.c1 <= bbox.c1 && this.isCopyPaste.c2 >= bbox.c2))
{
var oFirst = new CellAddress(bbox.r1, bbox.c1, 0);
......@@ -2659,15 +2659,28 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var oThis = this;
for(var i = 0, length = aDrawings.length; i < length; ++i)
{
//write only active drawing, else copy/paste
//write only active drawing, if copy/paste
var oDrawing = aDrawings[i];
if(!this.isCopyPaste)
this.bs.WriteItem(c_oSerWorksheetsTypes.Drawing, function(){oThis.WriteDrawing(oDrawing);});
else if(this.isCopyPaste && oDrawing.graphicObject.selected)//for copy/paste
{
if(oDrawing.isGroup() && oDrawing.graphicObject.selectedObjects && oDrawing.graphicObject.selectedObjects.length)
{
var oDrawingSelected = oDrawing.graphicObject.selectedObjects;
var curDrawing;
for(var selDr = 0; selDr < oDrawingSelected.length; selDr++)
{
curDrawing = oDrawingSelected[selDr];
this.bs.WriteItem(c_oSerWorksheetsTypes.Drawing, function(){oThis.WriteDrawing(oDrawing, curDrawing);});
}
}
else
this.bs.WriteItem(c_oSerWorksheetsTypes.Drawing, function(){oThis.WriteDrawing(oDrawing);});
}
}
};
this.WriteDrawing = function(oDrawing)
this.WriteDrawing = function(oDrawing, curDrawing)
{
var oThis = this;
if(null != oDrawing.Type)
......@@ -2683,6 +2696,8 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var oBinaryChartWriter = new BinaryChartWriter(this.memory);
this.bs.WriteItem(c_oSer_DrawingType.GraphicFrame, function(){oBinaryChartWriter.Write(oDrawing.graphicObject);});
}
else if(curDrawing)
this.bs.WriteItem(c_oSer_DrawingType.pptxDrawing, function(){window.global_pptx_content_writer.WriteDrawing(oThis.memory, curDrawing, null, null, null);});
else
this.bs.WriteItem(c_oSer_DrawingType.pptxDrawing, function(){window.global_pptx_content_writer.WriteDrawing(oThis.memory, oDrawing.graphicObject, null, null, null);});
};
......@@ -2733,7 +2748,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var oThis = this;
//сортируем Row по индексам
var aIndexes = new Array();
//write only active cells, else copy/paste
//write only active cells, if copy/paste
if(oThis.isCopyPaste)
{
for(var i = oThis.isCopyPaste.r1; i <= oThis.isCopyPaste.r2; i++)
......@@ -3132,7 +3147,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
var oNewComments = new Object();
for(var i = 0, length = aComments.length; i < length; ++i)
{
//write only active comments, else copy/paste
//write only active comments, if copy/paste
if(this.isCopyPaste && !(aComments[i].nRow >= this.isCopyPaste.r1 && aComments[i].nRow <= this.isCopyPaste.r2 && aComments[i].nCol >= this.isCopyPaste.c1 && aComments[i].nCol <= this.isCopyPaste.c2))
continue;
var elem = aComments[i];
......@@ -3158,7 +3173,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, aDxfs, aXfs, aF
}
for(var i = 0, length = aCommentsCoords.length; i < length; ++i)
{
//write only active comments, else copy/paste
//write only active comments, if copy/paste
if(this.isCopyPaste && !(aCommentsCoords[i].nRow >= this.isCopyPaste.r1 && aCommentsCoords[i].nRow <= this.isCopyPaste.r2 && aCommentsCoords[i].nCol >= this.isCopyPaste.c1 && aCommentsCoords[i].nCol <= this.isCopyPaste.c2))
continue;
var elem = aCommentsCoords[i];
......
......@@ -2795,10 +2795,35 @@
var curRow;
var startCol;
var startRow;
var xfrm;
History.Create_NewPoint();
History.StartTransaction();
//определяем стартовую позицию, если изображений несколько вставляется
for(var i = 0; i < data.Drawings.length; i++)
{
drawingObject = data.Drawings[i];
xfrm = drawingObject.graphicObject.spPr.xfrm;
if(xfrm)
{
if(i == 0)
{
startCol = xfrm.offX;
startRow = xfrm.offY;
}
else
{
if(startCol > xfrm.offX)
{
startCol = xfrm.offX;
}
if(startRow > xfrm.offY)
{
startRow = xfrm.offY;
}
}
}
else
{
if(i == 0)
{
startCol = drawingObject.from.col;
......@@ -2815,6 +2840,7 @@
startRow = drawingObject.from.row;
}
}
}
};
for(var i = 0; i < data.Drawings.length; i++)
{
......@@ -2843,9 +2869,19 @@
}
else if (drawingObject.graphicObject instanceof CShape || drawingObject.graphicObject instanceof CImageShape || drawingObject.graphicObject instanceof CGroupShape) {
xfrm = drawingObject.graphicObject.spPr.xfrm;
if(xfrm)
{
curCol = xfrm.offX - startCol + ws.objectRender.convertMetric(ws.cols[activeRange.c1].left - ws.getCellLeft(0, 1), 1, 3);
curRow = xfrm.offY - startRow + ws.objectRender.convertMetric(ws.rows[activeRange.r1].top - ws.getCellTop(0, 1), 1, 3);
drawingObject.graphicObject.setPosition(curCol, curRow);
}
else
{
curCol = drawingObject.from.col - startCol + activeRange.c1;
curRow = drawingObject.from.row - startRow + activeRange.r1;
drawingObject.graphicObject.setPosition(ws.objectRender.convertMetric(ws.cols[curCol].left, 1, 3), ws.objectRender.convertMetric(ws.rows[curRow].top, 1, 3));
}
drawingObject.graphicObject.setDrawingObjects(ws.objectRender);
drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
......@@ -2854,6 +2890,7 @@
drawingObject.graphicObject.addToDrawingObjects();
}
};
History.EndTransaction();
}
};
......
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