Commit f90f277c authored by Ilya.Kirillov's avatar Ilya.Kirillov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52261 954022d7-b5bf-4e40-9824-e11837661b57
parent a55a356a
...@@ -693,8 +693,8 @@ Paragraph.prototype = ...@@ -693,8 +693,8 @@ Paragraph.prototype =
Internal_Check_EmptyHyperlink : function(Pos) Internal_Check_EmptyHyperlink : function(Pos)
{ {
var Start = this.Internal_FindBackward( Pos, [ para_Text, para_Drawing, para_Space, para_Tab, para_PageNum, para_HyperlinkStart ] ); var Start = this.Internal_FindBackward( Pos, [ para_Text, para_Drawing, para_Space, para_Tab, para_PageNum, para_Math, para_HyperlinkStart ] );
var End = this.Internal_FindForward ( Pos, [ para_Text, para_Drawing, para_Space, para_Tab, para_PageNum, para_HyperlinkEnd, para_End ] ); var End = this.Internal_FindForward ( Pos, [ para_Text, para_Drawing, para_Space, para_Tab, para_PageNum, para_Math, para_HyperlinkEnd, para_End ] );
if ( true === Start.Found && para_HyperlinkStart === Start.Type && true === End.Found && para_HyperlinkEnd === End.Type ) if ( true === Start.Found && para_HyperlinkStart === Start.Type && true === End.Found && para_HyperlinkEnd === End.Type )
{ {
...@@ -720,29 +720,6 @@ Paragraph.prototype = ...@@ -720,29 +720,6 @@ Paragraph.prototype =
Internal_Get_ParaPos_By_Pos : function(ContentPos) Internal_Get_ParaPos_By_Pos : function(ContentPos)
{ {
/*
var CurLine = this.Lines.length - 1;
for ( ; CurLine > 0; CurLine-- )
{
if ( this.Lines[CurLine].StartPos <= ContentPos )
break;
}
var CurRange = this.Lines[CurLine].Ranges.length - 1;
for ( ; CurRange > 0; CurRange-- )
{
if ( this.Lines[CurLine].Ranges[CurRange].StartPos <= ContentPos )
break;
}
var CurPage = this.Pages.length - 1;
for ( ; CurPage > 0; CurPage-- )
{
if ( this.Pages[CurPage].StartLine <= CurLine )
break;
}
*/
var _ContentPos = Math.max( 0, Math.min( ContentPos, this.Content.length - 1 ) ); var _ContentPos = Math.max( 0, Math.min( ContentPos, this.Content.length - 1 ) );
while ( undefined === this.Content[_ContentPos].CurPage ) while ( undefined === this.Content[_ContentPos].CurPage )
...@@ -1349,31 +1326,66 @@ Paragraph.prototype = ...@@ -1349,31 +1326,66 @@ Paragraph.prototype =
// При проверке, убирается ли слово, мы должны учитывать ширину // При проверке, убирается ли слово, мы должны учитывать ширину
// предшевствующих пробелов. // предшевствующих пробелов.
if ( LineTextAscent < TextAscent ) if ( para_Text === Item.Type )
LineTextAscent = TextAscent; {
if ( LineTextAscent < TextAscent )
LineTextAscent = TextAscent;
if ( LineTextAscent2 < TextAscent2 ) if ( LineTextAscent2 < TextAscent2 )
LineTextAscent2 = TextAscent2; LineTextAscent2 = TextAscent2;
if ( LineTextDescent < TextDescent ) if ( LineTextDescent < TextDescent )
LineTextDescent = TextDescent; LineTextDescent = TextDescent;
if ( linerule_Exact === ParaPr.Spacing.LineRule ) if ( linerule_Exact === ParaPr.Spacing.LineRule )
{ {
// Смещение не учитывается в метриках строки, когда расстояние между строк точное // Смещение не учитывается в метриках строки, когда расстояние между строк точное
if ( LineAscent < TextAscent ) if ( LineAscent < TextAscent )
LineAscent = TextAscent; LineAscent = TextAscent;
if ( LineDescent < TextDescent ) if ( LineDescent < TextDescent )
LineDescent = TextDescent; LineDescent = TextDescent;
}
else
{
if ( LineAscent < TextAscent + Item.YOffset )
LineAscent = TextAscent + Item.YOffset;
if ( LineDescent < TextDescent - Item.YOffset )
LineDescent = TextDescent - Item.YOffset;
}
} }
else else //if ( para_Math === Item.Type )
{ {
if ( LineAscent < TextAscent + Item.YOffset ) // TODO: Здесь нужно переделать. Необходимо у формулы запросить ее Ascent и Descent
LineAscent = TextAscent + Item.YOffset; // и учитывать именно эти значения.
if ( LineDescent < TextDescent - Item.YOffset ) if ( LineTextAscent < TextAscent )
LineDescent = TextDescent - Item.YOffset; LineTextAscent = TextAscent;
if ( LineTextAscent2 < TextAscent2 )
LineTextAscent2 = TextAscent2;
if ( LineTextDescent < TextDescent )
LineTextDescent = TextDescent;
if ( linerule_Exact === ParaPr.Spacing.LineRule )
{
// Смещение не учитывается в метриках строки, когда расстояние между строк точное
if ( LineAscent < TextAscent )
LineAscent = TextAscent;
if ( LineDescent < TextDescent )
LineDescent = TextDescent;
}
else
{
if ( LineAscent < TextAscent + Item.YOffset )
LineAscent = TextAscent + Item.YOffset;
if ( LineDescent < TextDescent - Item.YOffset )
LineDescent = TextDescent - Item.YOffset;
}
} }
if ( !bWord ) if ( !bWord )
...@@ -2370,7 +2382,7 @@ Paragraph.prototype = ...@@ -2370,7 +2382,7 @@ Paragraph.prototype =
{ {
var _Item = this.Content[_Pos]; var _Item = this.Content[_Pos];
var _Type = _Item.Type; var _Type = _Item.Type;
if ( para_Drawing === _Type || para_End === _Type || (para_NewLine === _Type && break_Line === _Item.BreakType) || para_PageNum === _Type || para_Space === _Type || para_Tab === _Type || para_Text === _Type ) if ( para_Drawing === _Type || para_End === _Type || (para_NewLine === _Type && break_Line === _Item.BreakType) || para_PageNum === _Type || para_Space === _Type || para_Tab === _Type || para_Text === _Type || para_Math === _Type )
{ {
bBreakPageLineEmpty = false; bBreakPageLineEmpty = false;
break; break;
...@@ -2525,9 +2537,9 @@ Paragraph.prototype = ...@@ -2525,9 +2537,9 @@ Paragraph.prototype =
// TODO: заменить на функцию проверки // TODO: заменить на функцию проверки
var ____Pos = Pos + 1; var ____Pos = Pos + 1;
var Next = this.Internal_FindForward( ____Pos, [ para_End, para_NewLine, para_Space, para_Text, para_Drawing, para_Tab, para_PageNum ] ); var Next = this.Internal_FindForward( ____Pos, [ para_End, para_NewLine, para_Space, para_Text, para_Drawing, para_Tab, para_PageNum, para_Math ] );
while ( true === Next.Found && para_Drawing === Next.Type && drawing_Anchor === this.Content[Next.LetterPos].Get_DrawingType() ) while ( true === Next.Found && para_Drawing === Next.Type && drawing_Anchor === this.Content[Next.LetterPos].Get_DrawingType() )
Next = this.Internal_FindForward( ++____Pos, [ para_End, para_NewLine, para_Space, para_Text, para_Drawing, para_Tab, para_PageNum ] ); Next = this.Internal_FindForward( ++____Pos, [ para_End, para_NewLine, para_Space, para_Text, para_Drawing, para_Tab, para_PageNum, para_Math ] );
if ( true === Next.Found && para_End === Next.Type ) if ( true === Next.Found && para_End === Next.Type )
{ {
...@@ -3873,7 +3885,8 @@ Paragraph.prototype = ...@@ -3873,7 +3885,8 @@ Paragraph.prototype =
switch( Item.Type ) switch( Item.Type )
{ {
case para_Text : case para_Math:
case para_Text:
{ {
if ( false === bWord ) if ( false === bWord )
{ {
...@@ -5798,6 +5811,14 @@ Paragraph.prototype = ...@@ -5798,6 +5811,14 @@ Paragraph.prototype =
this.Internal_AddHyperlink( Item ); this.Internal_AddHyperlink( Item );
break; break;
} }
case para_Math:
{
var TextPr = this.Internal_GetTextPr( CurPos );
var NewParaTextPr = new ParaTextPr( TextPr );
this.Internal_Content_Add( CurPos, Item );
this.Internal_Content_Add( CurPos + 1, NewParaTextPr );
break;
}
case para_PageNum: case para_PageNum:
case para_Tab: case para_Tab:
case para_Drawing: case para_Drawing:
...@@ -6843,7 +6864,7 @@ Paragraph.prototype = ...@@ -6843,7 +6864,7 @@ Paragraph.prototype =
var Item = this.Content[CurPos]; var Item = this.Content[CurPos];
var ItemType = Item.Type; var ItemType = Item.Type;
if ( para_Text === ItemType || para_Space === ItemType || para_End === ItemType || para_Tab === ItemType || (para_Drawing === ItemType && true === Item.Is_Inline() ) || para_PageNum === ItemType || para_NewLine === ItemType || para_HyperlinkStart === ItemType ) if ( para_Text === ItemType || para_Space === ItemType || para_End === ItemType || para_Tab === ItemType || (para_Drawing === ItemType && true === Item.Is_Inline() ) || para_PageNum === ItemType || para_NewLine === ItemType || para_HyperlinkStart === ItemType || para_Math === ItemType )
break; break;
CurPos++; CurPos++;
...@@ -6859,7 +6880,7 @@ Paragraph.prototype = ...@@ -6859,7 +6880,7 @@ Paragraph.prototype =
var ItemType = Item.Type; var ItemType = Item.Type;
var bEnd = false; var bEnd = false;
if ( para_Text === ItemType || para_Space === ItemType || para_End === ItemType || para_Tab === ItemType || (para_Drawing === ItemType && true === Item.Is_Inline() ) || para_PageNum === ItemType || para_NewLine === ItemType ) if ( para_Text === ItemType || para_Space === ItemType || para_End === ItemType || para_Tab === ItemType || (para_Drawing === ItemType && true === Item.Is_Inline() ) || para_PageNum === ItemType || para_NewLine === ItemType || para_Math === ItemType )
{ {
this.CurPos.ContentPos = CurPos + 1; this.CurPos.ContentPos = CurPos + 1;
bEnd = true; bEnd = true;
...@@ -6912,7 +6933,7 @@ Paragraph.prototype = ...@@ -6912,7 +6933,7 @@ Paragraph.prototype =
// Функция определяет начальную позицию курсора в параграфе // Функция определяет начальную позицию курсора в параграфе
Internal_GetStartPos : function() Internal_GetStartPos : function()
{ {
var oPos = this.Internal_FindForward( 0, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_End] ); var oPos = this.Internal_FindForward( 0, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_End, para_Math] );
if ( true === oPos.Found ) if ( true === oPos.Found )
return oPos.LetterPos; return oPos.LetterPos;
...@@ -6964,7 +6985,7 @@ Paragraph.prototype = ...@@ -6964,7 +6985,7 @@ Paragraph.prototype =
var oPos; var oPos;
if ( true != Word ) if ( true != Word )
oPos = this.Internal_FindBackward( this.CurPos.ContentPos - 1, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_End] ); oPos = this.Internal_FindBackward( this.CurPos.ContentPos - 1, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_End, para_Math] );
else else
oPos = this.Internal_FindWordStart( this.CurPos.ContentPos - 1, CursorPos_min ); oPos = this.Internal_FindWordStart( this.CurPos.ContentPos - 1, CursorPos_min );
...@@ -6996,7 +7017,7 @@ Paragraph.prototype = ...@@ -6996,7 +7017,7 @@ Paragraph.prototype =
{ {
var oPos; var oPos;
if ( true != Word ) if ( true != Word )
oPos = this.Internal_FindBackward( this.CurPos.ContentPos - 1, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_End] ); oPos = this.Internal_FindBackward( this.CurPos.ContentPos - 1, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_End, para_Math] );
else else
oPos = this.Internal_FindWordStart( this.CurPos.ContentPos - 1, CursorPos_min ); oPos = this.Internal_FindWordStart( this.CurPos.ContentPos - 1, CursorPos_min );
...@@ -7022,7 +7043,7 @@ Paragraph.prototype = ...@@ -7022,7 +7043,7 @@ Paragraph.prototype =
var oPos; var oPos;
if ( true != Word ) if ( true != Word )
oPos = this.Internal_FindBackward( this.CurPos.ContentPos - 1, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine] ); oPos = this.Internal_FindBackward( this.CurPos.ContentPos - 1, [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_Math] );
else else
oPos = this.Internal_FindWordStart( this.CurPos.ContentPos - 1, CursorPos_min ); oPos = this.Internal_FindWordStart( this.CurPos.ContentPos - 1, CursorPos_min );
...@@ -8728,6 +8749,7 @@ Paragraph.prototype = ...@@ -8728,6 +8749,7 @@ Paragraph.prototype =
case para_Numbering: case para_Numbering:
case para_PresentationNumbering: case para_PresentationNumbering:
case para_PageNum: case para_PageNum:
case para_Math:
{ {
if ( true === bClearText ) if ( true === bClearText )
return null; return null;
...@@ -8843,7 +8865,7 @@ Paragraph.prototype = ...@@ -8843,7 +8865,7 @@ Paragraph.prototype =
// Проверяем пустой ли параграф // Проверяем пустой ли параграф
IsEmpty : function() IsEmpty : function()
{ {
var Pos = this.Internal_FindForward( 0, [para_Tab, para_Drawing, para_PageNum, para_Text, para_Space, para_NewLine] ); var Pos = this.Internal_FindForward( 0, [para_Tab, para_Drawing, para_PageNum, para_Text, para_Space, para_NewLine, para_Math] );
return ( Pos.Found === true ? false : true ); return ( Pos.Found === true ? false : true );
}, },
...@@ -8888,7 +8910,7 @@ Paragraph.prototype = ...@@ -8888,7 +8910,7 @@ Paragraph.prototype =
StartPos = Temp; StartPos = Temp;
} }
var CheckArray = [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine]; var CheckArray = [para_PageNum, para_Drawing, para_Tab, para_Text, para_Space, para_NewLine, para_Math];
if ( true === bCheckHidden ) if ( true === bCheckHidden )
CheckArray.push( para_End ); CheckArray.push( para_End );
...@@ -8934,7 +8956,7 @@ Paragraph.prototype = ...@@ -8934,7 +8956,7 @@ Paragraph.prototype =
TabsCount++; TabsCount++;
TabsPos.push( Pos ); TabsPos.push( Pos );
} }
else if ( para_Text === ItemType || para_Space === ItemType || (para_Drawing === ItemType && true === Item.Is_Inline() ) || para_PageNum === ItemType ) else if ( para_Text === ItemType || para_Space === ItemType || (para_Drawing === ItemType && true === Item.Is_Inline() ) || para_PageNum === ItemType || para_Math === ItemType )
break; break;
} }
......
...@@ -7485,7 +7485,7 @@ ParaPresentationNumbering.prototype = ...@@ -7485,7 +7485,7 @@ ParaPresentationNumbering.prototype =
}; };
// Класс ParaMath // Класс ParaMath
function ParaMath(value) function ParaMath()
{ {
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
...@@ -7526,12 +7526,12 @@ ParaMath.prototype = ...@@ -7526,12 +7526,12 @@ ParaMath.prototype =
Draw : function( X, Y, Context ) Draw : function( X, Y, Context )
{ {
this.Math.Draw_2( X, Y, Context ) this.Math.Draw( X, Y, Context );
}, },
Measure : function( Context ) Measure : function( Context, TextPr )
{ {
this.Math.RecalculateComposition_2(); this.Math.RecalculateComposition(Context, TextPr);
var Size = this.Math.getSize(); var Size = this.Math.getSize();
this.Width = Size.width; this.Width = Size.width;
......
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