Commit fe59d833 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлены баги с падением при drag-n-drop в формулах (баги 27347, 27334).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59398 954022d7-b5bf-4e40-9824-e11837661b57
parent e549b9f5
......@@ -8577,7 +8577,10 @@ CDocument.prototype =
var DocContent = this.Get_SelectedContent();
if (false === this.Can_InsertContent(DocContent, NearPos))
{
History.Remove_LastPoint();
return;
}
var Para = NearPos.Paragraph;
......@@ -8666,9 +8669,20 @@ CDocument.prototype =
{
// Проверяем, что вставляемый контент тоже формула
var Element = SelectedContent.Elements[0].Element;
if (1 !== SelectedContent.Elements.length || type_Paragraph !== Element.Get_Type() || 2 !== Element.Content.length || para_Math !== Element.Content[0].Type || null === LastClass.Parent)
if (1 !== SelectedContent.Elements.length || type_Paragraph !== Element.Get_Type()|| null === LastClass.Parent)
return false;
var Math = null;
var Count = Element.Content.length;
for (var Index = 0; Index < Count; Index++)
{
var Item = Element.Content[Index];
if (para_Math === Item.Type && null === Math)
Math = Element.Content[Index];
else if (true !== Item.Is_Empty({SkipEnd : true}))
return false;
}
}
else if (para_Run !== LastClass.Type)
return false;
......
......@@ -579,6 +579,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
if(RPI.NeedResize)
{
this.Root.Set_Paragraph(Para);
this.Root.Set_ParaMath(this);
this.Root.PreRecalc(null, this, ArgSize, RPI);
this.Root.Resize(g_oTextMeasurer, RPI/*recalculate properties info*/);
// когда формула будеат разбиваться на строки, Position придется перерасчитывать
......
......@@ -87,6 +87,10 @@ ParaRun.prototype.Set_Paragraph = function(Paragraph)
this.Paragraph = Paragraph;
};
ParaRun.prototype.Set_ParaMath = function(ParaMath)
{
this.ParaMath = ParaMath;
};
ParaRun.prototype.Save_StartState = function()
{
this.StartState = new CParaRunStartState(this);
......
......@@ -740,6 +740,7 @@ CMathBase.prototype =
};
CMathBase.prototype.Set_Paragraph = ParaHyperlink.prototype.Set_Paragraph;
CMathBase.prototype.Get_ElementByPos = ParaHyperlink.prototype.Get_ElementByPos;
CMathBase.prototype.Set_ParaMath = CMathContent.prototype.Set_ParaMath;
CMathBase.prototype.Recalculate_Reset = function(StartRange, StartLine)
{
for (var nPos = 0, nCount = this.Content.length; nPos < nCount; nPos++)
......
......@@ -1574,6 +1574,9 @@ CMathContent.prototype =
},
Internal_Content_Add : function(Pos, Item, bUpdatePosition)
{
Item.Set_ParaMath(this.ParaMath);
Item.Parent = this;
History.Add( this, { Type : historyitem_Math_AddItem, Pos : Pos, EndPos : Pos, Items : [ Item ] } );
this.Content.splice( Pos, 0, Item );
......@@ -2038,6 +2041,15 @@ CMathContent.prototype =
};
CMathContent.prototype.Set_Paragraph = ParaHyperlink.prototype.Set_Paragraph;
CMathContent.prototype.Get_ElementByPos = ParaHyperlink.prototype.Get_ElementByPos;
CMathContent.prototype.Set_ParaMath = function(ParaMath)
{
this.ParaMath = ParaMath;
for (var Index = 0, Count = this.Content.length; Index < Count; Index++)
{
this.Content[Index].Set_ParaMath(ParaMath);
}
};
CMathContent.prototype.Load_FromMenu = function(Type, Paragraph)
{
this.Paragraph = Paragraph;
......
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