Commit 40ba835a authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander.Trofimov

совместное редактирование формул

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54207 954022d7-b5bf-4e40-9824-e11837661b57
parent 3b1532ff
......@@ -8000,6 +8000,25 @@ ParaMath.prototype =
this.bs.WriteItemWithLength ( function(){oThis.boMaths.WriteOMathPara(oThis.Math);});
},
/*Write_ElemToBinary2 : function(Writer, elem)
{
var oThis = this;
this.bs = new BinaryCommonWriter(Writer);
this.boMaths = new Binary_oMathWriter(Writer);
this.bs.WriteItemWithLength ( function(){oThis.boMaths.WriteArgNodes(elem);});
},*/
//добавление формулы в формулу
Write_MathElemToBinary : function(Writer, elem)
{
var oThis = this;
this.bs = new BinaryCommonWriter(Writer);
this.boMaths = new Binary_oMathWriter(Writer);
this.bs.WriteItemWithLength ( function(){oThis.boMaths.WriteMathElem(elem);});
},
Read_FromBinary2 : function(Reader)
{
var oThis = this;
......@@ -8013,8 +8032,40 @@ ParaMath.prototype =
res = this.bcr.Read1(length, function(t, l){
return oThis.boMathr.ReadMathOMathPara(t,l,oThis.Math);
});
},
},
/*Read_ElemFromBinary2 : function(Reader, elem)
{
var oThis = this;
this.boMathr = new Binary_oMathReader(Reader);
this.bcr = new Binary_CommonReader(Reader);
var length = Reader.GetUChar();
var res = false;
Reader.cur += 3;
res = this.bcr.Read1(length, function(t, l){
return oThis.boMathr.ReadMathArg(t,l,elem);
});
},*/
Read_MathElemFromBinary : function(Reader)
{
var oThis = this;
this.boMathr = new Binary_oMathReader(Reader);
this.bcr = new Binary_CommonReader(Reader);
var length = Reader.GetUChar();
var res = false;
Reader.cur += 3;
var obj = null;
var elem = null;
res = this.bcr.Read1(length, function(t, l){
elem = oThis.boMathr.ReadMathArg(t,l,obj);
});
return elem;
},
Save_Changes : function(Data, Writer)
{
......@@ -8023,6 +8074,7 @@ ParaMath.prototype =
Load_Changes : function(Reader)
{
this.Math.CurrentContent.Load_Changes(Reader);
}
};
......
This diff is collapsed.
......@@ -418,9 +418,6 @@ CControlComposition.prototype =
this.Content[this.CurPos].UpdateCursor();
}
}
var MathControl = new CControlComposition();
MathControl.AddComposition();
MathControl.SetPosition({x: 27.5 - 6, y: 25.3 });
var inherit = function(obj, extObj)
{
......@@ -1145,9 +1142,6 @@ function Create_Structures()
}
var MathComposition = new CMathComposition();
MathComposition.SetPosition({x: 27.5 - 6, y: 25.3 });
function MathRecalculate()
{
editor.WordControl.m_oLogicDocument.DrawingDocument.OnRecalculatePage(0, { Width : Page_Width, Height : Page_Height, Margins : {
......
......@@ -6586,9 +6586,120 @@ CMathContent.prototype =
}
},
Save_Changes: function(Data, Writer)
{
},
{
Writer.WriteLong( historyitem_type_Math );
var Type = Data.Type;
// Пишем тип
Writer.WriteLong( Type );
var Math = this.Composition.Parent;
switch ( Type )
{
case historyitem_Math_AddItem:
{
var bArray = Data.UseArray;
var Count = Data.Items.length;
Writer.WriteLong( Count );
for ( var Index = 0; Index < Count; Index++ )
{
if ( true === bArray )
Writer.WriteLong( Data.PosArray[Index] );
else
Writer.WriteLong( Data.Pos + Index );
Math.Write_MathElemToBinary(Writer, Data.Items[Index]);
}
break;
}
case historyitem_Math_RemoveItem:
{
/*var bArray = Data.UseArray;
var Count = Data.Items.length;
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var RealCount = Count;
for ( var Index = 0; Index < Count; Index++ )
{
if ( true === bArray )
{
if ( false === Data.PosArray[Index] )
RealCount--;
else
Writer.WriteLong( Data.PosArray[Index] );
}
else
Writer.WriteLong( Data.Pos );
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( RealCount );
Writer.Seek( EndPos );
break;*/
}
}
/*var oThis = this;
this.bs = new BinaryCommonWriter(Writer);
this.boMaths = new Binary_oMathWriter(Writer);
this.bs.WriteItemWithLength ( function(){oThis.boMaths.WriteArgNodes(oThis.Data);});
*/
},
Load_Changes : function(Reader)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if ( historyitem_type_Math != ClassType )
return;
var paraMath = this.Composition.Parent;
var Type = Reader.GetLong();
switch ( Type )
{
case historyitem_Math_AddItem:
{
var Count = Reader.GetLong();
//var oMathComp = new CMathComposition;
for ( var Index = 0; Index < Count; Index++ )
{
var Pos = Reader.GetLong()
var elem = paraMath.Read_MathElemFromBinary(Reader);
if ( null != elem )
{
//paraMath.Math.AddToComposition(Item.Math.Root);
// TODO: Подумать над тем как по минимуму вставлять отметки совместного редактирования
var Element = new mathElem(elem);
this.content.splice( Pos, 0, new ParaCollaborativeChangesEnd() );
this.content.splice( Pos, 0, Element );
this.content.splice( Pos, 0, new ParaCollaborativeChangesStart() );
CollaborativeEditing.Add_ChangedClass(this);
}
}
this.DeleteCollaborativeMarks = false;
break;
}
}
},
Refresh_RecalcData: function()
{
this.Composition.Refresh_RecalcData2(); // Refresh_RecalcData сообщает родительскому классу, что у него произошли изменения, нужно пересчитать
......@@ -6980,6 +7091,14 @@ CMathContent.prototype =
this.setEndPos_Selection(1);
//this.setEnd_Selection(1);
//this.selection.active = false;
},
Get_Id : function()
{
return this.GetId();
},
GetId : function()
{
return this.Id;
}
/////////////////////////////////////////////////////////////////
......@@ -7035,6 +7154,10 @@ function CMathComposition()
};
this.Init();
//для совместного редактирования каждый элемент записываем в глобальную таблицу
//this.Id = g_oIdCounter.Get_NewId();
//g_oTableId.Add( this, this.Id );
}
CMathComposition.prototype =
{
......@@ -7784,6 +7907,8 @@ CMathComposition.prototype =
var Pos = this.SelectContent.CurPos,
EndPos = this.SelectContent.CurPos + 1;
//для совместного редактирования
this.CurrentContent.Id = this.Id;
History.Add(this.CurrentContent, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: EndPos});
},
CreateEquation: function(indef)
......
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