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"; "use strict";
function CGroupShape(parent) function CGroupShape()
{ {
this.nvGrpSpPr = null; this.nvGrpSpPr = null;
...@@ -297,21 +297,25 @@ CGroupShape.prototype = ...@@ -297,21 +297,25 @@ CGroupShape.prototype =
convertToPPTX: function(drawingDocument, worksheet) convertToPPTX: function(drawingDocument, worksheet)
{ {
var sp_tree_copy = [].concat(this.spTree), i; var c = new CGroupShape();
for(i = this.spTree.length-1; i > -1; --i) 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); for(var i = 0; i < this.spTree.length; ++i)
this.setParent(null);
this.setBDeleted(false);
for(i = 0; i < sp_tree_copy.length; ++i)
{ {
this.addToSpTree(this.spTree.length, sp_tree_copy[i].convertToPPTX(drawingDocument, worksheet)); c.addToSpTree(c.spTree.length, this.spTree[i].convertToPPTX(drawingDocument, worksheet));
this.spTree[this.spTree.length - 1].setGroup(this); c.spTree[c.spTree.length - 1].setGroup(c);
} }
return this; return c;
}, },
isSimpleObject: function() isSimpleObject: function()
......
...@@ -61,6 +61,7 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor) ...@@ -61,6 +61,7 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor)
{ {
drawingObjects = new DrawingObjects(); drawingObjects = new DrawingObjects();
} }
var oldDrawingBase = graphic.drawingBase;
var drawingObject = drawingObjects.createDrawingObject(anchor); var drawingObject = drawingObjects.createDrawingObject(anchor);
drawingObject.graphicObject = graphic; drawingObject.graphicObject = graphic;
...@@ -83,11 +84,28 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor) ...@@ -83,11 +84,28 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor)
_this.objectLocker.checkObjects( function(result) {} ); _this.objectLocker.checkObjects( function(result) {} );
} }
worksheet.setSelectionShape(true); */ 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) if(graphic.recalcTransform)
{ {
graphic.recalcTransform(); graphic.recalcTransform();
if(graphic.recalcBounds)
{
graphic.recalcBounds();
}
graphic.addToRecalculate(); graphic.addToRecalculate();
} }
return ret; return ret;
} }
......
...@@ -3023,7 +3023,7 @@ ...@@ -3023,7 +3023,7 @@
_insertImagesFromBinary: function(ws, data, isIntoShape) _insertImagesFromBinary: function(ws, data, isIntoShape)
{ {
var activeRange = ws.activeRange; 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.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
...@@ -3035,20 +3035,44 @@ ...@@ -3035,20 +3035,44 @@
xfrm = drawingObject.graphicObject.spPr.xfrm; xfrm = drawingObject.graphicObject.spPr.xfrm;
if(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) if(i == 0)
{ {
startCol = xfrm.offX; startCol = offX;
startRow = xfrm.offY; startRow = offY;
} }
else 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 @@ ...@@ -3072,7 +3096,16 @@
} }
} }
}; };
if(startRow < 0)
{
startRow = 0;
}
if(startCol < 0)
{
startCol = 0;
}
for(var i = 0; i < data.Drawings.length; i++) for(var i = 0; i < data.Drawings.length; i++)
{ {
data.Drawings[i].graphicObject = data.Drawings[i].graphicObject.copy(); data.Drawings[i].graphicObject = data.Drawings[i].graphicObject.copy();
...@@ -3105,6 +3138,10 @@ ...@@ -3105,6 +3138,10 @@
//drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument); //drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
drawingObject.graphicObject.addToDrawingObjects(); drawingObject.graphicObject.addToDrawingObjects();
if(drawingObject.graphicObject.checkDrawingBaseCoords)
{
drawingObject.graphicObject.checkDrawingBaseCoords();
}
drawingObject.graphicObject.recalculate(); drawingObject.graphicObject.recalculate();
drawingObject.graphicObject.select(ws.objectRender.controller, 0); drawingObject.graphicObject.select(ws.objectRender.controller, 0);
...@@ -3138,7 +3175,7 @@ ...@@ -3138,7 +3175,7 @@
_insertImagesFromBinaryWord: function(ws, data) _insertImagesFromBinaryWord: function(ws, data)
{ {
var activeRange = ws.activeRange; 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.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
...@@ -3162,24 +3199,48 @@ ...@@ -3162,24 +3199,48 @@
//create new drawingBase //create new drawingBase
drawingObject = ws.objectRender.createDrawingObject(); drawingObject = ws.objectRender.createDrawingObject();
drawingObject.graphicObject = graphicObject; drawingObject.graphicObject = graphicObject;
xfrm = drawingObject.graphicObject.spPr.xfrm; if(drawingObject.graphicObject.spPr && drawingObject.graphicObject.spPr.xfrm)
if(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) if(i == 0)
{ {
startCol = xfrm.offX; startCol = offX;
startRow = xfrm.offY; startRow = offY;
} }
else 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 @@ ...@@ -3221,6 +3282,10 @@
drawingObject.graphicObject.checkRemoveCache && drawingObject.graphicObject.checkRemoveCache(); drawingObject.graphicObject.checkRemoveCache && drawingObject.graphicObject.checkRemoveCache();
//drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument); //drawingObject.graphicObject.setDrawingDocument(ws.objectRender.drawingDocument);
drawingObject.graphicObject.addToDrawingObjects(); drawingObject.graphicObject.addToDrawingObjects();
if(drawingObject.graphicObject.checkDrawingBaseCoords)
{
drawingObject.graphicObject.checkDrawingBaseCoords();
}
drawingObject.graphicObject.recalculate(); drawingObject.graphicObject.recalculate();
drawingObject.graphicObject.select(ws.objectRender.controller, 0); 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