Commit 113ad38b authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Вынес некоторые классы для совместного редактирование в common'ы

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62481 954022d7-b5bf-4e40-9824-e11837661b57
parent 8e18c816
......@@ -1223,6 +1223,13 @@ CTableId.prototype.Read_Class_FromBinary = function(Reader)
case historyitem_type_rad : Element = new CRadical(); break;
case historyitem_type_deg_subsup : Element = new CDegreeSubSup(); break;
case historyitem_type_deg : Element = new CDegree(); break;
case historyitem_type_Slide : Element = new Slide(); break;
case historyitem_type_SlideLayout : Element = new SlideLayout(); break;
case historyitem_type_SlideMaster : Element = new MasterSlide(); break;
case historyitem_type_SlideComments : Element = new SlideComments(); break;
case historyitem_type_PropLocker : Element = new PropLocker(); break;
case historyitem_type_Theme : Element = new CTheme(); break;
case historyitem_type_GraphicFrame : Element = new CGraphicFrame(); break;
}
if ( null !== Element )
......@@ -1424,4 +1431,125 @@ CTableId.prototype.Load_Changes = function(Reader, Reader2)
CTableId.prototype.Unlock = function(Data)
{
// Ничего не делаем
};
function CLock()
{
this.Type = locktype_None;
this.UserId = null;
}
CLock.prototype =
{
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 false;
},
Set_UserId : function(UserId)
{
this.UserId = UserId;
},
Get_UserId : function()
{
return this.UserId;
},
Have_Changes : function()
{
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type )
return true;
return false;
}
};
function CContentChanges()
{
this.m_aChanges = [];
}
CContentChanges.prototype =
{
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;
}
return CurPos;
},
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
......@@ -2,344 +2,6 @@
//-----------------------------------------------------------------------------------
// Global counters
//-----------------------------------------------------------------------------------
function CLock()
{
this.Type = locktype_None;
this.UserId = null;
this.Get_Type = function()
{
return this.Type;
};
this.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();
}
};
this.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 );
};
this.Lock = function(bMine)
{
if ( locktype_None === this.Type )
{
if ( true === bMine )
this.Type = locktype_Mine;
else
true.Type = locktype_Other;
}
};
this.Is_Locked = function()
{
if ( locktype_None != this.Type && locktype_Mine != this.Type )
return true;
return false;
};
this.Set_UserId = function(UserId)
{
this.UserId = UserId;
};
this.Get_UserId = function()
{
return this.UserId;
};
this.Have_Changes = function()
{
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type )
return true;
return false;
};
}
function CTableId()
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Id = g_oIdCounter.Get_NewId();
this.Add(this, this.Id);
}
CTableId.prototype =
{
Add: function(Class, Id, sheetId)
{
if ( false === this.m_bTurnOff && (Class.Write_ToBinary2 || Class === this))
{
Class.Id = Id;
this.m_aPairs[Id] = Class;
if(Class !== this && History instanceof CHistory)
History.Add(this, {Type: historyitem_TableId_Add, Id: Id, Class: Class});
}
},
Get_ById: function(Id)
{
if ( "undefined" != typeof(this.m_aPairs[Id]) )
return this.m_aPairs[Id];
return null;
},
Get_ByClass: function(Class)
{
if ( "undefined" != typeof( Class.Get_Id ) )
return Class.Get_Id();
if ( "undefined" != typeof( Class.GetId() ) )
return Class.GetId();
return null;
},
Reset_Id: function(Class, Id_new, Id_old)
{
if ( Class === this.m_aPairs[Id_old] )
{
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
History.Add( this, { Type : historyitem_TableId_Reset, Id_new : Id_new, Id_old : Id_old } );
}
else
{
this.Add( Class, Id_new );
}
},
Get_Id: function()
{
return this.Id;
},
//-----------------------------------------------------------------------------------
// Функции для работы с Undo/Redo
//-----------------------------------------------------------------------------------
Undo: function(Data)
{
// Ничего не делаем (можно удалять/добавлять ссылки на классы в данном классе
// но это не обяательно, т.к. Id всегда уникальные)
},
Redo: function(type, data)
{
// Ничего не делаем (можно удалять/добавлять ссылки на классы в данном классе
// но это не обяательно, т.к. Id всегда уникальные)
},
//-----------------------------------------------------------------------------------
// Функции для работы с совместным редактирования
//-----------------------------------------------------------------------------------
Read_Class_FromBinary: function(Reader)
{
var ElementType = Reader.GetLong();
var Element = null;
// Временно отключаем регистрацию новых классов
this.m_bTurnOff = true;
switch( ElementType )
{
case historyitem_type_Paragraph : Element = new Paragraph(); break;
case historyitem_type_TextPr : Element = new ParaTextPr(); break;
case historyitem_type_Hyperlink : Element = new ParaHyperlink(); break;
case historyitem_type_Drawing : Element = new ParaDrawing(); break;
case historyitem_type_Table : Element = new CTable(); break;
case historyitem_type_TableRow : Element = new CTableRow(); break;
case historyitem_type_TableCell : Element = new CTableCell(); break;
case historyitem_type_DocumentContent : Element = new CDocumentContent(); break;
case historyitem_type_HdrFtr : Element = new CHeaderFooter(); break;
case historyitem_type_AbstractNum : Element = new CAbstractNum(); break;
case historyitem_type_Comment : Element = new CComment(); break;
case historyitem_type_Style : Element = new CStyle(); break;
case historyitem_type_Math : Element = new ParaMath(false); break;
case historyitem_type_MathContent : Element = new CMathContent(); break;
case historyitem_type_CommentMark : Element = new ParaComment(); break;
case historyitem_type_ParaRun : Element = new ParaRun(); break;
case historyitem_type_Section : Element = new CSectionPr(); break;
case historyitem_type_DefaultShapeDefinition : Element = new DefaultShapeDefinition(); break;
case historyitem_type_CNvPr : Element = new CNvPr(); break;
case historyitem_type_NvPr : Element = new NvPr(); break;
case historyitem_type_Ph : Element = new Ph(); break;
case historyitem_type_UniNvPr : Element = new UniNvPr(); break;
case historyitem_type_StyleRef : Element = new StyleRef(); break;
case historyitem_type_FontRef : Element = new FontRef(); break;
case historyitem_type_Chart : Element = new CChart(); break;
case historyitem_type_ChartSpace : Element = new CChartSpace(); break;
case historyitem_type_Legend : Element = new CLegend(); break;
case historyitem_type_Layout : Element = new CLayout(); break;
case historyitem_type_LegendEntry : Element = new CLegendEntry(); break;
case historyitem_type_PivotFmt : Element = new CPivotFmt(); break;
case historyitem_type_DLbl : Element = new CDLbl(); break;
case historyitem_type_Marker : Element = new CMarker(); break;
case historyitem_type_PlotArea : Element = new CPlotArea(); break;
case historyitem_type_NumFmt : Element = new CNumFmt(); break;
case historyitem_type_Scaling : Element = new CScaling(); break;
case historyitem_type_DTable : Element = new CDTable(); break;
case historyitem_type_LineChart : Element = new CLineChart(); break;
case historyitem_type_DLbls : Element = new CDLbls(); break;
case historyitem_type_UpDownBars : Element = new CUpDownBars(); break;
case historyitem_type_BarChart : Element = new CBarChart(); break;
case historyitem_type_BubbleChart : Element = new CBubbleChart(); break;
case historyitem_type_DoughnutChart : Element = new CDoughnutChart(); break;
case historyitem_type_OfPieChart : Element = new COfPieChart(); break;
case historyitem_type_PieChart : Element = new CPieChart(); break;
case historyitem_type_RadarChart : Element = new CRadarChart(); break;
case historyitem_type_ScatterChart : Element = new CScatterChart(); break;
case historyitem_type_StockChart : Element = new CStockChart(); break;
case historyitem_type_SurfaceChart : Element = new CSurfaceChart(); break;
case historyitem_type_BandFmt : Element = new CBandFmt(); break;
case historyitem_type_AreaChart : Element = new CAreaChart(); break;
case historyitem_type_ScatterSer : Element = new CScatterSeries(); break;
case historyitem_type_DPt : Element = new CDPt(); break;
case historyitem_type_ErrBars : Element = new CErrBars(); break;
case historyitem_type_MinusPlus : Element = new CMinusPlus(); break;
case historyitem_type_NumLit : Element = new CNumLit(); break;
case historyitem_type_NumericPoint : Element = new CNumericPoint(); break;
case historyitem_type_NumRef : Element = new CNumRef(); break;
case historyitem_type_TrendLine : Element = new CTrendLine(); break;
case historyitem_type_Tx : Element = new CTx(); break;
case historyitem_type_StrRef : Element = new CStrRef(); break;
case historyitem_type_StrCache : Element = new CStrCache(); break;
case historyitem_type_StrPoint : Element = new CStringPoint(); break;
case historyitem_type_XVal : Element = new CXVal(); break;
case historyitem_type_MultiLvlStrRef : Element = new CMultiLvlStrRef(); break;
case historyitem_type_MultiLvlStrCache : Element = new CMultiLvlStrCache(); break;
case historyitem_type_StringLiteral : Element = new CStringLiteral(); break;
case historyitem_type_YVal : Element = new CYVal(); break;
case historyitem_type_AreaSeries : Element = new CAreaSeries(); break;
case historyitem_type_Cat : Element = new CCat(); break;
case historyitem_type_PictureOptions : Element = new CPictureOptions(); break;
case historyitem_type_RadarSeries : Element = new CRadarSeries(); break;
case historyitem_type_BarSeries : Element = new CBarSeries(); break;
case historyitem_type_LineSeries : Element = new CLineSeries(); break;
case historyitem_type_PieSeries : Element = new CPieSeries(); break;
case historyitem_type_SurfaceSeries : Element = new CSurfaceSeries(); break;
case historyitem_type_BubbleSeries : Element = new CBubbleSeries(); break;
case historyitem_type_ExternalData : Element = new CExternalData(); break;
case historyitem_type_PivotSource : Element = new CPivotSource(); break;
case historyitem_type_Protection : Element = new CProtection(); break;
case historyitem_type_ChartWall : Element = new CChartWall(); break;
case historyitem_type_View3d : Element = new CView3d(); break;
case historyitem_type_ChartText : Element = new CChartText(); break;
case historyitem_type_ShapeStyle : Element = new CShapeStyle(); break;
case historyitem_type_Xfrm : Element = new CXfrm(); break;
case historyitem_type_SpPr : Element = new CSpPr(); break;
case historyitem_type_ClrScheme : Element = new ClrScheme(); break;
case historyitem_type_ClrMap : Element = new ClrMap(); break;
case historyitem_type_ExtraClrScheme : Element = new ExtraClrScheme(); break;
case historyitem_type_FontCollection : Element = new FontCollection(); break;
case historyitem_type_FontScheme : Element = new FontScheme(); break;
case historyitem_type_FormatScheme : Element = new FmtScheme(); break;
case historyitem_type_ThemeElements : Element = new ThemeElements(); break;
case historyitem_type_HF : Element = new HF(); break;
case historyitem_type_BgPr : Element = new CBgPr(); break;
case historyitem_type_Bg : Element = new CBg(); break;
case historyitem_type_PrintSettings : Element = new CPrintSettings(); break;
case historyitem_type_HeaderFooterChart : Element = new CHeaderFooterChart(); break;
case historyitem_type_PageMarginsChart : Element = new CPageMarginsChart(); break;
case historyitem_type_PageSetup : Element = new CPageSetup(); break;
case historyitem_type_Shape : Element = new CShape(); break;
case historyitem_type_DispUnits : Element = new CDispUnits(); break;
case historyitem_type_GroupShape : Element = new CGroupShape(); break;
case historyitem_type_ImageShape : Element = new CImageShape(); break;
case historyitem_type_Geometry : Element = new Geometry(); break;
case historyitem_type_Path : Element = new Path(); break;
case historyitem_type_TextBody : Element = new CTextBody(); break;
case historyitem_type_CatAx : Element = new CCatAx(); break;
case historyitem_type_ValAx : Element = new CValAx(); break;
case historyitem_type_WrapPolygon : Element = new CWrapPolygon(); break;
case historyitem_type_DateAx : Element = new CDateAx(); break;
case historyitem_type_SerAx : Element = new CSerAx(); break;
case historyitem_type_Title : Element = new CTitle(); break;
}
if ( null !== Element )
Element.Read_FromBinary2(Reader);
// Включаем назад регистрацию новых классов
this.m_bTurnOff = false;
return Element;
},
Save_Changes: function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( historyitem_type_TableId );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case historyitem_TableId_Add :
{
// String : Id элемента
// Varibale : сам элемент
Writer.WriteString2( Data.Id );
Data.Class.Write_ToBinary2( Writer );
break;
}
case historyitem_TableId_Reset:
{
// String : Id_new
// String : Id_old
Writer.WriteString2( Data.Id_new );
Writer.WriteString2( Data.Id_old );
break;
}
}
},
Save_Changes2: function(Data, Writer)
{
return false;
},
Load_Changes: function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( historyitem_type_TableId != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case historyitem_TableId_Add:
{
// String : Id элемента
// Varibale : сам элемент
var Id = Reader.GetString2();
var Class = this.Read_Class_FromBinary( Reader );
this.m_aPairs[Id] = Class;
break;
}
case historyitem_TableId_Reset:
{
// String : Id_new
// String : Id_old
var Id_new = Reader.GetString2();
var Id_old = Reader.GetString2();
if ( "undefined" != this.m_aPairs[Id_old] )
{
var Class = this.m_aPairs[Id_old];
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
}
break;
}
}
return true;
},
Unlock: function(Data)
{
// Ничего не делаем
}
};
var g_oIdCounter = null;
var g_oTableId = null;
......
......@@ -8,409 +8,6 @@
var g_oIdCounter = new CIdCounter();
function CTableId()
{
this.m_aPairs = {};
this.m_bTurnOff = false;
this.Add = function(Class, Id)
{
if ( false === this.m_bTurnOff )
{
Class.Id = Id;
this.m_aPairs[Id] = Class;
History.Add( this, { Type : historyitem_TableId_Add, Id : Id, Class : Class } );
}
};
this.Add( this, g_oIdCounter.Get_NewId() );
// Получаем указатель на класс по Id
this.Get_ById = function(Id)
{
if ( "" === Id )
return null;
if ( "undefined" != typeof(this.m_aPairs[Id]) )
return this.m_aPairs[Id];
return null;
};
// Получаем Id, по классу (вообще, данную функцию лучше не использовать)
this.Get_ByClass = function(Class)
{
if ( "undefined" != typeof( Class.Get_Id ) )
return Class.Get_Id();
if ( "undefined" != typeof( Class.GetId() ) )
return Class.GetId();
return null;
};
this.Reset_Id = function(Class, Id_new, Id_old)
{
if ( Class === this.m_aPairs[Id_old] )
{
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
History.Add( this, { Type : historyitem_TableId_Reset, Id_new : Id_new, Id_old : Id_old } );
}
else
{
this.Add( Class, Id_new );
}
};
this.Get_Id = function()
{
return this.Id;
};
//-----------------------------------------------------------------------------------
// Функции для работы с Undo/Redo
//-----------------------------------------------------------------------------------
this.Undo = function(Data)
{
// Ничего не делаем (можно удалять/добавлять ссылки на классы в данном классе
// но это не обяательно, т.к. Id всегда уникальные)
};
this.Redo = function(Redo)
{
// Ничего не делаем (можно удалять/добавлять ссылки на классы в данном классе
// но это не обяательно, т.к. Id всегда уникальные)
};
this.Refresh_RecalcData = function(Data)
{
// Ничего не делаем, добавление/удаление классов не влияет на пересчет
};
//-----------------------------------------------------------------------------------
// Функции для работы с совместным редактирования
//-----------------------------------------------------------------------------------
this.Read_Class_FromBinary = function(Reader)
{
var props = null;
var ElementType = Reader.GetLong();
var Element = null;
// Временно отключаем регистрацию новых классов
this.m_bTurnOff = true;
switch( ElementType )
{
case historyitem_type_Paragraph : Element = new Paragraph(); break;
case historyitem_type_TextPr : Element = new ParaTextPr(); break;
case historyitem_type_Hyperlink : Element = new ParaHyperlink(); break;
case historyitem_type_Drawing : Element = new ParaDrawing(); break;
case historyitem_type_Table : Element = new CTable(); break;
case historyitem_type_TableRow : Element = new CTableRow(); break;
case historyitem_type_TableCell : Element = new CTableCell(); break;
case historyitem_type_DocumentContent : Element = new CDocumentContent(); break;
case historyitem_type_HdrFtr : Element = new CHeaderFooter(); break;
case historyitem_type_AbstractNum : Element = new CAbstractNum(); break;
case historyitem_type_Comment : Element = new CComment(); break;
case historyitem_type_Style : Element = new CStyle(); break;
case historyitem_type_CommentMark : Element = new ParaComment(); break;
case historyitem_type_ParaRun : Element = new ParaRun(); break;
case historyitem_type_Section : Element = new CSectionPr(); break;
case historyitem_type_DefaultShapeDefinition : Element = new DefaultShapeDefinition(); break;
case historyitem_type_CNvPr : Element = new CNvPr(); break;
case historyitem_type_NvPr : Element = new NvPr(); break;
case historyitem_type_Ph : Element = new Ph(); break;
case historyitem_type_UniNvPr : Element = new UniNvPr(); break;
case historyitem_type_StyleRef : Element = new StyleRef(); break;
case historyitem_type_FontRef : Element = new FontRef(); break;
case historyitem_type_Chart : Element = new CChart(); break;
case historyitem_type_ChartSpace : Element = new CChartSpace(); break;
case historyitem_type_Legend : Element = new CLegend(); break;
case historyitem_type_Layout : Element = new CLayout(); break;
case historyitem_type_LegendEntry : Element = new CLegendEntry(); break;
case historyitem_type_PivotFmt : Element = new CPivotFmt(); break;
case historyitem_type_DLbl : Element = new CDLbl(); break;
case historyitem_type_Marker : Element = new CMarker(); break;
case historyitem_type_PlotArea : Element = new CPlotArea(); break;
case historyitem_type_NumFmt : Element = new CNumFmt(); break;
case historyitem_type_Scaling : Element = new CScaling(); break;
case historyitem_type_DTable : Element = new CDTable(); break;
case historyitem_type_LineChart : Element = new CLineChart(); break;
case historyitem_type_DLbls : Element = new CDLbls(); break;
case historyitem_type_UpDownBars : Element = new CUpDownBars(); break;
case historyitem_type_BarChart : Element = new CBarChart(); break;
case historyitem_type_BubbleChart : Element = new CBubbleChart(); break;
case historyitem_type_DoughnutChart : Element = new CDoughnutChart(); break;
case historyitem_type_OfPieChart : Element = new COfPieChart(); break;
case historyitem_type_PieChart : Element = new CPieChart(); break;
case historyitem_type_RadarChart : Element = new CRadarChart(); break;
case historyitem_type_ScatterChart : Element = new CScatterChart(); break;
case historyitem_type_StockChart : Element = new CStockChart(); break;
case historyitem_type_SurfaceChart : Element = new CSurfaceChart(); break;
case historyitem_type_BandFmt : Element = new CBandFmt(); break;
case historyitem_type_AreaChart : Element = new CAreaChart(); break;
case historyitem_type_ScatterSer : Element = new CScatterSeries(); break;
case historyitem_type_DPt : Element = new CDPt(); break;
case historyitem_type_ErrBars : Element = new CErrBars(); break;
case historyitem_type_MinusPlus : Element = new CMinusPlus(); break;
case historyitem_type_NumLit : Element = new CNumLit(); break;
case historyitem_type_NumericPoint : Element = new CNumericPoint(); break;
case historyitem_type_NumRef : Element = new CNumRef(); break;
case historyitem_type_TrendLine : Element = new CTrendLine(); break;
case historyitem_type_Tx : Element = new CTx(); break;
case historyitem_type_StrRef : Element = new CStrRef(); break;
case historyitem_type_StrCache : Element = new CStrCache(); break;
case historyitem_type_StrPoint : Element = new CStringPoint(); break;
case historyitem_type_XVal : Element = new CXVal(); break;
case historyitem_type_MultiLvlStrRef : Element = new CMultiLvlStrRef(); break;
case historyitem_type_MultiLvlStrCache : Element = new CMultiLvlStrCache(); break;
case historyitem_type_StringLiteral : Element = new CStringLiteral(); break;
case historyitem_type_YVal : Element = new CYVal(); break;
case historyitem_type_AreaSeries : Element = new CAreaSeries(); break;
case historyitem_type_Cat : Element = new CCat(); break;
case historyitem_type_PictureOptions : Element = new CPictureOptions(); break;
case historyitem_type_RadarSeries : Element = new CRadarSeries(); break;
case historyitem_type_BarSeries : Element = new CBarSeries(); break;
case historyitem_type_LineSeries : Element = new CLineSeries(); break;
case historyitem_type_PieSeries : Element = new CPieSeries(); break;
case historyitem_type_SurfaceSeries : Element = new CSurfaceSeries(); break;
case historyitem_type_BubbleSeries : Element = new CBubbleSeries(); break;
case historyitem_type_ExternalData : Element = new CExternalData(); break;
case historyitem_type_PivotSource : Element = new CPivotSource(); break;
case historyitem_type_Protection : Element = new CProtection(); break;
case historyitem_type_ChartWall : Element = new CChartWall(); break;
case historyitem_type_View3d : Element = new CView3d(); break;
case historyitem_type_ChartText : Element = new CChartText(); break;
case historyitem_type_ShapeStyle : Element = new CShapeStyle(); break;
case historyitem_type_Xfrm : Element = new CXfrm(); break;
case historyitem_type_SpPr : Element = new CSpPr(); break;
case historyitem_type_ClrScheme : Element = new ClrScheme(); break;
case historyitem_type_ClrMap : Element = new ClrMap(); break;
case historyitem_type_ExtraClrScheme : Element = new ExtraClrScheme(); break;
case historyitem_type_FontCollection : Element = new FontCollection(); break;
case historyitem_type_FontScheme : Element = new FontScheme(); break;
case historyitem_type_FormatScheme : Element = new FmtScheme(); break;
case historyitem_type_ThemeElements : Element = new ThemeElements(); break;
case historyitem_type_HF : Element = new HF(); break;
case historyitem_type_BgPr : Element = new CBgPr(); break;
case historyitem_type_Bg : Element = new CBg(); break;
case historyitem_type_PrintSettings : Element = new CPrintSettings(); break;
case historyitem_type_HeaderFooterChart : Element = new CHeaderFooterChart(); break;
case historyitem_type_PageMarginsChart : Element = new CPageMarginsChart(); break;
case historyitem_type_PageSetup : Element = new CPageSetup(); break;
case historyitem_type_Shape : Element = new CShape(); break;
case historyitem_type_DispUnits : Element = new CDispUnits(); break;
case historyitem_type_GroupShape : Element = new CGroupShape(); break;
case historyitem_type_ImageShape : Element = new CImageShape(); break;
case historyitem_type_Geometry : Element = new Geometry(); break;
case historyitem_type_Path : Element = new Path(); break;
case historyitem_type_TextBody : Element = new CTextBody(); break;
case historyitem_type_CatAx : Element = new CCatAx(); break;
case historyitem_type_ValAx : Element = new CValAx(); break;
case historyitem_type_WrapPolygon : Element = new CWrapPolygon(); break;
case historyitem_type_DateAx : Element = new CDateAx(); break;
case historyitem_type_SerAx : Element = new CSerAx(); break;
case historyitem_type_Title : Element = new CTitle(); break;
case historyitem_type_Math : Element = new ParaMath(false); break;
case historyitem_type_MathContent : Element = new CMathContent(); break;
case historyitem_type_acc : Element = new CAccent(); break;
case historyitem_type_bar : Element = new CBar(); break;
case historyitem_type_box : Element = new CBox(); break;
case historyitem_type_borderBox : Element = new CBorderBox(); break;
case historyitem_type_delimiter : Element = new CDelimiter(); break;
case historyitem_type_eqArr : Element = new CEqArray(); break;
case historyitem_type_frac : Element = new CFraction(); break;
case historyitem_type_mathFunc : Element = new CMathFunc(); break;
case historyitem_type_groupChr : Element = new CGroupCharacter(); break;
case historyitem_type_lim : Element = new CLimit(); break;
case historyitem_type_matrix : Element = new CMathMatrix(); break;
case historyitem_type_nary : Element = new CNary(); break;
case historyitem_type_phant : Element = new CPhantom(); break;
case historyitem_type_rad : Element = new CRadical(); break;
case historyitem_type_deg_subsup : Element = new CDegreeSubSup(); break;
case historyitem_type_deg : Element = new CDegree(); break;
case historyitem_type_Slide : Element = new Slide(); break;
case historyitem_type_SlideLayout : Element = new SlideLayout(); break;
case historyitem_type_SlideMaster : Element = new MasterSlide(); break;
case historyitem_type_SlideComments : Element = new SlideComments(); break;
case historyitem_type_PropLocker : Element = new PropLocker(); break;
case historyitem_type_Theme : Element = new CTheme(); break;
case historyitem_type_GraphicFrame : Element = new CGraphicFrame(); break;
}
if ( null !== Element )
Element.Read_FromBinary2(Reader);
// Включаем назад регистрацию новых классов
this.m_bTurnOff = false;
return Element;
};
this.Save_Changes = function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong( historyitem_type_TableId );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
switch ( Type )
{
case historyitem_TableId_Add :
{
// String : Id элемента
// Varibale : сам элемент
Writer.WriteString2( Data.Id );
Data.Class.Write_ToBinary2( Writer );
break;
}
case historyitem_TableId_Reset:
{
// String : Id_new
// String : Id_old
Writer.WriteString2( Data.Id_new );
Writer.WriteString2( Data.Id_old );
break;
}
case historyitem_TableId_Description:
{
// Long : FileCheckSum
// Long : FileSize
// Long : Description
// Long : ItemsCount
// Long : PointIndex
// Long : StartPoint
// Long : LastPoint
// Long : SumIndex
// Long : DeletedIndex
Writer.WriteLong(Data.FileCheckSum);
Writer.WriteLong(Data.FileSize);
Writer.WriteLong(Data.Description);
Writer.WriteLong(Data.ItemsCount);
Writer.WriteLong(Data.PointIndex);
Writer.WriteLong(Data.StartPoint);
Writer.WriteLong(Data.LastPoint);
Writer.WriteLong(Data.SumIndex);
Writer.WriteLong(null === Data.DeletedIndex ? -10 : Data.DeletedIndex);
break;
}
}
};
this.Save_Changes2 = function(Data, Writer)
{
return false;
};
this.Load_Changes = function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( historyitem_type_TableId != ClassType )
return;
var Type = Reader.GetLong();
switch ( Type )
{
case historyitem_TableId_Add:
{
// String : Id элемента
// Varibale : сам элемент
var Id = Reader.GetString2();
var Class = this.Read_Class_FromBinary( Reader );
this.m_aPairs[Id] = Class;
break;
}
case historyitem_TableId_Reset:
{
// String : Id_new
// String : Id_old
var Id_new = Reader.GetString2();
var Id_old = Reader.GetString2();
if ( "undefined" != this.m_aPairs[Id_old] )
{
var Class = this.m_aPairs[Id_old];
delete this.m_aPairs[Id_old];
this.m_aPairs[Id_new] = Class;
}
break;
}
case historyitem_TableId_Description:
{
// Long : FileCheckSum
// Long : FileSize
// Long : Description
// Long : ItemsCount
// Long : PointIndex
// Long : StartPoint
// Long : LastPoint
// Long : SumIndex
// Long : DeletedIndex
// var FileCheckSum = Reader.GetLong();
// var FileSize = Reader.GetLong();
// var Description = Reader.GetLong();
// var ItemsCount = Reader.GetLong();
// var PointIndex = Reader.GetLong();
// var StartPoint = Reader.GetLong();
// var LastPoint = Reader.GetLong();
// var SumIndex = Reader.GetLong();
// var DeletedIndex = Reader.GetLong();
//
// console.log("----------------------------");
// console.log("FileCheckSum " + FileCheckSum);
// console.log("FileSize " + FileSize);
// console.log("Description " + Description + " " + Get_HistoryPointStringDescription(Description));
// console.log("ItemsCount " + ItemsCount);
// console.log("PointIndex " + PointIndex);
// console.log("StartPoint " + StartPoint);
// console.log("LastPoint " + LastPoint);
// console.log("SumIndex " + SumIndex);
// console.log("DeletedIndex " + (-10 === DeletedIndex ? null : DeletedIndex));
break;
}
}
return true;
};
this.Unlock = function(Data)
{
// Ничего не делаем
};
}
var g_oTableId = null;
......@@ -1422,79 +1019,6 @@ var changestype_2_Comment = 3; // Работает с комме
var changestype_2_Element_and_Type = 4; // Проверяем возможно ли сделать изменение заданного типа с заданным элементом(а не с текущим)
var changestype_2_ElementsArray_and_Type = 5; // Аналогично предыдущему, только идет массив элементов
function CLock()
{
this.Type = locktype_None;
this.UserId = null;
this.Get_Type = function()
{
return this.Type;
};
this.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();
}
};
this.Check = function(lockObject)
{
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( lockObject );
};
this.Lock = function(bMine)
{
if ( locktype_None === this.Type )
{
if ( true === bMine )
this.Type = locktype_Mine;
else
true.Type = locktype_Other;
}
};
this.Is_Locked = function()
{
if ( locktype_None != this.Type && locktype_Mine != this.Type )
return true;
return false;
};
this.Set_UserId = function(UserId)
{
this.UserId = UserId;
};
this.Get_UserId = function()
{
return this.UserId;
};
this.Have_Changes = function()
{
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type )
return true;
return false;
};
}
var contentchanges_Add = 1;
var contentchanges_Remove = 2;
......@@ -1600,43 +1124,3 @@ function CContentChangesElement(Type, Pos, Count, Data)
// Разбиваем сложное действие на простейшие
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();
}
};
}
\ No newline at end of file
......@@ -858,82 +858,7 @@ var changestype_2_Comment = 3; // Работает с комме
var changestype_2_Element_and_Type = 4; // Проверяем возможно ли сделать изменение заданного типа с заданным элементом(а не с текущим)
var changestype_2_ElementsArray_and_Type = 5; // Аналогично предыдущему, только идет массив элементов
function CLock()
{
this.Type = locktype_None;
this.UserId = null;
}
CLock.prototype =
{
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 false;
},
Set_UserId : function(UserId)
{
this.UserId = UserId;
},
Get_UserId : function()
{
return this.UserId;
},
Have_Changes : function()
{
if ( locktype_Other2 === this.Type || locktype_Other3 === this.Type )
return true;
return false;
}
}
var contentchanges_Add = 1;
var contentchanges_Remove = 2;
......@@ -1043,46 +968,3 @@ CContentChangesElement.prototype =
return Positions;
}
};
function CContentChanges()
{
this.m_aChanges = [];
}
CContentChanges.prototype =
{
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;
}
return CurPos;
},
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
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