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

Bug 26086 - Потеря графического объекта, добавленного на второй и далее листы...

Bug 26086 - Потеря графического объекта, добавленного на второй и далее листы , правка бага с двойным кликом на диаграмму в группе в презентациях

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58642 954022d7-b5bf-4e40-9824-e11837661b57
parent 940adb43
......@@ -2826,6 +2826,7 @@ function DrawingObjects() {
}
oNewChartSpace.spPr.xfrm.setOffX(pos_x);
oNewChartSpace.spPr.xfrm.setOffY(pos_y);
oNewChartSpace.checkDrawingBaseCoords();
oNewChartSpace.recalculate();
_this.showDrawingObjects(false);
_this.controller.selectObject(oNewChartSpace, 0);
......@@ -3123,6 +3124,7 @@ function DrawingObjects() {
var coords = _this.coordsManager.calculateCoords(obj.from);
obj.graphicObject.spPr.xfrm.setOffX( pxToMm(coords.x));
obj.graphicObject.spPr.xfrm.setOffY( pxToMm(coords.y));
obj.graphicObject.checkDrawingBaseCoords();
obj.graphicObject.recalculate();
bNeedRedraw = true;
}
......@@ -3911,6 +3913,7 @@ function DrawingObjects() {
CheckSpPrXfrm(drawingObject.graphicObject);
drawingObject.graphicObject.spPr.xfrm.setOffX( pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY( pxToMm(coords.y) );
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
......@@ -3926,6 +3929,7 @@ function DrawingObjects() {
CheckSpPrXfrm(drawingObject.graphicObject);
drawingObject.graphicObject.spPr.xfrm.setOffX( pxToMm(coords.x));
drawingObject.graphicObject.spPr.xfrm.setOffY( pxToMm(coords.y) );
drawingObject.graphicObject.checkDrawingBaseCoords();
bNeedRecalc = true;
}
}
......
......@@ -1632,6 +1632,7 @@ DrawingObjectsController.prototype =
{
objects_by_type.shapes[i].group.updateCoordinatesAfterInternalResize();
}
objects_by_type.shapes[i].checkDrawingBaseCoords();
}
for(i = 0; i < objects_by_type.images.length; ++i)
{
......@@ -1642,6 +1643,7 @@ DrawingObjectsController.prototype =
{
objects_by_type.images[i].group.updateCoordinatesAfterInternalResize();
}
objects_by_type.images[i].checkDrawingBaseCoords();
}
for(i = 0; i < objects_by_type.charts.length; ++i)
{
......@@ -1652,6 +1654,7 @@ DrawingObjectsController.prototype =
{
objects_by_type.charts[i].group.updateCoordinatesAfterInternalResize();
}
objects_by_type.charts[i].checkDrawingBaseCoords();
}
//if(this.selection.groupSelection)
//{
......@@ -1670,6 +1673,7 @@ DrawingObjectsController.prototype =
{
objects_by_type.shapes[i].group.updateCoordinatesAfterInternalResize();
}
objects_by_type.shapes[i].checkDrawingBaseCoords();
}
for(i = 0; i < objects_by_type.images.length; ++i)
{
......@@ -1680,6 +1684,7 @@ DrawingObjectsController.prototype =
{
objects_by_type.images[i].group.updateCoordinatesAfterInternalResize();
}
objects_by_type.images[i].checkDrawingBaseCoords();
}
for(i = 0; i < objects_by_type.charts.length; ++i)
{
......@@ -1690,6 +1695,7 @@ DrawingObjectsController.prototype =
{
objects_by_type.charts[i].group.updateCoordinatesAfterInternalResize();
}
objects_by_type.charts[i].checkDrawingBaseCoords();
}
//if(this.selection.groupSelection)
//{
......@@ -3295,6 +3301,7 @@ DrawingObjectsController.prototype =
sp.spPr.xfrm.setFlipV(cur_group.spPr.xfrm.flipV === true ? !(sp.spPr.xfrm.flipV === true) : sp.spPr.xfrm.flipV === true);
sp.setGroup(null);
sp.addToDrawingObjects();
sp.checkDrawingBaseCoords();
cur_group.deleteDrawingBase();
this.resetSelection();
this.selectObject(sp, cur_group.selectStartPage);
......@@ -4187,7 +4194,7 @@ DrawingObjectsController.prototype =
{
if(this.selection.groupSelection.selectedObjects.length === 1 && this.selection.groupSelection.selectedObjects[0].getObjectType() === historyitem_type_ChartSpace)
{
this.selection.groupSelection.selectedObjects[0].theme = this.document.theme;
this.selection.groupSelection.selectedObjects[0].theme = this.getTheme();
ExecuteNoHistory(function()
{
CheckSpPrXfrm2(this.selection.groupSelection.selectedObjects[0]);
......@@ -4485,6 +4492,7 @@ DrawingObjectsController.prototype =
sp.spPr.xfrm.setFlipV(cur_group.spPr.xfrm.flipV === true ? !(sp.spPr.xfrm.flipV === true) : sp.spPr.xfrm.flipV === true);
sp.setGroup(null);
sp.addToDrawingObjects();
sp.checkDrawingBaseCoords();
this.selectObject(sp, 0);
}
cur_group.deleteDrawingBase();
......
......@@ -332,6 +332,7 @@ CChartSpace.prototype =
select: CShape.prototype.select,
checkHitToBounds: CShape.prototype.checkHitToBounds,
calculateSnapArrays: CShape.prototype.calculateSnapArrays,
checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords,
recalculateTextPr: function()
......@@ -10071,6 +10072,18 @@ CChartSpace.prototype =
w.WriteLong(data.Type);
switch (data.Type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
writeDouble(w, data.fromCol );
writeDouble(w, data.fromColOff);
writeDouble(w, data.fromRow );
writeDouble(w, data.fromRowOff);
writeDouble(w, data.toCol);
writeDouble(w, data.toColOff);
writeDouble(w, data.toRow );
writeDouble(w, data.toRowOff);
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
break;
......@@ -10186,6 +10199,21 @@ CChartSpace.prototype =
var type = r.GetLong();
switch (type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
if(this.drawingBase)
{
this.drawingBase.from.col = readDouble(r);
this.drawingBase.from.colOff = readDouble(r);
this.drawingBase.from.row = readDouble(r);
this.drawingBase.from.rowOff = readDouble(r);
this.drawingBase.to.col = readDouble(r);
this.drawingBase.to.colOff = readDouble(r);
this.drawingBase.to.row = readDouble(r);
this.drawingBase.to.rowOff = readDouble(r);
}
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
deleteDrawingBase(this.worksheet.Drawings, this.Get_Id());
......
"use strict";
var historyitem_ChartFormatSetChart = 1001;
var historyitem_AutoShapes_SetDrawingBaseCoors = 1000;
var historyitem_AutoShapes_SetWorksheet = 1002;
var historyitem_AutoShapes_AddToDrawingObjects = 1003;
var historyitem_AutoShapes_RemoveFromDrawingObjects = 1004;
......
......@@ -1289,6 +1289,7 @@ CGroupShape.prototype =
sp_tree[i].spPr.xfrm.setOffX(sp_tree[i].spPr.xfrm.offX - x_min_clear);
sp_tree[i].spPr.xfrm.setOffY(sp_tree[i].spPr.xfrm.offY - y_min_clear);
}
this.checkDrawingBaseCoords();
},
select: CShape.prototype.select,
......@@ -1438,6 +1439,7 @@ CGroupShape.prototype =
resetInternalSelection: DrawingObjectsController.prototype.resetInternalSelection,
recalculateCurPos: DrawingObjectsController.prototype.recalculateCurPos,
checkHitToBounds: CShape.prototype.checkHitToBounds,
checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords,
calculateSnapArrays: function(snapArrayX, snapArrayY)
{
......@@ -1683,6 +1685,19 @@ CGroupShape.prototype =
w.WriteLong(data.Type);
switch(data.Type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
writeDouble(w, data.fromCol );
writeDouble(w, data.fromColOff);
writeDouble(w, data.fromRow );
writeDouble(w, data.fromRowOff);
writeDouble(w, data.toCol);
writeDouble(w, data.toColOff);
writeDouble(w, data.toRow );
writeDouble(w, data.toRowOff);
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
break;
......@@ -1731,6 +1746,21 @@ CGroupShape.prototype =
var type = r.GetLong();
switch (type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
if(this.drawingBase)
{
this.drawingBase.from.col = readDouble(r);
this.drawingBase.from.colOff = readDouble(r);
this.drawingBase.from.row = readDouble(r);
this.drawingBase.from.rowOff = readDouble(r);
this.drawingBase.to.col = readDouble(r);
this.drawingBase.to.colOff = readDouble(r);
this.drawingBase.to.row = readDouble(r);
this.drawingBase.to.rowOff = readDouble(r);
}
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
deleteDrawingBase(this.worksheet.Drawings, this.Get_Id());
......
......@@ -145,6 +145,7 @@ CImageShape.prototype =
normalize: CShape.prototype.normalize,
checkHitToBounds: CShape.prototype.checkHitToBounds,
calculateSnapArrays: CShape.prototype.calculateSnapArrays,
checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords,
sendMouseData: function()
{
......@@ -848,6 +849,18 @@ CImageShape.prototype =
w.WriteLong(data.Type);
switch(data.Type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
writeDouble(w, data.fromCol );
writeDouble(w, data.fromColOff);
writeDouble(w, data.fromRow );
writeDouble(w, data.fromRowOff);
writeDouble(w, data.toCol);
writeDouble(w, data.toColOff);
writeDouble(w, data.toRow );
writeDouble(w, data.toRowOff);
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
break;
......@@ -898,6 +911,21 @@ CImageShape.prototype =
var type = r.GetLong();
switch(type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
if(this.drawingBase)
{
this.drawingBase.from.col = readDouble(r);
this.drawingBase.from.colOff = readDouble(r);
this.drawingBase.from.row = readDouble(r);
this.drawingBase.from.rowOff = readDouble(r);
this.drawingBase.to.col = readDouble(r);
this.drawingBase.to.colOff = readDouble(r);
this.drawingBase.to.row = readDouble(r);
this.drawingBase.to.rowOff = readDouble(r);
}
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
deleteDrawingBase(this.worksheet.Drawings, this.Get_Id());
......
......@@ -2156,6 +2156,34 @@ CShape.prototype =
},
checkDrawingBaseCoords: function()
{
if(this.drawingBase && this.spPr && this.spPr.xfrm && !this.group)
{
var oldX = this.x, oldY = this.y, oldExtX = this.extX, oldExtY = this.extY;
this.x = this.spPr.xfrm.offX;
this.y = this.spPr.xfrm.offY;
this.extX = this.spPr.xfrm.extX;
this.extY = this.spPr.xfrm.extY;
this.drawingBase.setGraphicObjectCoords();
this.x = oldX;
this.y = oldY;
this.extX = oldExtX;
this.extY = oldExtY;
var from = this.drawingBase.from, to = this.drawingBase.to;
History.Add(this, {Type: historyitem_AutoShapes_SetDrawingBaseCoors,
fromCol: from.col,
fromColOff: from.colOff,
fromRow : from.row,
fromRowOff: from.rowOff,
toCol: to.col,
toColOff: to.colOff,
toRow : to.row,
toRowOff: to.rowOff
});
}
},
getTransformMatrix: function ()
{
return this.transform;
......@@ -3420,6 +3448,11 @@ CShape.prototype =
{
switch (data.Type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
addToDrawings(this.worksheet, this, data.Pos);
......@@ -3586,6 +3619,18 @@ CShape.prototype =
w.WriteLong(data.Type);
switch (data.Type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
writeDouble(w, data.fromCol );
writeDouble(w, data.fromColOff);
writeDouble(w, data.fromRow );
writeDouble(w, data.fromRowOff);
writeDouble(w, data.toCol);
writeDouble(w, data.toColOff);
writeDouble(w, data.toRow );
writeDouble(w, data.toRowOff);
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
break;
......@@ -3642,6 +3687,21 @@ CShape.prototype =
var type = r.GetLong();
switch (type)
{
case historyitem_AutoShapes_SetDrawingBaseCoors:
{
if(this.drawingBase)
{
this.drawingBase.from.col = readDouble(r);
this.drawingBase.from.colOff = readDouble(r);
this.drawingBase.from.row = readDouble(r);
this.drawingBase.from.rowOff = readDouble(r);
this.drawingBase.to.col = readDouble(r);
this.drawingBase.to.colOff = readDouble(r);
this.drawingBase.to.row = readDouble(r);
this.drawingBase.to.rowOff = readDouble(r);
}
break;
}
case historyitem_AutoShapes_RemoveFromDrawingObjects:
{
deleteDrawingBase(this.worksheet.Drawings, this.Get_Id());
......
......@@ -98,6 +98,7 @@ StartAddNewShape.prototype =
shape.setRecalculateInfo();
}
shape.addToDrawingObjects();
shape.checkDrawingBaseCoords();
oThis.drawingObjects.checkChartTextSelection();
oThis.drawingObjects.resetSelection();
shape.select(oThis.drawingObjects, 0);
......@@ -549,6 +550,7 @@ RotateState.prototype =
{
drawing.spPr.xfrm.setOffY(drawing.spPr.xfrm.offY - min_y);
}
drawing.checkDrawingBaseCoords();
}
oThis.drawingObjects.drawingObjects.checkGraphicObjectPosition(0, 0, Math.max.apply(Math, arr_x2), Math.max.apply(Math, arr_y2));
}
......
......@@ -113,6 +113,7 @@ function MoveShapeImageTrack(originalObject)
}
this.originalObject.spPr.xfrm.setOffX(this.x/scale_coefficients.cx + ch_off_x);
this.originalObject.spPr.xfrm.setOffY(this.y/scale_coefficients.cy + ch_off_y);
this.originalObject.checkDrawingBaseCoords();
};
}
......@@ -310,6 +311,7 @@ function MoveGroupTrack(originalObject)
if(this.originalObject.selectStartPage !== this.pageIndex)
this.originalObject.selectStartPage = this.pageIndex;
}
this.originalObject.checkDrawingBaseCoords();
};
}
......
......@@ -754,6 +754,7 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
xfrm.setExtY(this.resizedExtY/scale_coefficients.cy);
xfrm.setFlipH(this.resizedflipH);
xfrm.setFlipV(this.resizedflipV);
this.originalObject.checkDrawingBaseCoords();
};
}, this, []);
}
......@@ -1413,6 +1414,7 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
{
this.childs[i].trackEnd();
}
this.original.checkDrawingBaseCoords();
};
}, this, []);
......
......@@ -107,7 +107,7 @@ function deleteDrawingBase(aObjects, graphicId)
CShape.prototype.addToDrawingObjects = function(pos)
{
var controller = this.getDrawingObjectsController();
var position = addToDrawings(this.worksheet, this, pos, /*lockByDefault*/undefined, c_oAscCellAnchorType.cellanchorAbsolute);
var position = addToDrawings(this.worksheet, this, pos, /*lockByDefault*/undefined, undefined);
var data = {Type: historyitem_AutoShapes_AddToDrawingObjects, Pos: position};
History.Add(this, data);
this.worksheet.addContentChanges(new CContentChangesElement(contentchanges_Add, data.Pos, 1, data));
......
......@@ -398,6 +398,7 @@ DrawingObjectsController.prototype.createGroup = function()
group.setParent(this.drawingObjects);
}
group.addToDrawingObjects();
group.checkDrawingBaseCoords();
this.selectObject(group, 0);
group.addToRecalculate();
this.startRecalculate();
......@@ -474,6 +475,7 @@ DrawingObjectsController.prototype.addChartDrawingObject = function(options)
options.putRange(old_range);
}
chart.addToRecalculate();
chart.checkDrawingBaseCoords();
this.startRecalculate();
this.drawingObjects.sendGraphicObjectProps();
}
......@@ -500,6 +502,7 @@ DrawingObjectsController.prototype.addImageFromParams = function(rasterImageId,
image.setWorksheet(this.drawingObjects.getWorksheetModel());
image.setDrawingObjects(this.drawingObjects);
image.addToDrawingObjects();
image.checkDrawingBaseCoords();
this.selectObject(image, 0);
image.addToRecalculate();
this.startRecalculate();
......
......@@ -42,6 +42,7 @@ CGraphicFrame.prototype =
setBDeleted: CShape.prototype.setBDeleted,
getBase64Img: CShape.prototype.getBase64Img,
checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords,
Is_DrawingShape: function()
......
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