diff --git a/word/Editor/Paragraph.js b/word/Editor/Paragraph.js index 4bb5c3746e504c28da3df592c2af6b1947b2c73e..24af5b2e17d73e69c52b3eebe229524d8bdb7564 100644 --- a/word/Editor/Paragraph.js +++ b/word/Editor/Paragraph.js @@ -1947,6 +1947,7 @@ Paragraph.prototype = var Range = Line.Ranges[CurRange]; + PDSE.Set_LineMetrics(Y, Y - Line.Metrics.Ascent, Y + Line.Metrics.Descent); PDSE.Reset_Range( CurPage, CurLine, CurRange, X, Y ); var StartPos = Range.StartPos; @@ -14574,6 +14575,10 @@ function CParagraphDrawStateElements() this.X = 0; this.Y = 0; + + this.LineTop = 0; + this.LineBottom = 0; + this.BaseLine = 0; } CParagraphDrawStateElements.prototype = @@ -14599,6 +14604,13 @@ CParagraphDrawStateElements.prototype = this.X = X; this.Y = Y; + }, + + Set_LineMetrics : function(BaseLine, Top, Bottom) + { + this.LineTop = Top; + this.LineBottom = Bottom; + this.BaseLine = BaseLine; } }; diff --git a/word/Editor/ParagraphContent.js b/word/Editor/ParagraphContent.js index c3c3a79940dcde2f58b8077e1ceab65ca851a1cc..2964543d97f9c29d5609faff97679c0d10c28e35 100644 --- a/word/Editor/ParagraphContent.js +++ b/word/Editor/ParagraphContent.js @@ -7445,34 +7445,44 @@ ParaPresentationNumbering.prototype = /** * КлаÑÑ Ð¿Ñ€ÐµÐ´ÑтавлÑющий ÑÑылку на ÑноÑку. - * @param {string} sId - Идентификатор ÑноÑки. + * @param {CFootEndnote} Footnote - СÑылка на ÑноÑку. * @constructor */ -function ParaFootnoteReference(sId) +function ParaFootnoteReference(Footnote) { - this.FootnoteId = sId; + this.Footnote = Footnote; this.Width = 0; this.WidthVisible = 0; - this.Height = 0; + this.Number = 1; } -ParaFootnoteReference.prototype.Type = para_FootnoteReference; -ParaFootnoteReference.prototype.Get_Type = function() +ParaFootnoteReference.prototype.Type = para_FootnoteReference; +ParaFootnoteReference.prototype.Get_Type = function() { return para_FootnoteReference; }; -ParaFootnoteReference.prototype.Draw = function(X, Y, Context) +ParaFootnoteReference.prototype.Draw = function(X, Y, Context, PDSE) { Context.SetFontSlot(fontslot_ASCII, vertalign_Koef_Size); - Context.FillTextCode(X, Y, "1".charCodeAt(0)); + g_oTextMeasurer.SetFontSlot(fontslot_ASCII, vertalign_Koef_Size); + + // TODO: Пока делаем обычный вариант Ñ Ñ‚Ð¸Ð¿Ð¾Ð¼ Decimal + var _X = X; + var T = Numbering_Number_To_String(this.Number); + for (var nPos = 0; nPos < T.length; ++nPos) + { + var Char = T.charAt(nPos); + Context.FillText(_X, Y, Char); + _X += g_oTextMeasurer.Measure(Char).Width; + } // TODO: Ðадо переделать в отдельную функцию отриÑовщика if (editor && editor.ShowParaMarks) { if (Context.m_oContext && Context.m_oContext.setLineDash) - Context.m_oContext.setLineDash([1,1]); + Context.m_oContext.setLineDash([1, 1]); - var l = X, t = Y - this.Height, r = X + this.Get_Width(), b = Y; + var l = X, t = PDSE.LineTop, r = X + this.Get_Width(), b = PDSE.BaseLine; Context.drawHorLineExt(c_oAscLineDrawingRule.Top, t, l, r, 0, 0, 0); Context.drawVerLine(c_oAscLineDrawingRule.Right, l, t, b, 0); Context.drawVerLine(c_oAscLineDrawingRule.Left, r, t, b, 0); @@ -7482,16 +7492,24 @@ ParaFootnoteReference.prototype.Draw = function(X, Y, Context) Context.m_oContext.setLineDash([]); } }; -ParaFootnoteReference.prototype.Measure = function(Context, TextPr) +ParaFootnoteReference.prototype.Measure = function(Context, TextPr) { Context.SetFontSlot(fontslot_ASCII, vertalign_Koef_Size); - var Temp = Context.MeasureCode("1".charCodeAt(0)); - var ResultWidth = (Math.max((Temp.Width + TextPr.Spacing), 0) * TEXTWIDTH_DIVIDER) | 0; + + // TODO: Пока делаем обычный вариант Ñ Ñ‚Ð¸Ð¿Ð¾Ð¼ Decimal + var X = 0; + var T = Numbering_Number_To_String(this.Number); + for (var nPos = 0; nPos < T.length; ++nPos) + { + var Char = T.charAt(nPos); + X += Context.Measure(Char).Width; + } + + var ResultWidth = (Math.max((X + TextPr.Spacing), 0) * TEXTWIDTH_DIVIDER) | 0; this.Width = ResultWidth; this.WidthVisible = ResultWidth; - this.Height = Temp.Height; }; -ParaFootnoteReference.prototype.Get_Width = function() +ParaFootnoteReference.prototype.Get_Width = function() { return (this.Width / TEXTWIDTH_DIVIDER); }; @@ -7503,7 +7521,7 @@ ParaFootnoteReference.prototype.Set_WidthVisible = function(WidthVisible) { this.WidthVisible = (WidthVisible * TEXTWIDTH_DIVIDER) | 0; }; -ParaFootnoteReference.prototype.Is_RealContent = function() +ParaFootnoteReference.prototype.Is_RealContent = function() { return true; }; @@ -7511,22 +7529,26 @@ ParaFootnoteReference.prototype.Can_AddNumbering = function() { return true; }; -ParaFootnoteReference.prototype.Copy = function() +ParaFootnoteReference.prototype.Copy = function() { return new ParaFootnoteReference(sId); }; -ParaFootnoteReference.prototype.Write_ToBinary = function(Writer) +ParaFootnoteReference.prototype.Write_ToBinary = function(Writer) { // Long : Type // String : FootnoteId Writer.WriteLong(this.Type); Writer.WriteString2(this.FootnoteId); }; -ParaFootnoteReference.prototype.Read_FromBinary = function(Reader) +ParaFootnoteReference.prototype.Read_FromBinary = function(Reader) { // String : FootnoteId this.FootnoteId = Reader.GetString2(); }; +ParaFootnoteReference.prototype.Get_Footnote = function() +{ + return this.Footnote; +}; function ParagraphContent_Read_FromBinary(Reader) diff --git a/word/Editor/Paragraph_Recalculate.js b/word/Editor/Paragraph_Recalculate.js index 196146a4c8c542f614b2921e483f4619a1bdfd33..026d89048d14d4a3d5137d0b5fc43302a0b258b7 100644 --- a/word/Editor/Paragraph_Recalculate.js +++ b/word/Editor/Paragraph_Recalculate.js @@ -2792,6 +2792,11 @@ CParagraphRecalculateStateWrap.prototype = NumberingItem.LineAscent = LineAscent; return X; + }, + + Add_FootnoteReference : function(sId, oPos) + { + } }; diff --git a/word/Editor/Run.js b/word/Editor/Run.js index 6ef06343361a80cc73cd3b31e84ab1533469ba08..fcaf9d9284409e0135a0fcb944c1e223f2015698 100644 --- a/word/Editor/Run.js +++ b/word/Editor/Run.js @@ -2256,6 +2256,9 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) // При проверке, убираетÑÑ Ð»Ð¸ Ñлово, мы должны учитывать ширину предшеÑтвующих пробелов. var LetterLen = Item.Width / TEXTWIDTH_DIVIDER;//var LetterLen = Item.Get_Width(); + + if (para_FootnoteReference === ItemType) + PRS.Add_FootnoteReference(Item.Get_Footnote(), Pos); if (true !== Word) { @@ -4436,7 +4439,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) if (para_Drawing != ItemType || Item.Is_Inline()) { - Item.Draw(X, Y - this.YOffset, pGraphics); + Item.Draw(X, Y - this.YOffset, pGraphics, PDSE); X += Item.Get_WidthVisible(); }