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

Правки в связи с изменениями схемы для Run

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58340 954022d7-b5bf-4e40-9824-e11837661b57
parent de83f98b
...@@ -550,6 +550,10 @@ ParaMath.prototype = ...@@ -550,6 +550,10 @@ ParaMath.prototype =
var ArgSize = new CMathArgSize(); var ArgSize = new CMathArgSize();
if(PRS.NewRange == false)
this.Root.Recalculate_Reset(PRS.Range, PRS.Line);
this.Root.Resize(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize, TextPr); this.Root.Resize(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize, TextPr);
//this.Root.Resize(null, this, g_oTextMeasurer, RPI/*recalculate properties info*/, TextPr); //this.Root.Resize(null, this, g_oTextMeasurer, RPI/*recalculate properties info*/, TextPr);
...@@ -665,8 +669,7 @@ ParaMath.prototype = ...@@ -665,8 +669,7 @@ ParaMath.prototype =
} }
} }
if(PRS.NewRange == false)
this.Root.Recalculate_Reset(PRS.Range, PRS.Line);
......
...@@ -41,6 +41,7 @@ function ParaRun(Paragraph, bMathRun) ...@@ -41,6 +41,7 @@ function ParaRun(Paragraph, bMathRun)
this.Type = para_Math_Run; this.Type = para_Math_Run;
this.Parent = null; this.Parent = null;
this.ArgSize = 0;
this.bEqqArray = false; this.bEqqArray = false;
this.size = new CMathSize(); this.size = new CMathSize();
this.MathPrp = new CMPrp(); this.MathPrp = new CMPrp();
...@@ -1464,7 +1465,67 @@ ParaRun.prototype.Recalculate_MeasureContent = function() ...@@ -1464,7 +1465,67 @@ ParaRun.prototype.Recalculate_MeasureContent = function()
this.RecalcInfo.Recalc = true; this.RecalcInfo.Recalc = true;
this.RecalcInfo.Measure = false; this.RecalcInfo.Measure = false;
}; };
ParaRun.prototype.Recalculate_MeasureContent_2 = function(WidthPoints)
{
if ( false === this.RecalcInfo.Measure )
return;
var Pr = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(Pr, this.ArgSize);
if(!this.IsNormalText()) // выставляем false, чтобы не применился наклон к спец символам
{
Pr.Italic = false;
Pr.Bold = false;
var defaultTxtPrp = this.Parent.ParaMath.Get_Default_TPrp();
Pr.FontFamily = defaultTxtPrp.FontFamily;
Pr.RFonts.Set_All(defaultTxtPrp.FontFamily.Name, defaultTxtPrp.FontFamily.Index);
}
this.size.SetZero();
var widthCurr = 0,
ascent = 0, descent = 0;
var Theme = this.Paragraph.Get_Theme();
g_oTextMeasurer.SetTextPr(Pr, Theme);
g_oTextMeasurer.SetFontSlot(fontslot_ASCII);
var ContentLength = this.Content.length;
for ( var Pos = 0; Pos < ContentLength; Pos++ )
{
var Item = this.Content[Pos];
var ItemType = Item.Type;
Item.Parent = this;
Item.Resize(g_oTextMeasurer);
var oSize = Item.size;
widthCurr = oSize.width;
this.size.width += widthCurr;
var oDescent = oSize.height - oSize.ascent;
ascent = ascent > oSize.ascent ? ascent : oSize.ascent;
descent = descent < oDescent ? oDescent : descent;
if(this.bEqqArray)
{
if(ItemType !== para_Math_Ampersand)
WidthPoints.UpdatePoint(widthCurr);
else
WidthPoints.AddNewAlignRange();
}
}
this.RecalcInfo.Recalc = true;
this.RecalcInfo.Measure = false;
}
ParaRun.prototype.Recalculate_Measure2 = function(Metrics) ParaRun.prototype.Recalculate_Measure2 = function(Metrics)
{ {
var TAscent = Metrics.Ascent; var TAscent = Metrics.Ascent;
...@@ -1497,13 +1558,23 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1497,13 +1558,23 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
if ( this.Paragraph !== PRS.Paragraph ) if ( this.Paragraph !== PRS.Paragraph )
{ {
this.Paragraph = PRS.Paragraph; this.Paragraph = PRS.Paragraph;
if(this.Type == para_Math_Run)
{
this.ArgSize = PRS.ArgSize.value;
this.bEqqArray = PRS.bEqqArray;
this.Parent = PRS.Parent;
}
this.RecalcInfo.TextPr = true; this.RecalcInfo.TextPr = true;
this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All ); this.Paragraph.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
} }
// Сначала измеряем элементы (можно вызывать каждый раз, внутри разруливается, чтобы измерялось 1 раз) // Сначала измеряем элементы (можно вызывать каждый раз, внутри разруливается, чтобы измерялось 1 раз)
if(this.Type !== para_Math_Run)
this.Recalculate_MeasureContent(); this.Recalculate_MeasureContent();
else
this.Recalculate_MeasureContent_2(PRS.WidthPoints);
var CurLine = PRS.Line - this.StartLine; var CurLine = PRS.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range ); var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range );
...@@ -7776,6 +7847,8 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI, ...@@ -7776,6 +7847,8 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI,
// обновляем позиции start и end для Range // обновляем позиции start и end для Range
//this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos); //this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos);
this.protected_AddRange(0, 0);
this.protected_FillRange(0, 0, RangeStartPos, RangeEndPos);
var oWPrp = this.Get_CompiledPr(true); var oWPrp = this.Get_CompiledPr(true);
......
...@@ -4046,7 +4046,11 @@ CMathContent.prototype = ...@@ -4046,7 +4046,11 @@ CMathContent.prototype =
this.InfoPoints.ContentPoints.UpdatePoint(this.content[pos].size.width); this.InfoPoints.ContentPoints.UpdatePoint(this.content[pos].size.width);
} }
else if(this.content[pos].Type == para_Math_Run) else if(this.content[pos].Type == para_Math_Run)
{
//this.content[pos].Recalculate_Range();
this.content[pos].Math_Recalculate(oMeasure, this, ParaMath.Paragraph, RPI, this.Compiled_ArgSz, this.InfoPoints.ContentPoints); this.content[pos].Math_Recalculate(oMeasure, this, ParaMath.Paragraph, RPI, this.Compiled_ArgSz, this.InfoPoints.ContentPoints);
}
this.WidthToElement[pos] = this.size.width; this.WidthToElement[pos] = this.size.width;
......
...@@ -49,7 +49,6 @@ function CMathText(bJDraw) ...@@ -49,7 +49,6 @@ function CMathText(bJDraw)
this.rasterOffsetY = 0; this.rasterOffsetY = 0;
this.GapLeft = 0; this.GapLeft = 0;
this.GapRight = 0; this.GapRight = 0;
this.WidthVisible = 0;
// TO DO // TO DO
// убрать // убрать
...@@ -515,17 +514,13 @@ CMathText.prototype = ...@@ -515,17 +514,13 @@ CMathText.prototype =
this.size.height = height; this.size.height = height;
this.size.ascent = ascent; this.size.ascent = ascent;
this.WidthVisible = this.size.width;
//this.size = {width: width, widthG: width, height: height, ascent: ascent}; //this.size = {width: width, widthG: width, height: height, ascent: ascent};
}, },
/*ApplyGaps: function() Get_WidthVisible: function()
{ {
this.size.SetZero(); return this.size.width;
},
this.size.width = this.GapLeft + this.GapRight;
this.WidthVisible = this.size.width;
},*/
draw: function(x, y, pGraphics) draw: function(x, y, pGraphics)
{ {
var X = this.pos.x + x, var X = this.pos.x + x,
...@@ -751,7 +746,10 @@ CMathAmp.prototype = ...@@ -751,7 +746,10 @@ CMathAmp.prototype =
}; };
} }
this.WidthVisible = this.size.width; },
Get_WidthVisible: function()
{
return this.size.width;
}, },
setPosition: function(pos) setPosition: function(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