Commit a6f2fa32 authored by Ilya Kirillov's avatar Ilya Kirillov

Send reverted changes to other users. Fixed an issue with copy of some content changes.

parent 7de0aa79
...@@ -660,7 +660,6 @@ CWordCollaborativeEditing.prototype.Undo = function() ...@@ -660,7 +660,6 @@ CWordCollaborativeEditing.prototype.Undo = function()
// Формируем новую пачку действий, которые будут откатывать нужные нам действия. // Формируем новую пачку действий, которые будут откатывать нужные нам действия.
// На первом шаге мы заданнуюю пачку изменений коммутируем с последними измениями. Смотрим на то какой набор // На первом шаге мы заданнуюю пачку изменений коммутируем с последними измениями. Смотрим на то какой набор
// изменений у нас получается. // изменений у нас получается.
// Объектная модель у нас простая: класс, в котором возможно есть массив элементов(тоже классов), у которого воможно // Объектная модель у нас простая: класс, в котором возможно есть массив элементов(тоже классов), у которого воможно
...@@ -710,10 +709,7 @@ CWordCollaborativeEditing.prototype.Undo = function() ...@@ -710,10 +709,7 @@ CWordCollaborativeEditing.prototype.Undo = function()
arrReverseChanges.splice(0, 0, oReverseChange); arrReverseChanges.splice(0, 0, oReverseChange);
} }
// Накатываем изменения в данном клиенте
var oLogicDocument = this.m_oLogicDocument; var oLogicDocument = this.m_oLogicDocument;
oLogicDocument.DrawingDocument.EndTrackTable(null, true); oLogicDocument.DrawingDocument.EndTrackTable(null, true);
...@@ -730,6 +726,26 @@ CWordCollaborativeEditing.prototype.Undo = function() ...@@ -730,6 +726,26 @@ CWordCollaborativeEditing.prototype.Undo = function()
oLogicDocument.Document_UpdateSelectionState(); oLogicDocument.Document_UpdateSelectionState();
oLogicDocument.Document_UpdateInterfaceState(); oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateRulersState(); oLogicDocument.Document_UpdateRulersState();
var oBinaryWriter = History.BinaryWriter;
var aSendingChanges = [];
for (var nIndex = 0, nCount = arrReverseChanges.length; nIndex < nCount; ++nIndex)
{
var oReverseChange = arrReverseChanges[nIndex];
var oChangeClass = oReverseChange.GetClass();
var nBinaryPos = oBinaryWriter.GetCurPosition();
oBinaryWriter.WriteString2(oChangeClass.Get_Id());
oBinaryWriter.WriteLong(oReverseChange.Type);
oReverseChange.WriteToBinary(oBinaryWriter);
var nBinaryLen = oBinaryWriter.GetCurPosition() - nBinaryPos;
var oChange = new AscCommon.CCollaborativeChanges();
oChange.Set_FromUndoRedo(oChangeClass, oReverseChange, {Pos : nBinaryPos, Len : nBinaryLen});
aSendingChanges.push(oChange.m_pData);
}
editor.CoAuthoringApi.saveChanges(aSendingChanges, 0, null);
}; };
CWordCollaborativeEditing.prototype.CanUndo = function() CWordCollaborativeEditing.prototype.CanUndo = function()
{ {
......
...@@ -65,9 +65,9 @@ AscDFH.changesRelationMap[AscDFH.historyitem_Document_MathSettings] = [AscD ...@@ -65,9 +65,9 @@ AscDFH.changesRelationMap[AscDFH.historyitem_Document_MathSettings] = [AscD
* @constructor * @constructor
* @extends {AscDFH.CChangesBaseContentChange} * @extends {AscDFH.CChangesBaseContentChange}
*/ */
function CChangesDocumentAddItem(Class, Pos, Item) function CChangesDocumentAddItem(Class, Pos, Items)
{ {
CChangesDocumentAddItem.superclass.constructor.call(this, Class, Pos, [Item], true); CChangesDocumentAddItem.superclass.constructor.call(this, Class, Pos, Items, true);
} }
AscCommon.extendClass(CChangesDocumentAddItem, AscDFH.CChangesBaseContentChange); AscCommon.extendClass(CChangesDocumentAddItem, AscDFH.CChangesBaseContentChange);
CChangesDocumentAddItem.prototype.Type = AscDFH.historyitem_Document_AddItem; CChangesDocumentAddItem.prototype.Type = AscDFH.historyitem_Document_AddItem;
......
...@@ -8332,7 +8332,7 @@ CDocumentContent.prototype.Internal_Content_Add = function(Position, NewOb ...@@ -8332,7 +8332,7 @@ CDocumentContent.prototype.Internal_Content_Add = function(Position, NewOb
NextObj = null; NextObj = null;
this.private_RecalculateNumbering([NewObject]); this.private_RecalculateNumbering([NewObject]);
History.Add(new CChangesDocumentContentAddItem(this, Position, NewObject)); History.Add(new CChangesDocumentContentAddItem(this, Position, [NewObject]));
this.Content.splice(Position, 0, NewObject); this.Content.splice(Position, 0, NewObject);
NewObject.Set_Parent(this); NewObject.Set_Parent(this);
NewObject.Set_DocumentNext(NextObj); NewObject.Set_DocumentNext(NextObj);
......
...@@ -57,9 +57,9 @@ AscDFH.changesRelationMap[AscDFH.historyitem_DocumentContent_RemoveItem] = [ ...@@ -57,9 +57,9 @@ AscDFH.changesRelationMap[AscDFH.historyitem_DocumentContent_RemoveItem] = [
* @constructor * @constructor
* @extends {AscDFH.CChangesBaseContentChange} * @extends {AscDFH.CChangesBaseContentChange}
*/ */
function CChangesDocumentContentAddItem(Class, Pos, Item) function CChangesDocumentContentAddItem(Class, Pos, Items)
{ {
CChangesDocumentContentAddItem.superclass.constructor.call(this, Class, Pos, [Item], true); CChangesDocumentContentAddItem.superclass.constructor.call(this, Class, Pos, Items, true);
} }
AscCommon.extendClass(CChangesDocumentContentAddItem, AscDFH.CChangesBaseContentChange); AscCommon.extendClass(CChangesDocumentContentAddItem, AscDFH.CChangesBaseContentChange);
CChangesDocumentContentAddItem.prototype.Type = AscDFH.historyitem_DocumentContent_AddItem; CChangesDocumentContentAddItem.prototype.Type = AscDFH.historyitem_DocumentContent_AddItem;
......
...@@ -2513,7 +2513,7 @@ CTable.prototype = ...@@ -2513,7 +2513,7 @@ CTable.prototype =
for ( var Index = 0; Index < Rows; Index++ ) for ( var Index = 0; Index < Rows; Index++ )
{ {
Table.Content[Index] = this.Content[Index].Copy( Table ); Table.Content[Index] = this.Content[Index].Copy( Table );
History.Add(new CChangesTableAddRow(Table, Index, Table.Content[Index])); History.Add(new CChangesTableAddRow(Table, Index, [Table.Content[Index]]));
} }
Table.Internal_ReIndexing(0); Table.Internal_ReIndexing(0);
...@@ -6770,7 +6770,7 @@ CTable.prototype = ...@@ -6770,7 +6770,7 @@ CTable.prototype =
// Добавляем ячейку // Добавляем ячейку
Row.Content[CurCell] = CellInfo.Cell.Copy(Row); Row.Content[CurCell] = CellInfo.Cell.Copy(Row);
History.Add(new CChangesTableRowAddCell(Row, CurCell, Row.Content[CurCell])); History.Add(new CChangesTableRowAddCell(Row, CurCell, [Row.Content[CurCell]]));
CurCell++; CurCell++;
var VMerge = CellInfo.Cell.Get_VMerge(); var VMerge = CellInfo.Cell.Get_VMerge();
...@@ -6798,7 +6798,7 @@ CTable.prototype = ...@@ -6798,7 +6798,7 @@ CTable.prototype =
// Добавляем строку в новую таблицу // Добавляем строку в новую таблицу
Table.Content[CurRow2] = Row; Table.Content[CurRow2] = Row;
History.Add(new CChangesTableAddRow(Table, CurRow2, Table.Content[CurRow2])); History.Add(new CChangesTableAddRow(Table, CurRow2, [Table.Content[CurRow2]]));
CurRow2++; CurRow2++;
} }
...@@ -10193,7 +10193,7 @@ CTable.prototype = ...@@ -10193,7 +10193,7 @@ CTable.prototype =
this.Content[Index].PreDelete(); this.Content[Index].PreDelete();
History.Add(new CChangesTableRemoveRow(this, Index, this.Content[Index])); History.Add(new CChangesTableRemoveRow(this, Index, [this.Content[Index]]));
this.Rows--; this.Rows--;
this.Content.splice(Index, 1); this.Content.splice(Index, 1);
...@@ -10215,7 +10215,7 @@ CTable.prototype = ...@@ -10215,7 +10215,7 @@ CTable.prototype =
var NewRow = ( undefined === _NewRow ? new CTableRow( this, CellsCount ) : _NewRow ); var NewRow = ( undefined === _NewRow ? new CTableRow( this, CellsCount ) : _NewRow );
History.Add(new CChangesTableAddRow(this, Index, NewRow)); History.Add(new CChangesTableAddRow(this, Index, [NewRow]));
this.Content.splice( Index, 0, NewRow ); this.Content.splice( Index, 0, NewRow );
this.TableRowsBottom.splice( Index, 0, {} ); this.TableRowsBottom.splice( Index, 0, {} );
......
...@@ -593,9 +593,9 @@ CChangesTableInline.prototype.private_SetValue = function(Value) ...@@ -593,9 +593,9 @@ CChangesTableInline.prototype.private_SetValue = function(Value)
* @constructor * @constructor
* @extends {AscDFH.CChangesBaseContentChange} * @extends {AscDFH.CChangesBaseContentChange}
*/ */
function CChangesTableAddRow(Class, Pos, Row) function CChangesTableAddRow(Class, Pos, Rows)
{ {
CChangesTableAddRow.superclass.constructor.call(this, Class, Pos, [Row], true); CChangesTableAddRow.superclass.constructor.call(this, Class, Pos, Rows, true);
} }
AscCommon.extendClass(CChangesTableAddRow, AscDFH.CChangesBaseContentChange); AscCommon.extendClass(CChangesTableAddRow, AscDFH.CChangesBaseContentChange);
CChangesTableAddRow.prototype.Type = AscDFH.historyitem_Table_AddRow; CChangesTableAddRow.prototype.Type = AscDFH.historyitem_Table_AddRow;
...@@ -666,9 +666,9 @@ CChangesTableAddRow.prototype.CreateReverseChange = function() ...@@ -666,9 +666,9 @@ CChangesTableAddRow.prototype.CreateReverseChange = function()
* @constructor * @constructor
* @extends {AscDFH.CChangesBaseContentChange} * @extends {AscDFH.CChangesBaseContentChange}
*/ */
function CChangesTableRemoveRow(Class, Pos, Row) function CChangesTableRemoveRow(Class, Pos, Rows)
{ {
CChangesTableRemoveRow.superclass.constructor.call(this, Class, Pos, [Row], false); CChangesTableRemoveRow.superclass.constructor.call(this, Class, Pos, Rows, false);
} }
AscCommon.extendClass(CChangesTableRemoveRow, AscDFH.CChangesBaseContentChange); AscCommon.extendClass(CChangesTableRemoveRow, AscDFH.CChangesBaseContentChange);
CChangesTableRemoveRow.prototype.Type = AscDFH.historyitem_Table_RemoveRow; CChangesTableRemoveRow.prototype.Type = AscDFH.historyitem_Table_RemoveRow;
......
...@@ -580,7 +580,7 @@ CTableRow.prototype = ...@@ -580,7 +580,7 @@ CTableRow.prototype =
Remove_Cell : function(Index) Remove_Cell : function(Index)
{ {
History.Add(new CChangesTableRowRemoveCell(this, Index, this.Content[Index])); History.Add(new CChangesTableRowRemoveCell(this, Index, [this.Content[Index]]));
this.Content.splice(Index, 1); this.Content.splice(Index, 1);
this.CellsInfo.splice(Index, 1); this.CellsInfo.splice(Index, 1);
......
...@@ -410,9 +410,9 @@ CChangesTableRowHeight.prototype.Merge = private_TableRowChangesOnMergePr; ...@@ -410,9 +410,9 @@ CChangesTableRowHeight.prototype.Merge = private_TableRowChangesOnMergePr;
* @constructor * @constructor
* @extends {AscDFH.CChangesBaseContentChange} * @extends {AscDFH.CChangesBaseContentChange}
*/ */
function CChangesTableRowAddCell(Class, Pos, Cell) function CChangesTableRowAddCell(Class, Pos, Cells)
{ {
CChangesTableRowAddCell.superclass.constructor.call(this, Class, Pos, [Cell], true); CChangesTableRowAddCell.superclass.constructor.call(this, Class, Pos, Cells, true);
} }
AscCommon.extendClass(CChangesTableRowAddCell, AscDFH.CChangesBaseContentChange); AscCommon.extendClass(CChangesTableRowAddCell, AscDFH.CChangesBaseContentChange);
CChangesTableRowAddCell.prototype.Type = AscDFH.historyitem_TableRow_AddCell; CChangesTableRowAddCell.prototype.Type = AscDFH.historyitem_TableRow_AddCell;
...@@ -477,9 +477,9 @@ CChangesTableRowAddCell.prototype.CreateReverseChange = function() ...@@ -477,9 +477,9 @@ CChangesTableRowAddCell.prototype.CreateReverseChange = function()
* @constructor * @constructor
* @extends {AscDFH.CChangesBaseContentChange} * @extends {AscDFH.CChangesBaseContentChange}
*/ */
function CChangesTableRowRemoveCell(Class, Pos, Cell) function CChangesTableRowRemoveCell(Class, Pos, Cells)
{ {
CChangesTableRowRemoveCell.superclass.constructor.call(this, Class, Pos, [Cell], false); CChangesTableRowRemoveCell.superclass.constructor.call(this, Class, Pos, Cells, false);
} }
AscCommon.extendClass(CChangesTableRowRemoveCell, AscDFH.CChangesBaseContentChange); AscCommon.extendClass(CChangesTableRowRemoveCell, AscDFH.CChangesBaseContentChange);
CChangesTableRowRemoveCell.prototype.Type = AscDFH.historyitem_TableRow_RemoveCell; CChangesTableRowRemoveCell.prototype.Type = AscDFH.historyitem_TableRow_RemoveCell;
......
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