Commit 00150e75 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug 27353 - [Copy&Paste] Некорректная отрисовка автофигуры "textbox" после её...

Bug 27353 - [Copy&Paste] Некорректная отрисовка автофигуры "textbox" после её копирования на другой лист книги ;

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59417 954022d7-b5bf-4e40-9824-e11837661b57
parent 36749c94
This diff is collapsed.
"use strict";
function CGroupShape(parent)
function CGroupShape()
{
this.nvGrpSpPr = null;
......@@ -297,21 +297,25 @@ CGroupShape.prototype =
convertToPPTX: function(drawingDocument, worksheet)
{
var sp_tree_copy = [].concat(this.spTree), i;
for(i = this.spTree.length-1; i > -1; --i)
var c = new CGroupShape();
c.setBDeleted(false);
c.setWorksheet(worksheet);
if(this.nvGrpSpPr)
{
this.removeFromSpTreeByPos(i);
c.setNvSpPr(this.nvGrpSpPr.createDuplicate());
}
if(this.spPr)
{
c.setSpPr(this.spPr.createDuplicate());
c.spPr.setParent(c);
}
this.setWorksheet(worksheet);
this.setParent(null);
this.setBDeleted(false);
for(i = 0; i < sp_tree_copy.length; ++i)
for(var i = 0; i < this.spTree.length; ++i)
{
this.addToSpTree(this.spTree.length, sp_tree_copy[i].convertToPPTX(drawingDocument, worksheet));
this.spTree[this.spTree.length - 1].setGroup(this);
c.addToSpTree(c.spTree.length, this.spTree[i].convertToPPTX(drawingDocument, worksheet));
c.spTree[c.spTree.length - 1].setGroup(c);
}
return this;
return c;
},
isSimpleObject: function()
......
......@@ -61,6 +61,7 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor)
{
drawingObjects = new DrawingObjects();
}
var oldDrawingBase = graphic.drawingBase;
var drawingObject = drawingObjects.createDrawingObject(anchor);
drawingObject.graphicObject = graphic;
......@@ -83,11 +84,28 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor)
_this.objectLocker.checkObjects( function(result) {} );
}
worksheet.setSelectionShape(true); */
if(oldDrawingBase)
{
drawingObject.from.col = oldDrawingBase.from.col;
drawingObject.from.colOff = oldDrawingBase.from.colOff;
drawingObject.from.row = oldDrawingBase.from.row;
drawingObject.from.rowOff = oldDrawingBase.from.rowOff;
drawingObject.to.col = oldDrawingBase.to.col;
drawingObject.to.colOff = oldDrawingBase.to.colOff;
drawingObject.to.row = oldDrawingBase.to.row;
drawingObject.to.rowOff = oldDrawingBase.to.rowOff;
}
if(graphic.recalcTransform)
{
graphic.recalcTransform();
if(graphic.recalcBounds)
{
graphic.recalcBounds();
}
graphic.addToRecalculate();
}
return ret;
}
......
......@@ -3023,7 +3023,7 @@
_insertImagesFromBinary: function(ws, data, isIntoShape)
{
var activeRange = ws.activeRange;
var curCol, drawingObject, curRow, startCol, startRow, xfrm, aImagesSync = [], activeRow, activeCol, tempArr;
var curCol, drawingObject, curRow, startCol, startRow, xfrm, aImagesSync = [], activeRow, activeCol, tempArr, offX, offY, rot;
History.Create_NewPoint();
History.StartTransaction();
......@@ -3035,20 +3035,44 @@
xfrm = drawingObject.graphicObject.spPr.xfrm;
if(xfrm)
{
offX = 0;
offY = 0;
rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
rot = normalizeRotate(rot);
if ((rot >= 0 && rot < Math.PI * 0.25)
|| (rot > 3 * Math.PI * 0.25 && rot < 5 * Math.PI * 0.25)
|| (rot > 7 * Math.PI * 0.25 && rot < 2 * Math.PI))
{
if(isRealNumber(xfrm.offX) && isRealNumber(xfrm.offY))
{
offX = xfrm.offX;
offY = xfrm.offY;
}
}
else
{
if(isRealNumber(xfrm.offX) && isRealNumber(xfrm.offY)
&& isRealNumber(xfrm.extX) && isRealNumber(xfrm.extY))
{
offX = xfrm.offX + xfrm.extX/2 - xfrm.extY/2;
offY = xfrm.offY + xfrm.extY/2 - xfrm.extX/2;
}
}
if(i == 0)
{
startCol = xfrm.offX;
startRow = xfrm.offY;
startCol = offX;
startRow = offY;
}
else
{
if(startCol > xfrm.offX)
if(startCol > offX)
{
startCol = xfrm.offX;
startCol = offX;
}
if(startRow > xfrm.offY)
if(startRow > offY)
{
startRow = xfrm.offY;
startRow = offY;
}
}
}
......@@ -3072,7 +3096,16 @@
}
}
};
if(startRow < 0)
{
startRow = 0;
}
if(startCol < 0)
{
startCol = 0;
}
for(var i = 0; i < data.Drawings.length; i++)
{
data.Drawings[i].graphicObject = data.Drawings[i].graphicObject.copy();
......@@ -3105,6 +3138,10 @@
//drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
drawingObject.graphicObject.addToDrawingObjects();
if(drawingObject.graphicObject.checkDrawingBaseCoords)
{
drawingObject.graphicObject.checkDrawingBaseCoords();
}
drawingObject.graphicObject.recalculate();
drawingObject.graphicObject.select(ws.objectRender.controller, 0);
......@@ -3138,7 +3175,7 @@
_insertImagesFromBinaryWord: function(ws, data)
{
var activeRange = ws.activeRange;
var curCol, drawingObject, curRow, startCol, startRow, xfrm, drawingBase, graphicObject, aImagesSync = [];
var curCol, drawingObject, curRow, startCol = 0, startRow = 0, xfrm, drawingBase, graphicObject, aImagesSync = [], offX, offY, rot;
History.Create_NewPoint();
History.StartTransaction();
......@@ -3162,24 +3199,48 @@
//create new drawingBase
drawingObject = ws.objectRender.createDrawingObject();
drawingObject.graphicObject = graphicObject;
xfrm = drawingObject.graphicObject.spPr.xfrm;
if(xfrm)
if(drawingObject.graphicObject.spPr && drawingObject.graphicObject.spPr.xfrm)
{
xfrm = drawingObject.graphicObject.spPr.xfrm;
offX = 0;
offY = 0;
rot = isRealNumber(xfrm.rot) ? xfrm.rot : 0;
rot = normalizeRotate(rot);
if ((rot >= 0 && rot < Math.PI * 0.25)
|| (rot > 3 * Math.PI * 0.25 && rot < 5 * Math.PI * 0.25)
|| (rot > 7 * Math.PI * 0.25 && rot < 2 * Math.PI))
{
if(isRealNumber(xfrm.offX) && isRealNumber(xfrm.offY))
{
offX = xfrm.offX;
offY = xfrm.offY;
}
}
else
{
if(isRealNumber(xfrm.offX) && isRealNumber(xfrm.offY)
&& isRealNumber(xfrm.extX) && isRealNumber(xfrm.extY))
{
offX = xfrm.offX + xfrm.extX/2 - xfrm.extY/2;
offY = xfrm.offY + xfrm.extY/2 - xfrm.extX/2;
}
}
if(i == 0)
{
startCol = xfrm.offX;
startRow = xfrm.offY;
startCol = offX;
startRow = offY;
}
else
{
if(startCol > xfrm.offX)
if(startCol > offX)
{
startCol = xfrm.offX;
startCol = offX;
}
if(startRow > xfrm.offY)
if(startRow > offY)
{
startRow = xfrm.offY;
startRow = offY;
}
}
}
......@@ -3221,6 +3282,10 @@
drawingObject.graphicObject.checkRemoveCache && drawingObject.graphicObject.checkRemoveCache();
//drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
drawingObject.graphicObject.addToDrawingObjects();
if(drawingObject.graphicObject.checkDrawingBaseCoords)
{
drawingObject.graphicObject.checkDrawingBaseCoords();
}
drawingObject.graphicObject.recalculate();
drawingObject.graphicObject.select(ws.objectRender.controller, 0);
......
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