Commit 9cd6b442 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

CContentChangesElement перенес в editorscommon.js

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62519 954022d7-b5bf-4e40-9824-e11837661b57
parent bcf20d73
......@@ -1539,5 +1539,103 @@ CContentChanges.prototype.Refresh = function()
}
};
function CContentChangesElement(Type, Pos, Count, Data) {
this.m_nType = Type; // Тип изменений (удаление или добавление)
this.m_nCount = Count; // Количество добавленных/удаленных элементов
this.m_pData = Data; // Связанные с данным изменением данные из истории
// Разбиваем сложное действие на простейшие
this.m_aPositions = this.Make_ArrayOfSimpleActions( Type, Pos, Count );
}
CContentChangesElement.prototype.Refresh_BinaryData = function()
{
var Binary_Writer = History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition();
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 );
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
};
CContentChangesElement.prototype.Check_Changes = function(Type, Pos)
{
var CurPos = Pos;
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos <= this.m_aPositions[Index] )
this.m_aPositions[Index]++;
else
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
}
}
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos < this.m_aPositions[Index] )
this.m_aPositions[Index]--;
else if ( CurPos > this.m_aPositions[Index] )
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
else //if ( CurPos === this.m_aPositions[Index] )
{
if ( contentchanges_Remove === this.m_nType )
{
// Отмечаем, что действия совпали
this.m_aPositions[Index] = false;
return false;
}
else
{
CurPos++;
}
}
}
}
}
return CurPos;
};
CContentChangesElement.prototype.Make_ArrayOfSimpleActions = function(Type, Pos, Count)
{
// Разбиваем действие на простейшие
var Positions = [];
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos + Index;
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos;
}
return Positions;
};
var g_oIdCounter = new CIdCounter();
var g_oTableId = null;
\ No newline at end of file
......@@ -5,15 +5,9 @@ if(window.editor === "undefined" && window["Asc"]["editor"])
window.editor = window["Asc"]["editor"];
}
function CContentChangesElement(Type, Pos, Count, Data)
// ToDo убрать это отсюда!!!
CContentChangesElement.prototype.Refresh_BinaryData = function()
{
this.m_nType = Type; // Тип изменений (удаление или добавление)
this.m_nCount = Count; // Количество добавленных/удаленных элементов
this.m_pData = Data; // Связанные с данным изменением данные из истории
this.Refresh_BinaryData = function()
{
this.m_pData.Pos = this.m_aPositions[0];
if(editor && editor.isPresentationEditor)
......@@ -31,85 +25,7 @@ function CContentChangesElement(Type, Pos, Count, Data)
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
}
};
this.Check_Changes = function(Type, Pos)
{
var CurPos = Pos;
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos <= this.m_aPositions[Index] )
this.m_aPositions[Index]++;
else
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
}
}
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos < this.m_aPositions[Index] )
this.m_aPositions[Index]--;
else if ( CurPos > this.m_aPositions[Index] )
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
else //if ( CurPos === this.m_aPositions[Index] )
{
if ( contentchanges_Remove === this.m_nType )
{
// Отмечаем, что действия совпали
this.m_aPositions[Index] = false;
return false;
}
else
{
CurPos++;
}
}
}
}
}
return CurPos;
};
this.Make_ArrayOfSimpleActions = function(Type, Pos, Count)
{
// Разбиваем действие на простейшие
var Positions = [];
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos + Index;
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos;
}
return Positions;
};
// Разбиваем сложное действие на простейшие
this.m_aPositions = this.Make_ArrayOfSimpleActions( Type, Pos, Count );
}
};
function CheckIdSatetShapeAdd(state)
{
......
......@@ -1017,104 +1017,3 @@ var changestype_2_ElementsArray_and_Type = 5; // Аналогично преды
var contentchanges_Add = 1;
var contentchanges_Remove = 2;
\ No newline at end of file
function CContentChangesElement(Type, Pos, Count, Data)
{
this.m_nType = Type; // Тип изменений (удаление или добавление)
this.m_nCount = Count; // Количество добавленных/удаленных элементов
this.m_pData = Data; // Связанные с данным изменением данные из истории
this.Refresh_BinaryData = function()
{
var Binary_Writer = History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition();
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 );
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
};
this.Check_Changes = function(Type, Pos)
{
var CurPos = Pos;
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos <= this.m_aPositions[Index] )
this.m_aPositions[Index]++;
else
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
}
}
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos < this.m_aPositions[Index] )
this.m_aPositions[Index]--;
else if ( CurPos > this.m_aPositions[Index] )
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
else //if ( CurPos === this.m_aPositions[Index] )
{
if ( contentchanges_Remove === this.m_nType )
{
// Отмечаем, что действия совпали
this.m_aPositions[Index] = false;
return false;
}
else
{
CurPos++;
}
}
}
}
}
return CurPos;
};
this.Make_ArrayOfSimpleActions = function(Type, Pos, Count)
{
// Разбиваем действие на простейшие
var Positions = [];
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos + Index;
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos;
}
return Positions;
};
// Разбиваем сложное действие на простейшие
this.m_aPositions = this.Make_ArrayOfSimpleActions( Type, Pos, Count );
}
......@@ -858,108 +858,3 @@ var changestype_2_ElementsArray_and_Type = 5; // Аналогично преды
var contentchanges_Add = 1;
var contentchanges_Remove = 2;
\ No newline at end of file
function CContentChangesElement(Type, Pos, Count, Data)
{
this.m_nType = Type; // Тип изменений (удаление или добавление)
this.m_nCount = Count; // Количество добавленных/удаленных элементов
this.m_pData = Data; // Связанные с данным изменением данные из истории
// Разбиваем сложное действие на простейшие
this.m_aPositions = this.Make_ArrayOfSimpleActions( Type, Pos, Count );
}
CContentChangesElement.prototype =
{
Refresh_BinaryData : function()
{
var Binary_Writer = History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition();
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 );
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
},
Check_Changes : function(Type, Pos)
{
var CurPos = Pos;
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos <= this.m_aPositions[Index] )
this.m_aPositions[Index]++;
else
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
}
}
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos < this.m_aPositions[Index] )
this.m_aPositions[Index]--;
else if ( CurPos > this.m_aPositions[Index] )
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
else //if ( CurPos === this.m_aPositions[Index] )
{
if ( contentchanges_Remove === this.m_nType )
{
// Отмечаем, что действия совпали
this.m_aPositions[Index] = false;
return false;
}
else
{
CurPos++;
}
}
}
}
}
return CurPos;
},
Make_ArrayOfSimpleActions : function(Type, Pos, Count)
{
// Разбиваем действие на простейшие
var Positions = [];
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos + Index;
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos;
}
return Positions;
}
};
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