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

Merged revision(s) 68465-68562 from...

Merged revision(s) 68465-68562 from AVS/Sources/TeamlabOffice/branches/TeamlabOffice_v3.7_Math_ForcedBreak

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68568 954022d7-b5bf-4e40-9824-e11837661b57
parent fdfdac4e
This diff is collapsed.
......@@ -10275,15 +10275,38 @@ ParaRun.prototype.IsForcedBreak = function()
};
ParaRun.prototype.Is_StartForcedBreakOperator = function()
{
return true == this.IsForcedBreak() && true == this.Is_StartBreakOperator();
var bStartOperator = this.Content.length > 0 && this.Content[0].Type == para_Math_BreakOperator;
return true == this.IsForcedBreak() && true == bStartOperator;
};
ParaRun.prototype.Is_StartBreakOperator = function()
ParaRun.prototype.Get_AlignBrk = function(_CurLine, bBrkBefore)
{
return this.Content.length > 0 && this.Content[0].Type == para_Math_BreakOperator;
};
ParaRun.prototype.Get_AlignBrk = function()
{
return true == this.Is_StartForcedBreakOperator() ? this.MathPrp.Get_AlignBrk() : 0;
// null - break отсутствует
// 0 - break присутствует, alnAt = undefined
// Number = break присутствует, alnAt = Number
// если оператор находится в конце строки и по этому оператору осушествляется принудительный перенос (Forced)
// тогда StartPos = 0, EndPos = 1 (для предыдущей строки), т.к. оператор с принудительным переносом всегда должен находится в начале Run
var CurLine = _CurLine - this.StartLine;
var AlnAt = null;
if(CurLine > 0)
{
var RangesCount = this.protected_GetRangesCount(CurLine - 1);
var StartPos = this.protected_GetRangeStartPos(CurLine - 1, RangesCount - 1);
var EndPos = this.protected_GetRangeEndPos(CurLine - 1, RangesCount - 1);
var bStartBreakOperator = bBrkBefore == true && StartPos == 0 && EndPos == 0;
var bEndBreakOperator = bBrkBefore == false && StartPos == 0 && EndPos == 1;
if(bStartBreakOperator || bEndBreakOperator)
{
AlnAt = false == this.Is_StartForcedBreakOperator() ? null : this.MathPrp.Get_AlignBrk();
}
}
return AlnAt;
};
ParaRun.prototype.Math_Is_InclineLetter = function()
{
......@@ -10817,9 +10840,13 @@ ParaRun.prototype.Is_UseInParagraph = function()
return true;
};
ParaRun.prototype.Displace_BreakOperator = function(_CurLine, _CurRange, isForward, CountOperators)
ParaRun.prototype.Displace_BreakOperator = function(isForward, bBrkBefore, CountOperators)
{
if(true === this.Is_StartForcedBreakOperator())
var bResult = true;
var bFirstItem = this.State.ContentPos == 0 || this.State.ContentPos == 1,
bLastItem = this.State.ContentPos == this.Content.length - 1 || this.State.ContentPos == this.Content.length;
if(true === this.Is_StartForcedBreakOperator() && bFirstItem == true)
{
var AlnAt = this.MathPrp.Get_AlnAt();
......@@ -10837,6 +10864,12 @@ ParaRun.prototype.Displace_BreakOperator = function(_CurLine, _CurRange, isForwa
}
}
}
else
{
bResult = (bLastItem && bBrkBefore) || (bFirstItem && !bBrkBefore) ? false : true;
}
return bResult; // применили смещение к данному Run
};
ParaRun.prototype.Math_UpdateLineMetrics = function(PRS, ParaPr)
{
......
......@@ -2102,7 +2102,7 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
PRS.bMath_OneLine = bOneLine;
PRS.bContainCompareOper = bContainCompareOper;
};
CMathBase.prototype.Get_WrapToLine = function(_CurLine, _CurRange, WrapIndent)
/*CMathBase.prototype.Get_WrapToLine = function(_CurLine, _CurRange, WrapIndent)
{
var Wrap = 0;
......@@ -2117,7 +2117,7 @@ CMathBase.prototype.Get_WrapToLine = function(_CurLine, _CurRange, WrapIndent)
}
return Wrap;
};
};*/
CMathBase.prototype.Recalculate_MinMaxContentWidth = function(MinMax)
{
var bOneLine = MinMax.bMath_OneLine;
......@@ -2417,13 +2417,13 @@ CMathBase.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRang
}
}
};
CMathBase.prototype.Displace_BreakOperator = function(_CurLine, _CurRange, isForward, CountOperators)
CMathBase.prototype.Displace_BreakOperator = function(isForward, bBrkBefore, CountOperators)
{
this.Content[this.NumBreakContent].Displace_BreakOperator(_CurLine, _CurRange, isForward, CountOperators);
this.Content[this.NumBreakContent].Displace_BreakOperator(isForward, bBrkBefore, CountOperators);
};
CMathBase.prototype.Get_AlignBrk = function(_CurLine, _CurRange)
CMathBase.prototype.Get_AlignBrk = function(_CurLine, bBrkBefore)
{
return this.Content[this.NumBreakContent].Get_AlignBrk(_CurLine, _CurRange);
return this.Content[this.NumBreakContent].Get_AlignBrk(_CurLine, bBrkBefore);
};
CMathBase.prototype.raw_SetReviewType = function(Type, Info)
{
......
......@@ -21,6 +21,10 @@ CMathBreak.prototype.Copy = function()
};
CMathBreak.prototype.Get_AlignBrk = function()
{
// undefined - break отсутствует
// 0 - break присутствует, alnAt = undefined
// Number = break присутствует, alnAt = Number
return this.alnAt !== undefined ? this.alnAt : 0;
};
CMathBreak.prototype.Get_AlnAt = function()
......@@ -227,6 +231,7 @@ CBorderBox.prototype.recalculateSize = function()
height += this.gapBrd;
ascent += this.gapBrd;
}
if(this.Pr.hideBot == false)
height += this.gapBrd;
......@@ -623,14 +628,14 @@ CMathBoxPr.prototype.Set_FromObject = function(Obj)
else
this.opEmu = false;
};
CMathBoxPr.prototype.Get_AlignBrk = function()
{
return this.brk !== undefined ? this.brk.Get_AlignBrk() : 0;
};
CMathBoxPr.prototype.Get_AlnAt = function()
{
return this.brk != undefined ? this.brk.Get_AlnAt() : undefined;
};
CMathBoxPr.prototype.Get_AlignBrk = function()
{
return this.brk == undefined ? null : this.brk.Get_AlignBrk();
};
CMathBoxPr.prototype.Displace_Break = function(isForward)
{
if(this.brk !== undefined)
......@@ -794,9 +799,13 @@ CBox.prototype.IsForcedBreak = function()
};
CBox.prototype.Get_AlignBrk = function()
{
return this.Pr.Get_AlignBrk();
// null - break отсутствует
// 0 - break присутствует, alnAt = undefined
// Number = break присутствует, alnAt = Number
return false == this.private_CanUseForcedBreak() ? null : this.Pr.Get_AlignBrk();
};
CBox.prototype.Displace_BreakOperator = function(_CurLine, _CurRange, isForward, CountOperators)
CBox.prototype.Displace_BreakOperator = function(isForward, bBrkBefore, CountOperators)
{
if(this.Pr.brk !== undefined)
{
......
......@@ -150,7 +150,6 @@ CDegreeBase.prototype.GetSizeSup = function(oMeasure, Metric)
}
var PlH = 0.64*this.ParaMath.GetPlh(oMeasure, mgCtrPrp);
//var UpBaseline = 1.65*shCenter; // расстояние от baseline основания до бейзлайна итератора
var UpBaseline = 0.75*PlH; // расстояние от baseline основания до бейзлайна итератора
if(bTextElement)
......
......@@ -60,10 +60,6 @@ CFraction.prototype.init = function(props)
this.setProperties(props);
this.fillContent();
};
CFraction.prototype.getType = function()
{
return this.Pr.type;
};
CFraction.prototype.draw = function(x, y, pGraphics, PDSE)
{
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
......
......@@ -656,7 +656,7 @@ CMPrp.prototype =
},
Get_AlignBrk: function()
{
return this.brk !== undefined ? this.brk.Get_AlignBrk() : 0;
return this.brk !== undefined ? this.brk.Get_AlignBrk() : null;
},
Get_AlnAt: function()
{
......@@ -3891,7 +3891,7 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{
this.bOneLine = PRS.bMath_OneLine;
// для неинлайн формул :
// для неинлайн формул:
// у операторов, находяхщихся на этом уровне (в Run) приоритет выше, чем у внутренних операторов (внутри мат объектов)
// возможен только принудительный разрыв
var bOnlyForcedBreak = PRS.bOnlyForcedBreak;
......@@ -4142,52 +4142,6 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos);
};
CMathContent.prototype.Get_WrapToLine = function(_CurLine, _CurRange, WrapIndent)
{
// Get_WrapToLine может прийти до Recalculate_Range
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var Pos = this.protected_GetPrevRangeEndPos(CurLine, CurRange);
var ContentLen = this.Content.length;
var Wrap = 0;
if(this.bRoot == false || false == this.IsStartLine(_CurLine, _CurRange))
{
while(Pos < ContentLen)
{
var bInline = this.ParaMath.Is_Inline();
var Item = this.Content[Pos];
var bEmptyRun = Item.Type == para_Math_Run && true == Item.Math_EmptyRange(_CurLine, _CurRange);
var bBoxBreak = Item.Type == para_Math_Composition && Item.kind == MATH_BOX && true == Item.IsForcedBreak();
if(Item.Type == para_Math_Composition)
{
if(bBoxBreak == true)
{
Wrap = 0;
}
else
{
Wrap = Item.Get_WrapToLine(_CurLine, _CurRange, WrapIndent);
}
break;
}
else if(bEmptyRun == false)
{
if(false === Item.IsForcedBreak())
Wrap = WrapIndent;
break;
}
Pos++;
}
}
return Wrap;
};
CMathContent.prototype.private_ForceBreakBox = function(PRS, Box, _Depth, PrevLastPos, LastPos)
{
var BoxLen = Box.size.width;
......@@ -4351,42 +4305,24 @@ CMathContent.prototype.IsEmptyRange = function(_CurLine, _CurRange)
return bEmpty;
};
CMathContent.prototype.IsEmptyLine = function(_CurLine)
CMathContent.prototype.Displace_BreakOperator = function(isForward, bBrkBefore, CountOperators)
{
var CurLine = _CurLine - this.StartLine;
var StartRange = ( 0 === CurLine ? this.StartRange : 0 );
var RangesCount = StartRange + this.protected_GetRangesCount(CurLine);
var bEmpty = true;
var Pos = this.CurPos;
for(var _CurRange = StartRange; _CurRange < RangesCount; _CurRange++)
if(this.Content[Pos].Type == para_Math_Run)
{
if(false == this.IsEmptyRange(_CurLine, _CurRange))
var bApplyBreak = this.Content[Pos].Displace_BreakOperator(isForward, bBrkBefore, CountOperators);
var NewPos = bBrkBefore ? Pos + 1 : Pos - 1;
if(bApplyBreak == false && (this.Content[NewPos].Type == para_Math_Run || this.Content[NewPos].kind == MATH_BOX))
{
bEmpty = false;
break;
this.Content[NewPos].Displace_BreakOperator(isForward, bBrkBefore, CountOperators);
}
}
return bEmpty;
};
CMathContent.prototype.Displace_BreakOperator = function(_CurLine, _CurRange, isForward, CountOperators)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var bNextBox = true === this.Content[StartPos].IsEmptyRange(_CurLine, _CurRange) && StartPos != EndPos && this.Content[StartPos + 1].kind == MATH_BOX;
if(true === bNextBox) // Next element is Box
else
{
StartPos++;
this.Content[Pos].Displace_BreakOperator(isForward, bBrkBefore, CountOperators);
}
this.Content[StartPos].Displace_BreakOperator(_CurLine, _CurRange, isForward, CountOperators);
};
CMathContent.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
{
......@@ -4646,48 +4582,37 @@ CMathContent.prototype.Math_Is_End = function(_CurLine, _CurRange)
return result;
};
CMathContent.prototype.Get_AlignBrk = function(_CurLine, _CurRange)
CMathContent.prototype.Get_AlignBrk = function(_CurLine, bBrkBefore)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var AlnAt = null;
var AlnAt = 0;
var CurLine = _CurLine - this.StartLine;
var RangesCount = this.protected_GetRangesCount(CurLine - 1);
var EndPos = this.protected_GetRangeEndPos(CurLine - 1, RangesCount - 1);
if(CurLine !== 0)
if(CurLine !== 0) // получаем смещение до расчета Recalculate_Range
{
if(true == this.ParaMath.Is_BrkBinBefore())
{
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var bEndRun = this.Content[EndPos].Type == para_Math_Run && true == this.Content[EndPos].Math_Is_End(_CurLine - 1, RangesCount - 1),
bNextBox = EndPos < this.Content.length - 1 && this.Content[EndPos + 1].kind == MATH_BOX;
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++;
}
var bCheckNextBox = bEndRun == true && bNextBox == true && bBrkBefore == true;
var bRunEmptyRange = this.Content[EndPos].Type == para_Math_Run && this.Content[EndPos].Is_EmptyRange(_CurLine - 1, RangesCount - 1),
bPrevBox = EndPos > 0 && this.Content[EndPos - 1].kind == MATH_BOX;
var bCheckPrevNextBox = bRunEmptyRange == true && bPrevBox == true && bBrkBefore == false;
AlnAt = this.Content[StartPos].Get_AlignBrk(_CurLine, _CurRange);
if(bCheckPrevNextBox)
{
AlnAt = this.Content[EndPos - 1].Get_AlignBrk(_CurLine, bBrkBefore);
}
else if(bCheckNextBox)
{
AlnAt = this.Content[EndPos + 1].Get_AlignBrk(_CurLine, bBrkBefore);
}
else
{
var RangesCount = this.protected_GetRangesCount(CurLine - 1);
var EndPos = this.protected_GetRangeEndPos(CurLine - 1, RangesCount - 1);
var Range = CurLine - 1 == 0 ? this.StartRange + RangesCount - 1 : RangesCount - 1;
if(EndPos == this.Content.length - 1) // сюда не должны зайти, т.к. ищем AlnAt для оператора из предыдущей строки, соответственно предыдущая строка не может заканчиваться последним элементом
{
AlnAt = 0;
}
else
{
while(EndPos > 0 && this.Content[EndPos].Type == para_Math_Run && true == this.Content[EndPos].Is_EmptyRange(_CurLine - 1, Range))
{
EndPos--;
}
AlnAt = this.Content[EndPos].Get_AlignBrk(_CurLine, _CurRange);
}
AlnAt = this.Content[EndPos].Get_AlignBrk(_CurLine, bBrkBefore);
}
}
......@@ -4735,11 +4660,11 @@ CMathContent.prototype.Can_ModifyForcedBreak = function(Pr)
if(Pos !== null && this.bOneLine == false)
{
var bBreakOperator = this.Content[Pos].Check_ForcedBreak();
var CurrentRun = this.Content[Pos];
var bCanCheckNearsRun = bBreakOperator == false && false == CurrentRun.Is_SelectionUse();
var bPrevItem = bCanCheckNearsRun && Pos > 0 && true == CurrentRun.Cursor_Is_Start(),
bNextItem = bCanCheckNearsRun && Pos < this.Content.length - 1 && true == CurrentRun.Cursor_Is_End();
var bBreakOperator = this.Content[Pos].Check_ForcedBreak();
var CurrentRun = this.Content[Pos];
var bCanCheckNearsRun = bBreakOperator == false && false == CurrentRun.Is_SelectionUse();
var bPrevItem = bCanCheckNearsRun && Pos > 0 && true == CurrentRun.Cursor_Is_Start(),
bNextItem = bCanCheckNearsRun && Pos < this.Content.length - 1 && true == CurrentRun.Cursor_Is_End();
var bPrevRun = bPrevItem && this.Content[Pos - 1].Type == para_Math_Run,
bNextRun = bNextItem && this.Content[Pos + 1].Type == para_Math_Run;
......
......@@ -202,77 +202,7 @@ var MATH_BOUNDS_MEASURES = 1;
var MATH_MATRIX_ROW = 0;
var MATH_MATRIX_COLUMN = 1;
var c_oAscMathMenuTypes =
{
FractionBar: 0x001,
FractionSkewed: 0x002,
FractionLinear: 0x003,
FractionNoBar: 0x004,
RadicalHideDegree: 0x005,
NaryLimLoc: 0x006,
NaryHideUpperIterator: 0x007,
NaryHideLowerIterator: 0x008,
DelimiterHideBegOper: 0x009,
DelimiterHideEndOper: 0x00A,
DelimiterAddToLeft: 0x00B,
DelimiterAddToRight: 0x00C,
DelimiterRemoveContent: 0x00D,
DelimiterGrow: 0x00E,
DelimiterShpCentred: 0x00F,
GroupCharOver: 0x010,
GroupCharUnder: 0x011,
LimitOver: 0x012,
LimitUnder: 0x013,
BorderBoxHideTop: 0x014,
BorderBoxHideBot: 0x015,
BorderBoxHideLeft: 0x016,
BorderBoxHideRight: 0x017,
BorderBoxStrikeHor: 0x018,
BorderBoxStrikeVer: 0x019,
BorderBoxStrikeTopLTR: 0x020,
BorderBoxStrikeTopRTL: 0x021,
MatrixAddRowUnder: 0x022,
MatrixAddRowOver: 0x023,
MatrixRemoveRow: 0x024,
MatrixAddColumnToLeft: 0x025,
MatrixAddColumnToRight: 0x026,
MatrixRemoveColumn: 0x027,
MatrixBaseJcCenter: 0x028,
MatrixBaseJcTop: 0x029,
MatrixBaseJcBottom: 0x030,
MatrixColumnJcCenter: 0x031,
MatrixColumnJcLeft: 0x032,
MatrixColumnJcRight: 0x033,
MatrixRowSingleGap: 0x034,
MatrixRowOneAndHalfGap: 0x035,
MatrixRowDoubleGap: 0x036,
MatrixRowExactlyGap: 0x037,
MatrixRowMultipleGap: 0x038,
MatrixColumnSingleGap: 0x039,
MatrixColumnOneAndHalfGap: 0x040,
MatrixColumnDoubleGap: 0x041,
MatrixColumnExactlyGap: 0x042,
MatrixColumnMultipleGap: 0x043,
MatrixHidePlaceholders: 0x044,
MatrixMinColumnWidth: 0x045,
EqArrayAddRowUnder: 0x046,
EqArrayAddRowOver: 0x047,
EqArrayRemoveRow: 0x048,
EqArrayBaseJcCenter: 0x049,
EqArrayBaseJcTop: 0x050,
EqArrayBaseJcBottom: 0x051,
EqArrayRowSingleGap: 0x052,
EqArrayRowOneAndHalfGap: 0x053,
EqArrayRowDoubleGap: 0x054,
EqArrayRowExactlyGap: 0x055,
EqArrayRowMultipleGap: 0x056,
BarLineOver: 0x057,
BarLineUnder: 0x058,
DeleteElement: 0x059,
DeleteSubScript: 0x060,
DeleteSuperScript: 0x061,
IncreaseArgSize: 0x062,
DecreaseArgSize: 0x063,
AddForcedBreak: 0x064,
DeleteForcedBreak: 0x065
};
\ No newline at end of file
var MATH_LINE_START = 0;
var MATH_LINE_WRAP = 1;
var MATH_LINE_ALiGN_AT = 2;
\ No newline at end of file
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