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() ...@@ -993,7 +993,7 @@ function CTableId()
this.m_bTurnOff = false; this.m_bTurnOff = false;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.Add(this, this.Id); this.Add(this, this.Id);
}; }
CTableId.prototype.Add = function(Class, Id) CTableId.prototype.Add = function(Class, Id)
{ {
if (false === this.m_bTurnOff) if (false === this.m_bTurnOff)
...@@ -1439,75 +1439,65 @@ function CLock() ...@@ -1439,75 +1439,65 @@ function CLock()
this.UserId = null; this.UserId = null;
} }
CLock.prototype = CLock.prototype.Get_Type = function()
{ {
Get_Type : function() return this.Type;
{ };
return this.Type; CLock.prototype.Set_Type = function(NewType, Redraw)
}, {
if ( NewType === locktype_None )
Set_Type : function(NewType, Redraw) this.UserId = null;
{
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 false; this.Type = NewType;
},
Set_UserId : function(UserId) if ( false != Redraw )
{ {
this.UserId = UserId; // TODO: переделать перерисовку тут
}, var DrawingDocument = editor.WordControl.m_oLogicDocument.DrawingDocument;
DrawingDocument.ClearCachePages();
Get_UserId : function() DrawingDocument.FirePaint();
{ }
return this.UserId; };
}, 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() return false;
{ };
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type ) CLock.prototype.Set_UserId = function(UserId)
return true; {
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() ...@@ -1516,40 +1506,37 @@ function CContentChanges()
this.m_aChanges = []; this.m_aChanges = [];
} }
CContentChanges.prototype = CContentChanges.prototype.Add = function(Changes)
{ {
Add : function(Changes) this.m_aChanges.push( Changes );
{ };
this.m_aChanges.push( Changes ); CContentChanges.prototype.Clear = function()
}, {
this.m_aChanges.length = 0;
Clear : function() };
{ CContentChanges.prototype.Check = function(Type, Pos)
this.m_aChanges.length = 0; {
}, var CurPos = Pos;
var Count = this.m_aChanges.length;
Check : function(Type, Pos) for ( var Index = 0; Index < Count; Index++ )
{ {
var CurPos = Pos; var NewPos = this.m_aChanges[Index].Check_Changes(Type, CurPos);
var Count = this.m_aChanges.length; if ( false === NewPos )
for ( var Index = 0; Index < Count; Index++ ) return false;
{
var NewPos = this.m_aChanges[Index].Check_Changes(Type, CurPos); CurPos = NewPos;
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 g_oIdCounter = new CIdCounter();
{ var g_oTableId = null;
var Count = this.m_aChanges.length; \ No newline at end of file
for ( var Index = 0; Index < Count; Index++ )
{
this.m_aChanges[Index].Refresh_BinaryData();
}
}
};
\ No newline at end of file
...@@ -389,7 +389,6 @@ ...@@ -389,7 +389,6 @@
History = new CHistory(wb); History = new CHistory(wb);
g_oIdCounter = new CIdCounter();
g_oTableId = new CTableId(); g_oTableId = new CTableId();
if ( this.User ) if ( this.User )
g_oIdCounter.Set_UserId(this.User.asc_getId()); 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"; ...@@ -525,7 +525,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// History & global counters // History & global counters
History = new CHistory(wbModel); History = new CHistory(wbModel);
g_oIdCounter = new CIdCounter();
g_oTableId = new CTableId(); g_oTableId = new CTableId();
if ( this.User ) if ( this.User )
g_oIdCounter.Set_UserId(this.User.asc_getId()); g_oIdCounter.Set_UserId(this.User.asc_getId());
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Global counters // Global counters
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
var g_oIdCounter = null;
var g_oTableId = null;
function CCollaborativeEditing() function CCollaborativeEditing()
{ {
......
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
* Time: 12:01 * Time: 12:01
*/ */
var g_oIdCounter = new CIdCounter();
var g_oTableId = null;
function CCollaborativeChanges() function CCollaborativeChanges()
{ {
this.m_pData = null; this.m_pData = null;
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
* Time: 12:01 * Time: 12:01
*/ */
var g_oIdCounter = new CIdCounter();
var g_oTableId = null;
function CCollaborativeChanges() function CCollaborativeChanges()
{ {
this.m_pData = null; 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