Commit 658798bf authored by Ilya Kirillov's avatar Ilya Kirillov

Исправлен баг с расчетом границ между параграфами.

parent 4681623b
......@@ -1211,26 +1211,6 @@ Paragraph.prototype =
return { X : X, Y : Y, PageNum : this.Get_AbsolutePage(CurPage), Internal : { Line : CurLine, Page : CurPage, Range : CurRange }, Transform : Transform };
},
// Можно ли объединить границы двух параграфов с заданными настройками Pr1, Pr2
Internal_CompareBrd : function(Pr1, Pr2)
{
// Сначала сравним правую и левую границы параграфов
var Left_1 = Math.min( Pr1.Ind.Left, Pr1.Ind.Left + Pr1.Ind.FirstLine );
var Right_1 = Pr1.Ind.Right;
var Left_2 = Math.min( Pr2.Ind.Left, Pr2.Ind.Left + Pr2.Ind.FirstLine );
var Right_2 = Pr2.Ind.Right;
if ( Math.abs( Left_1 - Left_2 ) > 0.001 || Math.abs( Right_1 - Right_2 ) > 0.001 )
return false;
if ( false === Pr1.Brd.Top.Compare( Pr2.Brd.Top ) || false === Pr1.Brd.Bottom.Compare( Pr2.Brd.Bottom ) ||
false === Pr1.Brd.Left.Compare( Pr2.Brd.Left ) || false === Pr1.Brd.Right.Compare( Pr2.Brd.Right ) ||
false === Pr1.Brd.Between.Compare( Pr2.Brd.Between ) )
return false;
return true;
},
// Проверяем не пустые ли границы
Internal_Is_NullBorders : function (Borders)
{
......@@ -2366,7 +2346,8 @@ Paragraph.prototype =
if (border_Single === Pr.ParaPr.Brd.Between.Value
&& false === bDrawTop
&& false === bEmptyPageCurrent
&& true === bEmptyPagesBefore)
&& true === bEmptyPagesBefore
&& false === Pr.ParaPr.Brd.First)
{
bDrawBetween = true;
}
......@@ -7676,7 +7657,7 @@ Paragraph.prototype =
if ( undefined !== FramePr )
{
if ( null === PrevEl || type_Paragraph !== PrevEl.GetType() )
PrevEl = null
PrevEl = null;
else
{
var PrevFramePr = PrevEl.Get_FramePr();
......@@ -7738,10 +7719,15 @@ Paragraph.prototype =
}
}
if (false === this.Internal_Is_NullBorders(Pr.ParaPr.Brd) && true === this.Internal_CompareBrd(Prev_Pr, Pr.ParaPr) && undefined === PrevEl.Get_SectionPr() && true !== Pr.ParaPr.PageBreakBefore)
Pr.ParaPr.Brd.First = false;
if (true === this.private_CompareBorderSettings(Prev_Pr, Pr.ParaPr) && undefined === PrevEl.Get_SectionPr() && true !== Pr.ParaPr.PageBreakBefore)
{
Pr.ParaPr.Brd.First = false;
Pr.ParaPr.Brd.Between = Prev_Pr.Brd.Between.Copy();
}
else
Pr.ParaPr.Brd.First = true;
{
Pr.ParaPr.Brd.First = true;
}
}
else if ( null === PrevEl )
{
......@@ -7794,7 +7780,7 @@ Paragraph.prototype =
}
}
if (false === this.Internal_Is_NullBorders(Pr.ParaPr.Brd) && true === this.Internal_CompareBrd(Next_Pr, Pr.ParaPr) && undefined === this.Get_SectionPr() && (undefined === NextEl.Get_SectionPr() || true !== NextEl.IsEmpty()) && true !== Next_Pr.PageBreakBefore)
if (true === this.private_CompareBorderSettings(Next_Pr, Pr.ParaPr) && undefined === this.Get_SectionPr() && (undefined === NextEl.Get_SectionPr() || true !== NextEl.IsEmpty()) && true !== Next_Pr.PageBreakBefore)
Pr.ParaPr.Brd.Last = false;
else
Pr.ParaPr.Brd.Last = true;
......@@ -13951,6 +13937,30 @@ Paragraph.prototype.Set_ParaPropsForVerticalTextInCell = function(isVerticalText
this.Set_Ind({Left : Left, Right : Right, FirstLine : First}, true);
}
};
/**
* Проверяем можно ли объединить границы двух параграфов с заданными настройками Pr1, Pr2.
*/
Paragraph.prototype.private_CompareBorderSettings = function(Pr1, Pr2)
{
// Сначала сравним правую и левую границы параграфов
var Left_1 = Math.min(Pr1.Ind.Left, Pr1.Ind.Left + Pr1.Ind.FirstLine);
var Right_1 = Pr1.Ind.Right;
var Left_2 = Math.min(Pr2.Ind.Left, Pr2.Ind.Left + Pr2.Ind.FirstLine);
var Right_2 = Pr2.Ind.Right;
if (Math.abs(Left_1 - Left_2) > 0.001 || Math.abs(Right_1 - Right_2) > 0.001)
return false;
// Почему то Word не сравнивает границы между параграфами.
if (false === Pr1.Brd.Top.Compare(Pr2.Brd.Top)
|| false === Pr1.Brd.Bottom.Compare(Pr2.Brd.Bottom)
|| false === Pr1.Brd.Left.Compare(Pr2.Brd.Left)
|| false === Pr1.Brd.Right.Compare(Pr2.Brd.Right))
return false;
return true;
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
......
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