Commit 62c99686 authored by Sergey Luzyanin's avatar Sergey Luzyanin

method IsChangesClass was removed from CChangesBase;

parent ba9de9ae
...@@ -229,20 +229,15 @@ CHistory.prototype.Undo = function() ...@@ -229,20 +229,15 @@ CHistory.prototype.Undo = function()
if(!Item.Class.Read_FromBinary2 && !Item.Class.IsChangesClass) if(!Item.Class.RefreshRecalcData)
Item.Class.Undo( Item.Type, Item.Data, Item.SheetId ); Item.Class.Undo( Item.Type, Item.Data, Item.SheetId );
else else
{ {
if (Item.Class && Item.Class.IsChangesClass && Item.Class.IsChangesClass()) if (Item.Class)
{ {
Item.Class.Undo(); Item.Class.Undo();
Item.Class.RefreshRecalcData(); Item.Class.RefreshRecalcData();
} }
else
{
Item.Class.Undo(Item.Type);
Item.Class.Refresh_RecalcData && Item.Class.Refresh_RecalcData(Item.Type);
}
} }
this._addRedoObjectParam(oRedoObjectParam, Item); this._addRedoObjectParam(oRedoObjectParam, Item);
...@@ -299,39 +294,30 @@ CHistory.prototype.RedoAdd = function(oRedoObjectParam, Class, Type, sheetid, ra ...@@ -299,39 +294,30 @@ CHistory.prototype.RedoAdd = function(oRedoObjectParam, Class, Type, sheetid, ra
} }
// ToDo Убрать это!!! // ToDo Убрать это!!!
if(Class && !Class.Load_Changes && !Class.Load) if(Class && !Class.Load) {
{
Class.Redo( Type, Data, sheetid ); Class.Redo( Type, Data, sheetid );
} }
else else
{ {
if(Class && Data && !Data.isDrawingCollaborativeData) if(Class && Data && !Data.isDrawingCollaborativeData){
Class.Redo(Data); Class.Redo(Data);
}
else else
{ {
if(!Class){ if(!Class){
if(Data.isDrawingCollaborativeData){ if(Data.isDrawingCollaborativeData){
Data.oBinaryReader.Seek2(Data.nPos); Data.oBinaryReader.Seek2(Data.nPos);
var nReaderPos = Data.oBinaryReader.GetCurPos(); var nChangesType = Data.oBinaryReader.GetLong();
var nChangesType = Data.oBinaryReader.GetLong(); var changedObject = AscCommon.g_oTableId.Get_ById(Data.sChangedObjectId);
if(changedObject){
var changedObject = AscCommon.g_oTableId.Get_ById(Data.sChangedObjectId); var fChangesClass = AscDFH.changesFactory[nChangesType];
if(changedObject){ if (fChangesClass){
var oChange = new fChangesClass(changedObject);
var fChangesClass = AscDFH.changesFactory[nChangesType]; oChange.ReadFromBinary(Data.oBinaryReader);
if (fChangesClass) oChange.Load(new CDocumentColor(255, 255, 255));
{ }
var oChange = new fChangesClass(changedObject); }
oChange.ReadFromBinary(Data.oBinaryReader); }
oChange.Load(new CDocumentColor(255, 255, 255));
}
else
{
Data.oBinaryReader.Seek2(nReaderPos);
changedObject.Load_Changes(Data.oBinaryReader, null, new CDocumentColor(255, 255, 255));
}
}
}
} }
} }
} }
...@@ -354,29 +340,12 @@ CHistory.prototype.RedoExecute = function(Point, oRedoObjectParam) ...@@ -354,29 +340,12 @@ CHistory.prototype.RedoExecute = function(Point, oRedoObjectParam)
for ( var Index = 0; Index < Point.Items.length; Index++ ) for ( var Index = 0; Index < Point.Items.length; Index++ )
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if(!Item.Class.Read_FromBinary2 && !Item.Class.IsChangesClass) if(!Item.Class.RefreshRecalcData)
Item.Class.Redo( Item.Type, Item.Data, Item.SheetId ); Item.Class.Redo( Item.Type, Item.Data, Item.SheetId );
else else
{ {
if(!Item.Data || !Item.Data.isDrawingCollaborativeData) Item.Class.Redo();
{ Item.Class.RefreshRecalcData();
if (Item.Class && Item.Class.IsChangesClass && Item.Class.IsChangesClass())
{
Item.Class.Redo();
Item.Class.RefreshRecalcData();
}
else
{
Item.Class.Redo(Item.Type);
Item.Class.Refresh_RecalcData && Item.Class.Refresh_RecalcData(Item.Type);
}
}
else
{
Item.Data.oBinaryReader.Seek(Item.Data.nPos);
Item.Class.Load_Changes(Item.Data.oBinaryReader, null, new CDocumentColor(255, 255, 255));
}
} }
this._addRedoObjectParam(oRedoObjectParam, Item); this._addRedoObjectParam(oRedoObjectParam, Item);
} }
......
...@@ -92,7 +92,7 @@ UndoRedoItemSerializable.prototype = { ...@@ -92,7 +92,7 @@ UndoRedoItemSerializable.prototype = {
SerializeInner : function(oBinaryWriter, collaborativeEditing) SerializeInner : function(oBinaryWriter, collaborativeEditing)
{ {
//nClassType //nClassType
if(!this.oClass.Save_Changes && !this.oClass.WriteToBinary) if(!this.oClass.WriteToBinary)
{ {
oBinaryWriter.WriteBool(true); oBinaryWriter.WriteBool(true);
var nClassType = this.oClass.getClassType(); var nClassType = this.oClass.getClassType();
...@@ -140,19 +140,10 @@ UndoRedoItemSerializable.prototype = { ...@@ -140,19 +140,10 @@ UndoRedoItemSerializable.prototype = {
{ {
oBinaryWriter.WriteBool(false); oBinaryWriter.WriteBool(false);
var Class; var Class;
if (this.oClass && this.oClass.IsChangesClass && this.oClass.IsChangesClass()) Class = this.oClass.GetClass();
{ oBinaryWriter.WriteString2(Class.Get_Id());
Class = this.oClass.GetClass(); oBinaryWriter.WriteLong(this.oClass.Type);
oBinaryWriter.WriteString2(Class.Get_Id()); this.oClass.WriteToBinary(oBinaryWriter);
oBinaryWriter.WriteLong(this.oClass.Type);
this.oClass.WriteToBinary(oBinaryWriter);
}
else
{
oBinaryWriter.WriteString2(this.oClass.Get_Id());
this.oClass.Save_Changes(this.nActionType, oBinaryWriter);
}
} }
}, },
SerializeDataObject : function(oBinaryWriter, oData, nSheetId, collaborativeEditing) SerializeDataObject : function(oBinaryWriter, oData, nSheetId, collaborativeEditing)
......
...@@ -59,24 +59,12 @@ AscCommon.CContentChangesElement.prototype.Refresh_BinaryData = function() ...@@ -59,24 +59,12 @@ AscCommon.CContentChangesElement.prototype.Refresh_BinaryData = function()
var Binary_Writer = History.BinaryWriter; var Binary_Writer = History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition(); var Binary_Pos = Binary_Writer.GetCurPosition();
if (this.m_pData.Data && this.m_pData.Data.IsChangesClass && this.m_pData.Data.IsChangesClass()) this.m_pData.Data.UseArray = true;
{ this.m_pData.Data.PosArray = this.m_aPositions;
this.m_pData.Data.UseArray = true;
this.m_pData.Data.PosArray = this.m_aPositions;
Binary_Writer.WriteString2(this.m_pData.Class.Get_Id());
Binary_Writer.WriteLong(this.m_pData.Data.Type);
this.m_pData.Data.WriteToBinary(Binary_Writer);
}
else
{
this.m_pData.Data.UseArray = true;
this.m_pData.Data.PosArray = this.m_aPositions;
Binary_Writer.WriteString2(this.m_pData.Class.Get_Id());
this.m_pData.Class.Save_Changes(this.m_pData.Data, Binary_Writer);
}
Binary_Writer.WriteString2(this.m_pData.Class.Get_Id());
Binary_Writer.WriteLong(this.m_pData.Data.Type);
this.m_pData.Data.WriteToBinary(Binary_Writer);
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos; var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
this.m_pData.Binary.Pos = Binary_Pos; this.m_pData.Binary.Pos = Binary_Pos;
......
...@@ -588,6 +588,24 @@ CCollaborativeEditingBase.prototype.Refresh_DCChanges = function() ...@@ -588,6 +588,24 @@ CCollaborativeEditingBase.prototype.Refresh_DCChanges = function()
this.Clear_DCChanges(); this.Clear_DCChanges();
}; };
//-----------------------------------------------------------------------------------
// Функции для работы с массивами PosExtChangesX, PosExtChangesY
//-----------------------------------------------------------------------------------
CCollaborativeEditingBase.prototype.AddPosExtChanges = function(Item, ChangeObject){
};
CCollaborativeEditingBase.prototype.RefreshPosExtChanges = function(){
};
CCollaborativeEditingBase.prototype.RewritePosExtChanges = function(changesArr, scale, Binary_Writer)
{
};
CCollaborativeEditingBase.prototype.RefreshPosExtChanges = function()
{
};
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Функции для работы с отметками изменений // Функции для работы с отметками изменений
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
......
...@@ -6,6 +6,21 @@ ...@@ -6,6 +6,21 @@
window['AscDFH'].drawingsConstructorsMap = drawingConstructorsMap; window['AscDFH'].drawingsConstructorsMap = drawingConstructorsMap;
window['AscDFH'].drawingContentChanges = drawingContentChanges; window['AscDFH'].drawingContentChanges = drawingContentChanges;
var oPosExtMap = {};
oPosExtMap[AscDFH.historyitem_Xfrm_SetOffX] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetOffY] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetExtX] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetExtY] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetChOffX] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetChOffY] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetChExtX] = true;
oPosExtMap[AscDFH.historyitem_Xfrm_SetChExtY] = true;
var oPosExtHor = {};
oPosExtHor[AscDFH.historyitem_Xfrm_SetOffX] = true;
oPosExtHor[AscDFH.historyitem_Xfrm_SetExtX] = true;
oPosExtHor[AscDFH.historyitem_Xfrm_SetChOffX] = true;
oPosExtHor[AscDFH.historyitem_Xfrm_SetChExtX] = true;
function private_SetValue(Value) { function private_SetValue(Value) {
if (!this.Class) { if (!this.Class) {
return; return;
...@@ -96,6 +111,12 @@ ...@@ -96,6 +111,12 @@
this.Type = reader.GetLong(); this.Type = reader.GetLong();
CChangesDrawingsDouble.superclass.ReadFromBinary.call(this, reader); CChangesDrawingsDouble.superclass.ReadFromBinary.call(this, reader);
}; };
CChangesDrawingsDouble.prototype.IsPosExtChange = function () {
return !!oPosExtMap[this.Type];
};
CChangesDrawingsDouble.prototype.IsHorizontal = function () {
return !!oPosExtHor[this.Type];
};
window['AscDFH'].CChangesDrawingsDouble = CChangesDrawingsDouble; window['AscDFH'].CChangesDrawingsDouble = CChangesDrawingsDouble;
...@@ -354,6 +375,16 @@ ...@@ -354,6 +375,16 @@
}; };
function CChangesDrawingsContentPresentation(Class, Type, Pos, Items, isAdd){
CChangesDrawingsContentPresentation.superclass.constructor.call(this, Class, Type, Pos, Items, isAdd);
}
AscCommon.extendClass(CChangesDrawingsContentPresentation, CChangesDrawingsContent);
CChangesDrawingsContentPresentation.prototype.IsContentChange = function(){
return true;
};
window['AscDFH'].CChangesDrawingsContentPresentation = CChangesDrawingsContentPresentation;
function CChangesDrawingsContentNoId(Class, Type, Pos, Items, isAdd){ function CChangesDrawingsContentNoId(Class, Type, Pos, Items, isAdd){
CChangesDrawingsContentNoId.superclass.constructor.call(this, Class, Type, Pos, Items, isAdd); CChangesDrawingsContentNoId.superclass.constructor.call(this, Class, Type, Pos, Items, isAdd);
} }
......
...@@ -101,6 +101,10 @@ function (window, undefined) { ...@@ -101,6 +101,10 @@ function (window, undefined) {
this.m_nPixHeight = nPixHeight; this.m_nPixHeight = nPixHeight;
}; };
COleObject.prototype.canRotate = function () {
return false;
};
COleObject.prototype.copy = function() COleObject.prototype.copy = function()
{ {
var copy = new COleObject(); var copy = new COleObject();
......
...@@ -2919,11 +2919,6 @@ ...@@ -2919,11 +2919,6 @@
// В большинстве случаев загрузка чужого изменения работает как простое Redo // В большинстве случаев загрузка чужого изменения работает как простое Redo
this.Redo(); this.Redo();
}; };
CChangesBase.prototype.IsChangesClass = function()
{
// TODO: Эта функция добавлена пока все изменения не переделаны на классы
return true;
};
CChangesBase.prototype.GetClass = function() CChangesBase.prototype.GetClass = function()
{ {
return this.Class; return this.Class;
...@@ -2945,6 +2940,10 @@ ...@@ -2945,6 +2940,10 @@
{ {
return true; return true;
}; };
CChangesBase.prototype.IsPosExtChange = function(oChange)
{
return false;
};
window['AscDFH'].CChangesBase = CChangesBase; window['AscDFH'].CChangesBase = CChangesBase;
/** /**
* Базовый класс для изменений, которые меняют содержимое родительского класса.* * Базовый класс для изменений, которые меняют содержимое родительского класса.*
......
...@@ -2120,23 +2120,12 @@ CContentChangesElement.prototype.Refresh_BinaryData = function() ...@@ -2120,23 +2120,12 @@ CContentChangesElement.prototype.Refresh_BinaryData = function()
var Binary_Writer = AscCommon.History.BinaryWriter; var Binary_Writer = AscCommon.History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition(); var Binary_Pos = Binary_Writer.GetCurPosition();
if (this.m_pData.Data && this.m_pData.Data.IsChangesClass && this.m_pData.Data.IsChangesClass()) this.m_pData.Data.UseArray = true;
{ this.m_pData.Data.PosArray = this.m_aPositions;
this.m_pData.Data.UseArray = true;
this.m_pData.Data.PosArray = this.m_aPositions;
Binary_Writer.WriteString2(this.m_pData.Class.Get_Id());
Binary_Writer.WriteLong(this.m_pData.Data.Type);
this.m_pData.Data.WriteToBinary(Binary_Writer);
}
else
{
this.m_pData.Data.UseArray = true;
this.m_pData.Data.PosArray = this.m_aPositions;
Binary_Writer.WriteString2(this.m_pData.Class.Get_Id()); Binary_Writer.WriteString2(this.m_pData.Class.Get_Id());
this.m_pData.Class.Save_Changes(this.m_pData.Data, Binary_Writer); Binary_Writer.WriteLong(this.m_pData.Data.Type);
} this.m_pData.Data.WriteToBinary(Binary_Writer);
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos; var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
......
...@@ -62,7 +62,6 @@ CCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, AdditionalIn ...@@ -62,7 +62,6 @@ CCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, AdditionalIn
// Пересчитываем позиции // Пересчитываем позиции
this.Refresh_DCChanges(); this.Refresh_DCChanges();
this.RefreshPosExtChanges(); this.RefreshPosExtChanges();
// Генерируем свои изменения // Генерируем свои изменения
var StartPoint = ( null === AscCommon.History.SavedIndex ? 0 : AscCommon.History.SavedIndex + 1 ); var StartPoint = ( null === AscCommon.History.SavedIndex ? 0 : AscCommon.History.SavedIndex + 1 );
var LastPoint = -1; var LastPoint = -1;
...@@ -455,9 +454,9 @@ CCollaborativeEditing.prototype.OnCallback_AskLock = function(result) ...@@ -455,9 +454,9 @@ CCollaborativeEditing.prototype.OnCallback_AskLock = function(result)
editor.isChartEditor = false; editor.isChartEditor = false;
}; };
CCollaborativeEditing.prototype.AddPosExtChanges = function(Item, bHor) CCollaborativeEditing.prototype.AddPosExtChanges = function(Item, ChangeObject)
{ {
if(bHor) if(ChangeObject.IsHorizontal())
{ {
this.PosExtChangesX.push(Item); this.PosExtChangesX.push(Item);
} }
...@@ -468,16 +467,22 @@ CCollaborativeEditing.prototype.AddPosExtChanges = function(Item, bHor) ...@@ -468,16 +467,22 @@ CCollaborativeEditing.prototype.AddPosExtChanges = function(Item, bHor)
}; };
CCollaborativeEditing.prototype.RewriteChanges = function(changesArr, scale, Binary_Writer) CCollaborativeEditing.prototype.RewritePosExtChanges = function(changesArr, scale)
{ {
for(var i = 0; i < changesArr.length; ++i) for(var i = 0; i < changesArr.length; ++i)
{ {
var changes = changesArr[i]; var changes = changesArr[i];
var data = changes.Data; var data = changes.Data;
data.newPr *= scale; data.New *= scale;
var Binary_Pos = Binary_Writer.GetCurPosition(); data.Old *= scale;
changes.Class.Save_Changes(data, Binary_Writer); var Binary_Writer = AscCommon.History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition();
Binary_Writer.WriteString2(changes.Class.Get_Id());
Binary_Writer.WriteLong(changes.Data.Type);
changes.Data.WriteToBinary(Binary_Writer);
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos; var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
changes.Binary.Pos = Binary_Pos; changes.Binary.Pos = Binary_Pos;
changes.Binary.Len = Binary_Len; changes.Binary.Len = Binary_Len;
} }
...@@ -487,8 +492,8 @@ CCollaborativeEditing.prototype.RefreshPosExtChanges = function() ...@@ -487,8 +492,8 @@ CCollaborativeEditing.prototype.RefreshPosExtChanges = function()
{ {
if(this.ScaleX != null && this.ScaleY != null) if(this.ScaleX != null && this.ScaleY != null)
{ {
this.RewriteChanges(this.PosExtChangesX, this.ScaleX, AscCommon.History.BinaryWriter); this.RewritePosExtChanges(this.PosExtChangesX, this.ScaleX);
this.RewriteChanges(this.PosExtChangesY, this.ScaleY, AscCommon.History.BinaryWriter); this.RewritePosExtChanges(this.PosExtChangesY, this.ScaleY);
} }
this.PosExtChangesX.length = 0; this.PosExtChangesX.length = 0;
this.PosExtChangesY.length = 0; this.PosExtChangesY.length = 0;
......
...@@ -380,8 +380,8 @@ AscDFH.changesFactory[AscDFH.historyitem_Presentation_AddSlideMaster] = AscDFH.C ...@@ -380,8 +380,8 @@ AscDFH.changesFactory[AscDFH.historyitem_Presentation_AddSlideMaster] = AscDFH.C
AscDFH.changesFactory[AscDFH.historyitem_Presentation_ChangeTheme] = AscDFH.CChangesDrawingChangeTheme ; AscDFH.changesFactory[AscDFH.historyitem_Presentation_ChangeTheme] = AscDFH.CChangesDrawingChangeTheme ;
AscDFH.changesFactory[AscDFH.historyitem_Presentation_SlideSize] = AscDFH.CChangesDrawingsObjectNoId ; AscDFH.changesFactory[AscDFH.historyitem_Presentation_SlideSize] = AscDFH.CChangesDrawingsObjectNoId ;
AscDFH.changesFactory[AscDFH.historyitem_Presentation_ChangeColorScheme] = AscDFH.CChangesDrawingChangeTheme ; AscDFH.changesFactory[AscDFH.historyitem_Presentation_ChangeColorScheme] = AscDFH.CChangesDrawingChangeTheme ;
AscDFH.changesFactory[AscDFH.historyitem_Presentation_RemoveSlide] = AscDFH.CChangesDrawingsContent ; AscDFH.changesFactory[AscDFH.historyitem_Presentation_RemoveSlide] = AscDFH.CChangesDrawingsContentPresentation ;
AscDFH.changesFactory[AscDFH.historyitem_Presentation_AddSlide] = AscDFH.CChangesDrawingsContent ; AscDFH.changesFactory[AscDFH.historyitem_Presentation_AddSlide] = AscDFH.CChangesDrawingsContentPresentation ;
AscDFH.drawingsChangesMap[AscDFH.historyitem_Presentation_SetShowPr] = function(oClass, value){oClass.showPr = value;}; AscDFH.drawingsChangesMap[AscDFH.historyitem_Presentation_SetShowPr] = function(oClass, value){oClass.showPr = value;};
...@@ -393,7 +393,7 @@ AscDFH.drawingContentChanges[AscDFH.historyitem_Presentation_RemoveSlide] = func ...@@ -393,7 +393,7 @@ AscDFH.drawingContentChanges[AscDFH.historyitem_Presentation_RemoveSlide] = func
AscDFH.drawingContentChanges[AscDFH.historyitem_Presentation_AddSlideMaster] = function(oClass){return oClass.slideMasters;}; AscDFH.drawingContentChanges[AscDFH.historyitem_Presentation_AddSlideMaster] = function(oClass){return oClass.slideMasters;};
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_Presentation_SetShowPr] = CShowPr; AscDFH.drawingsConstructorsMap[AscDFH.historyitem_Presentation_SetShowPr] = CShowPr;
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_Presentation_SlideSize] = AscFormat.CDrawingBaseCoordsWritable AscDFH.drawingsConstructorsMap[AscDFH.historyitem_Presentation_SlideSize] = AscFormat.CDrawingBaseCoordsWritable;
function CPresentation(DrawingDocument) function CPresentation(DrawingDocument)
{ {
...@@ -4776,7 +4776,7 @@ CPresentation.prototype = ...@@ -4776,7 +4776,7 @@ CPresentation.prototype =
{ {
if(AscFormat.isRealNumber(pos) && pos > -1 && pos < this.Slides.length) if(AscFormat.isRealNumber(pos) && pos > -1 && pos < this.Slides.length)
{ {
History.Add(new AscDFH.CChangesDrawingsContent(this, AscDFH.historyitem_Presentation_RemoveSlide, pos, [this.Slides[pos]], false)); History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_Presentation_RemoveSlide, pos, [this.Slides[pos]], false));
this.Slides[pos].removeAllCommentsToInterface(); this.Slides[pos].removeAllCommentsToInterface();
return this.Slides.splice(pos, 1)[0]; return this.Slides.splice(pos, 1)[0];
} }
...@@ -4785,7 +4785,7 @@ CPresentation.prototype = ...@@ -4785,7 +4785,7 @@ CPresentation.prototype =
insertSlide: function(pos, slide) insertSlide: function(pos, slide)
{ {
History.Add(new AscDFH.CChangesDrawingsContent(this, AscDFH.historyitem_Presentation_AddSlide, pos, [slide], true)); History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_Presentation_AddSlide, pos, [slide], true));
this.Slides.splice(pos, 0, slide); this.Slides.splice(pos, 0, slide);
}, },
......
...@@ -47,8 +47,8 @@ AscDFH.changesFactory[AscDFH.historyitem_SlideSetNum ] = AscDFH.CC ...@@ -47,8 +47,8 @@ AscDFH.changesFactory[AscDFH.historyitem_SlideSetNum ] = AscDFH.CC
AscDFH.changesFactory[AscDFH.historyitem_SlideSetTiming ] = AscDFH.CChangesDrawingsObjectNoId; AscDFH.changesFactory[AscDFH.historyitem_SlideSetTiming ] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_SlideSetSize ] = AscDFH.CChangesDrawingsObjectNoId; AscDFH.changesFactory[AscDFH.historyitem_SlideSetSize ] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_SlideSetBg ] = AscDFH.CChangesDrawingsObjectNoId; AscDFH.changesFactory[AscDFH.historyitem_SlideSetBg ] = AscDFH.CChangesDrawingsObjectNoId;
AscDFH.changesFactory[AscDFH.historyitem_SlideAddToSpTree ] = AscDFH.CChangesDrawingsContent ; AscDFH.changesFactory[AscDFH.historyitem_SlideAddToSpTree ] = AscDFH.CChangesDrawingsContentPresentation ;
AscDFH.changesFactory[AscDFH.historyitem_SlideRemoveFromSpTree ] = AscDFH.CChangesDrawingsContent ; AscDFH.changesFactory[AscDFH.historyitem_SlideRemoveFromSpTree ] = AscDFH.CChangesDrawingsContentPresentation ;
AscDFH.changesFactory[AscDFH.historyitem_SlideSetCSldName ] = AscDFH.CChangesDrawingsString ; AscDFH.changesFactory[AscDFH.historyitem_SlideSetCSldName ] = AscDFH.CChangesDrawingsString ;
AscDFH.changesFactory[AscDFH.historyitem_SlideSetClrMapOverride ] = AscDFH.CChangesDrawingsObject ; AscDFH.changesFactory[AscDFH.historyitem_SlideSetClrMapOverride ] = AscDFH.CChangesDrawingsObject ;
AscDFH.changesFactory[AscDFH.historyitem_PropLockerSetId ] = AscDFH.CChangesDrawingsString ; AscDFH.changesFactory[AscDFH.historyitem_PropLockerSetId ] = AscDFH.CChangesDrawingsString ;
...@@ -553,7 +553,7 @@ Slide.prototype = ...@@ -553,7 +553,7 @@ Slide.prototype =
{ {
this.checkDrawingUniNvPr(item); this.checkDrawingUniNvPr(item);
var _pos = AscFormat.isRealNumber(pos) ? pos : this.cSld.spTree.length; var _pos = AscFormat.isRealNumber(pos) ? pos : this.cSld.spTree.length;
History.Add(new AscDFH.CChangesDrawingsContent(this, AscDFH.historyitem_SlideAddToSpTree, _pos, [item], true)); History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_SlideAddToSpTree, _pos, [item], true));
this.cSld.spTree.splice(_pos, 0, item); this.cSld.spTree.splice(_pos, 0, item);
}, },
...@@ -620,7 +620,7 @@ Slide.prototype = ...@@ -620,7 +620,7 @@ Slide.prototype =
{ {
if(sp_tree[i].Get_Id() === id) if(sp_tree[i].Get_Id() === id)
{ {
History.Add(new AscDFH.CChangesDrawingsContent(this, AscDFH.historyitem_SlideRemoveFromSpTree, i, [sp_tree[i]], false)); History.Add(new AscDFH.CChangesDrawingsContentPresentation(this, AscDFH.historyitem_SlideRemoveFromSpTree, i, [sp_tree[i]], false));
sp_tree.splice(i, 1); sp_tree.splice(i, 1);
return i; return i;
} }
......
...@@ -100,10 +100,7 @@ CWordCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, Addition ...@@ -100,10 +100,7 @@ CWordCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, Addition
var oChanges = new AscCommon.CCollaborativeChanges(); var oChanges = new AscCommon.CCollaborativeChanges();
oChanges.Set_FromUndoRedo(Item.Class, Item.Data, Item.Binary); oChanges.Set_FromUndoRedo(Item.Class, Item.Data, Item.Binary);
if (Item.Data.IsChangesClass && Item.Data.IsChangesClass()) aChanges2.push(Item.Data);
aChanges2.push(Item.Data);
else
aChanges2.push(oChanges.m_pDatay);
aChanges.push(oChanges.m_pData); aChanges.push(oChanges.m_pData);
} }
...@@ -621,8 +618,8 @@ CWordCollaborativeEditing.prototype.private_CollectOwnChanges = function() ...@@ -621,8 +618,8 @@ CWordCollaborativeEditing.prototype.private_CollectOwnChanges = function()
for (var Index = 0; Index < Point.Items.length; Index++) for (var Index = 0; Index < Point.Items.length; Index++)
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if (Item.Data.IsChangesClass && Item.Data.IsChangesClass())
this.m_oOwnChanges.push(Item.Data); this.m_oOwnChanges.push(Item.Data);
} }
} }
}; };
...@@ -690,7 +687,7 @@ CWordCollaborativeEditing.prototype.Undo = function() ...@@ -690,7 +687,7 @@ CWordCollaborativeEditing.prototype.Undo = function()
for (var nIndex = nCount - 1; nIndex >= 0; --nIndex) for (var nIndex = nCount - 1; nIndex >= 0; --nIndex)
{ {
var oChange = this.m_aAllChanges[nPosition + nIndex]; var oChange = this.m_aAllChanges[nPosition + nIndex];
if (!oChange || !oChange.IsChangesClass || !oChange.IsChangesClass()) if (!oChange)
continue; continue;
var oClass = oChange.GetClass(); var oClass = oChange.GetClass();
...@@ -850,7 +847,7 @@ CWordCollaborativeEditing.prototype.private_CommutateContentChanges = function(o ...@@ -850,7 +847,7 @@ CWordCollaborativeEditing.prototype.private_CommutateContentChanges = function(o
for (var nIndex = nStartPosition, nOverallCount = this.m_aAllChanges.length; nIndex < nOverallCount; ++nIndex) for (var nIndex = nStartPosition, nOverallCount = this.m_aAllChanges.length; nIndex < nOverallCount; ++nIndex)
{ {
var oTempChange = this.m_aAllChanges[nIndex]; var oTempChange = this.m_aAllChanges[nIndex];
if (!oTempChange || !oTempChange.IsChangesClass || !oTempChange.IsChangesClass()) if (!oTempChange)
continue; continue;
if (oChange.IsRelated(oTempChange)) if (oChange.IsRelated(oTempChange))
......
...@@ -243,16 +243,11 @@ CHistory.prototype = ...@@ -243,16 +243,11 @@ CHistory.prototype =
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if (Item.Data && Item.Data.IsChangesClass && Item.Data.IsChangesClass()) if (Item.Data)
{ {
Item.Data.Undo(); Item.Data.Undo();
Item.Data.RefreshRecalcData(); Item.Data.RefreshRecalcData();
} }
else
{
Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
}
this.private_UpdateContentChangesOnUndo(Item); this.private_UpdateContentChangesOnUndo(Item);
} }
} }
...@@ -265,16 +260,11 @@ CHistory.prototype = ...@@ -265,16 +260,11 @@ CHistory.prototype =
for (var Index = Point.Items.length - 1; Index >= 0; Index--) for (var Index = Point.Items.length - 1; Index >= 0; Index--)
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if (Item.Data && Item.Data.IsChangesClass && Item.Data.IsChangesClass()) if (Item.Data)
{ {
Item.Data.Undo(); Item.Data.Undo();
Item.Data.RefreshRecalcData(); Item.Data.RefreshRecalcData();
} }
else
{
Item.Class.Undo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
}
this.private_UpdateContentChangesOnUndo(Item); this.private_UpdateContentChangesOnUndo(Item);
} }
} }
...@@ -302,16 +292,11 @@ CHistory.prototype = ...@@ -302,16 +292,11 @@ CHistory.prototype =
{ {
var Item = Point.Items[Index]; var Item = Point.Items[Index];
if (Item.Data && Item.Data.IsChangesClass && Item.Data.IsChangesClass()) if (Item.Data)
{ {
Item.Data.Redo(); Item.Data.Redo();
Item.Data.RefreshRecalcData(); Item.Data.RefreshRecalcData();
} }
else
{
Item.Class.Redo(Item.Data);
Item.Class.Refresh_RecalcData(Item.Data);
}
this.private_UpdateContentChangesOnRedo(Item); this.private_UpdateContentChangesOnRedo(Item);
} }
...@@ -434,21 +419,14 @@ CHistory.prototype = ...@@ -434,21 +419,14 @@ CHistory.prototype =
var Binary_Pos = this.BinaryWriter.GetCurPosition(); var Binary_Pos = this.BinaryWriter.GetCurPosition();
var Class; var Class;
if (_Class && _Class.IsChangesClass && _Class.IsChangesClass()) if (_Class) {
{ Class = _Class.GetClass();
Class = _Class.GetClass(); Data = _Class;
Data = _Class;
this.BinaryWriter.WriteString2(Class.Get_Id()); this.BinaryWriter.WriteString2(Class.Get_Id());
this.BinaryWriter.WriteLong(_Class.Type); this.BinaryWriter.WriteLong(_Class.Type);
_Class.WriteToBinary(this.BinaryWriter); _Class.WriteToBinary(this.BinaryWriter);
} }
else
{
Class = _Class;
this.BinaryWriter.WriteString2(Class.Get_Id());
Class.Save_Changes(Data, this.BinaryWriter);
}
var Binary_Len = this.BinaryWriter.GetCurPosition() - Binary_Pos; var Binary_Len = this.BinaryWriter.GetCurPosition() - Binary_Pos;
var Item = { var Item = {
...@@ -467,7 +445,7 @@ CHistory.prototype = ...@@ -467,7 +445,7 @@ CHistory.prototype =
if (!this.CollaborativeEditing) if (!this.CollaborativeEditing)
return; return;
if (_Class && _Class.IsChangesClass && _Class.IsChangesClass()) if (_Class)
{ {
if (_Class.IsContentChange()) if (_Class.IsContentChange())
{ {
...@@ -483,55 +461,9 @@ CHistory.prototype = ...@@ -483,55 +461,9 @@ CHistory.prototype =
else else
this.CollaborativeEditing.Update_DocumentPositionsOnRemove(Class, Data.Pos, Count); this.CollaborativeEditing.Update_DocumentPositionsOnRemove(Class, Data.Pos, Count);
} }
} if(_Class.IsPosExtChange()){
else this.CollaborativeEditing.AddPosExtChanges(Item, _Class);
{ }
var bPresentation = !(typeof CPresentation === "undefined");
var bSlide = !(typeof Slide === "undefined");
if (( Class instanceof AscFormat.CDrawingDocContent && ( AscDFH.historyitem_DocumentContent_AddItem === Data.Type || AscDFH.historyitem_DocumentContent_RemoveItem === Data.Type ) ) ||
( bPresentation && Class instanceof CPresentation && (AscDFH.historyitem_Presentation_AddSlide === Data.Type || AscDFH.historyitem_Presentation_RemoveSlide === Data.Type)) ||
( bSlide && Class instanceof Slide && (AscDFH.historyitem_SlideAddToSpTree === Data.Type || AscDFH.historyitem_SlideRemoveFromSpTree === Data.Type))
)
{
var bAdd = ( ( Class instanceof AscFormat.CDrawingDocContent && AscDFH.historyitem_DocumentContent_AddItem === Data.Type ) ||
( bPresentation && Class instanceof CPresentation && (AscDFH.historyitem_Presentation_AddSlide === Data.Type )) ||
( bSlide && Class instanceof Slide && (AscDFH.historyitem_SlideAddToSpTree === Data.Type))
) ? true : false;
var Count = 1;
if (Class instanceof AscFormat.CDrawingDocContent && AscDFH.historyitem_DocumentContent_RemoveItem === Data.Type)
Count = Data.Items.length;
var ContentChanges = new AscCommon.CContentChangesElement(( bAdd == true ? AscCommon.contentchanges_Add : AscCommon.contentchanges_Remove ), Data.Pos, Count, Item);
Class.Add_ContentChanges(ContentChanges);
this.CollaborativeEditing.Add_NewDC(Class);
if (true === bAdd)
this.CollaborativeEditing.Update_DocumentPositionsOnAdd(Class, Data.Pos);
else
this.CollaborativeEditing.Update_DocumentPositionsOnRemove(Class, Data.Pos, Count);
}
}
if (this.CollaborativeEditing.AddPosExtChanges && Class instanceof AscFormat.CXfrm)
{
if (AscDFH.historyitem_Xfrm_SetOffX === Data.Type ||
AscDFH.historyitem_Xfrm_SetOffY === Data.Type ||
AscDFH.historyitem_Xfrm_SetExtX === Data.Type ||
AscDFH.historyitem_Xfrm_SetExtY === Data.Type ||
AscDFH.historyitem_Xfrm_SetChOffX === Data.Type ||
AscDFH.historyitem_Xfrm_SetChOffY === Data.Type ||
AscDFH.historyitem_Xfrm_SetChExtX === Data.Type ||
AscDFH.historyitem_Xfrm_SetChExtY === Data.Type)
{
this.CollaborativeEditing.AddPosExtChanges(Item,
AscDFH.historyitem_Xfrm_SetOffX === Data.Type ||
AscDFH.historyitem_Xfrm_SetExtX === Data.Type ||
AscDFH.historyitem_Xfrm_SetChOffX === Data.Type ||
AscDFH.historyitem_Xfrm_SetChExtX === Data.Type);
}
} }
}, },
......
...@@ -1582,20 +1582,6 @@ CMathBase.prototype.Redo = function(Data) ...@@ -1582,20 +1582,6 @@ CMathBase.prototype.Redo = function(Data)
{ {
Data.Redo(this); Data.Redo(this);
}; };
CMathBase.prototype.Save_Changes = function(Data, Writer)
{
Writer.WriteLong(this.ClassType);
WriteChanges_ToBinary(Data, Writer);
};
CMathBase.prototype.Load_Changes = function(Reader)
{
var ClassType = Reader.GetLong();
if (this.ClassType !== ClassType)
return;
ReadChanges_FromBinary(Reader, this);
};
CMathBase.prototype.Get_AllFontNames = function(AllFonts) CMathBase.prototype.Get_AllFontNames = function(AllFonts)
{ {
this.CtrPrp.Document_Get_AllFontNames(AllFonts); this.CtrPrp.Document_Get_AllFontNames(AllFonts);
......
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