Commit 50677b7b authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

Fix critical Bug 20981 - [Copy&Paste] Ошибка в консоли при копировании листа с...

Fix critical Bug 20981 - [Copy&Paste] Ошибка в консоли при копировании листа с автофигурой, если она содержит текст

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50932 954022d7-b5bf-4e40-9824-e11837661b57
parent 68f35960
...@@ -2757,13 +2757,13 @@ function DrawingObjects() { ...@@ -2757,13 +2757,13 @@ function DrawingObjects() {
var drawingObject = _this.cloneDrawingObject(currentSheet.model.Drawings[i]); var drawingObject = _this.cloneDrawingObject(currentSheet.model.Drawings[i]);
drawingObject.updateAnchorPosition(); drawingObject.updateAnchorPosition();
// Check drawing area
if ( !worksheet.cols[drawingObject.to.col] ) { if ( !worksheet.cols[drawingObject.to.col] ) {
while ( !worksheet.cols[drawingObject.to.col] ) { while ( !worksheet.cols[drawingObject.to.col] ) {
worksheet.expandColsOnScroll(true); worksheet.expandColsOnScroll(true);
} }
worksheet.expandColsOnScroll(true); // для colOff worksheet.expandColsOnScroll(true); // для colOff
} }
if ( !worksheet.rows[drawingObject.to.row] ) { if ( !worksheet.rows[drawingObject.to.row] ) {
while ( !worksheet.rows[drawingObject.to.row] ) { while ( !worksheet.rows[drawingObject.to.row] ) {
worksheet.expandRowsOnScroll(true); worksheet.expandRowsOnScroll(true);
...@@ -2771,11 +2771,12 @@ function DrawingObjects() { ...@@ -2771,11 +2771,12 @@ function DrawingObjects() {
worksheet.expandRowsOnScroll(true); // для rowOff worksheet.expandRowsOnScroll(true); // для rowOff
} }
// Object types
if (drawingObject.graphicObject instanceof CChartAsGroup) { if (drawingObject.graphicObject instanceof CChartAsGroup) {
_this.calcChartInterval(drawingObject.graphicObject.chart); _this.calcChartInterval(drawingObject.graphicObject.chart);
drawingObject.graphicObject.drawingBase = drawingObject; drawingObject.graphicObject.drawingBase = drawingObject;
drawingObject.graphicObject.drawingObjects = _this; drawingObject.graphicObject.setDrawingObjects(_this);
if (drawingObject.graphicObject.chartTitle) if (drawingObject.graphicObject.chartTitle)
drawingObject.graphicObject.chartTitle.drawingObjects = _this; drawingObject.graphicObject.chartTitle.drawingObjects = _this;
...@@ -2785,12 +2786,15 @@ function DrawingObjects() { ...@@ -2785,12 +2786,15 @@ function DrawingObjects() {
drawingObject.graphicObject.init(); drawingObject.graphicObject.init();
aObjects.push( drawingObject ); aObjects.push( drawingObject );
var boundsChecker = _this.getBoundsChecker(drawingObject);
aBoundsCheckers.push(boundsChecker);
} }
if (drawingObject.graphicObject instanceof CShape) { if (drawingObject.graphicObject instanceof CShape) {
drawingObject.graphicObject.drawingBase = drawingObject; drawingObject.graphicObject.drawingBase = drawingObject;
drawingObject.graphicObject.drawingObjects = _this; drawingObject.graphicObject.setDrawingObjects(_this);
drawingObject.graphicObject.setDrawingDocument(this.drawingDocument); drawingObject.graphicObject.setDrawingDocument(_this.drawingDocument);
var xfrm = drawingObject.graphicObject.spPr.xfrm; var xfrm = drawingObject.graphicObject.spPr.xfrm;
if(!xfrm) if(!xfrm)
...@@ -2806,12 +2810,16 @@ function DrawingObjects() { ...@@ -2806,12 +2810,16 @@ function DrawingObjects() {
} }
drawingObject.graphicObject.recalculate(); drawingObject.graphicObject.recalculate();
aObjects.push( drawingObject ); aObjects.push( drawingObject );
var boundsChecker = _this.getBoundsChecker(drawingObject);
aBoundsCheckers.push(boundsChecker);
} }
if (drawingObject.graphicObject instanceof CImageShape) { if (drawingObject.graphicObject instanceof CImageShape) {
aObjectsSync[aObjectsSync.length] = drawingObject; aObjectsSync[aObjectsSync.length] = drawingObject;
drawingObject.graphicObject.drawingBase = drawingObject; drawingObject.graphicObject.drawingBase = drawingObject;
drawingObject.graphicObject.drawingObjects = _this; drawingObject.graphicObject.setDrawingDocument(_this.drawingDocument);
drawingObject.graphicObject.setDrawingObjects(_this);
var xfrm = drawingObject.graphicObject.spPr.xfrm; var xfrm = drawingObject.graphicObject.spPr.xfrm;
if(!xfrm) if(!xfrm)
...@@ -2827,11 +2835,10 @@ function DrawingObjects() { ...@@ -2827,11 +2835,10 @@ function DrawingObjects() {
} }
drawingObject.graphicObject.recalculate(aImagesSync); drawingObject.graphicObject.recalculate(aImagesSync);
} }
if (drawingObject.graphicObject instanceof CGroupShape) { if (drawingObject.graphicObject instanceof CGroupShape) {
drawingObject.graphicObject.drawingBase = drawingObject; drawingObject.graphicObject.drawingBase = drawingObject;
drawingObject.graphicObject.drawingObjects = _this; drawingObject.graphicObject.setDrawingObjects(_this);
var xfrm = drawingObject.graphicObject.spPr.xfrm; var xfrm = drawingObject.graphicObject.spPr.xfrm;
if(!xfrm) if(!xfrm)
...@@ -2849,6 +2856,9 @@ function DrawingObjects() { ...@@ -2849,6 +2856,9 @@ function DrawingObjects() {
drawingObject.graphicObject.setDrawingDocument(this.drawingDocument); drawingObject.graphicObject.setDrawingDocument(this.drawingDocument);
drawingObject.graphicObject.recalculate(aImagesSync); drawingObject.graphicObject.recalculate(aImagesSync);
aObjects.push( drawingObject ); aObjects.push( drawingObject );
var boundsChecker = _this.getBoundsChecker(drawingObject);
aBoundsCheckers.push(boundsChecker);
} }
} }
...@@ -3517,6 +3527,7 @@ function DrawingObjects() { ...@@ -3517,6 +3527,7 @@ function DrawingObjects() {
drawingObject.graphicObject = new CImageShape(drawingObject, _this); drawingObject.graphicObject = new CImageShape(drawingObject, _this);
drawingObject.graphicObject.initDefault( pxToMm(coordsFrom.x), pxToMm(coordsFrom.y), pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y), _image.src ); drawingObject.graphicObject.initDefault( pxToMm(coordsFrom.x), pxToMm(coordsFrom.y), pxToMm(coordsTo.x - coordsFrom.x), pxToMm(coordsTo.y - coordsFrom.y), _image.src );
drawingObject.graphicObject.select(_this.controller); drawingObject.graphicObject.select(_this.controller);
drawingObject.graphicObject.setDrawingObjects(_this);
drawingObject.graphicObject.addToDrawingObjects(); drawingObject.graphicObject.addToDrawingObjects();
} }
......
...@@ -74,11 +74,13 @@ CChartAsGroup.prototype = ...@@ -74,11 +74,13 @@ CChartAsGroup.prototype =
setDrawingObjects: function(drawingObjects) setDrawingObjects: function(drawingObjects)
{ {
var newValue = isRealObject(drawingObjects) ? drawingObjects.getWorksheet().model.getId() : null; if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() )
var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null; {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, var newValue = drawingObjects.getWorksheet().model.getId();
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue))); var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null;
this.drawingObjects = drawingObjects; History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.drawingObjects = drawingObjects;
}
}, },
getBoundsInGroup: function() getBoundsInGroup: function()
...@@ -1859,6 +1861,7 @@ CChartAsGroup.prototype = ...@@ -1859,6 +1861,7 @@ CChartAsGroup.prototype =
this.hAxisTitle = new CChartTitle(this, CHART_TITLE_TYPE_H_AXIS); this.hAxisTitle = new CChartTitle(this, CHART_TITLE_TYPE_H_AXIS);
this.hAxisTitle.readFromBinary(r); this.hAxisTitle.readFromBinary(r);
} }
this.chart = new asc_CChart();
this.chart.Read_FromBinary2(r, false); this.chart.Read_FromBinary2(r, false);
this.spPr.Read_FromBinary2(r); this.spPr.Read_FromBinary2(r);
if(isRealNumber(x) && isRealNumber(y)) if(isRealNumber(x) && isRealNumber(y))
......
...@@ -91,12 +91,13 @@ CGroupShape.prototype = ...@@ -91,12 +91,13 @@ CGroupShape.prototype =
setDrawingObjects: function(drawingObjects) setDrawingObjects: function(drawingObjects)
{ {
var newValue = isRealObject(drawingObjects) ? drawingObjects.getWorksheet().model.getId() : null; if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() )
var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null; {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, var newValue = drawingObjects.getWorksheet().model.getId();
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue))); var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null;
this.drawingObjects = drawingObjects; History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.drawingObjects = drawingObjects;
}
}, },
......
...@@ -91,12 +91,13 @@ CImageShape.prototype = ...@@ -91,12 +91,13 @@ CImageShape.prototype =
setDrawingObjects: function(drawingObjects) setDrawingObjects: function(drawingObjects)
{ {
var newValue = isRealObject(drawingObjects) ? drawingObjects.getWorksheet().model.getId() : null; if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() )
var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null; {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, var newValue = drawingObjects.getWorksheet().model.getId();
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue))); var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null;
this.drawingObjects = drawingObjects; History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.drawingObjects = drawingObjects;
}
}, },
getObjectType: function() getObjectType: function()
......
...@@ -858,12 +858,13 @@ CShape.prototype = ...@@ -858,12 +858,13 @@ CShape.prototype =
setDrawingObjects: function(drawingObjects) setDrawingObjects: function(drawingObjects)
{ {
var newValue = isRealObject(drawingObjects) ? drawingObjects.getWorksheet().model.getId() : null; if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() )
var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null; {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, var newValue = drawingObjects.getWorksheet().model.getId();
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue))); var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null;
this.drawingObjects = drawingObjects; History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.drawingObjects = drawingObjects;
}
}, },
setGroup: function(group) setGroup: function(group)
......
...@@ -2292,7 +2292,6 @@ Woorksheet.prototype.clone=function(sNewId){ ...@@ -2292,7 +2292,6 @@ Woorksheet.prototype.clone=function(sNewId){
oNewWs.hyperlinkManager.startRecalculate(); oNewWs.hyperlinkManager.startRecalculate();
if(null != this.Drawings && this.Drawings.length > 0) if(null != this.Drawings && this.Drawings.length > 0)
{ {
oNewWs.Drawings = []; oNewWs.Drawings = [];
var w = new CMemory(); var w = new CMemory();
for(var i = 0; i < this.Drawings.length; ++i) for(var i = 0; i < this.Drawings.length; ++i)
...@@ -2305,7 +2304,8 @@ Woorksheet.prototype.clone=function(sNewId){ ...@@ -2305,7 +2304,8 @@ Woorksheet.prototype.clone=function(sNewId){
for(var i = 0; i < this.Drawings.length; ++i) for(var i = 0; i < this.Drawings.length; ++i)
{ {
var obj = null; var obj = null;
switch(stream.GetLong()) var objectType = stream.GetLong();
switch (objectType)
{ {
case CLASS_TYPE_SHAPE: case CLASS_TYPE_SHAPE:
{ {
...@@ -2322,7 +2322,7 @@ Woorksheet.prototype.clone=function(sNewId){ ...@@ -2322,7 +2322,7 @@ Woorksheet.prototype.clone=function(sNewId){
obj = new CGroupShape(null, null); obj = new CGroupShape(null, null);
break; break;
} }
case CLASS_TYPE_CHART: case CLASS_TYPE_CHART_AS_GROUP:
{ {
obj = new CChartAsGroup(null, null); obj = new CChartAsGroup(null, null);
break; break;
...@@ -2330,8 +2330,8 @@ Woorksheet.prototype.clone=function(sNewId){ ...@@ -2330,8 +2330,8 @@ Woorksheet.prototype.clone=function(sNewId){
} }
if(isRealObject(obj)) if(isRealObject(obj))
{ {
var drawingObject = drawingObjects.createDrawingObject(); var drawingObject = drawingObjects.cloneDrawingObject(this.Drawings[i]);
obj.readFromBinaryForCopyPaste2(stream, null, null, null, null); obj.readFromBinaryForCopyPaste2(stream, null, drawingObjects, null, null);
drawingObject.graphicObject = obj; drawingObject.graphicObject = obj;
oNewWs.Drawings.push(drawingObject); oNewWs.Drawings.push(drawingObject);
} }
......
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