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

Переделано добавление и изменение буквицы в новом параграфе (через класс...

Переделано добавление и изменение буквицы в новом параграфе (через класс ParaRun). Исправлены баги с добавлением буквицы, когда один из следующих параметров был ненулевым: первая строка, правое поле, отступ до параграфа. Исправлены баги с неправильным определением отступов до и после параграфа между параграфами, находящимися в рамке в не рамки.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55960 954022d7-b5bf-4e40-9824-e11837661b57
parent e8d7f572
......@@ -1001,6 +1001,15 @@ ParaComment.prototype =
Item.Set_RStyle( DefHyper );
}
},
Can_AddDropCap : function()
{
return null;
},
Get_TextForDropCap : function(DropCapText, UseContentPos, ContentPos, Depth)
{
},
//-----------------------------------------------------------------------------------
// Функции пересчета
//-----------------------------------------------------------------------------------
......
......@@ -2506,7 +2506,8 @@ CDocument.prototype =
var NewParagraph = new Paragraph( this.DrawingDocument, this, 0, 0, 0, 0, 0 );
var TextPr = OldParagraph.Split_DropCap( NewParagraph );
var LineH = OldParagraph.Lines[0].Bottom - OldParagraph.Lines[0].Top;
var Before = OldParagraph.Get_CompiledPr().ParaPr.Spacing.Before;
var LineH = OldParagraph.Lines[0].Bottom - OldParagraph.Lines[0].Top - Before;
var LineTA = OldParagraph.Lines[0].Metrics.TextAscent2;
var LineTD = OldParagraph.Lines[0].Metrics.TextDescent + OldParagraph.Lines[0].Metrics.LineGap;
......@@ -2514,7 +2515,7 @@ CDocument.prototype =
FramePr.Init_Default_DropCap( bInText );
NewParagraph.Set_FrameParaPr( OldParagraph );
NewParagraph.Set_FramePr2( FramePr );
NewParagraph.Update_DropCapByLines( TextPr, NewParagraph.Pr.FramePr.Lines, LineH, LineTA, LineTD );
NewParagraph.Update_DropCapByLines( TextPr, NewParagraph.Pr.FramePr.Lines, LineH, LineTA, LineTD, Before );
this.Internal_Content_Add( Pos, NewParagraph );
OldParagraph.Cursor_MoveToStartPos();
......
......@@ -743,6 +743,33 @@ ParaHyperlink.prototype =
Item.Set_RStyle( DefHyper );
}
},
Can_AddDropCap : function()
{
var Count = this.Content.length;
for ( var Pos = 0; Pos < Count; Pos++ )
{
var TempRes = this.Content[Pos].Can_AddDropCap();
if ( null !== TempRes )
return TempRes;
}
return null;
},
Get_TextForDropCap : function(DropCapText, UseContentPos, ContentPos, Depth)
{
var EndPos = ( true === UseContentPos ? ContentPos.Get(Depth) : this.Content.length - 1 );
for ( var Pos = 0; Pos <= EndPos; Pos++ )
{
this.Content[Pos].Get_TextForDropCap( DropCapText, (true === UseContentPos && Pos === EndPos ? true : false), ContentPos, Depth + 1 );
if ( true === DropCapText.Mixed && ( true === DropCapText.Check || DropCapText.Runs.length > 0 ) )
return;
}
},
//-----------------------------------------------------------------------------------
// Функции пересчета
//-----------------------------------------------------------------------------------
......
......@@ -388,6 +388,17 @@ ParaMath.prototype =
Clear_TextFormatting : function( DefHyper )
{
},
Can_AddDropCap : function()
{
return false;
},
Get_TextForDropCap : function(DropCapText, UseContentPos, ContentPos, Depth)
{
if ( true === DropCapText.Check )
DropCapText.Mixed = true;
},
//-----------------------------------------------------------------------------------
// Функции пересчета
//-----------------------------------------------------------------------------------
......
This diff is collapsed.
......@@ -1177,6 +1177,65 @@ ParaRun.prototype =
return Str;
},
Can_AddDropCap : function()
{
var Count = this.Content.length;
for ( var Pos = 0; Pos < Count; Pos++ )
{
var Item = this.Content[Pos];
switch ( Item.Type )
{
case para_Text:
return true;
case para_Space:
case para_Tab:
case para_PageNum:
return false;
}
}
return null;
},
Get_TextForDropCap : function(DropCapText, UseContentPos, ContentPos, Depth)
{
var EndPos = ( true === UseContentPos ? ContentPos.Get(Depth) : this.Content.length );
for ( var Pos = 0; Pos < EndPos; Pos++ )
{
var Item = this.Content[Pos];
var ItemType = Item.Type;
if ( true === DropCapText.Check )
{
if ( para_Space === ItemType || para_Tab === ItemType || para_PageNum === ItemType || para_Drawing === ItemType )
{
DropCapText.Mixed = true;
return;
}
}
else
{
if ( para_Text === ItemType )
{
DropCapText.Runs.push(this);
DropCapText.Text.push(Item);
this.Remove_FromContent( Pos, 1, true );
Pos--;
EndPos--;
if ( true === DropCapText.Mixed )
return;
}
}
}
},
//-----------------------------------------------------------------------------------
// Функции пересчета
//-----------------------------------------------------------------------------------
......@@ -1227,6 +1286,32 @@ ParaRun.prototype =
this.RecalcInfo.Measure = false;
},
Recalculate_Measure2 : function(Metrics)
{
var TAscent = Metrics.Ascent;
var TDescent = Metrics.Descent;
var Count = this.Content.length;
for ( var Index = 0; Index < Count; Index++ )
{
var Item = this.Content[Index];
if ( para_Text === Item.Type )
{
var Temp = g_oTextMeasurer.Measure2( Item.Value );
if ( null === TAscent || TAscent < Temp.Ascent )
TAscent = Temp.Ascent;
if ( null === TDescent || TDescent > Temp.Ascent - Temp.Height )
TDescent = Temp.Ascent - Temp.Height;
}
}
Metrics.Ascent = TAscent;
Metrics.Descent = TDescent;
},
Recalculate_Range : function(PRS, ParaPr, Depth)
{
if ( this.Paragraph !== PRS.Paragraph )
......@@ -1795,8 +1880,8 @@ ParaRun.prototype =
if ( PRS.LineTextAscent < this.TextAscent )
PRS.LineTextAscent = this.TextAscent;
//if ( PRS.LineTextAscent2 < this.TextAscent2 )
//PRS.LineTextAscent2 = this.TextAscent2;
if ( PRS.LineTextAscent2 < this.TextAscent2 )
PRS.LineTextAscent2 = this.TextAscent2;
if ( PRS.LineTextDescent < this.TextDescent )
PRS.LineTextDescent = this.TextDescent;
......
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