Commit 4e4783ba authored by Anna.Pavlova's avatar Anna.Pavlova

1. Поправлен баг : неправильное выравнивание формул, находящихся на страницах, отличных от первой

2. Поправлены баги для inline формул: две формулы находятся в одной строке (при этом хотя бы одна занимает больше одной строки)
3. Поправен расчет выравнивания inline-формул по ширине

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61261 954022d7-b5bf-4e40-9824-e11837661b57
parent 5b91b353
...@@ -75,7 +75,10 @@ CMathPropertiesSettings.prototype.Merge = function(Pr) ...@@ -75,7 +75,10 @@ CMathPropertiesSettings.prototype.Merge = function(Pr)
this.defJc = Pr.defJc; this.defJc = Pr.defJc;
if(Pr.brkBin !== null && Pr.brkBin !== undefined) if(Pr.brkBin !== null && Pr.brkBin !== undefined)
this.brkBin = Pr.brkBin this.brkBin = Pr.brkBin;
if(Pr.dispDef !== null && Pr.dispDef !== undefined)
this.dispDef = Pr.dispDef;
}; };
var g_oMathSettings = {}; var g_oMathSettings = {};
...@@ -211,7 +214,7 @@ function ParaMath() ...@@ -211,7 +214,7 @@ function ParaMath()
this.X = 0; this.X = 0;
this.Y = 0; this.Y = 0;
this.FirstPage = 0; this.FirstPage = -1;
this.LinesWidths = []; // в тч для отрисовки рамки this.LinesWidths = []; // в тч для отрисовки рамки
this.LinesPositions = []; this.LinesPositions = [];
...@@ -438,16 +441,22 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, Page, _X, _XL ...@@ -438,16 +441,22 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, Page, _X, _XL
var wrapIndent = MathSettings.Get_WrapIndent(this.State); var wrapIndent = MathSettings.Get_WrapIndent(this.State);
var CurrentPage = Page - this.FirstPage;
_X += MathSettings.Get_LeftMargin(this.State); _X += MathSettings.Get_LeftMargin(this.State);
_XLimit -= MathSettings.Get_RightMargin(this.State); _XLimit -= MathSettings.Get_RightMargin(this.State);
var Jc = this.Get_Align(); var Jc = this.Get_Align();
var FirstWidth = Page == 0 ? this.LinesWidths[0] : 0; // если страница не первая, то ширину первой строки формулы не учитываем var FirstWidth = CurrentPage == 0 ? this.LinesWidths[0] : 0; // если страница не первая, то ширину первой строки формулы не учитываем
var W = 0; var W = 0;
var MaxW = this.CurPageInfo.MaxLineW; var MaxW = this.CurPageInfo.MaxLineW;
if(this.FirstPage == Page) var LineCount = this.Root.protected_GetLinesCount();
if(LineCount == 1) // чтобы не сравнивать с wrapIndent, когда формула занимает одну строку
W = FirstWidth;
else if(CurrentPage == 0)
W = Math.max(MaxW + wrapIndent, FirstWidth); W = Math.max(MaxW + wrapIndent, FirstWidth);
else else
W = MaxW; W = MaxW;
...@@ -831,12 +840,25 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -831,12 +840,25 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ParaRange = PRS.Range; var ParaRange = PRS.Range;
var Page = PRS.Page; var Page = PRS.Page;
var RecalCurrentMath = PRS.PrevLineRecalcInfo.Object == null || PRS.PrevLineRecalcInfo.Object == this;
var bFirstLine = this.Root.IsFirstLine(ParaLine); var bFirstLine = this.Root.IsFirstLine(ParaLine);
var RecalcResult = PRS.RecalcResult,
RecalcInfoObject = PRS.PrevLineRecalcInfo.Object;
var CurrentPage = Page - this.FirstPage;
var MathSettings = Get_WordDocumentDefaultMathSettings();
// первый пересчет // первый пересчет
if(PRS.PrevLineRecalcInfo.Object == null && true == bFirstLine) if(PRS.PrevLineRecalcInfo.Object == null && true == bFirstLine)
{ {
this.State = ALIGN_MARGIN_WRAP; if(false == MathSettings.Get_DispDef() || this.ParaMathRPI.bInline)
this.State = ALIGN_EMPTY;
else if(CurrentPage == 0)
this.State = ALIGN_MARGIN_WRAP;
else
this.State = ALIGN_MARGIN;
this.FirstPage = Page; this.FirstPage = Page;
this.CurPageInfo.Page = -1; this.CurPageInfo.Page = -1;
this.LinesWidths.length = 0; this.LinesWidths.length = 0;
...@@ -858,14 +880,6 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -858,14 +880,6 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.CurPageInfo.MaxLineW = 0; this.CurPageInfo.MaxLineW = 0;
} }
var bFirstPage = this.FirstPage == Page;
var MathSettings = Get_WordDocumentDefaultMathSettings();
if(false == MathSettings.Get_DispDef())
this.State = ALIGN_EMPTY;
else if(bFirstPage == false)
this.State = ALIGN_MARGIN;
PRS.X += MathSettings.Get_LeftMargin(this.State); PRS.X += MathSettings.Get_LeftMargin(this.State);
PRS.XEnd -= MathSettings.Get_RightMargin(this.State); PRS.XEnd -= MathSettings.Get_RightMargin(this.State);
...@@ -874,12 +888,15 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -874,12 +888,15 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
PRS.XRange = PRS.X; PRS.XRange = PRS.X;
PRS.RecalcResult = recalcresult_NextLine; if(RecalCurrentMath == true)
PRS.PrevLineRecalcInfo.Object = null; {
PRS.RecalcResult = recalcresult_NextLine;
PRS.PrevLineRecalcInfo.Object = null;
}
this.Root.Recalculate_Range(PRS, ParaPr, Depth); this.Root.Recalculate_Range(PRS, ParaPr, Depth);
if(bFirstPage && PRS.bMathWordLarge && this.State !== ALIGN_EMPTY) if(CurrentPage == 0 && PRS.bMathWordLarge && this.State !== ALIGN_EMPTY)
{ {
this.UpdateInfoForBreak(PRS); this.UpdateInfoForBreak(PRS);
this.State++; this.State++;
...@@ -914,23 +931,30 @@ ParaMath.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cu ...@@ -914,23 +931,30 @@ ParaMath.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cu
}; };
ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange) ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
{ {
var SpaceLen = PRSC.SpaceLen;
this.Root.Recalculate_Range_Width(PRSC, _CurLine, _CurRange); this.Root.Recalculate_Range_Width(PRSC, _CurLine, _CurRange);
var W = PRSC.Range.W + PRSC.SpaceLen; PRSC.Range.W += PRSC.SpaceLen - SpaceLen;
PRSC.Range.SpaceLen = SpaceLen;
var W = PRSC.Range.W;
var CurLine = _CurLine - this.Root.StartLine; var CurLine = _CurLine - this.Root.StartLine;
this.LinesWidths[CurLine] = W; this.LinesWidths[CurLine] = W;
}; };
ParaMath.prototype.UpdateWidthLine = function(PRS, Width) ParaMath.prototype.UpdateWidthLine = function(PRS, Width)
{ {
var RecalCurrentMath = PRS.PrevLineRecalcInfo.Object == null || PRS.PrevLineRecalcInfo.Object == this;
var MaxW = this.CurPageInfo.MaxLineW, var MaxW = this.CurPageInfo.MaxLineW,
CurLine = PRS.Line - this.Root.StartLine; CurLine = PRS.Line - this.Root.StartLine;
if(MaxW < Width && CurLine !== 0) if(MaxW < Width && CurLine !== 0 && RecalCurrentMath == true)
{ {
this.CurPageInfo.MaxLineW = Width; this.CurPageInfo.MaxLineW = Width;
if(align_Justify == this.Get_Align()) if(align_Justify == this.Get_Align() && this.ParaMathRPI.bInline == false)
this.UpdateInfoForBreak(PRS); this.UpdateInfoForBreak(PRS);
} }
}; };
......
...@@ -2365,6 +2365,15 @@ ParaRun.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange) ...@@ -2365,6 +2365,15 @@ ParaRun.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
break; break;
} }
case para_Math_BreakOperator: case para_Math_BreakOperator:
{
if ( true === PRSC.Word )
{
PRSC.Word = false;
}
PRSC.Range.W += Item.Width / TEXTWIDTH_DIVIDER;
break;
}
case para_Space: case para_Space:
{ {
if ( true === PRSC.Word ) if ( true === PRSC.Word )
......
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