Commit 5b9bc613 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

g_oIdCounter и g_oTableId перенес в editorscommon.js

CLock и CContentChanges перевел на prototype

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62494 954022d7-b5bf-4e40-9824-e11837661b57
parent 4a8b38c4
......@@ -993,7 +993,7 @@ function CTableId()
this.m_bTurnOff = false;
this.Id = g_oIdCounter.Get_NewId();
this.Add(this, this.Id);
};
}
CTableId.prototype.Add = function(Class, Id)
{
if (false === this.m_bTurnOff)
......@@ -1439,75 +1439,65 @@ function CLock()
this.UserId = null;
}
CLock.prototype =
CLock.prototype.Get_Type = function()
{
Get_Type : function()
{
return this.Type;
},
Set_Type : function(NewType, Redraw)
{
if ( NewType === locktype_None )
this.UserId = null;
this.Type = NewType;
if ( false != Redraw )
{
// TODO: переделать перерисовку тут
var DrawingDocument = editor.WordControl.m_oLogicDocument.DrawingDocument;
DrawingDocument.ClearCachePages();
DrawingDocument.FirePaint();
}
},
Check : function(Id)
{
if ( this.Type === locktype_Mine )
CollaborativeEditing.Add_CheckLock( false );
else if ( this.Type === locktype_Other || this.Type === locktype_Other2 || this.Type === locktype_Other3 )
CollaborativeEditing.Add_CheckLock( true );
else
CollaborativeEditing.Add_CheckLock( Id );
},
Lock : function(bMine)
{
if ( locktype_None === this.Type )
{
if ( true === bMine )
this.Type = locktype_Mine;
else
true.Type = locktype_Other;
}
},
Is_Locked : function()
{
if ( locktype_None != this.Type && locktype_Mine != this.Type )
return true;
return this.Type;
};
CLock.prototype.Set_Type = function(NewType, Redraw)
{
if ( NewType === locktype_None )
this.UserId = null;
return false;
},
this.Type = NewType;
Set_UserId : function(UserId)
{
this.UserId = UserId;
},
Get_UserId : function()
{
return this.UserId;
},
if ( false != Redraw )
{
// TODO: переделать перерисовку тут
var DrawingDocument = editor.WordControl.m_oLogicDocument.DrawingDocument;
DrawingDocument.ClearCachePages();
DrawingDocument.FirePaint();
}
};
CLock.prototype.Check = function(Id)
{
if ( this.Type === locktype_Mine )
CollaborativeEditing.Add_CheckLock( false );
else if ( this.Type === locktype_Other || this.Type === locktype_Other2 || this.Type === locktype_Other3 )
CollaborativeEditing.Add_CheckLock( true );
else
CollaborativeEditing.Add_CheckLock( Id );
};
CLock.prototype.Lock = function(bMine)
{
if ( locktype_None === this.Type )
{
if ( true === bMine )
this.Type = locktype_Mine;
else
true.Type = locktype_Other;
}
};
CLock.prototype.Is_Locked = function()
{
if ( locktype_None != this.Type && locktype_Mine != this.Type )
return true;
Have_Changes : function()
{
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type )
return true;
return false;
};
CLock.prototype.Set_UserId = function(UserId)
{
this.UserId = UserId;
};
CLock.prototype.Get_UserId = function()
{
return this.UserId;
};
CLock.prototype.Have_Changes = function()
{
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type )
return true;
return false;
}
return false;
};
......@@ -1516,40 +1506,37 @@ function CContentChanges()
this.m_aChanges = [];
}
CContentChanges.prototype =
CContentChanges.prototype.Add = function(Changes)
{
Add : function(Changes)
{
this.m_aChanges.push( Changes );
},
Clear : function()
{
this.m_aChanges.length = 0;
},
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;
}
this.m_aChanges.push( Changes );
};
CContentChanges.prototype.Clear = function()
{
this.m_aChanges.length = 0;
};
CContentChanges.prototype.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;
},
return CurPos;
};
CContentChanges.prototype.Refresh = function()
{
var Count = this.m_aChanges.length;
for ( var Index = 0; Index < Count; Index++ )
{
this.m_aChanges[Index].Refresh_BinaryData();
}
};
Refresh : function()
{
var Count = this.m_aChanges.length;
for ( var Index = 0; Index < Count; Index++ )
{
this.m_aChanges[Index].Refresh_BinaryData();
}
}
};
\ No newline at end of file
var g_oIdCounter = new CIdCounter();
var g_oTableId = null;
\ No newline at end of file
......@@ -389,7 +389,6 @@
History = new CHistory(wb);
g_oIdCounter = new CIdCounter();
g_oTableId = new CTableId();
if ( this.User )
g_oIdCounter.Set_UserId(this.User.asc_getId());
......
......@@ -525,7 +525,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// History & global counters
History = new CHistory(wbModel);
g_oIdCounter = new CIdCounter();
g_oTableId = new CTableId();
if ( this.User )
g_oIdCounter.Set_UserId(this.User.asc_getId());
......
......@@ -2,8 +2,6 @@
//-----------------------------------------------------------------------------------
// Global counters
//-----------------------------------------------------------------------------------
var g_oIdCounter = null;
var g_oTableId = null;
function CCollaborativeEditing()
{
......
......@@ -6,11 +6,6 @@
* Time: 12:01
*/
var g_oIdCounter = new CIdCounter();
var g_oTableId = null;
function CCollaborativeChanges()
{
this.m_pData = null;
......
......@@ -6,10 +6,6 @@
* Time: 12:01
*/
var g_oIdCounter = new CIdCounter();
var g_oTableId = null;
function CCollaborativeChanges()
{
this.m_pData = null;
......
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