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

Переделала пересчет формулы при разбивки на Range

Поправила баги : 
http://bugzserver/show_bug.cgi?id=30164
http://bugzserver/show_bug.cgi?id=30184

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64806 954022d7-b5bf-4e40-9824-e11837661b57
parent e7a4cbb9
This diff is collapsed.
......@@ -1219,7 +1219,7 @@ Paragraph.prototype.private_RecalculateLineCheckRanges = function(CurLine, CurPa
var Ranges2;
if ( true === this.Use_Wrap() )
Ranges2 = this.Parent.CheckRange(Left, Top, Right, Bottom, Top2, Bottom2, PageFields.X, PageFields.XLimit, this.PageNum + CurPage, true);
Ranges2 = this.Parent.CheckRange(Left, Top, Right, Bottom, Top2, Bottom2, PageFields.X, PageFields.XLimit, this.PageNum + CurPage, true, PRS.bMathWrap);
else
Ranges2 = [];
......@@ -2204,6 +2204,7 @@ function CParagraphRecalculateStateWrap(Para)
this.bOnlyForcedBreak = false; // учитывается, если возможна разбивка только по операторам выше уровням => в этом случае можно сделать принудительный разрыв во внутреннем контенте
this.bFastRecalculate = false;
this.bBoxOperator = false;
this.bMathWrap = false;
}
CParagraphRecalculateStateWrap.prototype =
......@@ -2286,6 +2287,7 @@ CParagraphRecalculateStateWrap.prototype =
{
this.RestartPageRecalcInfo.Line = 0;
this.RestartPageRecalcInfo.Object = null;
this.bMathWrap = false;
},
Set_RestartPageRecalcInfo : function(Line, Object)
......
......@@ -9403,7 +9403,7 @@ ParaRun.prototype.Math_Is_End = function(_CurLine, _CurRange)
return EndPos == this.Content.length;
};
ParaRun.prototype.IsEmptyLine = function(_CurLine, _CurRange)
ParaRun.prototype.IsEmptyRange = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
......
......@@ -408,7 +408,7 @@ CMathBase.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
CMathBase.superclass.Shift_Range.call(this, Dx, Dy, _CurLine, _CurRange);
}
};
CMathBase.prototype.IsFirstRange = function(_CurLine, _CurRange)
CMathBase.prototype.IsStartRange = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
......@@ -2127,14 +2127,14 @@ CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _C
}
}
};
CMathBase.prototype.IsEmptyLine = function(_CurLine, _CurRange)
CMathBase.prototype.IsEmptyRange = function(_CurLine, _CurRange)
{
var bEmpty = false;
var Numb = this.NumBreakContent;
if(this.bOneLine == false)
{
bEmpty = this.Content[Numb].IsEmptyLine(_CurLine, _CurRange);
bEmpty = this.Content[Numb].IsEmptyRange(_CurLine, _CurRange);
}
return bEmpty;
......
......@@ -1885,20 +1885,6 @@ CMathContent.prototype.getElem = function(nNum)
{
return this.Content[nNum];
};
CMathContent.prototype.Is_FirstComposition = function()
{
var result = false;
if(this.Content.length > 1)
{
var bEmptyRun = this.Content[0].Is_Empty(),
bMathComp = this.Content[1].Type == para_Math_Composition;
if(bEmptyRun && bMathComp)
result = true;
}
return result;
};
CMathContent.prototype.GetLastElement = function()
{
var pos = this.Content.length - 1;
......@@ -3941,7 +3927,7 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var bOperBefore = this.ParaMath.Is_BrkBinBefore(); // true - оператор находится в начале строки, false - оператор находится в конце строки
// для внутристроковой формулы : начало формулы - начало нового слова
if(this.bRoot && bInline && true == this.IsFirstRange(PRS.Line, PRS.Range) && PRS.Ranges.length == 0)
if(this.bRoot && bInline && true == this.IsStartRange(PRS.Line, PRS.Range) && PRS.Ranges.length == 0)
{
PRS.Update_CurPos(0, Depth);
PRS.Update_CurPos(0, Depth+1); // нулевой элемент всегда Run
......@@ -4319,7 +4305,7 @@ CMathContent.prototype.Recalculate_Reset = function(StartRange, StartLine, PRS)
this.protected_ClearLines();
}
};
CMathContent.prototype.IsEmptyLine = function(_CurLine, _CurRange)
CMathContent.prototype.IsEmptyRange = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
......@@ -4327,24 +4313,44 @@ CMathContent.prototype.IsEmptyLine = function(_CurLine, _CurRange)
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var bEmpty = false;
var bEmpty = true;
if(StartPos == EndPos)
{
bEmpty = this.Content[StartPos].IsEmptyLine(_CurLine, _CurRange);
bEmpty = this.Content[StartPos].IsEmptyRange(_CurLine, _CurRange);
}
else
{
var Pos = StartPos;
while(Pos < EndPos && this.Content[Pos].Type == para_Math_Run && this.Content[Pos].Is_Empty() == true)
while(Pos <= EndPos)
{
if(false == this.Content[Pos].IsEmptyRange(_CurLine, _CurRange))
{
bEmpty = false;
break;
}
Pos++;
}
}
if(Pos == EndPos && this.Content[Pos].Type == para_Math_Composition)
return bEmpty;
};
CMathContent.prototype.IsEmptyLine = function(_CurLine)
{
var CurLine = _CurLine - this.StartLine;
var StartRange = ( 0 === CurLine ? this.StartRange : 0 );
var RangesCount = StartRange + this.protected_GetRangesCount(CurLine);
var bEmpty = true;
for(var _CurRange = StartRange; _CurRange < RangesCount; _CurRange++)
{
if(false == this.IsEmptyRange(_CurLine, _CurRange))
{
bEmpty = this.Content[Pos].IsEmptyLine(_CurLine, _CurRange);
bEmpty = false;
break;
}
}
......@@ -4604,10 +4610,6 @@ CMathContent.prototype.Math_Is_End = function(_CurLine, _CurRange)
return result;
};
CMathContent.prototype.IsStartLine = function(Line)
{
return Line == this.StartLine;
};
CMathContent.prototype.GetAlignBrk = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
......@@ -4621,7 +4623,8 @@ CMathContent.prototype.GetAlignBrk = function(_CurLine, _CurRange)
{
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
while(this.Content[StartPos].Type == para_Math_Run && true == this.Content[StartPos].Is_EmptyRange(_CurLine, _CurRange))
var Lng = this.Content.length;
while(StartPos < Lng - 1 && this.Content[StartPos].Type == para_Math_Run && true == this.Content[StartPos].Is_EmptyRange(_CurLine, _CurRange))
{
StartPos++;
}
......@@ -4652,10 +4655,14 @@ CMathContent.prototype.GetAlignBrk = function(_CurLine, _CurRange)
return AlnAt;
};
CMathContent.prototype.IsFirstRange = function(Line, Range)
CMathContent.prototype.IsStartRange = function(Line, Range)
{
return Line - this.StartLine == 0 && Range - this.StartRange == 0;
};
CMathContent.prototype.IsStartLine = function(Line)
{
return Line == this.StartLine;
};
CMathContent.prototype.Get_SelectionDirection = function()
{
if (true !== this.Selection.Use)
......
......@@ -171,40 +171,43 @@ var MATH_EMPTY = 3;
var MATH_PLACEHOLDER = 4;
var MATH_PARA_RUN = 5;
var LOCATION_TOP = 0;
var LOCATION_BOT = 1;
var LOCATION_LEFT = 2;
var LOCATION_RIGHT = 3;
var LOCATION_SEP = 4;
var LOCATION_TOP = 0;
var LOCATION_BOT = 1;
var LOCATION_LEFT = 2;
var LOCATION_RIGHT = 3;
var LOCATION_SEP = 4;
var VJUST_TOP = 0;
var VJUST_BOT = 1;
var VJUST_TOP = 0;
var VJUST_BOT = 1;
////////////////////////////////////////
var BREAK_BEFORE = 0;
var BREAK_AFTER = 1;
var BREAK_REPEAT = 2;
var BREAK_BEFORE = 0;
var BREAK_AFTER = 1;
var BREAK_REPEAT = 2;
var BREAK_MIN_MIN = 0;
var BREAK_PLUS_MIN = 1;
var BREAK_MIN_PLUS = 2;
var BREAK_MIN_MIN = 0;
var BREAK_PLUS_MIN = 1;
var BREAK_MIN_PLUS = 2;
var STY_BOLD = 0;
var STY_BI = 1;
var STY_ITALIC = 2;
var STY_PLAIN = 3;
var STY_BOLD = 0;
var STY_BI = 1;
var STY_ITALIC = 2;
var STY_PLAIN = 3;
/////////////////////////////////////////
var ALIGN_MARGIN_WRAP = 0;
var ALIGN_MARGIN = 1;
var ALIGN_WRAP = 2;
var ALIGN_EMPTY = 3;
var ALIGN_MARGIN_WRAP = 0;
var ALIGN_MARGIN = 1;
var ALIGN_WRAP = 2;
var ALIGN_EMPTY = 3;
var WRAP_MATH_EMPTY = 0;
var WRAP_MATH_ON_SIDE = 1;
var WRAP_MATH_TOPBOTTOM = 2;
var MATH_INTERVAL_EMPTY = 0;
var MATH_INTERVAL_ON_SIDE = 1;
var MATH_SIZE = 0;
var MATH_BOUNDS_MEASURES = 1;
\ No newline at end of file
var MATH_UPDWRAP_NOCHANGES = 0;
var MATH_UPDWRAP_NEWRANGE = 1;
var MATH_UPDWRAP_UNDERFLOW = 2;
var MATH_SIZE = 0;
var MATH_BOUNDS_MEASURES = 1;
\ No newline at end of file
......@@ -3568,7 +3568,7 @@ CDelimiter.prototype.setPosition = function(pos, PosInfo)
{
var PosOper = new CMathPosition();
if(true === this.IsFirstRange(Line, Range))
if(true === this.IsStartRange(Line, Range))
{
PosOper.x = pos.x;
PosOper.y = pos.y - this.begOper.size.ascent;
......@@ -3626,7 +3626,7 @@ CDelimiter.prototype.Draw_Elements = function(PDSE)
if(this.bOneLine == false)
{
if(true === this.IsFirstRange(PDSE.Line, PDSE.Range))
if(true === this.IsStartRange(PDSE.Line, PDSE.Range))
{
this.begOper.draw(PosLine.x, PosLine.y, PDSE.Graphics, PDSE);
PDSE.X += this.BrGapLeft;
......
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