Commit fa51982b authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлен баг с рассчетом расстояния до и после параграфа в таблицах (баг 22204).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56185 954022d7-b5bf-4e40-9824-e11837661b57
parent 3e6b0c86
......@@ -3041,7 +3041,7 @@ Paragraph.prototype =
// тогда мы должны пересчитать предыдущую страницу, с учетом того, что предыдущий параграф
// надо начать с новой страницы.
var Curr = this.Get_DocumentPrev();
while ( null != Curr && type_Paragraph === Curr.GetType() )
while ( null != Curr && type_Paragraph === Curr.GetType() && undefined === Curr.Get_SectionPr() )
{
var CurrKeepNext = Curr.Get_CompiledPr2(false).ParaPr.KeepNext;
if ( (true === CurrKeepNext && Curr.Pages.length > 1) || false === CurrKeepNext || true !== Curr.Is_Inline() )
......@@ -3051,7 +3051,7 @@ Paragraph.prototype =
else
{
var Prev = Curr.Get_DocumentPrev();
if ( null === Prev || type_Paragraph != Prev.GetType() )
if ( null === Prev || type_Paragraph != Prev.GetType() || undefined !== Prev.Get_SectionPr() )
break;
var PrevKeepNext = Prev.Get_CompiledPr2(false).ParaPr.KeepNext;
......@@ -14418,7 +14418,17 @@ Paragraph.prototype =
}
else if ( null === PrevEl )
{
if ( true === Pr.ParaPr.Spacing.BeforeAutoSpacing )
if ( true === this.Parent.Is_TableCellContent() && true === Pr.ParaPr.ContextualSpacing )
{
var Cell = this.Parent.Parent;
var PrevEl = Cell.Get_LastParagraphPrevCell();
if ( (null !== PrevEl && type_Paragraph === PrevEl.GetType() && PrevEl.Style_Get() === StyleId) || (null === PrevEl && undefined === StyleId) )
{
Pr.ParaPr.Spacing.Before = 0;
}
}
else if ( true === Pr.ParaPr.Spacing.BeforeAutoSpacing )
{
Pr.ParaPr.Spacing.Before = 0;
}
......@@ -14488,7 +14498,18 @@ Paragraph.prototype =
}
else
{
Pr.ParaPr.Spacing.After = this.Internal_CalculateAutoSpacing( Pr.ParaPr.Spacing.After, Pr.ParaPr.Spacing.AfterAutoSpacing, this );
if ( true === this.Parent.Is_TableCellContent() && true === Pr.ParaPr.ContextualSpacing )
{
var Cell = this.Parent.Parent;
var NextEl = Cell.Get_FirstParagraphNextCell();
if ( (null !== NextEl && type_Paragraph === NextEl.GetType() && NextEl.Style_Get() === StyleId) || (null === NextEl && StyleId === undefined) )
{
Pr.ParaPr.Spacing.After = 0;
}
}
else
Pr.ParaPr.Spacing.After = this.Internal_CalculateAutoSpacing( Pr.ParaPr.Spacing.After, Pr.ParaPr.Spacing.AfterAutoSpacing, this );
}
return Pr;
......
......@@ -2364,6 +2364,9 @@ ParaEnd.prototype =
{
if ( null !== this.SectionPr )
{
Context.b_color1( 0, 0, 0, 255);
Context.p_color( 0, 0, 0, 255);
Context.SetFont( {FontFamily: { Name : "Courier New", Index : -1 }, FontSize: 8, Italic: false, Bold : false} );
var Widths = this.SectionPr.Widths;
var strSectionBreak = this.SectionPr.Str;
......
......@@ -20614,6 +20614,57 @@ CTableCell.prototype =
else
return CurTable.Parent.Check_TableCoincidence(Table);
},
Get_LastParagraphPrevCell : function()
{
if ( undefined === this.Row || null === this.Row )
return null;
var CellIndex = this.Index;
var Row = this.Row;
// TODO: Разобраться, что делать в данном случае
if ( 0 === CellIndex )
{
if ( 0 === this.Row.Index && undefined !== this.Row.Table && null !== this.Row.Table )
{
var Prev = this.Row.Table.Get_DocumentPrev();
if ( type_Paragraph === Prev.GetType() )
return Prev;
}
return null;
}
var PrevCell = Row.Get_Cell( CellIndex );
var Count = PrevCell.Content.Content.length;
if ( Count <= 0 )
return null;
var Element = PrevCell.Content.Content[Count - 1];
if ( type_Paragraph !== Element.GetType() )
return null;
return Element;
},
Get_FirstParagraphNextCell : function()
{
if ( undefined === this.Row || null === this.Row )
return null;
var CellIndex = this.Index;
var Row = this.Row;
// TODO: Разобраться, что делать в данном случае
if ( CellIndex >= this.Row.Get_CellsCount() - 1 )
return null;
var NextCell = Row.Get_Cell( CellIndex );
return NextCell.Content.Get_FirstParagraph();
},
//-----------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//-----------------------------------------------------------------------------------
......
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