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

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

Исправлены баги в рассчете расстояния между строк в параграфе в презентациях. Исправлен баг с рассчетом SpacingBefore в презентациях.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53189 954022d7-b5bf-4e40-9824-e11837661b57
parent cc32940e
...@@ -485,21 +485,21 @@ function CTextMeasurer() ...@@ -485,21 +485,21 @@ function CTextMeasurer()
this.GetAscender = function() this.GetAscender = function()
{ {
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em; var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Ascender = this.m_oManager.m_lAscender; var Ascender = ( 0 !== this.m_oManager.m_lLineHeight ) ? 1.2 * this.m_oManager.m_lUnits_Per_Em * this.m_oManager.m_lAscender / this.m_oManager.m_lLineHeight : this.m_oManager.m_lAscender;
return Ascender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm; return Ascender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
} }
this.GetDescender = function() this.GetDescender = function()
{ {
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em; var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Descender = this.m_oManager.m_lDescender; var Descender = ( 0 !== this.m_oManager.m_lLineHeight ) ? 1.2 * this.m_oManager.m_lUnits_Per_Em * this.m_oManager.m_lDescender / this.m_oManager.m_lLineHeight : this.m_oManager.m_lDescender;
return Descender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm; return Descender * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
} }
this.GetHeight = function() this.GetHeight = function()
{ {
var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em; var UnitsPerEm = this.m_oManager.m_lUnits_Per_Em;
var Height = this.m_oManager.m_lLineHeight; var Height = ( 0 !== this.m_oManager.m_lLineHeight ) ? 1.2 * this.m_oManager.m_lUnits_Per_Em : this.m_oManager.m_lLineHeight;
return Height * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm; return Height * this.m_oLastFont.SetUpSize / UnitsPerEm * g_dKoef_pt_to_mm;
} }
......
...@@ -692,7 +692,8 @@ Paragraph.prototype = ...@@ -692,7 +692,8 @@ Paragraph.prototype =
}, },
// Рассчитываем текст // Рассчитываем текст
Internal_Recalculate_0: function () { Internal_Recalculate_0: function ()
{
if (pararecalc_0_None === this.RecalcInfo.Recalc_0_Type) if (pararecalc_0_None === this.RecalcInfo.Recalc_0_Type)
return; return;
...@@ -711,10 +712,15 @@ Paragraph.prototype = ...@@ -711,10 +712,15 @@ Paragraph.prototype =
var TextDescent = 0; var TextDescent = 0;
g_oTextMeasurer.SetFontSlot(fontslot_ASCII); g_oTextMeasurer.SetFontSlot(fontslot_ASCII);
TextHeight = g_oTextMeasurer.GetHeight();
TextDescent = Math.abs(g_oTextMeasurer.GetDescender()); var TA = g_oTextMeasurer.GetAscender();
TextAscent = TextHeight - TextDescent; var TD = Math.abs(g_oTextMeasurer.GetDescender());
TextAscent2 = g_oTextMeasurer.GetAscender(); var TH = g_oTextMeasurer.GetHeight();
TextDescent = TD;
TextAscent = TH - TD;
TextAscent2 = TA;
TextHeight = TH;
var ContentLength = this.Content.length; var ContentLength = this.Content.length;
...@@ -781,13 +787,19 @@ Paragraph.prototype = ...@@ -781,13 +787,19 @@ Paragraph.prototype =
} }
case para_TextPr: case para_TextPr:
{ {
CurTextPr = this.Internal_CalculateTextPr(Pos); CurTextPr = this.Internal_CalculateTextPr(Pos);
g_oTextMeasurer.SetTextPr(CurTextPr); g_oTextMeasurer.SetTextPr(CurTextPr);
g_oTextMeasurer.SetFontSlot(fontslot_ASCII); g_oTextMeasurer.SetFontSlot(fontslot_ASCII);
TextDescent = Math.abs(g_oTextMeasurer.GetDescender());
TextHeight = g_oTextMeasurer.GetHeight(); TA = g_oTextMeasurer.GetAscender();
TextAscent = TextHeight - TextDescent; TD = Math.abs(g_oTextMeasurer.GetDescender());
TextAscent2 = g_oTextMeasurer.GetAscender(); TH = g_oTextMeasurer.GetHeight();
TextDescent = TD;
TextAscent = TH - TD;
TextAscent2 = TA;
TextHeight = TH;
break; break;
} }
...@@ -1825,7 +1837,7 @@ Paragraph.prototype = ...@@ -1825,7 +1837,7 @@ Paragraph.prototype =
// убирается в промежутках. // убирается в промежутках.
var TempDy = this.Lines[this.Pages[CurPage].FirstLine].Metrics.Ascent; var TempDy = this.Lines[this.Pages[CurPage].FirstLine].Metrics.Ascent;
if (0 === this.Pages[CurPage].FirstLine && (0 === CurPage || true === this.Parent.Is_TableCellContent())) if (0 === this.Pages[CurPage].FirstLine && (0 === CurPage || true === this.Parent.Is_TableCellContent()) && null !== this.Get_DocumentPrev() )
TempDy += ParaPr.Spacing.Before; TempDy += ParaPr.Spacing.Before;
if (0 === this.Pages[CurPage].FirstLine) { if (0 === this.Pages[CurPage].FirstLine) {
...@@ -1840,17 +1852,21 @@ Paragraph.prototype = ...@@ -1840,17 +1852,21 @@ Paragraph.prototype =
var LastPage_Bottom = this.Pages[CurPage].Bounds.Bottom; var LastPage_Bottom = this.Pages[CurPage].Bounds.Bottom;
if (true === this.Lines[CurLine].RangeY) { if ( true === this.Lines[CurLine].RangeY )
{
Top = Y; Top = Y;
Top2 = Y; Top2 = Y;
this.Lines[CurLine].Top = Top - this.Pages[CurPage].Y; this.Lines[CurLine].Top = Top - this.Pages[CurPage].Y;
if (0 === CurLine) { if (0 === CurLine)
if (0 === CurPage || true === this.Parent.Is_TableCellContent()) { {
if ( ( 0 === CurPage || true === this.Parent.Is_TableCellContent() ) && null !== this.Get_DocumentPrev() )
{
Top2 = Top + ParaPr.Spacing.Before; Top2 = Top + ParaPr.Spacing.Before;
Bottom2 = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent; Bottom2 = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent;
Bottom = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap; Bottom = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap;
if (true === ParaPr.Brd.First && border_Single === ParaPr.Brd.Top.Value) { if (true === ParaPr.Brd.First && border_Single === ParaPr.Brd.Top.Value)
{
Top2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space; Top2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space;
Bottom2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space; Bottom2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space;
Bottom += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space; Bottom += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space;
...@@ -1861,19 +1877,22 @@ Paragraph.prototype = ...@@ -1861,19 +1877,22 @@ Paragraph.prototype =
Bottom += ParaPr.Brd.Between.Size + ParaPr.Brd.Between.Space; Bottom += ParaPr.Brd.Between.Size + ParaPr.Brd.Between.Space;
} }
} }
else { else
{
// Параграф начинается с новой страницы // Параграф начинается с новой страницы
Bottom2 = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent; Bottom2 = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent;
Bottom = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap; Bottom = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap;
if (border_Single === ParaPr.Brd.Top.Value) { if (border_Single === ParaPr.Brd.Top.Value)
{
Top2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space; Top2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space;
Bottom2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space; Bottom2 += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space;
Bottom += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space; Bottom += ParaPr.Brd.Top.Size + ParaPr.Brd.Top.Space;
} }
} }
} }
else { else
{
Bottom2 = Top + this.Lines[CurLine].Metrics.Ascent + this.Lines[CurLine].Metrics.Descent; Bottom2 = Top + this.Lines[CurLine].Metrics.Ascent + this.Lines[CurLine].Metrics.Descent;
Bottom = Top + this.Lines[CurLine].Metrics.Ascent + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap; Bottom = Top + this.Lines[CurLine].Metrics.Ascent + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap;
} }
...@@ -1900,9 +1919,12 @@ Paragraph.prototype = ...@@ -1900,9 +1919,12 @@ Paragraph.prototype =
this.Bounds.Bottom = Bottom; this.Bounds.Bottom = Bottom;
this.Pages[CurPage].Bounds.Bottom = Bottom; this.Pages[CurPage].Bounds.Bottom = Bottom;
} }
else { else
if (0 != CurLine) { {
if (CurLine != this.Pages[CurPage].FirstLine) { if (0 != CurLine)
{
if (CurLine != this.Pages[CurPage].FirstLine)
{
Top = Y + TempDy + this.Lines[CurLine - 1].Metrics.Descent + this.Lines[CurLine - 1].Metrics.LineGap; Top = Y + TempDy + this.Lines[CurLine - 1].Metrics.Descent + this.Lines[CurLine - 1].Metrics.LineGap;
Bottom = Top + this.Lines[CurLine].Metrics.Ascent + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap; Bottom = Top + this.Lines[CurLine].Metrics.Ascent + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap;
Top2 = Top; Top2 = Top;
...@@ -1965,11 +1987,13 @@ Paragraph.prototype = ...@@ -1965,11 +1987,13 @@ Paragraph.prototype =
} }
} }
else { else
{
Top = Y; Top = Y;
Top2 = Y; Top2 = Y;
if (0 === CurPage || true === this.Parent.Is_TableCellContent()) { if ( ( 0 === CurPage || true === this.Parent.Is_TableCellContent() ) && null !== this.Get_DocumentPrev() )
{
Top2 = Top + ParaPr.Spacing.Before; Top2 = Top + ParaPr.Spacing.Before;
Bottom = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap; Bottom = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap;
Bottom2 = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent; Bottom2 = Top + ParaPr.Spacing.Before + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent;
...@@ -1985,7 +2009,8 @@ Paragraph.prototype = ...@@ -1985,7 +2009,8 @@ Paragraph.prototype =
Bottom += ParaPr.Brd.Between.Size + ParaPr.Brd.Between.Space; Bottom += ParaPr.Brd.Between.Size + ParaPr.Brd.Between.Space;
} }
} }
else { else
{
// Параграф начинается с новой страницы // Параграф начинается с новой страницы
Bottom = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap; Bottom = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent + this.Lines[0].Metrics.LineGap;
Bottom2 = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent; Bottom2 = Top + this.Lines[0].Metrics.Ascent + this.Lines[0].Metrics.Descent;
...@@ -1997,7 +2022,8 @@ Paragraph.prototype = ...@@ -1997,7 +2022,8 @@ Paragraph.prototype =
} }
} }
if (bEnd) { if (bEnd)
{
Bottom += ParaPr.Spacing.After; Bottom += ParaPr.Spacing.After;
// Если нижняя граница Between, тогда она учитывается в следующем параграфе // Если нижняя граница Between, тогда она учитывается в следующем параграфе
...@@ -2441,7 +2467,7 @@ Paragraph.prototype = ...@@ -2441,7 +2467,7 @@ Paragraph.prototype =
var EndLine = this.Lines.length - 1; var EndLine = this.Lines.length - 1;
var TempDy = this.Lines[this.Pages[CurPage].FirstLine].Metrics.Ascent; var TempDy = this.Lines[this.Pages[CurPage].FirstLine].Metrics.Ascent;
if (0 === StartLine && (0 === CurPage || true === this.Parent.Is_TableCellContent())) if (0 === StartLine && ( 0 === CurPage || true === this.Parent.Is_TableCellContent() ) && null !== this.Get_DocumentPrev() )
TempDy += ParaPr.Spacing.Before; TempDy += ParaPr.Spacing.Before;
if (0 === StartLine) { if (0 === StartLine) {
......
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