Commit c0781f3c authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Переделала функцию для добавления строк в EqArray , реализовала функции для...

Переделала функцию для добавления строк в EqArray , реализовала функции для совместного редактирования при добавлении строк в EqArray

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59365 954022d7-b5bf-4e40-9824-e11837661b57
parent 2b191513
......@@ -1817,6 +1817,7 @@ var historyitem_Math_RemoveItem = 2; // Удаляем элем
var historyitem_Math_CtrPrpFSize = 3; // CtrPrp
var hisotryitem_Math_ParaJc = 4; // ParaMath.Jc
var historyitem_Math_CtrPrpShd = 5;
var historyitem_Math_AddItems_ToMathBase = 6;
function ReadChanges_FromBinary(Reader, Class)
{
......@@ -1825,9 +1826,10 @@ function ReadChanges_FromBinary(Reader, Class)
switch(Type)
{
case historyitem_Math_CtrPrpFSize: Changes = new CChangesMathFontSize(); break;
case hisotryitem_Math_ParaJc : Changes = new CChangesMathParaJc(); break;
case historyitem_Math_CtrPrpShd: Changes = new CChangesMathShd(); break;
case historyitem_Math_CtrPrpFSize : Changes = new CChangesMathFontSize(); break;
case hisotryitem_Math_ParaJc : Changes = new CChangesMathParaJc(); break;
case historyitem_Math_CtrPrpShd : Changes = new CChangesMathShd(); break;
case historyitem_Math_AddItems_ToMathBase : Changes = new CChangesMathAddItems(); break;
}
if (null !== Changes)
......@@ -1930,24 +1932,64 @@ CChangesMathShd.prototype.Load_Changes = function(Reader, Class)
this.Redo(Class);
};
function CChangesMathAddItems(Pos, Items)
{
this.Pos = Pos;
this.Items = Items;
}
CChangesMathAddItems.prototype.Type = historyitem_Math_AddItems_ToMathBase;
CChangesMathAddItems.prototype.Undo = function(Class)
{
};
CChangesMathAddItems.prototype.Redo = function(Class)
{
Class.raw_Internal_Content_Add(this.Pos, this.Items, false);
};
CChangesMathAddItems.prototype.Save_Changes = function(Writer)
{
var Count = this.Items.length;
Writer.WriteLong(Count);
for(var Index = 0; Index < Count; Index++)
{
Writer.WriteLong(this.Pos + Index);
Writer.WriteString2(this.Items[Index].Get_Id());
}
};
CChangesMathAddItems.prototype.Load_Changes = function(Reader, Class)
{
var Count = Reader.GetLong();
this.Pos = Reader.GetLong();
if(this.Items == undefined)
this.Items = [];
for(var Index = 0; Index < Count; Index++)
{
var Element = g_oTableId.Get_ById( Reader.GetString2() );
if ( null != Element )
this.Items.push(Element);
}
this.Redo(Class);
};
function CChangesMathParaJc(NewValue, OldValue)
{
this.New = NewValue;
this.Old = OldValue;
}
CChangesMathParaJc.prototype.Type = hisotryitem_Math_ParaJc;
CChangesMathParaJc.prototype.Undo = function(Class)
{
Class.raw_SetAlign(this.Old);
};
CChangesMathParaJc.prototype.Redo = function(Class)
{
Class.raw_SetAlign(this.New);
};
CChangesMathParaJc.prototype.Save_Changes = function(Writer)
{
// Bool : undefined?
......@@ -1960,7 +2002,6 @@ CChangesMathParaJc.prototype.Save_Changes = function(Writer)
Writer.WriteLong(this.New);
}
};
CChangesMathParaJc.prototype.Load_Changes = function(Reader, Class)
{
if (true === Reader.GetBool())
......
......@@ -1040,6 +1040,41 @@ CMathBase.prototype.Draw_HighLights = function(PDSH, bAll)
PDSH.X = this.pos.x + this.ParaMath.X + this.size.width;
};
CMathBase.prototype.Internal_Content_Add = function(Pos, Items, bUpdatePosition)
{
History.Add(this, new CChangesMathAddItems(Pos, Items));
//History.Add( this, { Type : historyitem_Math_AddItems_ToMathBase, Pos : Pos, EndPos : Pos, Items : Items } );
this.raw_Internal_Content_Add(Pos, Items, bUpdatePosition);
};
CMathBase.prototype.raw_Internal_Content_Add = function(Pos, Items, bUpdatePosition)
{
for(var Index = 0; Index < Items.length; Index++)
this.Content.splice(Pos + Index, 0, Items[Index]);
this.Update_Pos_After_AddItems(Pos, bUpdatePosition);
this.fillContent();
this.private_SetNeedResize();
}
CMathBase.prototype.Update_Pos_After_AddItems = CMathContent.prototype.Update_Pos_After_AddItems;
CMathBase.prototype.private_CorrectSelectionPos = CMathContent.prototype.private_CorrectSelectionPos;
CMathBase.prototype.private_SetNeedResize = CMathContent.prototype.private_SetNeedResize;
CMathBase.prototype.private_CorrectCurPos = function()
{
if (this.CurPos > this.Content.length - 1)
{
this.CurPos = this.Content.length - 1;
this.Content[this.CurPos].Cursor_MoveToEndPos(false);
}
if (this.CurPos < 0)
{
this.CurPos = this.Content.length - 1;
this.Content[this.CurPos].Cursor_MoveToStartPos();
}
}
CMathBase.prototype.Search = ParaHyperlink.prototype.Search;
CMathBase.prototype.Add_SearchResult = ParaHyperlink.prototype.Add_SearchResult;
CMathBase.prototype.Clear_SearchResults = ParaHyperlink.prototype.Clear_SearchResults;
......
......@@ -1564,6 +1564,10 @@ CMathContent.prototype =
History.Add( this, { Type : historyitem_Math_AddItem, Pos : Pos, EndPos : Pos, Items : [ Item ] } );
this.Content.splice( Pos, 0, Item );
this.Update_Pos_After_AddItems(Pos, bUpdatePosition);
},
Update_Pos_After_AddItems: function(Pos, bUpdatePosition)
{
if(bUpdatePosition !== false)
{
if ( this.CurPos >= Pos )
......
......@@ -640,10 +640,6 @@ CMathEqArrPr.prototype.Read_FromBinary = function(Reader)
this.row = Reader.GetLong();
};
CMathEqArrPr.prototype.DecreaseCountRow = function()
{
this.row++;
}
////
function CEqArray(props)
......@@ -688,16 +684,23 @@ CEqArray.prototype.init = function(props)
this.fillContent();
}
CEqArray.prototype.addRow = function()
{
this.bDecreaseRow = true;
var NewContent = new CMathContent();
this.Internal_Content_Add(this.CurPos + 1, [NewContent], true);
return NewContent;
}
/*CEqArray.prototype.addRow = function()
{
this.Content.splice( this.CurPos + 1, 0, new CMathContent() );
this.Content[this.CurPos + 1].ParentElement = this;
this.Pr.DecreaseCountRow();
this.bDecreaseRow = true;
//this.Pr.DecreaseCountRow();
//this.bDecreaseRow = true;
return this.Content[this.CurPos + 1];
}
}*/
CEqArray.prototype.fillContent = function()
{
var nRowsCount = this.Content.length;
......@@ -710,11 +713,7 @@ CEqArray.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo
{
if(this.bDecreaseRow)
{
this.elements.splice(this.CurPos + 1, 0, []);
this.elements[this.CurPos + 1][0] = this.Content[this.CurPos + 1];
this.alignment.hgt[this.CurPos + 1] = MCJC_CENTER;
this.nRow++;
this.fillContent();
this.bDecreaseRow = false;
}
......
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