Commit 6668b903 authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander.Trofimov

исправлено падение в run при использовании формул

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57855 954022d7-b5bf-4e40-9824-e11837661b57
parent 78ba6763
......@@ -160,14 +160,14 @@ ParaMath.prototype =
{
var oText = new CMathText(false);
oText.addTxt(Item.Value);
oStartContent.Add(oText);
oStartContent.Add(oText, true);
}
else if ( para_Space === Type )
{
//var oSpace = new ParaSpace(1);
var oText = new CMathText(false);
oText.addTxt(" ");
oStartContent.Add(oText);
oStartContent.Add(oText, true);
}
else if ( para_Math === Type )
{
......@@ -200,7 +200,7 @@ ParaMath.prototype =
var Pos = oMRun.Content.length;
var EndPos = Pos + 1;
var oItem = oStartContent.Content[i];
oMRun.Add(oItem);
oMRun.Add(oItem, true);
oStartContent.Remove_FromContent(i, 1, false);
}
}
......@@ -360,6 +360,8 @@ ParaMath.prototype =
var Items = [];
for (var i=start; i<=end; i++)
Items.push(oContent.Content.content[i]);
oContent.Content.CurPos -= len;
oContent.Content.content.splice( oContent.Start, len );
History.Add(oContent.Content, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: oContent.Start});
......
......@@ -253,9 +253,9 @@ ParaRun.prototype =
},
// Добавляем элемент в текущую позицию
Add : function(Item)
Add : function(Item, bMath)
{
this.Add_ToContent( this.State.ContentPos, Item, true );
this.Add_ToContent( this.State.ContentPos, Item, true, bMath );
},
Remove : function(Direction, bOnAddText)
......@@ -357,7 +357,7 @@ ParaRun.prototype =
},
// Добавляем элемент в позицию с сохранием в историю
Add_ToContent : function(Pos, Item, UpdatePosition)
Add_ToContent : function(Pos, Item, UpdatePosition, bMath)
{
History.Add( this, { Type : historyitem_ParaRun_AddItem, Pos : Pos, EndPos : Pos, Items : [ Item ] } );
this.Content.splice( Pos, 0, Item );
......@@ -396,7 +396,7 @@ ParaRun.prototype =
}
// Особый случай, когда мы добавляем элемент в самый последний ран
if ( Pos === this.Content.length - 1 && LinesCount - 1 === CurLine )
if ( Pos === this.Content.length - 1 && LinesCount - 1 === CurLine && !bMath)
{
this.Lines[CurLine].Ranges[RangesCount - 1].EndPos++;
}
......
......@@ -5427,17 +5427,6 @@ CMathContent.prototype =
Writer.WriteLong( Data.Pos + Index );
Writer.WriteString2( oElem.Id );
Writer.WriteLong( typeObj );
if (typeObj == MATH_PARA_RUN)
{
Writer.WriteBool(oElem.MathPrp.aln);
Writer.WriteBool(oElem.MathPrp.bold);
Writer.WriteBool(oElem.MathPrp.brk);
Writer.WriteBool(oElem.MathPrp.italic);
Writer.WriteBool(oElem.MathPrp.lit);
Writer.WriteLong(oElem.MathPrp.typeText);
}
}
break;
}
......@@ -5478,20 +5467,7 @@ CMathContent.prototype =
{
var Pos = Reader.GetLong();
var Element = g_oTableId.Get_ById( Reader.GetString2() );
var typeObj = Reader.GetLong();
if (typeObj == MATH_PARA_RUN)
{
var MathPrp = new CMPrp();
MathPrp.aln = Reader.GetBool();
MathPrp.bold = Reader.GetBool();
MathPrp.brk = Reader.GetBool();
MathPrp.italic = Reader.GetBool();
MathPrp.lit = Reader.GetBool();
Element.MathPrp = MathPrp;
Element.typeObj = typeObj;
}
this.DeleteEmptyRuns();
this.content.splice( Pos, 0, Element );
this.SetRunEmptyToContent(true);
}
......@@ -7248,7 +7224,7 @@ CMathContent.prototype =
{
oElem.Parent = this;
if(oElem.typeObj === MATH_COMP)
if(oElem.Type === para_Math_Composition)
{
//oElem.setArgSize(this.argSize);
this.content.splice(Pos,0,oElem);
......@@ -7273,7 +7249,7 @@ CMathContent.prototype =
{
var oText = new CMathText(false);
oText.addTxt(sText[i]);
MathRun.Add(oText);
MathRun.Add(oText, true);
}
oElem.DeleteEmptyRuns();
oElem.Add(MathRun,Pos);
......
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