Commit 6d38edf8 authored by Ilya Kirillov's avatar Ilya Kirillov

Classes CMathContent/CMathBase/ParaField are now inherit from a new class...

Classes CMathContent/CMathBase/ParaField are now inherit from a new class CChangesBaseContentChange.
parent b0c742aa
......@@ -2899,6 +2899,10 @@
{
return this.Add;
};
CChangesBaseContentChange.prototype.GetItemsCount = function()
{
return this.Items.length;
};
CChangesBaseContentChange.prototype.WriteToBinary = function(Writer)
{
// Long : Количество элементов
......
......@@ -42,19 +42,13 @@ AscDFH.changesFactory[AscDFH.historyitem_Field_RemoveItem] = CChangesParaFieldRe
/**
* @constructor
* @extends {AscDFH.CChangesBase}
* @extends {AscDFH.CChangesBaseContentChange}
*/
function CChangesParaFieldAddItem(Class, Pos, Items)
{
CChangesParaFieldAddItem.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
CChangesParaFieldAddItem.superclass.constructor.call(this, Class, Pos, Items, true);
}
AscCommon.extendClass(CChangesParaFieldAddItem, AscDFH.CChangesBase);
AscCommon.extendClass(CChangesParaFieldAddItem, AscDFH.CChangesBaseContentChange);
CChangesParaFieldAddItem.prototype.Type = AscDFH.historyitem_Field_AddItem;
CChangesParaFieldAddItem.prototype.Undo = function()
{
......@@ -74,48 +68,13 @@ CChangesParaFieldAddItem.prototype.Redo = function()
oField.private_UpdateTrackRevisions();
oField.protected_UpdateSpellChecking();
};
CChangesParaFieldAddItem.prototype.WriteToBinary = function(Writer)
CChangesParaFieldAddItem.prototype.private_WriteItem = function(Writer, Item)
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// Variable : Id элемента
// }
var bArray = this.UseArray;
var nCount = this.Items.length;
Writer.WriteLong(nCount);
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
if (true === bArray)
Writer.WriteLong(this.PosArray[nIndex]);
else
Writer.WriteLong(this.Pos + nIndex);
Writer.WriteString2(this.Items[nIndex].Get_Id());
}
Writer.WriteString2(Item.Get_Id());
};
CChangesParaFieldAddItem.prototype.ReadFromBinary = function(Reader)
CChangesParaFieldAddItem.prototype.private_ReadItem = function(Reader)
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// Variable : Id Элемента
// }
this.UseArray = true;
this.Items = [];
this.PosArray = [];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
return AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesParaFieldAddItem.prototype.Load = function(Color)
{
......@@ -137,19 +96,13 @@ CChangesParaFieldAddItem.prototype.Load = function(Color)
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
* @extends {AscDFH.CChangesBaseContentChange}
*/
function CChangesParaFieldRemoveItem(Class, Pos, Items)
{
CChangesParaFieldRemoveItem.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
CChangesParaFieldRemoveItem.superclass.constructor.call(this, Class, Pos, Items, false);
}
AscCommon.extendClass(CChangesParaFieldRemoveItem, AscDFH.CChangesBase);
AscCommon.extendClass(CChangesParaFieldRemoveItem, AscDFH.CChangesBaseContentChange);
CChangesParaFieldRemoveItem.prototype.Type = AscDFH.historyitem_Field_RemoveItem;
CChangesParaFieldRemoveItem.prototype.Undo = function()
{
......@@ -169,67 +122,13 @@ CChangesParaFieldRemoveItem.prototype.Redo = function()
oField.private_UpdateTrackRevisions();
oField.protected_UpdateSpellChecking();
};
CChangesParaFieldRemoveItem.prototype.WriteToBinary = function(Writer)
CChangesParaFieldRemoveItem.prototype.private_WriteItem = function(Writer, Item)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемых элементов
// }
var bArray = this.UseArray;
var nCount = this.Items.length;
var nStartPos = Writer.GetCurPosition();
Writer.Skip(4);
var nRealCount = nCount;
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
if (true === bArray)
{
if (false === this.PosArray[nIndex])
{
nRealCount--;
}
else
{
Writer.WriteLong(this.PosArray[nIndex]);
Writer.WriteString2(this.Items[nIndex]);
}
}
else
{
Writer.WriteLong(this.Pos);
Writer.WriteString2(this.Items[nIndex]);
}
}
var nEndPos = Writer.GetCurPosition();
Writer.Seek(nStartPos);
Writer.WriteLong(nRealCount);
Writer.Seek(nEndPos);
Writer.WriteString2(Item.Get_Id());
};
CChangesParaFieldRemoveItem.prototype.ReadFromBinary = function(Reader)
CChangesParaFieldRemoveItem.prototype.private_ReadItem = function(Reader)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемых элементов
// }
this.UseArray = true;
this.Items = [];
this.PosArray = [];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
return AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesParaFieldRemoveItem.prototype.Load = function(Color)
{
......
......@@ -413,7 +413,7 @@ CHistory.prototype =
// Заглушка на случай, если у нас во время создания одной точки в истории, после нескольких изменений идет
// пересчет, потом снова добавляются изменения и снова запускается пересчет и т.д.
if ( this.RecIndex >= this.Index )
if (this.RecIndex >= this.Index)
this.RecIndex = this.Index - 1;
var Binary_Pos = this.BinaryWriter.GetCurPosition();
......@@ -447,54 +447,62 @@ CHistory.prototype =
NeedRecalc : !this.MinorChanges
};
this.Points[this.Index].Items.push( Item );
this.Points[this.Index].Items.push(Item);
if (!this.CollaborativeEditing)
return;
if (_Class && _Class.IsChangesClass && _Class.IsChangesClass())
{
if (_Class.IsContentChange())
{
var bAdd = _Class.IsAdd();
var Count = _Class.GetItemsCount();
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);
}
}
else
{
var bPresentation = !(typeof CPresentation === "undefined");
var bSlide = !(typeof Slide === "undefined");
if ( ( Class instanceof CDocument && ( AscDFH.historyitem_Document_AddItem === Data.Type || AscDFH.historyitem_Document_RemoveItem === Data.Type ) ) ||
(((Class instanceof CDocumentContent || Class instanceof AscFormat.CDrawingDocContent)) && ( AscDFH.historyitem_DocumentContent_AddItem === Data.Type || AscDFH.historyitem_DocumentContent_RemoveItem === Data.Type ) ) ||
( Class instanceof CTable && ( AscDFH.historyitem_Table_AddRow === Data.Type || AscDFH.historyitem_Table_RemoveRow === Data.Type ) ) ||
( Class instanceof CTableRow && ( AscDFH.historyitem_TableRow_AddCell === Data.Type || AscDFH.historyitem_TableRow_RemoveCell === Data.Type ) ) ||
( Class instanceof Paragraph && ( AscDFH.historyitem_Paragraph_AddItem === Data.Type || AscDFH.historyitem_Paragraph_RemoveItem === Data.Type ) ) ||
( Class instanceof ParaHyperlink && ( AscDFH.historyitem_Hyperlink_AddItem === Data.Type || AscDFH.historyitem_Hyperlink_RemoveItem === Data.Type ) ) ||
( Class instanceof ParaRun && ( AscDFH.historyitem_ParaRun_AddItem === Data.Type || AscDFH.historyitem_ParaRun_RemoveItem === Data.Type ) ) ||
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 CDocument && AscDFH.historyitem_Document_AddItem === Data.Type ) ||
( ((Class instanceof CDocumentContent || Class instanceof AscFormat.CDrawingDocContent)) && AscDFH.historyitem_DocumentContent_AddItem === Data.Type ) ||
( Class instanceof CTable && AscDFH.historyitem_Table_AddRow === Data.Type ) ||
( Class instanceof CTableRow && AscDFH.historyitem_TableRow_AddCell === Data.Type ) ||
( Class instanceof Paragraph && AscDFH.historyitem_Paragraph_AddItem === Data.Type ) ||
( Class instanceof ParaHyperlink && AscDFH.historyitem_Hyperlink_AddItem === Data.Type ) ||
( Class instanceof ParaRun && AscDFH.historyitem_ParaRun_AddItem === 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 Paragraph ) || ( Class instanceof ParaHyperlink) || ( Class instanceof ParaRun ) ||
( Class instanceof CDocument && AscDFH.historyitem_Document_RemoveItem === Data.Type ) ||
( ((Class instanceof CDocumentContent || Class instanceof AscFormat.CDrawingDocContent)) && AscDFH.historyitem_DocumentContent_RemoveItem === Data.Type ) )
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 );
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 (this.CollaborativeEditing.AddPosExtChanges && Class instanceof AscFormat.CXfrm)
{
if(AscDFH.historyitem_Xfrm_SetOffX === Data.Type ||
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 ||
......@@ -507,7 +515,7 @@ CHistory.prototype =
AscDFH.historyitem_Xfrm_SetOffX === Data.Type ||
AscDFH.historyitem_Xfrm_SetExtX === Data.Type ||
AscDFH.historyitem_Xfrm_SetChOffX === Data.Type ||
AscDFH.historyitem_Xfrm_SetChExtX === Data.Type );
AscDFH.historyitem_Xfrm_SetChExtX === Data.Type);
}
}
},
......
......@@ -96,19 +96,13 @@ AscDFH.changesFactory[AscDFH.historyitem_MathDegree_SubSupType] = CChangesMat
/**
* @constructor
* @extends {AscDFH.CChangesBase}
* @extends {AscDFH.CChangesBaseContentChange}
*/
function CChangesMathContentAddItem(Class, Pos, Items)
{
CChangesMathContentAddItem.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
CChangesMathContentAddItem.superclass.constructor.call(this, Class, Pos, Items, true);
}
AscCommon.extendClass(CChangesMathContentAddItem, AscDFH.CChangesBase);
AscCommon.extendClass(CChangesMathContentAddItem, AscDFH.CChangesBaseContentChange);
CChangesMathContentAddItem.prototype.Type = AscDFH.historyitem_MathContent_AddItem;
CChangesMathContentAddItem.prototype.Undo = function()
{
......@@ -127,55 +121,20 @@ CChangesMathContentAddItem.prototype.Redo = function()
for (var nIndex = 0; nIndex < this.Items.length; ++nIndex)
this.Items[nIndex].Recalc_RunsCompiledPr();
};
CChangesMathContentAddItem.prototype.WriteToBinary = function(Writer)
CChangesMathContentAddItem.prototype.private_WriteItem = function(Writer, Item)
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// Variable : Id элемента
// }
var bArray = this.UseArray;
var nCount = this.Items.length;
Writer.WriteLong(nCount);
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
if (true === bArray)
Writer.WriteLong(this.PosArray[nIndex]);
else
Writer.WriteLong(this.Pos + nIndex);
Writer.WriteString2(this.Items[nIndex].Get_Id());
}
Writer.WriteString2(Item.Get_Id());
};
CChangesMathContentAddItem.prototype.ReadFromBinary = function(Reader)
CChangesMathContentAddItem.prototype.private_ReadItem = function(Reader)
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// Variable : Id Элемента
// }
this.UseArray = true;
this.Items = [];
this.PosArray = [];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
return AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesMathContentAddItem.prototype.Load = function(Color)
{
var oMathContent = this.Class;
for (var nIndex = 0, nCount = this.Items.length; nIndex < nCount; ++nIndex)
{
var Pos = this.PosArray[nIndex];
var Pos = oMathContent.m_oContentChanges.Check(AscCommon.contentchanges_Add, this.PosArray[nIndex]);
var Element = this.Items[nIndex];
if (null != Element)
......@@ -188,19 +147,13 @@ CChangesMathContentAddItem.prototype.Load = function(Color)
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
* @extends {AscDFH.CChangesBaseContentChange}
*/
function CChangesMathContentRemoveItem(Class, Pos, Items)
{
CChangesMathContentRemoveItem.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
CChangesMathContentRemoveItem.superclass.constructor.call(this, Class, Pos, Items, false);
}
AscCommon.extendClass(CChangesMathContentRemoveItem, AscDFH.CChangesBase);
AscCommon.extendClass(CChangesMathContentRemoveItem, AscDFH.CChangesBaseContentChange);
CChangesMathContentRemoveItem.prototype.Type = AscDFH.historyitem_MathContent_RemoveItem;
CChangesMathContentRemoveItem.prototype.Undo = function()
{
......@@ -219,74 +172,20 @@ CChangesMathContentRemoveItem.prototype.Redo = function()
var oMathContent = this.Class;
oMathContent.Content.splice(this.Pos, this.Items.length);
};
CChangesMathContentRemoveItem.prototype.WriteToBinary = function(Writer)
CChangesMathContentRemoveItem.prototype.private_WriteItem = function(Writer, Item)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемых элементов
// }
var bArray = this.UseArray;
var nCount = this.Items.length;
var nStartPos = Writer.GetCurPosition();
Writer.Skip(4);
var nRealCount = nCount;
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
if (true === bArray)
{
if (false === this.PosArray[nIndex])
{
nRealCount--;
}
else
{
Writer.WriteLong(this.PosArray[nIndex]);
Writer.WriteString2(this.Items[nIndex]);
}
}
else
{
Writer.WriteLong(this.Pos);
Writer.WriteString2(this.Items[nIndex]);
}
}
var nEndPos = Writer.GetCurPosition();
Writer.Seek(nStartPos);
Writer.WriteLong(nRealCount);
Writer.Seek(nEndPos);
Writer.WriteString2(Item.Get_Id());
};
CChangesMathContentRemoveItem.prototype.ReadFromBinary = function(Reader)
CChangesMathContentRemoveItem.prototype.private_ReadItem = function(Reader)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемых элементов
// }
this.UseArray = true;
this.Items = [];
this.PosArray = [];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
return AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesMathContentRemoveItem.prototype.Load = function(Color)
{
var oMathContent = this.Class;
for (var nIndex = 0, nCount = this.Items.length; nIndex < nCount; ++nIndex)
{
var ChangesPos = this.PosArray[nIndex];
var ChangesPos = oMathContent.m_oContentChanges.Check(AscCommon.contentchanges_Remove, this.PosArray[nIndex]);
if (false === ChangesPos)
continue;
......@@ -332,19 +231,13 @@ CChangesMathParaJc.prototype.private_SetValue = function(Value)
/**
* @constructor
* @extends {AscDFH.CChangesBase}
* @extends {AscDFH.CChangesBaseContentChange}
*/
function CChangesMathBaseAddItems(Class, Pos, Items)
{
CChangesMathBaseAddItems.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
CChangesMathBaseAddItems.superclass.constructor.call(this, Class, Pos, Items, true);
}
AscCommon.extendClass(CChangesMathBaseAddItems, AscDFH.CChangesBase);
AscCommon.extendClass(CChangesMathBaseAddItems, AscDFH.CChangesBaseContentChange);
CChangesMathBaseAddItems.prototype.Type = AscDFH.historyitem_MathBase_AddItems;
CChangesMathBaseAddItems.prototype.Undo = function()
{
......@@ -354,64 +247,41 @@ CChangesMathBaseAddItems.prototype.Redo = function()
{
this.Class.raw_AddToContent(this.Pos, this.Items, false);
};
CChangesMathBaseAddItems.prototype.WriteToBinary = function(Writer)
CChangesMathBaseAddItems.prototype.private_WriteItem = function(Writer, Item)
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// Variable : Id элемента
// }
var bArray = this.UseArray;
var nCount = this.Items.length;
Writer.WriteLong(nCount);
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
if (true === bArray)
Writer.WriteLong(this.PosArray[nIndex]);
else
Writer.WriteLong(this.Pos + nIndex);
Writer.WriteString2(this.Items[nIndex].Get_Id());
}
Writer.WriteString2(Item.Get_Id());
};
CChangesMathBaseAddItems.prototype.ReadFromBinary = function(Reader)
CChangesMathBaseAddItems.prototype.private_ReadItem = function(Reader)
{
// Long : Количество элементов
// Array of :
// {
// Long : Позиция
// Variable : Id Элемента
// }
this.UseArray = true;
this.Items = [];
this.PosArray = [];
return AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesMathBaseAddItems.prototype.Load = function(Color)
{
var oMathBase = this.Class;
for (var nIndex = 0, nCount = this.Items.length; nIndex < nCount; ++nIndex)
{
var Pos = oMathBase.m_oContentChanges.Check(AscCommon.contentchanges_Add, this.PosArray[nIndex]);
var Element = this.Items[nIndex];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
if (null !== Element)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
oMathBase.Content.splice(Pos, 0, Element);
Element.ParentElement = oMathBase;
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnAdd(oMathBase, Pos);
}
}
oMathBase.fillContent();
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
* @extends {AscDFH.CChangesBaseContentChange}
*/
function CChangesMathBaseRemoveItems(Class, Pos, Items)
{
CChangesMathBaseRemoveItems.superclass.constructor.call(this, Class);
this.Pos = Pos;
this.Items = Items;
this.UseArray = false;
this.PosArray = [];
CChangesMathBaseRemoveItems.superclass.constructor.call(this, Class, Pos, Items, false);
}
AscCommon.extendClass(CChangesMathBaseRemoveItems, AscDFH.CChangesBase);
AscCommon.extendClass(CChangesMathBaseRemoveItems, AscDFH.CChangesBaseContentChange);
CChangesMathBaseRemoveItems.prototype.Type = AscDFH.historyitem_MathBase_RemoveItems;
CChangesMathBaseRemoveItems.prototype.Undo = function()
{
......@@ -421,72 +291,27 @@ CChangesMathBaseRemoveItems.prototype.Redo = function()
{
this.Class.raw_RemoveFromContent(this.Pos, this.Items.length);
};
CChangesMathBaseRemoveItems.prototype.WriteToBinary = function(Writer)
CChangesMathBaseRemoveItems.prototype.private_WriteItem = function(Writer, Item)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемых элементов
// }
var bArray = this.UseArray;
var nCount = this.Items.length;
var nStartPos = Writer.GetCurPosition();
Writer.Skip(4);
var nRealCount = nCount;
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
if (true === bArray)
{
if (false === this.PosArray[nIndex])
{
nRealCount--;
}
else
{
Writer.WriteLong(this.PosArray[nIndex]);
Writer.WriteString2(this.Items[nIndex]);
}
}
else
{
Writer.WriteLong(this.Pos);
Writer.WriteString2(this.Items[nIndex]);
}
}
var nEndPos = Writer.GetCurPosition();
Writer.Seek(nStartPos);
Writer.WriteLong(nRealCount);
Writer.Seek(nEndPos);
Writer.WriteString2(Item.Get_Id());
};
CChangesMathBaseRemoveItems.prototype.ReadFromBinary = function(Reader)
CChangesMathBaseRemoveItems.prototype.private_ReadItem = function(Reader)
{
// Long : Количество удаляемых элементов
// Array of
// {
// Long : позиции удаляемых элементов
// String : id удаляемых элементов
// }
this.UseArray = true;
this.Items = [];
this.PosArray = [];
var nCount = Reader.GetLong();
for (var nIndex = 0; nIndex < nCount; ++nIndex)
{
this.PosArray[nIndex] = Reader.GetLong();
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
return AscCommon.g_oTableId.Get_ById(Reader.GetString2());
};
CChangesMathBaseRemoveItems.prototype.Load = function()
{
this.Redo();
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnRemove(this.Class, this.Pos, this.Items.length);
var oMathBase = this.Class;
for (var nIndex = 0, nCount = this.Items.length; nIndex < nCount; ++nIndex)
{
var ChangesPos = oMathBase.m_oContentChanges.Check(AscCommon.contentchanges_Remove, this.PosArray[nIndex]);
if (false === ChangesPos)
continue;
oMathBase.Content.splice(ChangesPos, 1);
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnRemove(oMathBase, ChangesPos, 1);
}
oMathBase.fillContent();
};
/**
* @constructor
......@@ -1471,11 +1296,6 @@ CChangesMathMatrixRemoveRow.prototype.ReadFromBinary = function(Reader)
this.Items[nIndex] = AscCommon.g_oTableId.Get_ById(Reader.GetString2());
}
};
CChangesMathMatrixRemoveRow.prototype.Load = function(Color)
{
this.Redo();
AscCommon.CollaborativeEditing.Update_DocumentPositionsOnRemove(this.Class, this.Pos, this.Items.length);
};
/**
* @constructor
* @extends {AscDFH.CChangesBase}
......
......@@ -183,6 +183,8 @@ function CMathBase(bInside)
this.ReviewInfo.Update();
}
this.m_oContentChanges = new AscCommon.CContentChanges(); // список изменений(добавление/удаление элементов)
return this;
}
AscCommon.extendClass(CMathBase, CParagraphContentWithParagraphLikeContent);
......@@ -2854,6 +2856,18 @@ CMathBase.prototype.Is_ContentUse = function(MathContent)
return false;
};
CMathBase.prototype.Clear_ContentChanges = function()
{
this.m_oContentChanges.Clear();
};
CMathBase.prototype.Add_ContentChanges = function(Changes)
{
this.m_oContentChanges.Add(Changes);
};
CMathBase.prototype.Refresh_ContentChanges = function()
{
this.m_oContentChanges.Refresh();
};
function CMathBasePr()
{
......
......@@ -1232,6 +1232,8 @@ function CMathContent()
this.size = new CMathSize();
this.m_oContentChanges = new AscCommon.CContentChanges(); // список изменений(добавление/удаление элементов)
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
AscCommon.g_oTableId.Add( this, this.Id );
}
......@@ -5644,6 +5646,18 @@ CMathContent.prototype.private_CanAutoCorrectTextFunc = function( AutoCorrection
return Result;
};
CMathContent.prototype.Clear_ContentChanges = function()
{
this.m_oContentChanges.Clear();
};
CMathContent.prototype.Add_ContentChanges = function(Changes)
{
this.m_oContentChanges.Add(Changes);
};
CMathContent.prototype.Refresh_ContentChanges = function()
{
this.m_oContentChanges.Refresh();
};
function AutoCorrectionControl (AutoCorrectionEngine, ParaMath)
{
......
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