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

1. Исправлен баг на селекте из-за последнего рефакторинга (ревизия 58678)

2. http://bugzserver/show_bug.cgi?id=26751
При нажатии на Enter формула разбивается на две, если разбивка происходит в ране в Root. Реализован Split для ParaMath

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58686 954022d7-b5bf-4e40-9824-e11837661b57
parent 84a19935
......@@ -1659,10 +1659,31 @@ ParaMath.prototype.Handle_AddNewLine = function()
*/
ParaMath.prototype.Split = function (ContentPos, Depth)
{
var NewParaMath = new ParaMath();
var NewParaMath = null;
var Pos = ContentPos.Get(Depth);
return null;
if(this.Root.content[Pos].Type == para_Math_Run)
{
NewParaMath = new ParaMath();
var NewRun = this.Root.content[Pos].Split(ContentPos, Depth+1);
NewParaMath.Root.Add_ToContent(0, NewRun);
var len = this.Root.content.length;
if(Pos < len - 1)
{
NewParaMath.Root.Concat_ToContent( this.Root.content.slice(Pos + 1) );
this.Root.Remove_FromContent(Pos+1, len - Pos - 1);
}
this.SetNeedResize();
NewParaMath.SetNeedResize();
}
return NewParaMath;
};
/**
......
......@@ -919,11 +919,15 @@ ParaRun.prototype.Split = function (ContentPos, Depth)
ParaRun.prototype.Split2 = function(CurPos)
{
// Создаем новый ран
var NewRun = new ParaRun(this.Paragraph);
var bMathRun = this.Type == para_Math_Run;
var NewRun = new ParaRun(this.Paragraph, bMathRun);
// Копируем настройки
NewRun.Set_Pr( this.Pr.Copy() );
if(bMathRun)
NewRun.Set_MathPr(this.MathPrp.Copy());
// TODO: Как только избавимся от para_End переделать тут
// Проверим, если наш ран содержит para_End, тогда мы должны para_End переметить в правый ран
......@@ -4899,7 +4903,7 @@ ParaRun.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
ParaRun.prototype.Split_Run = function(Pos)
{
// Создаем новый ран
var bMathRun = this.Type == para_Math_Run
var bMathRun = this.Type == para_Math_Run;
var NewRun = new ParaRun(this.Paragraph, bMathRun);
// Копируем настройки
......
......@@ -1057,12 +1057,6 @@ CMathBase.prototype =
var NewObj = new this.constructor();
NewObj.init(props);
//NewObj.argSize = this.argSize;
//NewObj.Composition = Composition;
//var CtrPrp = this.CtrPrp.Copy();
//NewObj.setCtrPrp(CtrPrp);
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
......
......@@ -906,7 +906,6 @@ function CMathContent()
this.InfoPoints = new CInfoPoints();
///////////////
this.bDot = false;
this.plhHide = false;
this.bRoot = false;
//////////////////
......@@ -941,7 +940,7 @@ CMathContent.prototype =
},
addElementToContent: function(obj) //for "read"
{
this.Internal_Content_Add(this.content.length, obj);
this.Internal_Content_Add(this.content.length, obj, false);
this.CurPos = this.content.length-1;
},
fillPlaceholders: function()
......@@ -2253,26 +2252,41 @@ CMathContent.prototype =
}
},
Internal_Content_Add : function(Pos, Item)
Internal_Content_Add : function(Pos, Item, bUpdatePosition)
{
History.Add( this, { Type : historyitem_Math_AddItem, Pos : Pos, EndPos : Pos, Items : [ Item ] } );
this.content.splice( Pos, 0, Item );
if ( this.CurPos >= Pos )
this.CurPos++;
if(bUpdatePosition !== false)
{
if ( this.CurPos >= Pos )
this.CurPos++;
if ( this.Selection.Start >= Pos )
this.Selection.Start++;
if ( this.Selection.Start >= Pos )
this.Selection.Start++;
if ( this.Selection.End >= Pos )
this.Selection.End++;
if ( this.Selection.End >= Pos )
this.Selection.End++;
}
if(this.ParaMath !== null)
this.ParaMath.SetNeedResize();
},
Add_ToContent : function(Pos, Item)
{
this.Internal_Content_Add(Pos, Item);
},
Concat_ToContent: function(NewItems)
{
var StartPos = this.content.length;
this.content = this.content.concat( NewItems );
History.Add( this, { Type : historyitem_Math_AddItem, Pos : StartPos, EndPos : this.content.length - 1, Items : NewItems } );
if(this.ParaMath !== null)
this.ParaMath.SetNeedResize();
},
Remove_FromContent : function(Pos, Count)
{
......@@ -2306,6 +2320,9 @@ CMathContent.prototype =
}
}
if(this.ParaMath !== null)
this.ParaMath.SetNeedResize();
},
Get_Default_TPrp: function()
......@@ -2626,6 +2643,8 @@ CMathContent.prototype =
case historyitem_Math_AddItem:
{
this.content.splice(Data.Pos, Data.EndPos - Data.Pos + 1);
this.ParaMath.SetNeedResize();
break;
}
case historyitem_Math_RemoveItem:
......@@ -2636,6 +2655,8 @@ CMathContent.prototype =
var Array_end = this.content.slice(Pos);
this.content = Array_start.concat(Data.Items, Array_end);
this.ParaMath.SetNeedResize();
break;
}
}
......@@ -2654,11 +2675,15 @@ CMathContent.prototype =
var Array_end = this.content.slice(Pos);
this.content = Array_start.concat(Data.Items, Array_end);
this.ParaMath.SetNeedResize();
break;
}
case historyitem_Math_RemoveItem:
{
this.content.splice(Data.Pos, Data.EndPos - Data.Pos + 1);
this.ParaMath.SetNeedResize();
break;
}
}
......
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