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

1. Поправила вычисление ширины формулы, выровненной по ширине (not inline)

2. Settings св-во BreakBin
3. Поправила баг: неправильно вычислялась высота Limit
4. Поправила баги: неправильно учитывались gaps для Box и Limit

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61008 954022d7-b5bf-4e40-9824-e11837661b57
parent 241fd171
......@@ -9,6 +9,8 @@ var g_dMathArgSizeKoeff_2 = 0.76 * 0.855;
function CMathPropertiesSettings()
{
this.brkBin = null;
this.defJc = null;
this.dispDef = null;
......@@ -21,9 +23,7 @@ function CMathPropertiesSettings()
this.rMargin = null;
this.wrapIndent = null;
// не реализовано //
this.brkBin = null;
this.brkBinSub = null;
this.interSp = null;
......@@ -43,6 +43,7 @@ function CMathPropertiesSettings()
}
CMathPropertiesSettings.prototype.SetDefaultPr = function()
{
this.brkBin = BREAK_BEFORE;
this.defJc = align_Justify;
this.dispDef = true;
this.intLim = NARY_SubSup;
......@@ -71,6 +72,9 @@ CMathPropertiesSettings.prototype.Merge = function(Pr)
if(Pr.defJc !== null && Pr.defJc !== undefined)
this.defJc = Pr.defJc;
if(Pr.brkBin !== null && Pr.brkBin !== undefined)
this.brkBin = Pr.brkBin
};
var g_oMathSettings = {};
......@@ -164,6 +168,11 @@ CMathSettings.prototype.Get_DispDef = function()
this.SetCompiledPr();
return this.CompiledPr.dispDef;
};
CMathSettings.prototype.Get_BrkBin = function()
{
this.SetCompiledPr();
return this.CompiledPr.brkBin;
};
function Get_WordDocumentDefaultMathSettings()
{
......@@ -210,7 +219,7 @@ function ParaMath()
this.bSelectionUse = false;
this.RecalcJustify = true;
this.Paragraph = null;
this.State = ALIGN_MARGIN_WRAP;
......@@ -817,7 +826,12 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var bFirstLine = this.Root.IsFirstLine(ParaLine);
if(PRS.PrevLineRecalcInfo.Object == null && true == bFirstLine)
{
this.State = ALIGN_MARGIN_WRAP;
this.LinesWidths.length = 0;
this.MaxLinesW = 0;
this.RecalcJustify = true;
}
var MathSettings = Get_WordDocumentDefaultMathSettings();
......@@ -855,6 +869,16 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.State++;
}
var Jc = this.Get_Align();
if(PRS.NewRange == false && Jc == align_Justify && this.RecalcJustify == true)
{
PRS.PrevLineRecalcInfo.Object = this;
PRS.RecalcResult = recalcresult_PrevLine;
PRS.NewRange = true;
this.RecalcJustify = false;
}
this.ParaMathRPI.ClearRecalculate();
};
ParaMath.prototype.Recalculate_Reset = function(CurRange, CurLine)
......@@ -872,29 +896,15 @@ ParaMath.prototype.Recalculate_Set_RangeEndPos = function(PRS, PRP, Depth)
};
ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
{
if(_CurLine == 0 && _CurRange == 0)
{
this.LinesWidths.length = 0;
this.MaxLinesW = 0;
/*var lng = this.Root.protected_GetLinesCount();
for(var Line = 0; Line < lng; Line++)
{
var W = this.Root.GetWidthLine(Line, 0);
this.LinesWidths.push(W);
this.MaxLinesW = Line !== 0 && this.MaxLinesW < W ? W: this.MaxLinesW;
}*/
}
this.Root.Recalculate_Range_Width(PRSC, _CurLine, _CurRange);
var W = PRSC.Range.W + PRSC.SpaceLen;
this.LinesWidths.push(W);
var CurLine = _CurLine - this.Root.StartLine;
this.LinesWidths[CurLine] = W;
this.MaxLinesW = _CurLine !== 0 && this.MaxLinesW < W ? W: this.MaxLinesW;
};
ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, _CurPage)
{
var CurLine = _CurLine - this.StartLine;
......@@ -903,7 +913,7 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
if (EndPos >= 1)
{
if ( 0 !== PRSA.LettersSkip )
{
......@@ -922,7 +932,6 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
PRSA.LastW = this.WidthVisible;
}
};
ParaMath.prototype.Recalculate_PageEndInfo = function(PRSI, _CurLine, _CurRange)
{
};
......@@ -1104,6 +1113,12 @@ ParaMath.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange
}
};
ParaMath.prototype.Is_BrkBinBefore = function()
{
var MathSettings = Get_WordDocumentDefaultMathSettings();
return this.Is_Inline() ? false : MathSettings.Get_BrkBin() == BREAK_BEFORE;
};
ParaMath.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
......
......@@ -1648,11 +1648,6 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var Pos = RangeStartPos;
var bInline = false;
if(this.Type == para_Math_Run)
bInline = this.ParaMath.Is_Inline();
var UpdateLineMetricsText = false;
var ContentLen = this.Content.length;
......@@ -1709,7 +1704,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
}
}
if (true !== NewRange || (this.Type == para_Math_Run && bInline == true))
if (true !== NewRange || (this.Type == para_Math_Run && this.ParaMath.Is_BrkBinBefore() == false))
{
// Отмечаем начало нового слова
PRS.Set_LineBreakPos(Pos);
......@@ -1830,14 +1825,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
SpaceLen += Item.Width / TEXTWIDTH_DIVIDER;//SpaceLen += Item.Get_Width();
/*if(bInline == false && bCurrWord == true)
{
PRS.Set_LineBreakPos(Pos);
WordLen = SpaceLen;
SpaceLen = 0;
Word = true;
}*/
if(bInline == false)
if(this.ParaMath.Is_BrkBinBefore() == true)
{
if(bCurrWord == true)
{
......
......@@ -625,7 +625,7 @@ CMathBase.prototype =
{
var kind = this.kind;
var gaps = {left: 0, right: 0};
var checkBase = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL|| kind == MATH_BOX || kind == MATH_BORDER_BOX || (kind == MATH_DELIMITER && this.Pr.grow == true);
var checkBase = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL || kind == MATH_LIMIT || kind == MATH_BORDER_BOX || (kind == MATH_DELIMITER && this.Pr.grow == true);
if(checkBase)
{
......
......@@ -103,7 +103,7 @@ CLimitPrimary.prototype.recalculateSize = function(oMeasure)
SizeIter = this.Iterator.size;
var width = SizeFName.width > SizeIter.width ? SizeFName.width : SizeIter.width,
height = SizeFName.height + SizeIter.height,
height = SizeFName.height + SizeIter.height + this.dH,
ascent;
if(this.Type == LIMIT_LOW)
......@@ -154,6 +154,10 @@ CLimit.prototype.getIterator = function()
{
return this.Content[1];
};
CLimit.prototype.getBase = function()
{
return this.getFName();
};
CLimit.prototype.ApplyProperties = function(RPI)
{
if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true)
......
......@@ -236,12 +236,6 @@ function CCoeffGaps()
right: new CGaps(0, 0, 0, 0.49)
};
/*this.Equal =
{
left: new CGaps(0.35, 0, 0, 0.7),
right: new CGaps(0.25, 0, 0, 0.5)
};*/
this.Equal =
{
left: new CGaps(0, 0, 0, 0.7),
......@@ -381,14 +375,7 @@ CMathArgSize.prototype =
function CMathGapsInfo(argSize)
{
//this.measure = oMeasure;
//this.Parent = Parent;
//this.ParaMath = this.Parent.ParaMath; // для Para_Run
this.argSize = argSize; // argSize выставляем один раз для всего контента
//this.leftRunPrp = null; // Run_Prp левого элемента
//this.currRunPrp = null;
this.Left = null; // элемент слева
this.Current = null; // текущий элемент
......@@ -534,7 +521,7 @@ CMathGapsInfo.prototype =
checkGapKind: function(kind)
{
var bEmptyGaps = kind == MATH_DELIMITER || kind == MATH_MATRIX,
bChildGaps = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL|| kind == MATH_BOX || kind == MATH_BORDER_BOX || (kind == MATH_DELIMITER);
bChildGaps = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL || kind == MATH_LIMIT || kind == MATH_BORDER_BOX || (kind == MATH_DELIMITER);
return {bEmptyGaps: bEmptyGaps, bChildGaps: bChildGaps};
}
......@@ -957,7 +944,6 @@ CMathContent.prototype.draw = function(x, y, pGraphics, PDSE)
}
else
this.Content[i].Draw_Elements(PDSE);
//this.Content[i].Math_Draw(x, y, pGraphics);
}
}
};
......
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