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

1. Выравнивание с учетом настроек из settings

2. Возврат к первой строке на первой странице на Recalculate_Range при выходе за границы (с учетом LeftMargin, RightMargin, WrapIndent)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60976 954022d7-b5bf-4e40-9824-e11837661b57
parent 64c14d42
This diff is collapsed.
......@@ -1451,12 +1451,14 @@ Paragraph.prototype.private_RecalculateLineAlign = function(CurLine, CurPa
var Math_X = ( 1 === RangesCount ? this.Pages[CurPage].X + ParaPr.Ind.Left : Range.X );
var Math_XLimit = ( 1 === RangesCount ? this.Pages[CurPage].XLimit - ParaPr.Ind.Right : Range.XEnd );
switch(Math_Jc)
X = ParaMath.Get_AlignToLine(CurLine, CurRange, Math_X, Math_XLimit);
/*switch(Math_Jc)
{
case align_Left : X = Math_X; break;
case align_Right : X = Math_XLimit - ParaMath.Width; break;
case align_Center : X = Math.max(Math_X + (Math_XLimit - Math_X - ParaMath.Width) / 2, Math_X); break;
}
}*/
}
else
{
......
......@@ -1718,10 +1718,9 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
}
else
{
if (X + SpaceLen + WordLen + LetterLen > XEnd)
if(X + SpaceLen + WordLen + LetterLen > XEnd)
{
if (true === FirstItemOnLine)
if(true === FirstItemOnLine)
{
// Слово оказалось единственным элементом в промежутке, и, все равно,
// не умещается целиком. Делаем следующее:
......@@ -1846,7 +1845,6 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
FirstItemOnLine = false;
}
}
else
{
......@@ -8128,6 +8126,23 @@ ParaRun.prototype.old_Math_Recalculate = function(oMeasure, RPI, WidthPoints)
if (RPI.PRS.LineTextDescent < this.TextDescent)
RPI.PRS.LineTextDescent = this.TextDescent;
};
ParaRun.prototype.Math_GetWidth = function(_CurLine, _CurRange)
{
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 W = 0;
for(var i = StartPos; i < EndPos; i++)
{
W += this.Content[i].size.width;
}
return W;
};
ParaRun.prototype.Recalculate_Range_OneLine = function(PRS, ParaPr, Depth)
{
// данная функция используется только для мат объектов, которые на строки не разбиваются
......
......@@ -1672,6 +1672,10 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.Update_WordLen(PRS, WordLen);
};
CMathBase.prototype.Math_GetWidth = function(_CurLine, _CurRange)
{
return this.size.width;
};
CMathBase.prototype.Update_WordLen = function(PRS, WordLen)
{
if(this.bInside == false)
......@@ -1705,6 +1709,7 @@ CMathBase.prototype.Get_CurrentParaPos = CMathContent.prototype.Get_Cur
CMathBase.prototype.private_UpdatePosOnAdd = CMathContent.prototype.private_UpdatePosOnAdd;
CMathBase.prototype.private_UpdatePosOnRemove = CMathContent.prototype.private_UpdateOnRemove;
CMathBase.prototype.private_CorrectSelectionPos = CMathContent.prototype.private_CorrectSelectionPos;
CMathBase.prototype.private_CorrectSelectionPos = CMathContent.prototype.private_CorrectSelectionPos;
CMathBase.prototype.private_SetNeedResize = CMathContent.prototype.private_SetNeedResize;
CMathBase.prototype.private_CorrectCurPos = function()
{
......
......@@ -720,9 +720,8 @@ function CMathContent()
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
}
Asc.extendClass(CMathContent, ParaHyperlink);
//Asc.extendClass(CMathContent, CParagraphContentWithContentBase);
//Asc.extendClass(CMathContent, ParaHyperlink);
Asc.extendClass(CMathContent, CParagraphContentWithParagraphLikeContent);
CMathContent.prototype.init = function()
{
......@@ -865,6 +864,22 @@ CMathContent.prototype.Get_WidthPoints = function()
{
return this.InfoPoints.ContentPoints;
};
CMathContent.prototype.GetWidthLine = function(_CurLine, _CurRange)
{
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 W = 0;
for(var i = StartPos; i <= EndPos; i++)
{
W += this.Content[i].Math_GetWidth(_CurLine, _CurRange);
}
return W;
};
CMathContent.prototype.Get_CompiledArgSize = function()
{
return this.Compiled_ArgSz;
......@@ -4123,10 +4138,10 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
PRS.Word = true;
LastPos = Pos - 1;
if(bInline || Item.kind == MATH_BOX)
{
LastPos = Pos - 1;
PRS.Update_CurPos(LastPos, Depth);
this.Content[LastPos].Update_LineBreakPos(PRS, true); // обновим : начало нового слова - конец предыдущего Run
}
......@@ -4198,6 +4213,12 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos);
};
CMathContent.prototype.IsFirstLine = function(Line)
{
var CurLine = Line - this.StartLine;
return CurLine == 0;
}
/*CMathContent.prototype.Is_CheckingNearestPos = ParaHyperlink.prototype.Is_CheckingNearestPos;
......
......@@ -49,7 +49,7 @@ function CMathText(bJDraw)
bSpecialOperator: false
};
this.ParaMath = null;
this.ParaMath = null;
this.Flags = 0;
this.Parent = null;
this.size = new CMathSize();
......
......@@ -198,4 +198,13 @@ var STY_BI = 1;
var STY_ITALIC = 2;
var STY_PLAIN = 3;
/////////////////////////////////////////
\ No newline at end of file
/////////////////////////////////////////
var ALIGN_MARGIN_WRAP = 0;
var ALIGN_MARGIN = 1;
var ALIGN_WRAP = 2;
var ALIGN_EMPTY = 3;
var MATH_LEFT_MARGIN = 0;
var MATH_RIGHT_MARGIN = 1;
var MATH_WRAP_INDENT = 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