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

1. Попрпавила баг : не пересчитывался размер формулы при смене текстовых настроек

2. На Correct_Pos добавила проверку на плейсхолдер для контента

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58675 954022d7-b5bf-4e40-9824-e11837661b57
parent 1320ec21
...@@ -28,14 +28,7 @@ function ParaMath() ...@@ -28,14 +28,7 @@ function ParaMath()
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
this.Type = para_Math; this.Type = para_Math;
//this.MathPara = true; // false - внутристроковая формула, true - формула на отдельной строке (w:oMath/w:oMathPara)
//this.OldMathPara = null;
this.Jc = undefined; this.Jc = undefined;
//this.Math = new CMathComposition();
//this.Math.Parent = this;
//this.Root = this.Math.Root;
this.Root = new CMathContent(); this.Root = new CMathContent();
this.Root.bRoot = true; this.Root.bRoot = true;
...@@ -43,14 +36,11 @@ function ParaMath() ...@@ -43,14 +36,11 @@ function ParaMath()
this.X = 0; this.X = 0;
this.Y = 0; this.Y = 0;
//this.CurrentContent = this.RootComposition;
//this.SelectContent = this.RootComposition;
this.bInline = false; this.bInline = false;
this.bChangeInline = true; this.bChangeInline = true;
this.NeedResize = true; this.NeedResize = true;
this.bSelectionUse = false; this.bSelectionUse = false;
//this.State = new CParaRunState(); // Положение курсора и селекта для данного run //this.State = new CParaRunState(); // Положение курсора и селекта для данного run
this.Paragraph = null; this.Paragraph = null;
...@@ -63,7 +53,6 @@ function ParaMath() ...@@ -63,7 +53,6 @@ function ParaMath()
this.Descent = 0; this.Descent = 0;
this.DefaultTextPr = new CTextPr(); this.DefaultTextPr = new CTextPr();
//this.DefaultTextPr.Init_Default();
this.DefaultTextPr.Italic = true; this.DefaultTextPr.Italic = true;
this.DefaultTextPr.FontFamily = {Name : "Cambria Math", Index : -1 }; this.DefaultTextPr.FontFamily = {Name : "Cambria Math", Index : -1 };
...@@ -170,6 +159,8 @@ ParaMath.prototype.Add = function(Item) ...@@ -170,6 +159,8 @@ ParaMath.prototype.Add = function(Item)
var oStartContent = oContent.Content.content[oContent.Start]; var oStartContent = oContent.Content.content[oContent.Start];
var oEndContent = oContent.Content.content[oContent.End]; var oEndContent = oContent.Content.content[oContent.End];
if ( para_Text === Type) if ( para_Text === Type)
{ {
var oText = new CMathText(false); var oText = new CMathText(false);
...@@ -233,8 +224,11 @@ ParaMath.prototype.Add = function(Item) ...@@ -233,8 +224,11 @@ ParaMath.prototype.Add = function(Item)
} }
oContent.Content.SetRunEmptyToContent(true); oContent.Content.SetRunEmptyToContent(true);
} }
oContent.Content.Correct_Content();
}; };
ParaMath.prototype.Remove = function(Direction, bOnAddText) ParaMath.prototype.Remove = function(Direction, bOnAddText)
...@@ -406,6 +400,8 @@ ParaMath.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll) ...@@ -406,6 +400,8 @@ ParaMath.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
{ {
// TODO: ParaMath.Apply_TextPr // TODO: ParaMath.Apply_TextPr
this.NeedResize = true;
if(ApplyToAll == true) // для ситуации, когда ApplyToAll = true, в Root формулы при этом позиции селекта не проставлены if(ApplyToAll == true) // для ситуации, когда ApplyToAll = true, в Root формулы при этом позиции селекта не проставлены
{ {
this.Root.Apply_TextPr(TextPr, IncFontSize, true); this.Root.Apply_TextPr(TextPr, IncFontSize, true);
...@@ -572,13 +568,8 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -572,13 +568,8 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
else else
this.Root.Resize_2(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize); this.Root.Resize_2(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize);
this.NeedResize = false; this.NeedResize = false;
//this.OldMathPara = this.MathPara;
//this.Root.Resize(null, this, g_oTextMeasurer, RPI/*recalculate properties info*/, TextPr);
this.Width = this.Root.size.width; this.Width = this.Root.size.width;
this.Height = this.Root.size.height; this.Height = this.Root.size.height;
......
...@@ -7971,6 +7971,14 @@ ParaRun.prototype.fillPlaceholders = function() ...@@ -7971,6 +7971,14 @@ ParaRun.prototype.fillPlaceholders = function()
this.Add_ToContent(0, placeholder, false); this.Add_ToContent(0, placeholder, false);
} }
ParaRun.prototype.Math_Correct_Content = function()
{
for(var i = 0; i < this.Content.length; i++)
{
if(this.Content[i].Type == para_Math_Placeholder)
this.Remove_FromContent(i, 1, true);
}
}
ParaRun.prototype.Set_MathPr = function(MPrp) ParaRun.prototype.Set_MathPr = function(MPrp)
{ {
var OldValue = this.MathPrp; var OldValue = this.MathPrp;
......
...@@ -3975,9 +3975,6 @@ CMathContent.prototype = ...@@ -3975,9 +3975,6 @@ CMathContent.prototype =
var GapsInfo = new CMathGapsInfo(oMeasure, this, this.Compiled_ArgSz.value); var GapsInfo = new CMathGapsInfo(oMeasure, this, this.Compiled_ArgSz.value);
if (!this.bRoot && this.content.length == 0)
this.fillPlaceholders();
this.RecalcInfo.bEqqArray = RPI.bEqqArray; this.RecalcInfo.bEqqArray = RPI.bEqqArray;
var lng = this.content.length; var lng = this.content.length;
...@@ -4438,7 +4435,7 @@ CMathContent.prototype = ...@@ -4438,7 +4435,7 @@ CMathContent.prototype =
} }
this.Selection.Start = posStart; this.Selection.Start = posStart;
this.Selection.End = posEnd; this.Selection.End = posEnd;
Depth++; Depth++;
if(this.IsPlaceholder()) if(this.IsPlaceholder())
...@@ -4831,7 +4828,6 @@ CMathContent.prototype = ...@@ -4831,7 +4828,6 @@ CMathContent.prototype =
this.Internal_Content_Add(len, emptyRun); this.Internal_Content_Add(len, emptyRun);
} }
}, },
Correct_Content : function() Correct_Content : function()
{ {
...@@ -4857,6 +4853,19 @@ CMathContent.prototype = ...@@ -4857,6 +4853,19 @@ CMathContent.prototype =
nLen--; nLen--;
} }
} }
if(para_Math_Run === oCurrElement.Type)
oCurrElement.Math_Correct_Content();
}
if (this.content.length == 1)
{
if(para_Math_Run === this.content[0].Type)
this.content[0].Math_Correct_Content();
if(this.content[0].Is_Empty())
this.content[0].fillPlaceholders();
} }
}, },
......
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