Commit 1dedc588 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55631 954022d7-b5bf-4e40-9824-e11837661b57
parent 14a02412
...@@ -2,6 +2,136 @@ ...@@ -2,6 +2,136 @@
var editor = window["Asc"]["editor"]; var editor = window["Asc"]["editor"];
function CContentChangesElement(Type, Pos, Count, Data)
{
this.m_nType = Type; // Тип изменений (удаление или добавление)
this.m_nPos = Pos; // Позиция, в которой произошли изменения
this.m_nCount = Count; // Количество добавленных/удаленных элементов
this.m_pData = Data; // Связанные с данным изменением данные из истории
this.Refresh_BinaryData = function()
{
this.m_pData.oldValue = this.m_aPositions[0];
};
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 CContentChanges()
{
this.m_aChanges = [];
this.Add = function(Changes)
{
this.m_aChanges.push( Changes );
};
this.Clear = function()
{
this.m_aChanges.length = 0;
};
this.Check = function(Type, Pos)
{
var CurPos = Pos;
var Count = this.m_aChanges.length;
for ( var Index = 0; Index < Count; Index++ )
{
var NewPos = this.m_aChanges[Index].Check_Changes(Type, CurPos);
if ( false === NewPos )
return false;
CurPos = NewPos;
}
return CurPos;
};
this.Refresh = function()
{
var Count = this.m_aChanges.length;
for ( var Index = 0; Index < Count; Index++ )
{
this.m_aChanges[Index].Refresh_BinaryData();
}
};
}
DrawingObjectsController.prototype.getTheme = function() DrawingObjectsController.prototype.getTheme = function()
{ {
return window["Asc"]["editor"].wbModel.theme; return window["Asc"]["editor"].wbModel.theme;
......
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