diff --git a/word/Editor/Paragraph.js b/word/Editor/Paragraph.js index 4d4bee797f..0ebd779fb1 100644 --- a/word/Editor/Paragraph.js +++ b/word/Editor/Paragraph.js @@ -977,22 +977,7 @@ Paragraph.prototype.Internal_Content_Add = function(Pos, Item) if (ContentPos.Data[0] >= Pos) ContentPos.Data[0]++; } - - // Передвинем все метки слов для проверки орфографии - for (var nIndex = 0, nCount = this.SpellChecker.Elements.length; nIndex < nCount; ++nIndex) - { - var Element = this.SpellChecker.Elements[nIndex]; - var ContentPos = Element.StartPos; - - if (ContentPos.Data[0] >= Pos) - ContentPos.Data[0]++; - - ContentPos = Element.EndPos; - - if (ContentPos.Data[0] >= Pos) - ContentPos.Data[0]++; - } - + if (Item.SetParent) Item.SetParent(this); @@ -1106,20 +1091,6 @@ Paragraph.prototype.Internal_Content_Remove = function(Pos) if (true === this.DeleteCommentOnRemove && para_Comment === Item.Type && this.LogicDocument) this.LogicDocument.RemoveComment(Item.CommentId, true, false); - for (var nIndex = 0, nCount = this.SpellChecker.Elements.length; nIndex < nCount; ++nIndex) - { - var Element = this.SpellChecker.Elements[nIndex]; - var ContentPos = Element.StartPos; - - if (ContentPos.Data[0] > Pos) - ContentPos.Data[0]--; - - ContentPos = Element.EndPos; - - if (ContentPos.Data[0] > Pos) - ContentPos.Data[0]--; - } - this.OnContentChange(); }; /** @@ -14488,20 +14459,6 @@ Paragraph.prototype.private_CheckDropCapForSpellCheck = function() oElement.SetCorrect(); }; -Paragraph.prototype.AddSpellCheckerElement = function(oElement) -{ - let oRun = this.GetClassByPos(oElement.GetStartPos()); - if (!oRun || !oRun.IsRun()) - return; - - oRun.AddSpellCheckerElement(oElement, true); - - oRun = this.GetClassByPos(oElement.GetEndPos()); - if (!oRun || !oRun.IsRun()) - return; - - oRun.AddSpellCheckerElement(oElement, false); -}; Paragraph.prototype.ReplaceMisspelledWord = function(Word, oElement) { var Element = null; @@ -14531,16 +14488,13 @@ Paragraph.prototype.ReplaceMisspelledWord = function(Word, oElement) Word = Word.substr(1); // Сначала вставим новое слово - var Class = Element.StartRun; - if (para_Run !== Class.Type || Element.StartPos.Data.Depth <= 0) - return; - - var RunPos = Element.StartPos.Data[Element.StartPos.Depth - 1]; - Class.AddText(Word, RunPos); + var startRun = Element.GetStartRun(); + var inRunPos = Element.GetStartInRunPos(); + startRun.AddText(Word, inRunPos); // Удалим старое слово - var StartPos = Element.StartPos; - var EndPos = Element.EndPos; + var StartPos = Element.GetStartPos(); + var EndPos = Element.GetEndPos(); // Если комментарии попадают в текст, тогда сначала их надо отдельно удалить var CommentsToDelete = {}; diff --git a/word/Editor/Paragraph/RunContent/Tab.js b/word/Editor/Paragraph/RunContent/Tab.js index 133716f7ae..2f53a020a6 100644 --- a/word/Editor/Paragraph/RunContent/Tab.js +++ b/word/Editor/Paragraph/RunContent/Tab.js @@ -44,6 +44,17 @@ var tab_Symbol = 0x0022;//0x2192; (function(window) { + let tabWidth = null; + + function getTabActualWidth() + { + if (null !== tabWidth) + return tabWidth; + + g_oTextMeasurer.SetFont({FontFamily : {Name : "ASCW3", Index : -1}, FontSize : 10, Italic : false, Bold : false}); + tabWidth = g_oTextMeasurer.Measure(String.fromCharCode(tab_Symbol)).Width; + return tabWidth; + } // TODO: Реализовать табы по точке и с чертой (tab_Bar tab_Decimal) @@ -56,15 +67,10 @@ var tab_Symbol = 0x0022;//0x2192; function CRunTab() { AscWord.CRunElementBase.call(this); - - this.Width = 0; - this.WidthVisible = 0; - this.RealWidth = 0; - - this.DotWidth = 0; - this.UnderscoreWidth = 0; - this.HyphenWidth = 0; - this.Leader = Asc.c_oAscTabLeader.None; + + this.Width = 0; + this.LeaderCode = 0x00; + this.LeaderWidth = 0; } CRunTab.prototype = Object.create(AscWord.CRunElementBase.prototype); CRunTab.prototype.constructor = CRunTab; @@ -76,39 +82,14 @@ var tab_Symbol = 0x0022;//0x2192; }; CRunTab.prototype.Draw = function(X, Y, Context) { - if (this.WidthVisible > 0.01) + if (this.Width > 0.01 && 0 !== this.LeaderCode) { - var sChar = null, nCharWidth = 0; - switch (this.Leader) - { - case Asc.c_oAscTabLeader.Dot: - sChar = '.'; - nCharWidth = this.DotWidth; - break; - case Asc.c_oAscTabLeader.Heavy: - case Asc.c_oAscTabLeader.Underscore: - sChar = '_'; - nCharWidth = this.UnderscoreWidth; - break; - case Asc.c_oAscTabLeader.Hyphen: - sChar = '-'; - nCharWidth = this.HyphenWidth; - break; - case Asc.c_oAscTabLeader.MiddleDot: - sChar = '·'; - nCharWidth = this.MiddleDotWidth; - break; - } - - if (null !== sChar && nCharWidth > 0.001) - { - Context.SetFontSlot(AscWord.fontslot_ASCII, 1); - var nCharsCount = Math.floor(this.WidthVisible / nCharWidth); - - var _X = X + (this.WidthVisible - nCharsCount * nCharWidth) / 2; - for (var nIndex = 0; nIndex < nCharsCount; ++nIndex, _X += nCharWidth) - Context.FillText(_X, Y, sChar); - } + Context.SetFontSlot(AscWord.fontslot_ASCII, 1); + var nCharsCount = Math.floor(this.Width / this.LeaderWidth); + + var _X = X + (this.Width - nCharsCount * this.LeaderWidth) / 2; + for (var nIndex = 0; nIndex < nCharsCount; ++nIndex, _X += this.LeaderWidth) + Context.FillTextCode(_X, Y, this.LeaderCode); } if (editor && editor.ShowParaMarks) @@ -116,31 +97,49 @@ var tab_Symbol = 0x0022;//0x2192; Context.p_color(0, 0, 0, 255); Context.b_color1(0, 0, 0, 255); - var X0 = this.Width / 2 - this.RealWidth / 2; + let tabActualWidth = getTabActualWidth(); + var X0 = this.Width / 2 - tabActualWidth / 2; Context.SetFont({FontFamily : {Name : "ASCW3", Index : -1}, FontSize : 10, Italic : false, Bold : false}); if (X0 > 0) Context.FillText2(X + X0, Y, String.fromCharCode(tab_Symbol), 0, this.Width); else - Context.FillText2(X, Y, String.fromCharCode(tab_Symbol), this.RealWidth - this.Width, this.Width); + Context.FillText2(X, Y, String.fromCharCode(tab_Symbol), tabActualWidth - this.Width, this.Width); } }; CRunTab.prototype.Measure = function(Context) { - Context.SetFontSlot(AscWord.fontslot_ASCII, 1); - - this.DotWidth = Context.Measure(".").Width; - this.UnderscoreWidth = Context.Measure("_").Width; - this.HyphenWidth = Context.Measure("-").Width * 1.5; - this.MiddleDotWidth = Context.Measure("·").Width; - - Context.SetFont({FontFamily : {Name : "ASCW3", Index : -1}, FontSize : 10, Italic : false, Bold : false}); - this.RealWidth = Context.Measure(String.fromCharCode(tab_Symbol)).Width; }; - CRunTab.prototype.SetLeader = function(nLeaderType) + CRunTab.prototype.SetLeader = function(leaderType, textPr) { - this.Leader = nLeaderType; + g_oTextMeasurer.SetTextPr(textPr); + g_oTextMeasurer.SetFontSlot(AscWord.fontslot_ASCII, 1); + + switch (leaderType) + { + case Asc.c_oAscTabLeader.Dot: // "." + this.LeaderCode = 0x002E; + this.LeaderWidth = g_oTextMeasurer.MeasureCode(0x002E).Width; + break; + case Asc.c_oAscTabLeader.Heavy: // "_" + case Asc.c_oAscTabLeader.Underscore: + this.LeaderCode = 0x005F; + this.LeaderWidth = g_oTextMeasurer.MeasureCode(0x005F).Width; + break; + case Asc.c_oAscTabLeader.Hyphen: // "-" + this.LeaderCode = 0x002D; + this.LeaderWidth = g_oTextMeasurer.MeasureCode(0x002D).Width * 1.5; + break; + case Asc.c_oAscTabLeader.MiddleDot: // "·" + this.LeaderCode = 0x00B7; + this.LeaderWidth = g_oTextMeasurer.MeasureCode(0x00B7).Width; + break; + default: + this.LeaderCode = 0x00; + this.LeaderWidth = 0; + break; + } }; CRunTab.prototype.GetWidth = function() { @@ -148,11 +147,10 @@ var tab_Symbol = 0x0022;//0x2192; }; CRunTab.prototype.GetWidthVisible = function() { - return this.WidthVisible; + return this.Width; }; CRunTab.prototype.SetWidthVisible = function(WidthVisible) { - this.WidthVisible = WidthVisible; }; CRunTab.prototype.Copy = function() { @@ -166,13 +164,15 @@ var tab_Symbol = 0x0022;//0x2192; { return { Width : this.Width, - WidthVisible : this.WidthVisible + LeaderCode : this.LeaderCode, + LeaderWidth : this.LeaderWidth }; }; CRunTab.prototype.LoadRecalculateObject = function(RecalcObj) { this.Width = RecalcObj.Width; - this.WidthVisible = RecalcObj.WidthVisible; + this.LeaderCode = RecalcObj.LeaderCode; + this.LeaderWidth = RecalcObj.LeaderWidth; }; CRunTab.prototype.PrepareRecalculateObject = function() { diff --git a/word/Editor/Run.js b/word/Editor/Run.js index b9a89d1bc6..9edf92ef81 100644 --- a/word/Editor/Run.js +++ b/word/Editor/Run.js @@ -88,16 +88,6 @@ function ParaRun(Paragraph, bMathRun) this.CompiledPr = AscWord.g_textPrCache.add(new AscWord.CTextPr()); // Скомпилированные настройки this.RecalcInfo = new CParaRunRecalcInfo(); // Флаги для пересчета (там же флаг пересчета стиля) - - this.TextAscent = 0; // текстовый ascent + linegap - this.TextAscent = 0; // текстовый ascent + linegap - this.TextDescent = 0; // текстовый descent - this.TextHeight = 0; // высота текста - this.TextAscent2 = 0; // текстовый ascent - this.Ascent = 0; // общий ascent - this.Descent = 0; // общий descent - this.YOffset = 0; // смещение по Y - this.CollPrChangeMine = false; this.CollPrChangeOther = false; this.CollaborativeMarks = new CRunCollaborativeMarks(); @@ -1838,16 +1828,10 @@ ParaRun.prototype.Add_ToContent = function(Pos, Item, UpdatePosition) } // Обновляем позиции для орфографии - var SpellingMarksCount = this.SpellingMarks.length; - for ( var Index = 0; Index < SpellingMarksCount; Index++ ) - { - var Mark = this.SpellingMarks[Index]; - var ContentPos = ( true === Mark.Start ? Mark.Element.StartPos : Mark.Element.EndPos ); - var Depth = Mark.Depth; - - if ( ContentPos.Data[Depth] >= Pos ) - ContentPos.Data[Depth]++; - } + for (let iMark = 0, nMarks = this.SpellingMarks.length; iMark < nMarks; ++iMark) + { + this.SpellingMarks[iMark].onAdd(Pos); + } this.private_UpdateDocumentOutline(); this.private_UpdateTrackRevisionOnChangeContent(true); @@ -1913,20 +1897,12 @@ ParaRun.prototype.Remove_FromContent = function(Pos, Count, UpdatePosition) else if ( ContentPos.Data[Depth] > Pos ) ContentPos.Data[Depth] = Math.max( 0 , Pos ); } - - // Обновляем позиции для орфографии - var SpellingMarksCount = this.SpellingMarks.length; - for ( var Index = 0; Index < SpellingMarksCount; Index++ ) - { - var Mark = this.SpellingMarks[Index]; - var ContentPos = ( true === Mark.Start ? Mark.Element.StartPos : Mark.Element.EndPos ); - var Depth = Mark.Depth; - - if ( ContentPos.Data[Depth] > Pos + Count ) - ContentPos.Data[Depth] -= Count; - else if ( ContentPos.Data[Depth] > Pos ) - ContentPos.Data[Depth] = Math.max( 0 , Pos ); - } + + // Обновляем позиции для орфографии + for (let iMark = 0, nMarks = this.SpellingMarks.length; iMark < nMarks; ++iMark) + { + this.SpellingMarks[iMark].onRemove(Pos, Count); + } this.private_UpdateDocumentOutline(); this.private_UpdateTrackRevisionOnChangeContent(true); @@ -2827,29 +2803,16 @@ ParaRun.prototype.Split2 = function(CurPos, Parent, ParentPos) } // Если были точки орфографии, тогда переместим их в новый ран - var SpellingMarksCount = this.SpellingMarks.length; - for ( var Index = 0; Index < SpellingMarksCount; Index++ ) + for (let iMark = 0, nMarks = this.SpellingMarks.length; iMark < nMarks; ++iMark) { - var Mark = this.SpellingMarks[Index]; - var MarkPos = ( true === Mark.Start ? Mark.Element.StartPos.Get(Mark.Depth) : Mark.Element.EndPos.Get(Mark.Depth) ); - - if ( MarkPos >= CurPos ) + let mark = this.SpellingMarks[iMark]; + if (mark.getPos() >= CurPos) { - var MarkElement = Mark.Element; - if ( true === Mark.Start ) - { - MarkElement.StartPos.Data[Mark.Depth] -= CurPos; - } - else - { - MarkElement.EndPos.Data[Mark.Depth] -= CurPos; - } - - NewRun.SpellingMarks.push( Mark ); - - this.SpellingMarks.splice( Index, 1 ); - SpellingMarksCount--; - Index--; + mark.movePos(-CurPos); + NewRun.SpellingMarks.push(mark); + this.SpellingMarks.splice(iMark, 1); + --nMarks; + --iMark; } } @@ -3440,32 +3403,11 @@ ParaRun.prototype.Recalculate_MeasureContent = function() _oTextPr = oTextPr.Copy(); _oTextPr.RFonts.SetAll("ASCW3"); } - - let isMathRun = this.IsMathRun(); - - // TODO: Пока для формул сделаем, чтобы работало по-старому, в дальнейшем надо будет переделать на fontslot - let nFontsFlags = isMathRun ? AscWord.fontslot_ASCII : AscWord.fontslot_None; - for (let nPos = 0, nCount = this.Content.length; nPos < nCount; ++nPos) - { - nFontsFlags |= this.Content[nPos].GetFontSlot(_oTextPr); - } - - if (AscWord.fontslot_Unknown === nFontsFlags) - nFontsFlags = oTextPr.CS || oTextPr.RTL ? AscWord.fontslot_CS : AscWord.fontslot_ASCII; - - let oMetrics = _oTextPr.GetTextMetrics(nFontsFlags, oTheme); - - // Под TextAscent мы будем понимать ascent + linegap (которые записаны в шрифте) - this.TextHeight = oMetrics.Height; - this.TextDescent = oMetrics.Descent; - this.TextAscent = oMetrics.Ascent + oMetrics.LineGap; - this.TextAscent2 = oMetrics.Ascent; - this.YOffset = oTextPr.Position; - + g_oTextMeasurer.SetTextPr(_oTextPr, oTheme); - + var oInfoMathText; - if (isMathRun) + if (this.IsMathRun()) { oInfoMathText = new CMathInfoTextPr({ TextPr : oTextPr, @@ -3481,6 +3423,9 @@ ParaRun.prototype.Recalculate_MeasureContent = function() let isKeepWidth = false; if (oTextForm && oTextForm.IsComb()) { + let textMetrics = this.getTextMetrics(); + let textAscent = textMetrics.Ascent + textMetrics.LineGap; + const nWRule = oTextForm.GetWidthRule(); isKeepWidth = Asc.CombFormWidthRule.Exact === nWRule; @@ -3489,12 +3434,12 @@ ParaRun.prototype.Recalculate_MeasureContent = function() if (undefined === oTextForm.Width || nWRule === Asc.CombFormWidthRule.Auto) nCombWidth = 0; else if (oTextForm.Width < 0) - nCombWidth = this.TextAscent * (Math.abs(oTextForm.Width) / 100); + nCombWidth = textAscent * (Math.abs(oTextForm.Width) / 100); else nCombWidth = AscCommon.TwipsToMM(oTextForm.Width); if (!nCombWidth || nCombWidth < 0) - nCombWidth = this.TextAscent; + nCombWidth = textAscent; let oParagraph = this.GetParagraph(); if (oParagraph @@ -3540,6 +3485,31 @@ ParaRun.prototype.Recalculate_MeasureContent = function() this.RecalcInfo.Recalc = true; this.RecalcInfo.ResetMeasure(); }; +ParaRun.prototype.getTextMetrics = function() +{ + let textPr = this.Get_CompiledPr(false); + if (this.IsUseAscFont(textPr)) + { + textPr = textPr.Copy(); + textPr.RFonts.SetAll("ASCW3"); + } + + // TODO: Пока для формул сделаем, чтобы работало по-старому, в дальнейшем надо будет переделать на fontslot + let fontSlot = this.IsMathRun() ? AscWord.fontslot_ASCII : AscWord.fontslot_None; + for (let nPos = 0, nCount = this.Content.length; nPos < nCount; ++nPos) + { + fontSlot |= this.Content[nPos].GetFontSlot(textPr); + } + + if (AscWord.fontslot_Unknown === fontSlot) + fontSlot = textPr.CS || textPr.RTL ? AscWord.fontslot_CS : AscWord.fontslot_ASCII; + + return textPr.GetTextMetrics(fontSlot, this.Paragraph.GetTheme()); +}; +ParaRun.prototype.getYOffset = function() +{ + return this.Get_Position(); +}; ParaRun.prototype.private_MeasureCombForm = function(nCombBorderW, nCombWidth, nMaxComb, oTextForm, isKeepWidth, oTextPr, oTheme, oInfoMathText) { let nCharsCount = 0; @@ -4359,7 +4329,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) if (true === StartWord) FirstItemOnLine = false; - Item.YOffset = this.YOffset; + Item.YOffset = this.getYOffset(); // Если до этого было слово, тогда не надо проверять убирается ли оно, но если стояли пробелы, // тогда мы их учитываем при проверке убирается ли данный элемент, и добавляем только если @@ -4533,7 +4503,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) var NewX = TabPos.NewX; var TabValue = TabPos.TabValue; - Item.SetLeader(TabPos.TabLeader); + Item.SetLeader(TabPos.TabLeader, this.Get_CompiledPr(false)); PRS.LastTab.TabPos = NewX; PRS.LastTab.Value = TabValue; @@ -4548,8 +4518,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) // рассчитываем его сразу здесь if (tab_Left !== TabValue) { - Item.Width = 0; - Item.WidthVisible = 0; + Item.Width = 0; // В Word2013 и раньше, если не левый таб заканчивается правее правой границы, тогда у параграфа // правая граница имеет максимально возможное значение (55см) @@ -4593,9 +4562,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) } else { - Item.Width = NewX - X; - Item.WidthVisible = NewX - X; - + Item.Width = NewX - X; + X = NewX; } } @@ -4970,10 +4938,20 @@ ParaRun.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur var UpdateLineMetricsText = false; var LineRule = ParaPr.Spacing.LineRule; - + + let textPr = this.Get_CompiledPr(false); + if (this.IsUseAscFont(textPr)) + { + textPr = textPr.Copy(); + textPr.RFonts.SetAll("ASCW3"); + } + // TODO: Пока для формул сделаем, чтобы работало по-старому, в дальнейшем надо будет переделать на fontslot + let fontSlot = this.IsMathRun() ? AscWord.fontslot_ASCII : AscWord.fontslot_None; + for (var CurPos = StartPos; CurPos < EndPos; CurPos++) { var Item = this.private_CheckInstrText(this.Content[CurPos]); + fontSlot |= Item.GetFontSlot(textPr); if (Item === Para.Numbering.Item) { @@ -5021,11 +4999,12 @@ ParaRun.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur } else { - if (PRS.LineAscent < Item.Height + this.YOffset) - PRS.LineAscent = Item.Height + this.YOffset; + let yOffset = this.getYOffset(); + if (PRS.LineAscent < Item.Height + yOffset) + PRS.LineAscent = Item.Height + yOffset; - if (PRS.LineDescent < -this.YOffset) - PRS.LineDescent = -this.YOffset; + if (PRS.LineDescent < -yOffset) + PRS.LineDescent = -yOffset; } } @@ -5046,41 +5025,51 @@ ParaRun.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur } } - if (false === UpdateLineMetricsText) + if (!UpdateLineMetricsText) { var oTextForm = this.GetTextForm(); if (oTextForm && oTextForm.IsComb()) UpdateLineMetricsText = true; } - if (true === UpdateLineMetricsText) + if (UpdateLineMetricsText) { + if (AscWord.fontslot_Unknown === fontSlot) + fontSlot = textPr.CS || textPr.RTL ? AscWord.fontslot_CS : AscWord.fontslot_ASCII; + + let metrics = textPr.GetTextMetrics(fontSlot, this.Paragraph.GetTheme()); + + let textDescent = metrics.Descent; + let textAscent = metrics.Ascent + metrics.LineGap; + let textAscent2 = metrics.Ascent; + // Пересчитаем метрику строки относительно размера данного текста - if (PRS.LineTextAscent < this.TextAscent) - PRS.LineTextAscent = this.TextAscent; + if (PRS.LineTextAscent < textAscent) + PRS.LineTextAscent = textAscent; - if (PRS.LineTextAscent2 < this.TextAscent2) - PRS.LineTextAscent2 = this.TextAscent2; + if (PRS.LineTextAscent2 < textAscent2) + PRS.LineTextAscent2 = textAscent2; - if (PRS.LineTextDescent < this.TextDescent) - PRS.LineTextDescent = this.TextDescent; + if (PRS.LineTextDescent < textDescent) + PRS.LineTextDescent = textDescent; if (Asc.linerule_Exact === LineRule) { // Смещение не учитывается в метриках строки, когда расстояние между строк точное - if (PRS.LineAscent < this.TextAscent) - PRS.LineAscent = this.TextAscent; + if (PRS.LineAscent < textAscent) + PRS.LineAscent = textAscent; - if (PRS.LineDescent < this.TextDescent) - PRS.LineDescent = this.TextDescent; + if (PRS.LineDescent < textDescent) + PRS.LineDescent = textDescent; } else { - if (PRS.LineAscent < this.TextAscent + this.YOffset) - PRS.LineAscent = this.TextAscent + this.YOffset; + let yOffset = this.getYOffset(); + if (PRS.LineAscent < textAscent + yOffset) + PRS.LineAscent = textAscent + yOffset; - if (PRS.LineDescent < this.TextDescent - this.YOffset) - PRS.LineDescent = this.TextDescent - this.YOffset; + if (PRS.LineDescent < textDescent - yOffset) + PRS.LineDescent = textDescent - yOffset; } } }; @@ -5654,7 +5643,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, } case para_Tab: { - PRSA.X += Item.WidthVisible; + PRSA.X += Item.GetWidthVisible(); break; } @@ -6229,9 +6218,11 @@ ParaRun.prototype.RecalculateMinMaxContentWidth = function(MinMax) } } } - - if (true === bCheckTextHeight && nMaxHeight < this.TextAscent + this.TextDescent) - nMaxHeight = this.TextAscent + this.TextDescent; + + let textMetrics = this.getTextMetrics(); + let textHeight = textMetrics.Ascent + textMetrics.LineGap + textMetrics.Descent; + if (true === bCheckTextHeight && nMaxHeight < textHeight) + nMaxHeight = textHeight; MinMax.bWord = bWord; MinMax.nWordLen = nWordLen; @@ -6570,6 +6561,8 @@ ParaRun.prototype.Draw_Elements = function(PDSE) var X = PDSE.X; var Y = PDSE.Y; + + let yOffset = this.getYOffset(); var CurTextPr = this.Get_CompiledPr( false ); @@ -6725,7 +6718,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) { if (para_Drawing != ItemType || Item.Is_Inline()) { - Item.Draw(X, Y - this.YOffset, pGraphics, PDSE, CurTextPr); + Item.Draw(X, Y - yOffset, pGraphics, PDSE, CurTextPr); X += Item.GetWidthVisible(); } @@ -6762,7 +6755,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) } case para_Space: { - Item.Draw( X, Y - this.YOffset, pGraphics, PDSE, CurTextPr ); + Item.Draw( X, Y - yOffset, pGraphics, PDSE, CurTextPr ); X += Item.GetWidthVisible(); @@ -6835,7 +6828,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) } } - Item.Draw(X, Y - this.YOffset, pGraphics); + Item.Draw(X, Y - yOffset, pGraphics); } X += Item.GetWidth(); @@ -6844,7 +6837,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) } case para_NewLine: { - Item.Draw( X, Y - this.YOffset, pGraphics ); + Item.Draw( X, Y - yOffset, pGraphics ); X += Item.WidthVisible; break; } @@ -6898,7 +6891,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) } } - Item.Draw(X, Y - this.YOffset, pGraphics, PDSE); + Item.Draw(X, Y - yOffset, pGraphics, PDSE); X += Item.GetWidthVisible(); } @@ -6957,8 +6950,9 @@ ParaRun.prototype.Draw_Lines = function(PDSL) isFormPlaceHolder = true; } + let yOffset = this.getYOffset(); var CurTextPr = this.Get_CompiledPr( false ); - var StrikeoutY = Y - this.YOffset; + var StrikeoutY = Y - yOffset; var fontCoeff = 1; // учтем ArgSize if(this.Type == para_Math_Run) @@ -6967,7 +6961,7 @@ ParaRun.prototype.Draw_Lines = function(PDSL) fontCoeff = MatGetKoeffArgSize(CurTextPr.FontSize, ArgSize.value); } - var UnderlineY = Y + UndOff - this.YOffset; + var UnderlineY = Y + UndOff - yOffset; var LineW = (CurTextPr.FontSize / 18) * g_dKoef_pt_to_mm; switch(CurTextPr.VertAlign) @@ -7049,31 +7043,24 @@ ParaRun.prototype.Draw_Lines = function(PDSL) PDSL.CurPos.Update(StartPos, PDSL.CurDepth); var nSpellingErrorsCounter = PDSL.GetSpellingErrorsCounter(); - - var SpellingMarksCount = this.SpellingMarks.length; - var SpellDataLen = EndPos + 1; - var SpellData = g_oSpellCheckerMarks.Check(SpellDataLen); - var Mark = null, MarkIndex = 0; - for ( var SPos = 0; SPos < SpellingMarksCount; SPos++) - { - Mark = this.SpellingMarks[SPos]; - - if ( false === Mark.Element.Checked ) - { - if ( true === Mark.Start ) - { - MarkIndex = Mark.Element.StartPos.Get(Mark.Depth); - if (MarkIndex < SpellDataLen) - SpellData[MarkIndex] += 1; - } - else - { - MarkIndex = Mark.Element.EndPos.Get(Mark.Depth); - if (MarkIndex < SpellDataLen) - SpellData[MarkIndex] -= 1; - } - } - } + + var SpellDataLen = EndPos + 1; + var SpellData = g_oSpellCheckerMarks.Check(SpellDataLen); + for (var iMark = 0, nMarks = this.SpellingMarks.length; iMark < nMarks; ++iMark) + { + let mark = this.SpellingMarks[iMark]; + if (!mark.isMisspelled()) + continue; + + let markPos = mark.getPos(); + if (markPos >= SpellDataLen) + continue; + + if (mark.isStart()) + SpellData[markPos] += 1; + else + SpellData[markPos] -= 1; + } let oLine = Para.Lines[PDSL.Line]; let oRange = oLine ? oLine.Ranges[PDSL.Range] : undefined; @@ -9250,35 +9237,20 @@ ParaRun.prototype.Split_Run = function(Pos) { NewRun.State.Selection.EndPos = 0; } - - // Если были точки орфографии, тогда переместим их в новый ран - var SpellingMarksCount = this.SpellingMarks.length; - for ( var Index = 0; Index < SpellingMarksCount; Index++ ) - { - var Mark = this.SpellingMarks[Index]; - var MarkPos = ( true === Mark.Start ? Mark.Element.StartPos.Get(Mark.Depth) : Mark.Element.EndPos.Get(Mark.Depth) ); - - if ( MarkPos >= Pos ) - { - var MarkElement = Mark.Element; - if ( true === Mark.Start ) - { - //MarkElement.ClassesS[Mark.Depth] = NewRun; - MarkElement.StartPos.Data[Mark.Depth] -= Pos; - } - else - { - //MarkElement.ClassesE[Mark.Depth] = NewRun; - MarkElement.EndPos.Data[Mark.Depth] -= Pos; - } - - NewRun.SpellingMarks.push( Mark ); - - this.SpellingMarks.splice( Index, 1 ); - SpellingMarksCount--; - Index--; - } - } + + // Если были точки орфографии, тогда переместим их в новый ран + for (let iMark = 0, nMarks = this.SpellingMarks.length; iMark < nMarks; ++iMark) + { + let mark = this.SpellingMarks[iMark]; + if (mark.getPos() >= Pos) + { + mark.movePos(-Pos); + NewRun.SpellingMarks.push(mark); + this.SpellingMarks.splice(iMark, 1); + --nMarks; + --iMark; + } + } History.Add(new CChangesRunOnEndSplit(this, NewRun)); AscCommon.CollaborativeEditing.OnEnd_SplitRun(NewRun); @@ -9960,8 +9932,6 @@ ParaRun.prototype.Set_Position = function(Value) History.Add(new CChangesRunPosition(this, OldValue, Value, this.private_IsCollPrChangeMine())); this.Recalc_CompiledPr(false); this.private_UpdateTrackRevisionOnChangeTextPr(true); - - this.YOffset = this.Get_Position(); } }; @@ -10587,7 +10557,6 @@ function CParaRunRecalcInfo() this.TextPr = true; // Нужно ли пересчитать скомпилированные настройки this.Measure = true; // Нужно ли перемерять элементы this.Recalc = true; // Нужно ли пересчитывать (только если текстовый ран) - this.RunLen = 0; this.MeasurePositions = []; // Массив позиций элементов, которые нужно пересчитать @@ -10602,7 +10571,6 @@ CParaRunRecalcInfo.prototype.Reset = function() this.TextPr = true; this.Measure = true; this.Recalc = true; - this.RunLen = 0; this.MeasurePositions = []; }; @@ -12210,33 +12178,39 @@ ParaRun.prototype.Displace_BreakOperator = function(isForward, bBrkBefore, Count ParaRun.prototype.Math_UpdateLineMetrics = function(PRS, ParaPr) { var LineRule = ParaPr.Spacing.LineRule; + + let textMetrics = this.getTextMetrics(); + let ascent = textMetics.Ascent + textMetrics.LineGap; + let ascent2 = textMetics.Ascent; + let descent = textMetics.Descent; // Пересчитаем метрику строки относительно размера данного текста - if ( PRS.LineTextAscent < this.TextAscent ) - PRS.LineTextAscent = this.TextAscent; + if ( PRS.LineTextAscent < ascent ) + PRS.LineTextAscent = ascent; - if ( PRS.LineTextAscent2 < this.TextAscent2 ) - PRS.LineTextAscent2 = this.TextAscent2; + if ( PRS.LineTextAscent2 < ascent2 ) + PRS.LineTextAscent2 = ascent2; - if ( PRS.LineTextDescent < this.TextDescent ) - PRS.LineTextDescent = this.TextDescent; + if ( PRS.LineTextDescent < descent ) + PRS.LineTextDescent = descent; if ( Asc.linerule_Exact === LineRule ) { // Смещение не учитывается в метриках строки, когда расстояние между строк точное - if ( PRS.LineAscent < this.TextAscent ) - PRS.LineAscent = this.TextAscent; + if ( PRS.LineAscent < ascent ) + PRS.LineAscent = ascent; - if ( PRS.LineDescent < this.TextDescent ) - PRS.LineDescent = this.TextDescent; + if ( PRS.LineDescent < descent ) + PRS.LineDescent = descent; } else { - if ( PRS.LineAscent < this.TextAscent + this.YOffset ) - PRS.LineAscent = this.TextAscent + this.YOffset; + let yOffset = this.getYOffset(); + if ( PRS.LineAscent < ascent + yOffset) + PRS.LineAscent = ascent + yOffset; - if ( PRS.LineDescent < this.TextDescent - this.YOffset ) - PRS.LineDescent = this.TextDescent - this.YOffset; + if ( PRS.LineDescent < descent - yOffset) + PRS.LineDescent = descent - yOffset; } }; @@ -12912,7 +12886,8 @@ ParaRun.prototype.IsInCheckBox = function() ParaRun.prototype.GetTextFormAutoWidth = function() { this.Recalculate_MeasureContent(); - return this.TextAscent; + let metrics = this.getTextMetrics(); + return metrics.Ascent + metrics.LineGap; }; ParaRun.prototype.CheckParentFormKey = function() { @@ -13290,29 +13265,22 @@ ParaRun.prototype.CheckSpelling = function(oCollector, nDepth) for (let nPos = nStartPos, nContentLen = this.Content.length; nPos < nContentLen; ++nPos) { oCollector.UpdatePos(nPos, nDepth); - oCollector.HandleRunElement(this.Content[nPos], oCurTextPr); + oCollector.HandleRunElement(this.Content[nPos], oCurTextPr, this, nPos); if (oCollector.IsExceedLimit()) break; } }; -ParaRun.prototype.AddSpellCheckerElement = function(oElement, isStart) +ParaRun.prototype.AddSpellCheckerElement = function(spellMark) { - if (isStart) - oElement.StartRun = this; - else - oElement.EndRun = this; - - // TODO: Зачем тут Depth? - this.SpellingMarks.push(new AscCommonWord.CParagraphSpellingMark(oElement, isStart, isStart ? oElement.GetStartPos().GetDepth() : oElement.GetEndPos().GetDepth())); + this.SpellingMarks.push(spellMark); }; -ParaRun.prototype.RemoveSpellCheckerElement = function(oElement) +ParaRun.prototype.RemoveSpellCheckerElement = function(element) { - for (let nCount = this.SpellingMarks.length, nIndex = nCount - 1; nIndex >= 0; --nIndex) + for (let iMark = this.SpellingMarks.length - 1; iMark >= 0; --iMark) { - let oMark = this.SpellingMarks[nIndex]; - if (oElement === oMark.Element) - this.SpellingMarks.splice(nIndex, 1); + if (this.SpellingMarks[iMark].getElement() === element) + this.SpellingMarks.splice(iMark, 1); } }; ParaRun.prototype.ClearSpellingMarks = function() diff --git a/word/Editor/SpellChecker/ParagraphCollector.js b/word/Editor/SpellChecker/ParagraphCollector.js index 56b38ae4a4..5a09045988 100644 --- a/word/Editor/SpellChecker/ParagraphCollector.js +++ b/word/Editor/SpellChecker/ParagraphCollector.js @@ -32,7 +32,7 @@ "use strict"; -(function(window, undefined) +(function(window) { const NON_LETTER_SYMBOLS = []; NON_LETTER_SYMBOLS[0x00A0] = 1; @@ -55,8 +55,12 @@ this.CurLcid = -1; this.bWord = false; this.sWord = ""; - this.StartPos = null; // AscWord.CParagraphContentPos - this.EndPos = null; // AscWord.CParagraphContentPos + + this.startRun = null; + this.startInRunPos = 0; + this.endRun = null; + this.endInRunPos = 0; + this.Prefix = null; // Защита от проверки орфографии в большом параграфе @@ -144,7 +148,7 @@ { if (this.bWord) { - this.SpellChecker.Add(this.StartPos, this.EndPos, this.sWord, this.CurLcid, this.GetPrefix(), 0); + this.SpellChecker.Add(this.startRun, this.startInRunPos, this.endRun, this.endInRunPos, this.sWord, this.CurLcid, this.GetPrefix(), 0); this.bWord = false; this.sWord = ""; @@ -153,30 +157,29 @@ /** * @param {AscWord.CRunElementBase} oElement * @param {CTextPr} oTextPr + * @param {AscWord.Run} run + * @param {number} inRunPos */ - CParagraphSpellCheckerCollector.prototype.HandleRunElement = function(oElement, oTextPr) + CParagraphSpellCheckerCollector.prototype.HandleRunElement = function(oElement, oTextPr, run, inRunPos) { if (this.IsWordLetter(oElement)) { if (!this.bWord) { - this.StartPos = this.ContentPos.Copy(); - this.EndPos = this.ContentPos.Copy(); - - let nDepth = this.ContentPos.GetDepth(); - this.EndPos.Update(this.ContentPos.Get(nDepth) + 1, nDepth); - + this.startRun = run; + this.startInRunPos = inRunPos; + this.endRun = run; + this.endInRunPos = inRunPos + 1; + this.bWord = true; this.sWord = oElement.GetCharForSpellCheck(oTextPr.Caps); } else { this.sWord += oElement.GetCharForSpellCheck(oTextPr.Caps); - - this.EndPos = this.ContentPos.Copy(); - - let nDepth = this.ContentPos.GetDepth(); - this.EndPos.Update(this.ContentPos.Get(nDepth) + 1, nDepth); + + this.endRun = run; + this.endInRunPos = inRunPos + 1; } } else @@ -184,7 +187,7 @@ if (this.bWord) { this.bWord = false; - this.SpellChecker.Add(this.StartPos, this.EndPos, this.sWord, this.CurLcid, this.GetPrefix(), oElement.IsDot() ? oElement.GetCharCode() : 0); + this.SpellChecker.Add(this.startRun, this.startInRunPos, this.endRun, this.endInRunPos, this.sWord, this.CurLcid, this.GetPrefix(), oElement.IsDot() ? oElement.GetCharCode() : 0); this.CheckPrefix(null); } else @@ -220,19 +223,92 @@ }; /** - * Метка начала/конца элемента для проверки + * Метка начала элемента для проверки * @constructor */ - function CParagraphSpellingMark(SpellCheckerElement, Start, Depth) + function SpellMarkStart(spellCheckElement) { - this.Element = SpellCheckerElement; - this.Start = Start; - this.Depth = Depth; + this.Element = spellCheckElement; } - + SpellMarkStart.prototype.getElement = function() + { + return this.Element; + }; + SpellMarkStart.prototype.isStart = function() + { + return true; + }; + SpellMarkStart.prototype.onAdd = function(pos) + { + if (this.Element.startInRunPos >= pos) + ++this.Element.startInRunPos; + }; + SpellMarkStart.prototype.onRemove = function(pos, count) + { + if (this.Element.startInRunPos > pos + count) + this.Element.startInRunPos -= count; + else if (this.Element.startInRunPos > pos) + this.Element.startInRunPos = Math.max(0, pos); + }; + SpellMarkStart.prototype.movePos = function(shift) + { + this.Element.startInRunPos += shift; + }; + SpellMarkStart.prototype.getPos = function() + { + return this.Element.startInRunPos; + }; + SpellMarkStart.prototype.isMisspelled = function() + { + return false === this.Element.Checked; + }; + /** + * Метка конца элемента для проверки + * @constructor + */ + function SpellMarkEnd(spellCheckElement) + { + this.Element = spellCheckElement; + } + SpellMarkEnd.prototype.getElement = function() + { + return this.Element; + }; + SpellMarkEnd.prototype.isStart = function() + { + return false; + }; + SpellMarkEnd.prototype.onAdd = function(pos) + { + if (this.Element.endInRunPos >= pos) + ++this.Element.endInRunPos; + }; + SpellMarkEnd.prototype.onRemove = function(pos, count) + { + if (this.Element.endInRunPos > pos + count) + this.Element.endInRunPos -= count; + else if (this.Element.endInRunPos > pos) + this.Element.endInRunPos = Math.max(0, pos); + }; + SpellMarkEnd.prototype.movePos = function(shift) + { + this.Element.endInRunPos += shift; + }; + SpellMarkEnd.prototype.getPos = function() + { + return this.Element.endInRunPos; + }; + SpellMarkEnd.prototype.isMisspelled = function() + { + return false === this.Element.Checked; + }; + //--------------------------------------------------------export---------------------------------------------------- window['AscCommonWord'] = window['AscCommonWord'] || {}; window['AscCommonWord'].CParagraphSpellCheckerCollector = CParagraphSpellCheckerCollector; - window['AscCommonWord'].CParagraphSpellingMark = CParagraphSpellingMark; + + window['AscWord'] = window['AscWord'] || {}; + window['AscWord'].SpellMarkStart = SpellMarkStart; + window['AscWord'].SpellMarkEnd = SpellMarkEnd; })(window); diff --git a/word/Editor/SpellChecker/ParagraphSpellChecker.js b/word/Editor/SpellChecker/ParagraphSpellChecker.js index 9ba6913e6e..8b23ceb57d 100644 --- a/word/Editor/SpellChecker/ParagraphSpellChecker.js +++ b/word/Editor/SpellChecker/ParagraphSpellChecker.js @@ -100,6 +100,10 @@ "usrLang" : arrLangs }); } + else + { + this.private_ClearMarksForCorrectWords(); + } return (arrWords.length || isFirst); }; @@ -153,7 +157,7 @@ } } }; - CParagraphSpellChecker.prototype.Add = function(StartPos, EndPos, Word, Lang, Prefix, Ending) + CParagraphSpellChecker.prototype.Add = function(startRun, startInRunPos, endRun, endInRunPos, Word, Lang, Prefix, Ending) { if (Word.length > 0) { @@ -163,8 +167,12 @@ Word = Word.substr(1); } - let oElement = new AscCommonWord.CParagraphSpellCheckerElement(StartPos, EndPos, Word, Lang, Prefix, Ending); - this.Paragraph.AddSpellCheckerElement(oElement); + if (!this.HaveDictionary(Lang) || !this.IsNeedCheckWord(Word)) + return; + + let oElement = new AscCommonWord.CParagraphSpellCheckerElement(startRun, startInRunPos, endRun, endInRunPos, Word, Lang, Prefix, Ending); + startRun.AddSpellCheckerElement(new AscWord.SpellMarkStart(oElement)); + endRun.AddSpellCheckerElement(new AscWord.SpellMarkEnd(oElement)); this.Elements.push(oElement); }; CParagraphSpellChecker.prototype.SpellCheckResponse = function(nRecalcId, usrCorrect) @@ -493,9 +501,9 @@ } } - this.private_ClearMarksForRightWords(); + this.private_ClearMarksForCorrectWords(); }; - CParagraphSpellChecker.prototype.private_ClearMarksForRightWords = function() + CParagraphSpellChecker.prototype.private_ClearMarksForCorrectWords = function() { for (let nCount = this.Elements.length, nIndex = nCount - 1; nIndex >= 0; --nIndex) { diff --git a/word/Editor/SpellChecker/ParagraphSpellCheckerElement.js b/word/Editor/SpellChecker/ParagraphSpellCheckerElement.js index 82ad260f0c..b49e1742e5 100644 --- a/word/Editor/SpellChecker/ParagraphSpellCheckerElement.js +++ b/word/Editor/SpellChecker/ParagraphSpellCheckerElement.js @@ -32,25 +32,25 @@ "use strict"; -(function(window, undefined) +(function(window) { /** * Отдельный элемент проверки орфографии внутри параграфа * @constructor */ - function CParagraphSpellCheckerElement(StartPos, EndPos, Word, Lang, Prefix, Ending) + function CParagraphSpellCheckerElement(startRun, startInRunPos, endRun, endInRunPos, Word, Lang, Prefix, Ending) { - this.StartPos = StartPos; - this.EndPos = EndPos; + this.startRun = startRun; + this.startInRunPos = startInRunPos; + this.endRun = endRun; + this.endInRunPos = endInRunPos; + this.Word = Word; this.Lang = Lang; this.Checked = null; // null - неизвестно, true - правильное слово, false - неправильное слово this.CurPos = false; this.Variants = null; - this.StartRun = null; - this.EndRun = null; - // В некоторых языках слова идут вместе со знаками пунктуации до или после, например, // -abwicklung и bwz. (в немецком языке) this.Prefix = Prefix; // Символ приставки, если есть, например, "-" @@ -58,11 +58,11 @@ } CParagraphSpellCheckerElement.prototype.GetStartPos = function() { - return this.StartPos; + return this.getStartParaPos(); }; CParagraphSpellCheckerElement.prototype.GetEndPos = function() { - return this.EndPos; + return this.getEndParaPos(); }; CParagraphSpellCheckerElement.prototype.GetPrefix = function() { @@ -90,11 +90,19 @@ }; CParagraphSpellCheckerElement.prototype.GetStartRun = function() { - return this.StartRun; + return this.startRun; + }; + CParagraphSpellCheckerElement.prototype.GetStartInRunPos = function() + { + return this.startInRunPos; }; CParagraphSpellCheckerElement.prototype.GetEndRun = function() { - return this.EndRun; + return this.endRun; + }; + CParagraphSpellCheckerElement.prototype.GetEndInRunPos = function() + { + return this.endInRunPos; }; CParagraphSpellCheckerElement.prototype.GetWord = function() { @@ -138,29 +146,67 @@ }; CParagraphSpellCheckerElement.prototype.ClearSpellingMarks = function() { - if (this.StartRun !== this.EndRun) + if (this.startRun !== this.endRun) { - if (this.StartRun) - this.StartRun.ClearSpellingMarks(); + if (this.startRun) + this.startRun.ClearSpellingMarks(); - if (this.EndRun) - this.EndRun.ClearSpellingMarks(); + if (this.endRun) + this.endRun.ClearSpellingMarks(); } else { - if (this.EndRun) - this.EndRun.ClearSpellingMarks(); + if (this.endRun) + this.endRun.ClearSpellingMarks(); } }; - CParagraphSpellCheckerElement.prototype.CheckPositionInside = function(oPos) - { - return (oPos && this.EndPos.Compare(oPos) >= 0 && this.StartPos.Compare(oPos) <= 0); - }; - CParagraphSpellCheckerElement.prototype.CheckIntersection = function(oStartPos, oEndPos) - { - return (oStartPos && oEndPos && this.StartPos.Compare(oEndPos) <= 0 && this.EndPos.Compare(oStartPos) >= 0); - }; - + CParagraphSpellCheckerElement.prototype.CheckPositionInside = function(pos) + { + if (!pos) + return false; + + let elementStartPos = this.getStartParaPos(); + let elementEndPos = this.getEndParaPos(); + return (elementStartPos.Compare(pos) <= 0 && elementEndPos.Compare(pos) >= 0); + }; + CParagraphSpellCheckerElement.prototype.CheckIntersection = function(startPos, endPos) + { + if (!startPos || !endPos) + return false; + + let elementStartPos = this.getStartParaPos(); + let elementEndPos = this.getEndParaPos(); + return (elementStartPos.Compare(endPos) <= 0 && elementEndPos.Compare(startPos) >= 0); + }; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Private area + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + CParagraphSpellCheckerElement.prototype.getParagraph = function() + { + return this.startRun ? this.startRun.GetParagraph() : null; + }; + CParagraphSpellCheckerElement.prototype.getStartParaPos = function() + { + let paragraph = this.getParagraph(); + let paraPos = paragraph ? paragraph.GetPosByElement(this.startRun) : null; + if (!paraPos) + return new AscWord.CParagraphContentPos(); + + paraPos.Update(this.startInRunPos, paraPos.GetDepth() + 1); + return paraPos; + }; + CParagraphSpellCheckerElement.prototype.getEndParaPos = function() + { + let paragraph = this.getParagraph(); + let paraPos = paragraph ? paragraph.GetPosByElement(this.endRun) : null; + if (!paraPos) + return new AscWord.CParagraphContentPos(); + + paraPos.Update(this.endInRunPos, paraPos.GetDepth() + 1); + return paraPos; + }; + //--------------------------------------------------------export---------------------------------------------------- window['AscCommonWord'] = window['AscCommonWord'] || {}; window['AscCommonWord'].CParagraphSpellCheckerElement = CParagraphSpellCheckerElement;