Commit 74befd8e authored by Sergey Luzyanin's avatar Sergey Luzyanin

fix Bug 34235; fix 34204

parent 879a8f53
......@@ -947,6 +947,7 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
var mapDrawings = {};
var mapRuns = {};
var mapTables = {};
var mapGrObjects = {};
for (var nIndex = 0, nCount = arrReverseChanges.length; nIndex < nCount; ++nIndex)
{
var oChange = arrReverseChanges[nIndex];
......@@ -963,12 +964,29 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
mapRuns[oClass.Get_Id()] = oClass;
else if (oClass instanceof AscCommonWord.CTable)
mapTables[oClass.Get_Id()] = oClass;
else if(oClass instanceof AscFormat.CShape || oClass instanceof AscFormat.CImageShape || oClass instanceof AscFormat.CChartSpace || oClass instanceof AscFormat.CGroupShape || oClass instanceof AscFormat.CGraphicFrame)
mapGrObjects[oClass.Get_Id()] = oClass;
}
// Создаем точку в истории. Делаем действия через обычные функции (с отключенным пересчетом), которые пишут в
// историю. Сохраняем список изменений в новой точке, удаляем данную точку.
var oHistory = AscCommon.History;
oHistory.CreateNewPointForCollectChanges();
for(var sId in mapGrObjects){
var oShape = mapGrObjects[sId];
if(!oShape.checkCorrect()){
oShape.setBDeleted(true);
if(oShape.group){
oShape.group.removeFromSpTree(oShape.Get_Id());
}
else if(AscFormat.Slide && (oShape.parent instanceof AscFormat.Slide)){
oShape.parent.removeFromSpTreeById(oShape.Get_Id());
}
else if(AscCommonWord.ParaDrawing && (oShape.parent instanceof AscCommonWord.ParaDrawing)){
mapDrawings[oShape.parent.Get_Id()] = oShape.parent;
}
}
}
var oDrawing;
for (var sId in mapDrawings)
{
......@@ -1047,6 +1065,8 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
oParagraph.CheckParaEnd();
}
var oBinaryWriter = AscCommon.History.BinaryWriter;
var aSendingChanges = [];
for (var nIndex = 0, nCount = arrReverseChanges.length; nIndex < nCount; ++nIndex)
......@@ -1211,6 +1231,10 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
// return false;
// }
if(oChange.CheckCorrect && !oChange.CheckCorrect())
{
return false;
}
return true;
};
......
......@@ -2855,6 +2855,9 @@ DrawingObjectsController.prototype =
if(oPr.isEqual(chartSettings)){
return;
}
//Title Settings
chart_space.setChart(chart_space.chart.createDuplicate());
chart_space.setStyle(chart_space.style);
if(this.drawingObjects && this.drawingObjects.getWorksheet && typeof sRange === "string" && sRange.length > 0)
{
var ws_view = this.drawingObjects.getWorksheet();
......@@ -2916,7 +2919,6 @@ DrawingObjectsController.prototype =
return;
}
}
//Title Settings
var chart = chart_space.chart;
var title_show_settings = chartSettings.getTitle();
if(title_show_settings === c_oAscChartTitleShowSettings.none)
......
......@@ -219,6 +219,20 @@
this.Redo();
this.RefreshRecalcData();
};
CChangesDrawingsObject.prototype.CheckCorrect = function()
{
if(this.Old){
var oObject = AscCommon.g_oTableId.Get_ById(this.Old);
if(oObject.CheckCorrect){
if(!oObject.CheckCorrect()){
return false;
}
}
}
return true;
};
function CChangesDrawingsContent(Class, Type, Pos, Items, isAdd) {
this.Type = Type;
CChangesDrawingsContent.superclass.constructor.call(this, Class, Pos, Items, isAdd);
......
......@@ -13003,6 +13003,13 @@ CChart.prototype =
},
CheckCorrect: function(){
if(!this.plotArea){
return false;
}
return true;
},
getContentChangesByType: function(type){
switch(type){
case AscDFH.historyitem_Chart_AddPivotFmt:{
......
......@@ -714,6 +714,21 @@ CChartSpace.prototype.checkDrawingBaseCoords = CShape.prototype.checkDrawingBase
CChartSpace.prototype.setDrawingBaseCoords = CShape.prototype.setDrawingBaseCoords;
CChartSpace.prototype.deleteBFromSerialize = CShape.prototype.deleteBFromSerialize;
CChartSpace.prototype.setBFromSerialize = CShape.prototype.setBFromSerialize;
CChartSpace.prototype.checkTypeCorrect = function(){
if(!this.chart){
return false;
}
if(!this.chart.plotArea){
return false
}
if(this.chart.plotArea.charts.length === 0){
return false;
}
if(this.chart.plotArea.charts[0].series.length === 0){
return false;
}
return true;
};
CChartSpace.prototype.drawSelect = function(drawingDocument, nPageIndex)
{
var i;
......@@ -2259,6 +2274,11 @@ CChartSpace.prototype.Refresh_RecalcData = function(data)
this.addToRecalculate();
break;
}
case AscDFH.historyitem_ChartSpace_SetChart:
{
this.handleUpdateType();
break;
}
}
};
CChartSpace.prototype.getObjectType = function()
......
......@@ -1092,7 +1092,14 @@ CGraphicFrame.prototype.Refresh_RecalcData2 = function()
this.recalcInfo.recalculateTable = true;
this.recalcInfo.recalculateSizes = true;
this.addToRecalculate();
};
};
CGraphicFrame.prototype.checkTypeCorrect = function()
{
if(!this.graphicObject){
return false;
}
return true;
};
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
......
......@@ -551,6 +551,18 @@
};
CGraphicObjectBase.prototype.checkCorrect = function(){
if(this.bDeleted === true){
return false;
}
return this.checkTypeCorrect();
};
CGraphicObjectBase.prototype.CheckCorrect = function(){
return this.checkCorrect();
};
CGraphicObjectBase.prototype.checkTypeCorrect = function(){
return true;
};
......
......@@ -1780,6 +1780,17 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
CGroupShape.prototype.Refresh_RecalcData = function()
{};
CGroupShape.prototype.checkTypeCorrect = function()
{
if(!this.spPr){
return false;
}
if(this.spTree.length === 0){
return false;
}
return true;
};
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CGroupShape = CGroupShape;
......
......@@ -721,6 +721,16 @@ CImageShape.prototype.getAllImages = function(images)
images[AscCommon.getFullImageSrc2(this.blipFill.RasterImageId)] = true;
}
};
CImageShape.prototype.checkTypeCorrect = function()
{
if(!this.blipFill){
return false;
}
if(!this.spPr){
return false;
}
return true;
};
CImageShape.prototype.Load_LinkData = function(linkData)
{
......
......@@ -150,6 +150,18 @@ function (window, undefined) {
if(AscFormat.CImageShape.prototype.handleUpdateExtents){
AscFormat.CImageShape.prototype.handleUpdateExtents.call(this, []);
}
};
COleObject.prototype.checkTypeCorrect = function(){
if(!this.m_sData){
return false;
}
if(!this.m_sApplicationId){
return false;
}
if(this.m_nPixHeight === null || this.m_nPixHeight === null){
return false;
}
return true;
};
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].COleObject = COleObject;
......
......@@ -5270,6 +5270,13 @@ CShape.prototype.checkTextWarp = function(oContent, oBodyPr, dWidth, dHeight, bN
return oRet;
};
CShape.prototype.checkTypeCorrect = function(){
if(!this.spPr){
return false;
}
return true;
}
function CreateBinaryReader(szSrc, offset, srcLen)
{
var nWritten = 0;
......
......@@ -327,6 +327,14 @@ SlideLayout.prototype =
}
}
},
CheckCorrect: function(){
if(!this.Master){
return false;
}
return true;
},
getMatchingShape: Slide.prototype.getMatchingShape,/*function(type, idx, bSingleBody)
{
var _input_reduced_type;
......
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