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