Commit f6927a5b authored by Anna.Pavlova's avatar Anna.Pavlova

Разбивка на строки с учетом сдвига и маргинов (из settings) для формул,...

Разбивка на строки с учетом сдвига и маргинов (из settings) для формул, размещенных на одной странице

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60992 954022d7-b5bf-4e40-9824-e11837661b57
parent 0333a088
...@@ -429,12 +429,12 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, _X, _XLimit) ...@@ -429,12 +429,12 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, _X, _XLimit)
var Jc = this.Get_Align(); var Jc = this.Get_Align();
if(CurLine == 0 && CurRange == 0) if(this.Root.IsFirstLine(_CurLine))
{ {
switch(Jc) switch(Jc)
{ {
case align_Left: X = _X; break; case align_Left: X = _X; break;
case align_Right: X = _XLimit - this.LinesWidths[0]; break; case align_Right: X = Math.max(_XLimit - this.LinesWidths[0], _X); break;
case align_Center: X = Math.max(_X + (_XLimit - _X - this.LinesWidths[0])/2, _X); break; case align_Center: X = Math.max(_X + (_XLimit - _X - this.LinesWidths[0])/2, _X); break;
case align_Justify: case align_Justify:
{ {
...@@ -814,7 +814,9 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -814,7 +814,9 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ParaRange = PRS.Range; var ParaRange = PRS.Range;
var Page = PRS.Page; var Page = PRS.Page;
if(PRS.PrevLineRecalcInfo.Object == null && true == this.Root.IsFirstLine(ParaLine)) var bFirstLine = this.Root.IsFirstLine(ParaLine);
if(PRS.PrevLineRecalcInfo.Object == null && true == bFirstLine)
this.State = ALIGN_MARGIN_WRAP; this.State = ALIGN_MARGIN_WRAP;
var MathSettings = Get_WordDocumentDefaultMathSettings(); var MathSettings = Get_WordDocumentDefaultMathSettings();
...@@ -825,7 +827,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -825,7 +827,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
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);
if(0 !== ParaLine) if(bFirstLine == false)
PRS.X += MathSettings.Get_WrapIndent(this.State); PRS.X += MathSettings.Get_WrapIndent(this.State);
// информация о пересчете // информация о пересчете
...@@ -842,22 +844,20 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -842,22 +844,20 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.Root.PreRecalc(null, this, ArgSize, RPI); this.Root.PreRecalc(null, this, ArgSize, RPI);
} }
PRS.bMath_OneLine = false;
this.Root.Recalculate_Range(PRS, ParaPr, Depth); this.Root.Recalculate_Range(PRS, ParaPr, Depth);
PRS.PrevLineRecalcInfo.Object = this; if(PRS.bMathWordLarge && this.State !== ALIGN_EMPTY)
if(PRS.FirstItemOnLine && this.State !== ALIGN_EMPTY)
{ {
PRS.PrevLineRecalcInfo.Object = this;
PRS.RecalcResult = recalcresult_PrevLine; PRS.RecalcResult = recalcresult_PrevLine;
PRS.NewRange = true; PRS.NewRange = true;
this.State++; this.State++;
} }
this.ParaMathRPI.ClearRecalculate(); this.ParaMathRPI.ClearRecalculate();
}; };
ParaMath.prototype.Recalculate_Reset = function(CurRange, CurLine ) ParaMath.prototype.Recalculate_Reset = function(CurRange, CurLine)
{ {
this.Root.Recalculate_Reset(CurRange, CurLine); // обновим StartLine и StartRange только для Root (в CParagraphContentWithContentBase), для внутренних элементов обновится на Recalculate_Range this.Root.Recalculate_Reset(CurRange, CurLine); // обновим StartLine и StartRange только для Root (в CParagraphContentWithContentBase), для внутренних элементов обновится на Recalculate_Range
} }
...@@ -877,7 +877,6 @@ ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange) ...@@ -877,7 +877,6 @@ ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
this.LinesWidths.length = 0; this.LinesWidths.length = 0;
this.MaxLinesW = 0; this.MaxLinesW = 0;
/*var lng = this.Root.protected_GetLinesCount(); /*var lng = this.Root.protected_GetLinesCount();
for(var Line = 0; Line < lng; Line++) for(var Line = 0; Line < lng; Line++)
{ {
......
...@@ -2137,6 +2137,9 @@ function CParagraphRecalculateStateWrap(Para) ...@@ -2137,6 +2137,9 @@ function CParagraphRecalculateStateWrap(Para)
Line : 0, // Номер строки, начиная с которой надо пересчитать Line : 0, // Номер строки, начиная с которой надо пересчитать
Object : null // Объект, который вызвал пересчет Object : null // Объект, который вызвал пересчет
}; };
this.bMath_OneLine = false; // for ParaMath
this.bMathWordLarge = false; // for ParaMath
} }
CParagraphRecalculateStateWrap.prototype = CParagraphRecalculateStateWrap.prototype =
...@@ -2159,6 +2162,9 @@ CParagraphRecalculateStateWrap.prototype = ...@@ -2159,6 +2162,9 @@ CParagraphRecalculateStateWrap.prototype =
this.NewPage = false; this.NewPage = false;
this.ForceNewPage = false; this.ForceNewPage = false;
this.bMath_OneLine = false;
this.bMathWordLarge = false;
}, },
// Обнуляем некоторые параметры перед новым отрезком // Обнуляем некоторые параметры перед новым отрезком
......
...@@ -1642,6 +1642,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1642,6 +1642,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ParaLine = PRS.Line; var ParaLine = PRS.Line;
var ParaRange = PRS.Range; var ParaRange = PRS.Range;
var bMathWordLarge = PRS.bMathWordLarge;
var LineRule = ParaPr.Spacing.LineRule; var LineRule = ParaPr.Spacing.LineRule;
...@@ -1736,6 +1737,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1736,6 +1737,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
if(this.Type == para_Math_Run) if(this.Type == para_Math_Run)
{ {
// //
bMathWordLarge = true;
} }
else if (false === Para.Internal_Check_Ranges(ParaLine, ParaRange)) else if (false === Para.Internal_Check_Ranges(ParaLine, ParaRange))
{ {
...@@ -2235,10 +2238,12 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2235,10 +2238,12 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
PRS.SpaceLen = SpaceLen; PRS.SpaceLen = SpaceLen;
PRS.WordLen = WordLen; PRS.WordLen = WordLen;
PRS.bMathWordLarge = bMathWordLarge;
PRS.X = X; PRS.X = X;
PRS.XEnd = XEnd; PRS.XEnd = XEnd;
if ( Pos >= ContentLen ) if ( Pos >= ContentLen )
{ {
RangeEndPos = Pos; RangeEndPos = 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