Commit c6685110 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Поправила баг : HighLight не прокидывалось в CtrPrp мат объекта (на редактировании)

2. В связи с разбивкой формул на строки поправила функцию Draw_HighLights (выделение текста, заливка)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62129 954022d7-b5bf-4e40-9824-e11837661b57
parent 22618813
......@@ -1412,18 +1412,12 @@ ParaMath.prototype.Get_Default_TPrp = function()
//-----------------------------------------------------------------------------------
ParaMath.prototype.Draw_HighLights = function(PDSH)
{
var CurLine = PDSH.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSH.Range - this.StartRange : PDSH.Range );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var X = PDSH.X;
var Y0 = PDSH.Y0;
var Y1 = PDSH.Y1;
if ( EndPos >= 1 )
if(false == this.Root.IsEmptyLine(PDSH.Line, PDSH.Range))
{
var X = PDSH.X;
var Y0 = PDSH.Y0;
var Y1 = PDSH.Y1;
var Comm = PDSH.Save_Comm();
var Coll = PDSH.Save_Coll();
......@@ -1441,19 +1435,20 @@ ParaMath.prototype.Draw_HighLights = function(PDSH)
var CommentId = ( CommentsCount > 0 ? PDSH.Comments[CommentsCount - 1] : null );
var CommentsFlag = PDSH.CommentsFlag;
var Bounds = this.Root.Get_Bounds();
var Bounds = this.Root.Get_LineBound(PDSH.Line);
Comm.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, 0, 0, 0, { Active : CommentsFlag === comments_ActiveComment ? true : false, CommentId : CommentId } );
}
if (null !== CollFirst)
{
var Bounds = this.Root.Get_Bounds();
var Bounds = this.Root.Get_LineBound(PDSH.Line);
Coll.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, CollFirst.r, CollFirst.g, CollFirst.b);
}
PDSH.Y0 = Y0;
PDSH.Y1 = Y1;
}
PDSH.Y0 = Y0;
PDSH.Y1 = Y1;
};
ParaMath.prototype.Draw_Elements = function(PDSE)
{
......@@ -2045,6 +2040,7 @@ var historyitem_Math_RFontsHAnsi = 16;
var historyitem_Math_RFontsCS = 17;
var historyitem_Math_RFontsEastAsia = 18;
var historyitem_Math_RFontsHint = 19;
var historyitem_Math_CtrPrpHighLight = 20;
function ReadChanges_FromBinary(Reader, Class)
......@@ -2070,6 +2066,7 @@ function ReadChanges_FromBinary(Reader, Class)
case historyitem_Math_RFontsCS : Changes = new CChangesMath_RFontsCS(); break;
case historyitem_Math_RFontsEastAsia : Changes = new CChangesMath_RFontsEastAsia(); break;
case historyitem_Math_RFontsHint : Changes = new CChangesMath_RFontsHint(); break;
case historyitem_Math_CtrPrpHighLight : Changes = new CChangesMathHighLight(); break;
}
if (null !== Changes)
......@@ -2170,6 +2167,54 @@ CChangesMathShd.prototype.Load_Changes = function(Reader, Class)
this.Redo(Class);
};
function CChangesMathHighLight(NewValue, OldValue)
{
this.New = NewValue;
this.Old = OldValue;
}
CChangesMathHighLight.prototype.Type = historyitem_Math_CtrPrpHighLight;
CChangesMathHighLight.prototype.Undo = function(Class)
{
Class.raw_SetHighLight(this.Old);
};
CChangesMathHighLight.prototype.Redo = function(Class)
{
Class.raw_SetHighLight(this.New);
};
CChangesMathHighLight.prototype.Save_Changes = function(Writer)
{
if ( undefined != this.New )
{
Writer.WriteBool(false);
if ( highlight_None != this.New )
{
Writer.WriteBool( false );
this.New.Write_ToBinary( Writer );
}
else
Writer.WriteBool( true );
}
else
Writer.WriteBool(true);
};
CChangesMathHighLight.prototype.Load_Changes = function(Reader, Class)
{
if ( Reader.GetBool() == false )
{
if ( Reader.GetBool() == false )
{
this.New = new CDocumentColor(0,0,0);
this.New.Read_FromBinary(Reader);
}
else
this.New = highlight_None;
}
else
this.New = undefined;
this.Redo(Class);
};
function CChangesMathColor(NewValue, OldValue)
{
this.New = NewValue;
......
......@@ -756,6 +756,9 @@ CMathBase.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
this.Set_Color(undefined);
}
if ( undefined != TextPr.HighLight )
this.Set_HighLight( null === TextPr.HighLight ? undefined : TextPr.HighLight );
if(undefined !== TextPr.Underline)
{
this.Set_Underline(TextPr.Underline);
......@@ -837,6 +840,15 @@ CMathBase.prototype.Set_Unifill = function(Value)
this.raw_SetUnifill(Value);
}
};
CMathBase.prototype.Set_HighLight = function(Value)
{
var OldValue = this.CtrPrp.HighLight;
if ( (undefined === Value && undefined !== OldValue) || ( highlight_None === Value && highlight_None !== OldValue ) || ( Value instanceof CDocumentColor && ( undefined === OldValue || highlight_None === OldValue || false === Value.Compare(OldValue) ) ) )
{
History.Add(this, new CChangesMathHighLight(Value, this.CtrPrp.HighLight));
this.raw_SetHighLight(Value);
}
};
CMathBase.prototype.Set_Shd = function(Shd)
{
if ( !(undefined === this.CtrPrp.Shd && undefined === Shd) && !(undefined !== this.CtrPrp.Shd && undefined !== Shd && true === this.CtrPrp.Shd.Compare( Shd ) ) )
......@@ -979,6 +991,11 @@ CMathBase.prototype.raw_SetUnifill = function(Value)
this.CtrPrp.Unifill = Value;
this.NeedUpdate_CtrPrp();
};
CMathBase.prototype.raw_SetHighLight = function(Value)
{
this.CtrPrp.HighLight = Value;
this.NeedUpdate_CtrPrp();
};
CMathBase.prototype.raw_SetRFonts = function(RFonts)
{
if ( undefined != RFonts )
......@@ -1525,7 +1542,8 @@ CMathBase.prototype.Select_MathContent = function(MathContent)
};
CMathBase.prototype.Draw_HighLights = function(PDSH, bAll)
{
var oShd = this.Get_CompiledCtrPrp().Shd;
var ComplCtrPrp = this.Get_CompiledCtrPrp();
var oShd = ComplCtrPrp.Shd;
var bDrawShd = ( oShd === undefined || shd_Nil === oShd.Value ? false : true );
var ShdColor = ( true === bDrawShd ? oShd.Get_Color( PDSH.Paragraph ) : null );
......@@ -1533,16 +1551,39 @@ CMathBase.prototype.Draw_HighLights = function(PDSH, bAll)
Y0 = PDSH.Y0,
Y1 = PDSH.Y1;
var CurLine = PDSH.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSH.Range - this.StartRange : PDSH.Range );
var StartPos, EndPos;
if(this.bOneLine)
{
StartPos = 0;
EndPos = this.Content.length - 1;
}
else
{
StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
}
var bAllCont = this.Selection.StartPos !== this.Selection.EndPos;
for (var CurPos = 0; CurPos < this.Content.length; CurPos++)
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
this.Content[CurPos].Draw_HighLights(PDSH, bAllCont);
var Bound = this.Get_LineBound(PDSH.Line);
if (true === bDrawShd)
PDSH.Shd.Add(Y0, Y1, X, X + this.size.width, 0, ShdColor.r, ShdColor.g, ShdColor.b );
PDSH.Shd.Add(Y0, Y1, X, X + Bound.W, 0, ShdColor.r, ShdColor.g, ShdColor.b );
PDSH.X = this.pos.x + this.ParaMath.X + this.size.width;
var HighLight = ComplCtrPrp.HighLight;
if ( highlight_None != HighLight )
PDSH.High.Add( Y0, Y1, X, X + Bound.W, 0, HighLight.r, HighLight.g, HighLight.b );
PDSH.X = Bound.X + Bound.W;
};
CMathBase.prototype.Draw_Lines = function(PDSL)
{
......@@ -1909,6 +1950,18 @@ CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _C
}
}
};
CMathBase.prototype.IsEmptyLine = function(_CurLine, _CurRange)
{
var bEmpty = false;
var Numb = this.NumBreakContent;
if(this.bOneLine == false)
{
bEmpty = this.Content[Numb].IsEmptyLine(_CurLine, _CurRange);
}
return bEmpty;
};
CMathBase.prototype.Get_LineBound = function(_CurLine)
{
var CurLine = _CurLine - this.StartLine;
......@@ -1991,6 +2044,11 @@ CMathBase.prototype.Is_EmptyRange = function()
{
return false;
};
CMathBase.prototype.IsShade = function()
{
var oShd = this.Get_CompiledCtrPrp().Shd;
return !(oShd === undefined || shd_Nil === oShd.Value);
};
CMathBase.prototype.Get_CurrentParaPos = CMathContent.prototype.Get_CurrentParaPos;
CMathBase.prototype.private_UpdatePosOnAdd = CMathContent.prototype.private_UpdatePosOnAdd;
CMathBase.prototype.private_UpdatePosOnRemove = CMathContent.prototype.private_UpdateOnRemove;
......@@ -2011,21 +2069,6 @@ CMathBase.prototype.private_CorrectCurPos = function()
this.Content[this.CurPos].Cursor_MoveToStartPos();
}
};
CMathBase.prototype.Search = CParagraphContentWithParagraphLikeContent.prototype.Search;
CMathBase.prototype.Add_SearchResult = CParagraphContentWithParagraphLikeContent.prototype.Add_SearchResult;
CMathBase.prototype.Clear_SearchResults = CParagraphContentWithParagraphLikeContent.prototype.Clear_SearchResults;
CMathBase.prototype.Remove_SearchResult = CParagraphContentWithParagraphLikeContent.prototype.Remove_SearchResult;
CMathBase.prototype.Search_GetId = CParagraphContentWithParagraphLikeContent.prototype.Search_GetId;
CMathBase.prototype.Set_SelectionContentPos = CParagraphContentWithParagraphLikeContent.prototype.Set_SelectionContentPos;
CMathBase.prototype.Get_LeftPos = CParagraphContentWithParagraphLikeContent.prototype.Get_LeftPos;
CMathBase.prototype.Get_RightPos = CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos;
CMathBase.prototype.Get_WordStartPos = CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos;
CMathBase.prototype.Get_WordEndPos = CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos;
CMathBase.prototype.Selection_Remove = CParagraphContentWithParagraphLikeContent.prototype.Selection_Remove;
CMathBase.prototype.Select_All = CParagraphContentWithParagraphLikeContent.prototype.Select_All;
CMathBase.prototype.Check_NearestPos = CParagraphContentWithParagraphLikeContent.prototype.Check_NearestPos;
CMathBase.prototype.Get_SelectionDirection = CParagraphContentWithParagraphLikeContent.prototype.Get_SelectionDirection;
CMathBase.prototype.Selection_CheckParaContentPos = function(ContentPos, Depth, bStart, bEnd)
{
if (true !== this.Selection.Use)
......
......@@ -3605,24 +3605,27 @@ CMathContent.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth)
};
CMathContent.prototype.Draw_HighLights = function(PDSH, bAll)
{
PDSH.X = this.ParaMath.X + this.pos.x;
var Bound = this.Get_LineBound(PDSH.Line);
PDSH.X = Bound.X;
var len = this.Content.length;
var CurLine = PDSH.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSH.Range - this.StartRange : PDSH.Range );
var H = 0;
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var Y0 = PDSH.Y0,
Y1 = PDSH.Y1;
var FirstRootRunNotShd = this.bRoot && this.Content.length > 0 && !this.Content[0].IsShade();
var FirstRunInRootNotShd = this.bRoot && this.Content.length > 0 && this.Content[StartPos].IsShade() == false;
if( FirstRootRunNotShd || !this.bRoot)
if(FirstRunInRootNotShd || this.bRoot == false)
{
Y0 = this.ParaMath.Y + this.pos.y;
Y1 = this.ParaMath.Y + this.pos.y + this.size.height;
Y0 = Bound.Y;
Y1 = Bound.Y + Bound.H;
}
for ( var CurPos = 0; CurPos < len; CurPos++ )
for ( var CurPos = StartPos; CurPos <= EndPos; CurPos++ )
{
PDSH.Y0 = Y0;
PDSH.Y1 = Y1;
......@@ -3632,7 +3635,6 @@ CMathContent.prototype.Draw_HighLights = function(PDSH, bAll)
this.Content[CurPos].Draw_HighLights(PDSH, bAll);
}
};
CMathContent.prototype.Draw_Lines = function(PDSL)
{
......@@ -4095,7 +4097,23 @@ CMathContent.prototype.IsEmptyLine = function(_CurLine, _CurRange)
var bEmpty = false;
if(StartPos == EndPos)
{
bEmpty = this.Content[StartPos].IsEmptyLine(_CurLine, _CurRange);
}
else
{
var Pos = StartPos;
while(Pos < EndPos && this.Content[Pos].Type == para_Math_Run && this.Content[Pos].Is_Empty() == true)
{
Pos++;
}
if(Pos == EndPos && this.Content[Pos].Type == para_Math_Composition)
{
bEmpty = this.Content[Pos].IsEmptyLine(_CurLine, _CurRange);
}
}
return bEmpty;
};
......
......@@ -3363,6 +3363,8 @@ CDelimiter.prototype.getColumnsCount = function()
};
CDelimiter.prototype.fillContent = function()
{
this.NeedBreakContent(0);
var nColumnsCount = this.getColumnsCount();
this.setDimension(1, nColumnsCount);
......
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