Merge remote-tracking branch 'remotes/origin/release/v8.0.0' into hotfix/v8.0.1

This commit is contained in:
KirillovIlya
2024-02-02 14:39:43 +03:00
15 changed files with 255 additions and 190 deletions

View File

@ -2365,6 +2365,9 @@ var CPresentation = CPresentation || function(){};
CPDFDoc.prototype.Is_OnRecalculate = function() {
return false;
};
CPDFDoc.prototype.IsActionStarted = function() {
return false;
};
CPDFDoc.prototype.GetSelectionState = function() {
return null;
};

View File

@ -2533,9 +2533,7 @@
return;
let ctx = this.canvas.getContext("2d");
ctx.strokeStyle = AscCommon.GlobalSkin.PageOutline;
let lineW = AscCommon.AscBrowser.retinaPixelRatio >> 0;
ctx.lineWidth = lineW;
let yPos = this.scrollY >> 0;
let yMax = yPos + this.height;
@ -2584,6 +2582,10 @@
return;
this.canvas.width = this.canvas.width;
ctx.strokeStyle = AscCommon.GlobalSkin.PageOutline;
ctx.lineWidth = lineW;
this.pageDetector = new CCurrentPageDetector(this.canvas.width, this.canvas.height);
let oDrDoc = oDoc.GetDrawingDocument();

View File

@ -114,7 +114,7 @@ AscCommon.darkModeCorrectColor2 = function(r, g, b)
this.fontSize = fontSize;
}
/**
* @returns {{w:number, h:number}}
* @returns {{w:number, h:number, ascent: number, descent: number}}
*/
TextLine.prototype.getSize = function()
{
@ -122,18 +122,29 @@ AscCommon.darkModeCorrectColor2 = function(r, g, b)
this.dc.Recalculate_Page(0, true, false);
let p = this.dc.GetElement(0);
let bounds = this.dc.GetContentBounds(0);
let lineMetrics = p.getLineMetrics(0);
return {
w : p.GetAutoWidthForDropCap(),
h : bounds.Bottom - bounds.Top
h : bounds.Bottom - bounds.Top,
ascent : lineMetrics.TextAscent2,
descent : lineMetrics.TextDescent,
};
};
TextLine.prototype.draw = function(graphics, x, y)
{
y -= this.fontSize * g_dKoef_pt_to_mm;
let showParaMarks = false;
if (editor && editor.ShowParaMarks)
{
editor.ShowParaMarks = false;
showParaMarks = true;
}
this.dc.Reset(x, y, AscWord.MAX_MM_VALUE, AscWord.MAX_MM_VALUE);
this.dc.Recalculate_Page(0, true, false);
this.dc.Draw(0, graphics);
if (showParaMarks)
editor.ShowParaMarks = true;
};
function CGraphics()
@ -1585,7 +1596,7 @@ CGraphics.prototype =
let _koef_px_to_mm = 25.4 / this.m_dDpiY;
let textH = textSize.h / _koef_px_to_mm;
let textH = textSize.ascent / _koef_px_to_mm;
let textW = textSize.w / _koef_px_to_mm;
var _ctx = this.m_oContext;
@ -1623,14 +1634,17 @@ CGraphics.prototype =
_ctx.stroke();
_ctx.beginPath();
y -= _yPxOffset * _koef_px_to_mm;
if (isHeader)
y += __h * _koef_px_to_mm;
y += _yPxOffset * _koef_px_to_mm;
if (!isHeader)
y -= __h * _koef_px_to_mm ;
x += _xPxOffset * _koef_px_to_mm;
if (fromRight)
x -= __w * _koef_px_to_mm
x -= __w * _koef_px_to_mm;
// Мы обрезаем высоту и ширину по пиксельной сетке, из-за этого текст кажется прижатым к низу
// Корректируем горизонтальную позицию, чтобы он был ближе к верху
y = ((y / _koef_px_to_mm) >> 0) * _koef_px_to_mm;
textLine.draw(this, x, y);
},

View File

@ -1993,7 +1993,9 @@
ctx.fillStyle = (_object.ActiveButtonIndex == -1) ? AscCommon.GlobalSkin.ContentControlsTextActive : AscCommon.GlobalSkin.ContentControlsText;
ctx.font = Math.round(11 * rPR) + "px Helvetica, Arial, sans-serif";
_object.fillText(ctx, _object.Name, xText + Math.round(3 * rPR), _y + Math.round(20 * rPR) - Math.round(6 * rPR), _object.CalculateNameRectNatural() * rPR);
let _textShift = ctx.direction === "rtl" ? _object.CalculateNameRectNatural() * rPR : 0;
_object.fillText(ctx, _object.Name, xText + Math.round(3 * rPR) + _textShift, _y + Math.round(20 * rPR) - Math.round(6 * rPR), _object.CalculateNameRectNatural() * rPR);
if (_object.IsNameAdvanced() && !_object.IsNoUseButtons())
{
@ -2207,7 +2209,8 @@
ctx.fillStyle = (_object.ActiveButtonIndex == -1) ? AscCommon.GlobalSkin.ContentControlsTextActive : AscCommon.GlobalSkin.ContentControlsText;
ctx.font = this.getFont(_koefY);
_object.fillText(ctx, _object.Name, xText + 3 / _koefX, _y + (20 - 6) / _koefY, _object.CalculateNameRectNatural() / _koefX);
let _textShift = ctx.direction === "rtl" ? _object.CalculateNameRectNatural() / _koefX : 0;
_object.fillText(ctx, _object.Name, xText + 3 / _koefX + _textShift, _y + (20 - 6) / _koefY, _object.CalculateNameRectNatural() / _koefX);
if (_object.IsNameAdvanced() && !_object.IsNoUseButtons())
{

View File

@ -632,9 +632,12 @@ window['AscCommonWord'].CTextToTableEngine = CTextToTableEngine;
function checkAsYouTypeEnterText(run, inRunPos, codePoint)
{
let localHistory = AscCommon.History;
if (!localHistory.checkAsYouTypeEnterText)
return false;
if (!localHistory.isEmpty())
return AscCommon.History.checkAsYouTypeEnterText(run, inRunPos, codePoint);
else (AscCommon.CollaborativeEditing.Is_Fast() && !AscCommon.CollaborativeEditing.Is_SingleUser())
return localHistory.checkAsYouTypeEnterText(run, inRunPos, codePoint);
else if (AscCommon.CollaborativeEditing.Is_Fast() && !AscCommon.CollaborativeEditing.Is_SingleUser())
return AscCommon.CollaborativeEditing.getCoHistory().checkAsYouTypeEnterText(run, inRunPos, codePoint);
return false;

View File

@ -2645,6 +2645,20 @@ CDocumentContentBase.prototype.GetSelectedParagraphs = function()
return logicDocument.GetSelectedParagraphs();
};
CDocumentContentBase.prototype.setSelectionStateSilent = function(state)
{
let logicDocument = this.GetLogicDocument();
if (logicDocument && !logicDocument.IsDocumentEditor())
logicDocument = null;
if (logicDocument)
logicDocument.Start_SilentMode();
this.SetSelectionState(state);
if (logicDocument)
logicDocument.End_SilentMode(false);
};
CDocumentContentBase.prototype.getSpeechDescription = function(prevState, action)
{
if (!prevState)
@ -2661,10 +2675,10 @@ CDocumentContentBase.prototype.getSpeechDescription = function(prevState, action
let obj = {};
let type = AscCommon.SpeechWorkerCommands.Text;
this.SetSelectionState(prevState);
this.setSelectionStateSilent(prevState);
let prevInfo = this.getSelectionInfo();
this.SetSelectionState(curState);
this.setSelectionStateSilent(curState);
let curInfo = this.getSelectionInfo();
let isActionSelectionChange = action && action.type === AscCommon.SpeakerActionType.keyDown && action.event.ShiftKey;
@ -2698,10 +2712,10 @@ CDocumentContentBase.prototype.getSpeechDescription = function(prevState, action
if (prevInfo.isSelection && !curInfo.isSelection && isActionSelectionChange)
{
obj.cancelSelection = true;
this.SetSelectionState(prevState);
this.setSelectionStateSilent(prevState);
type = AscCommon.SpeechWorkerCommands.TextUnselected;
obj.text = this.GetSelectedText(false);
this.SetSelectionState(curState);
this.setSelectionStateSilent(curState);
}
else if (!curInfo.isSelection || 0 === AscWord.CompareDocumentPositions(curInfo.selectionStart, curInfo.selectionEnd))
{
@ -2712,10 +2726,10 @@ CDocumentContentBase.prototype.getSpeechDescription = function(prevState, action
{
if (prevInfo.isSelection && 0 !== AscWord.CompareDocumentPositions(prevInfo.selectionStart, prevInfo.selectionEnd))
{
this.SetSelectionState(prevState);
this.setSelectionStateSilent(prevState);
type = AscCommon.SpeechWorkerCommands.TextUnselected;
obj.text = this.GetSelectedText(false);
this.SetSelectionState(curState);
this.setSelectionStateSilent(curState);
}
else
{
@ -2782,10 +2796,10 @@ CDocumentContentBase.prototype.getSpeechDescription = function(prevState, action
&& AscWord.CompareDocumentPositions(prevInfo.selectionStart, curInfo.selectionEnd) < 0)))
{
// TODO: Нужно ли посылать два ивента?
// this.SetSelectionState(prevState);
// this.setSelectionStateSilent(prevState);
// type = AscCommon.SpeechWorkerCommands.TextUnselected;
// obj.text = this.GetSelectedText(false);
// this.SetSelectionState(curState);
// this.setSelectionStateSilent(curState);
type = AscCommon.SpeechWorkerCommands.TextSelected;
obj.text = this.GetSelectedText(false);
@ -2803,7 +2817,7 @@ CDocumentContentBase.prototype.getSpeechDescription = function(prevState, action
type = isAdd ? AscCommon.SpeechWorkerCommands.TextSelected : AscCommon.SpeechWorkerCommands.TextUnselected;
obj.text = this.GetSelectedText(false);
this.SetSelectionState(curState);
this.setSelectionStateSilent(curState);
}
}
}

View File

@ -710,7 +710,7 @@ CHistory.prototype =
{
// Не объединяем точки в истории, когда отключается пересчет.
// TODO: Неправильно изменяется RecalcIndex
if (this.Document && true !== this.Document.Is_OnRecalculate())
if (this.Document && (!this.Document.Is_OnRecalculate() || this.Document.IsActionStarted()))
return false;
// Не объединяем точки во время Undo/Redo

View File

@ -2511,44 +2511,9 @@ ParaMath.prototype.Get_Default_TPrp = function()
//-----------------------------------------------------------------------------------
// Функции отрисовки
//-----------------------------------------------------------------------------------
ParaMath.prototype.Draw_HighLights = function(PDSH)
ParaMath.prototype.Draw_HighLights = function(drawState)
{
if(false == this.Root.IsEmptyRange(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();
this.Root.Draw_HighLights(PDSH, false);
var CommFirst = PDSH.Comm.Get_Next();
var CollFirst = PDSH.Coll.Get_Next();
PDSH.Load_Comm(Comm);
PDSH.Load_Coll(Coll);
if (null !== CommFirst)
{
var CommentsCount = PDSH.Comments.length;
var CommentId = ( CommentsCount > 0 ? PDSH.Comments[CommentsCount - 1] : null );
var CommentsFlag = PDSH.CommentsFlag;
var Bounds = this.Root.Get_LineBound(PDSH.Line, PDSH.Range);
Comm.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, 0, 0, 0, { Active : CommentsFlag === AscCommon.comments_ActiveComment ? true : false, CommentId : CommentId } );
}
if (null !== CollFirst)
{
var Bounds = this.Root.Get_LineBound(PDSH.Line, PDSH.Range);
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;
}
drawState.handleParaMath(this);
};
ParaMath.prototype.Draw_Elements = function(PDSE)
{

View File

@ -1951,6 +1951,10 @@ Paragraph.prototype.GetLineBounds = function(nCurLine)
return new CDocumentBounds(oPage.X, nTop, oPage.XLimit, nBottom);
};
Paragraph.prototype.getLineMetrics = function(iLine)
{
return this.Lines[iLine] ? this.Lines[iLine].Metrics : new CParaLineMetrics();
};
Paragraph.prototype.GetTextOnLine = function(nCurLine)
{
if (!this.IsRecalculated() || this.GetLinesCount() <= nCurLine)
@ -19006,6 +19010,11 @@ CParaDrawingRangeLines.prototype =
return Element;
},
getNext : function(saveIntermediate)
{
return this.Get_Next(saveIntermediate);
},
Get_NextForward : function()
{

View File

@ -289,9 +289,9 @@
};
CRunText.prototype.getBidiType = function()
{
if (this.Flags & FLAGS_RTL)
if (this.Flags & FLAGS_RTL || 0x060C <= this.Value && this.Value <= 0x074A)
return AscWord.BidiType.rtl;
else if (0x060C <= this.Value && this.Value <= 0x074A || this.IsPunctuation())
else if (this.IsPunctuation())
return AscWord.BidiType.neutral;
return AscWord.BidiType.ltr;

View File

@ -73,12 +73,8 @@
this.haveCurrentComment = false;
this.currentCommentId = null;
this.comments = []; // current list of comments
this.runComments = []; // comments we use for a particular run
this.hyperlinks = [];
this.Comments = [];
this.CommentsFlag = AscCommon.comments_NoComment;
this.searchCounter = 0;
@ -112,7 +108,7 @@
let logicDocument = paragraph.GetLogicDocument();
let commentManager = logicDocument && logicDocument.IsDocumentEditor() ? logicDocument.GetCommentsManager() : null;
this.DrawColl = undefined !== graphics.RENDERER_PDF_FLAG;
this.DrawColl = undefined === graphics.RENDERER_PDF_FLAG;
this.DrawSearch = logicDocument && logicDocument.IsDocumentEditor() && logicDocument.SearchEngine.Selection;
this.DrawComments = commentManager && commentManager.isUse();
this.DrawSolvedComments = commentManager && commentManager.isUseSolved();
@ -128,7 +124,6 @@
this.searchCounter = 0;
this.comments = [];
this.runComments = [];
this.haveCurrentComment = false;
let pageEndInfo = this.Paragraph.GetEndInfoByPage(page - 1);
@ -175,7 +170,7 @@
ParagraphHighlightDrawState.prototype.endRange = function()
{
this.bidiFlow.end();
}
};
ParagraphHighlightDrawState.prototype.AddInlineSdt = function(oSdt)
{
this.InlineSdt.push(oSdt);
@ -212,26 +207,6 @@
{
--this.searchCounter;
};
ParagraphHighlightDrawState.prototype.Save_Coll = function()
{
var Coll = this.Coll;
this.Coll = new CParaDrawingRangeLines();
return Coll;
};
ParagraphHighlightDrawState.prototype.Save_Comm = function()
{
var Comm = this.Comm;
this.Comm = new CParaDrawingRangeLines();
return Comm;
};
ParagraphHighlightDrawState.prototype.Load_Coll = function(Coll)
{
this.Coll = Coll;
};
ParagraphHighlightDrawState.prototype.Load_Comm = function(Comm)
{
this.Comm = Comm;
};
ParagraphHighlightDrawState.prototype.IsCollectFixedForms = function()
{
return this.CollectFixedForms;
@ -255,23 +230,101 @@
let flags = this.getFlags(element, !!collaborationColor);
let hyperlink = this.getHyperlinkObject();
this.bidiFlow.add([element, run, flags, hyperlink, collaborationColor], element.getBidiType());
this.bidiFlow.add([element, run, flags, hyperlink, collaborationColor, this.comments.slice(), this.haveCurrentComment], element.getBidiType());
};
ParagraphHighlightDrawState.prototype.handleBidiFlow = function(data)
{
let element = data[0];
let run = data[1];
let flags = data[2];
let hyperlink = data[3];
let collColor = data[4];
let element = data[0];
let run = data[1];
let flags = data[2];
let hyperlink = data[3];
let collColor = data[4];
let comments = data[5];
let curComment = data[6];
let w = element.GetWidthVisible();
this.handleRun(run);
this.addHighlight(this.X, this.X + w, flags, hyperlink, collColor);
this.addHighlight(this.X, this.X + w, flags, hyperlink, collColor, comments, curComment);
this.X += w;
};
ParagraphHighlightDrawState.prototype.handleParaMath = function(math)
{
if (!math || math.Root.IsEmptyRange(this.Line, this.Range))
return;
this.bidiFlow.end();
let y0 = this.Y0;
let y1 = this.Y1;
let coll = this.Coll;
let comm = this.Comm;
this.Coll = new CParaDrawingRangeLines();
this.Comm = new CParaDrawingRangeLines();
math.Root.Draw_HighLights(this);
let mathComments = this.Comm.getNext();
if (mathComments)
{
let bounds = math.Root.Get_LineBound(this.Line, this.Range);
comm.Add(bounds.Y, bounds.Y + bounds.H, bounds.X, bounds.X + bounds.W, 0, 0, 0, 0, mathComments.Additional);
}
let mathColl = this.Coll.getNext();
if (mathColl)
{
let bounds = math.Root.Get_LineBound(this.Line, this.Range);
coll.Add(bounds.Y, bounds.Y + bounds.H, bounds.X, bounds.X + bounds.W, 0, mathColl.r, mathColl.g, mathColl.b);
}
this.Coll = coll;
this.Comm = comm;
this.Y0 = y0;
this.Y1 = y1;
};
ParagraphHighlightDrawState.prototype.handleMathBase = function(element)
{
this.bidiFlow.end();
let textPr = element.Get_CompiledCtrPrp();
let shdColor = (textPr.Shd && !textPr.Shd.IsNil() ? textPr.Shd.GetSimpleColor(this.drawState.getTheme(), this.drawState.getColorMap()) : null);
let w = element.Get_LineBound(this.Line, this.Range).W;
let x = this.X;
let y0 = this.Y0;
let y1 = this.Y1;
let startPos = 0;
let endPos = element.Content.length - 1;
if (!element.bOneLine)
{
let rangeInfo = element.getRangePos(this.Line, this.Range);
startPos = rangeInfo[0];
endPos = rangeInfo[1];
}
for (let pos = startPos; pos <= endPos; ++pos)
{
element.Content[pos].Draw_HighLights(this);
}
// Add after because we are rendering in reverse direction
if (shdColor)
this.Shd.Add(y0, y1, x, x + w, 0, shdColor.r, shdColor.g, shdColor.b);
if (highlight_None !== textPr.HighLight)
this.High.Add(y0, y1, x, x + w, 0, textPr.HighLight.r, textPr.HighLight.g, textPr.HighLight.b);
this.X = x + w;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -334,8 +387,6 @@
this.run = run;
this.runComments = this.comments.slice();
let textPr = run.getCompiledPr();
let shd = textPr.Shd;
@ -355,7 +406,7 @@
/**
*
*/
ParagraphHighlightDrawState.prototype.addHighlight = function(startX, endX, flags, hyperlink, collColor)
ParagraphHighlightDrawState.prototype.addHighlight = function(startX, endX, flags, hyperlink, collColor, comments, curComment)
{
let startY = this.Y0;
let endY = this.Y1;
@ -369,8 +420,8 @@
if (flags & FLAG_COMPLEX_FIELD)
this.CFields.Add(startY, endY, startX, endX, 0, 0, 0, 0);
if (flags & FLAG_COMMENT && this.runComments.length)
this.Comm.Add(startY, endY, startX, endX, 0, 0, 0, 0, {Active : this.haveCurrentComment, CommentId : this.runComments});
if (flags & FLAG_COMMENT && comments.length)
this.Comm.Add(startY, endY, startX, endX, 0, 0, 0, 0, {Active : curComment, CommentId : comments});
if ((flags & FLAG_HIGHLIGHT) && (this.highlight && highlight_None !== this.highlight))
this.High.Add(startY, endY, startX, endX, 0, this.highlight.r, this.highlight.g, this.highlight.b, undefined, this.highlight);

View File

@ -64,9 +64,23 @@
run : null,
mathY : -1
};
// Track prev element for the case when cursor is placed between elements with different directions
this.prev = {
x : 0,
y : 0,
run : null,
element : null,
inRunPos : 0,
find : false,
usePos : false
};
}
ParagraphPositionCalculator.prototype.reset = function(page, line, range)
{
this.prev.element = null;
this.prev.find = false;
this.isNextCurrent = false;
this.nextRun = null;
@ -108,7 +122,7 @@
this.isNextCurrent = false;
}
};
ParagraphPositionCalculator.prototype.handleRunElement = function(element, run, isCurrent, isNearFootnoteRef)
ParagraphPositionCalculator.prototype.handleRunElement = function(element, run, isCurrent, isNearFootnoteRef, inRunPos)
{
if (para_Drawing === element.Type && !element.IsInline())
{
@ -125,6 +139,17 @@
this.nextRun = null;
}
if (isCurrent)
this.prev.find = true;
if (!this.prev.find)
{
this.prev.element = element;
this.prev.run = run;
this.prev.inRunPos = inRunPos;
this.prev.usePos = false;
}
this.bidi.add([element, run, isCurrent, isNearFootnoteRef], element.getBidiType());
};
ParagraphPositionCalculator.prototype.handleBidiFlow = function(data)
@ -133,20 +158,45 @@
let run = data[1];
let isCurrent = data[2];
if (element === this.prev.element)
{
this.prev.x = this.x;
this.prev.y = this.y;
this.prev.usePos = true;
}
let w = element.GetWidthVisible();
if (isCurrent)
{
this.posInfo.x = this.x;
this.posInfo.y = this.y;
if (element.getBidiType() === AscWord.BidiType.rtl)
this.posInfo.x += w;
this.posInfo.run = run;
// for comb forms
if (element.LGap)
this.posInfo.x += element.LGap;
let lastElement = this.prev.element && this.prev.find && this.prev.usePos && this.prev.element.IsText() ? this.prev.element : null;
if (lastElement && AscWord.checkAsYouTypeEnterText(this.prev.run, this.prev.inRunPos + 1, lastElement.GetCodePoint()))
{
this.posInfo.x = this.prev.x;
this.posInfo.y = this.prev.y;
if (lastElement.getBidiType() !== AscWord.BidiType.rtl)
this.posInfo.x += lastElement.GetWidthVisible();
this.posInfo.run = this.prev.run;
// for comb forms
if (element.LGap)
this.posInfo.x += element.LGap;
}
else
{
this.posInfo.x = this.x;
this.posInfo.y = this.y;
if (element.getBidiType() === AscWord.BidiType.rtl)
this.posInfo.x += w;
this.posInfo.run = run;
// for comb forms
if (element.LGap)
this.posInfo.x += element.LGap;
}
}
this.x += w;

View File

@ -2156,7 +2156,7 @@ ParaRun.prototype.recalculateCursorPosition = function(positionCalculator, isCur
let item = this.private_CheckInstrText(this.Content[pos]);
let isCurPos = isCurrent && pos === this.State.ContentPos;
let isNearNoteRef = isCurPos ? this.IsCurPosNearFootEndnoteReference() : false;
positionCalculator.handleRunElement(item, this, isCurPos, isNearNoteRef);
positionCalculator.handleRunElement(item, this, isCurPos, isNearNoteRef, pos);
}
if (isCurrent && endPos === this.State.ContentPos)

View File

@ -1840,50 +1840,9 @@ CMathBase.prototype.SetCurrentMathContent = function(oMathContent)
}
}
};
CMathBase.prototype.Draw_HighLights = function(PDSH, bAll)
CMathBase.prototype.Draw_HighLights = function(drawState, bAll)
{
var ComplCtrPrp = this.Get_CompiledCtrPrp();
var oShd = ComplCtrPrp.Shd;
var bDrawShd = ( oShd === undefined || Asc.c_oAscShdNil === oShd.Value ? false : true );
var ShdColor = ( true === bDrawShd ? oShd.Get_Color( PDSH.Paragraph ) : null );
var X = PDSH.X,
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 = StartPos; CurPos <= EndPos; CurPos++)
this.Content[CurPos].Draw_HighLights(PDSH, bAllCont);
var Bound = this.Get_LineBound(PDSH.Line, PDSH.Range);
if (true === bDrawShd)
PDSH.Shd.Add(Y0, Y1, X, X + Bound.W, 0, ShdColor.r, ShdColor.g, ShdColor.b );
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;
drawState.handleMathBase(this);
};
CMathBase.prototype.Draw_Lines = function(PDSL)
{

View File

@ -4194,41 +4194,33 @@ CMathContent.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth)
if(undefined !== this.Content[nLastPos])
this.Content[nLastPos].Get_EndPos(BehindEnd, ContentPos, Depth + 1);
};
CMathContent.prototype.Draw_HighLights = function(PDSH, bAll)
CMathContent.prototype.Draw_HighLights = function(drawState)
{
if (!this.bRoot && this.Parent && true !== this.ParentElement.Is_ContentUse(this))
return;
var Bound = this.Get_LineBound(PDSH.Line, PDSH.Range);
PDSH.X = Bound.X;
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 Y0 = PDSH.Y0,
Y1 = PDSH.Y1;
var FirstRunInRootNotShd = this.bRoot && this.Content.length > 0 && this.Content[StartPos].IsShade() == false;
if(FirstRunInRootNotShd || this.bRoot == false)
{
Y0 = Bound.Y;
Y1 = Bound.Y + Bound.H;
}
for ( var CurPos = StartPos; CurPos <= EndPos; CurPos++ )
{
PDSH.Y0 = Y0;
PDSH.Y1 = Y1;
if(bAll && this.Content[CurPos].Type == para_Math_Run)
this.Content[CurPos].SelectAll();
this.Content[CurPos].Draw_HighLights(PDSH, bAll);
}
let rangeInfo = this.getRangePos(drawState.Line, drawState.Range);
let rangeStart = rangeInfo[0];
let rangeEnd = rangeInfo[1];
let Y0 = drawState.Y0;
let Y1 = drawState.Y1;
// TODO: Переделать тут. На самом деле если первый (в корне) непустой элемент идет с заливкой, то Word заливает всю формулу
let bounds = this.Get_LineBound(drawState.Line, drawState.Range);
if (!this.bRoot || !this.Content.length || !this.Content[rangeStart].IsShade())
{
Y0 = bounds.Y;
Y1 = bounds.Y + bounds.H;
}
drawState.X = bounds.X;
for (let pos = rangeStart; pos <= rangeEnd; ++pos)
{
drawState.Y0 = Y0;
drawState.Y1 = Y1;
this.Content[pos].Draw_HighLights(drawState);
}
};
CMathContent.prototype.Draw_Lines = function(PDSL)
{