Commit 5ca9d142 authored by Ilya Kirillov's avatar Ilya Kirillov

Сделана схема, при которой может быть добавлена или нет специальная сноска с разделительной чертой.

parent a1941587
...@@ -48,7 +48,7 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split, ...@@ -48,7 +48,7 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
{ {
this.DrawingDocument = DrawingDocument; this.DrawingDocument = DrawingDocument;
if ( undefined !== editor && true === editor.isDocumentEditor && !(bPresentation === true) ) if ( undefined !== editor && true === editor.isDocumentEditor && !(bPresentation === true) && DrawingDocument.m_oLogicDocument )
{ {
this.LogicDocument = DrawingDocument.m_oLogicDocument; this.LogicDocument = DrawingDocument.m_oLogicDocument;
this.Styles = DrawingDocument.m_oLogicDocument.Get_Styles(); this.Styles = DrawingDocument.m_oLogicDocument.Get_Styles();
...@@ -9685,6 +9685,13 @@ CDocumentContent.prototype.Set_ParaPropsForVerticalTextInCell = function(isVerti ...@@ -9685,6 +9685,13 @@ CDocumentContent.prototype.Set_ParaPropsForVerticalTextInCell = function(isVerti
Element.Set_ParaPropsForVerticalTextInCell(isVerticalText); Element.Set_ParaPropsForVerticalTextInCell(isVerticalText);
} }
}; };
CDocumentContent.prototype.Set_LogicDocument = function(oLogicDocument)
{
this.LogicDocument = oLogicDocument;
this.Styles = oLogicDocument.Get_Styles();
this.Numbering = oLogicDocument.Get_Numbering();
this.DrawingObjects = oLogicDocument.DrawingObjects;
};
function CDocumentContentStartState(DocContent) function CDocumentContentStartState(DocContent)
{ {
......
...@@ -20,6 +20,10 @@ function CFootnotesController(LogicDocument) ...@@ -20,6 +20,10 @@ function CFootnotesController(LogicDocument)
this.Footnote = {}; // Список всех сносок с ключом - Id. this.Footnote = {}; // Список всех сносок с ключом - Id.
this.Pages = []; this.Pages = [];
// Специальные сноски
this.ContinuationNoticeFootnote = null;
this.ContinuationSeparatorFootnote = null;
this.SeparatorFootnote = null;
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора) // Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
LogicDocument.Get_TableId().Add(this, this.Id); LogicDocument.Get_TableId().Add(this, this.Id);
...@@ -34,6 +38,16 @@ CFootnotesController.prototype.Get_Id = function() ...@@ -34,6 +38,16 @@ CFootnotesController.prototype.Get_Id = function()
{ {
return this.Id; return this.Id;
}; };
/**
* Начальная инициализация после загрузки всех файлов.
*/
CFootnotesController.prototype.Init = function()
{
this.SeparatorFootnote = new CFootEndnote(this);
this.SeparatorFootnote.Paragraph_Add(new ParaSeparator(), false);
var oParagraph = this.SeparatorFootnote.Get_ElementByIndex(0);
oParagraph.Set_Spacing({After : 0, Line : 1, LineRule : Asc.linerule_Auto}, false);
};
/** /**
* Создаем новую сноску. * Создаем новую сноску.
* @returns {CFootEndnote} * @returns {CFootEndnote}
...@@ -63,9 +77,23 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y, ...@@ -63,9 +77,23 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y,
if (!this.Pages[nPageIndex]) if (!this.Pages[nPageIndex])
this.Pages[nPageIndex] = new CFootEndnotePage(); this.Pages[nPageIndex] = new CFootEndnotePage();
if (true === this.Is_EmptyPage(nPageIndex))
return;
// Мы пересчет начинаем с 0, потом просто делаем сдвиг, через функцию Shift. // Мы пересчет начинаем с 0, потом просто делаем сдвиг, через функцию Shift.
var CurY = Y; var CurY = Y;
if (null !== this.SeparatorFootnote)
{
this.SeparatorFootnote.Reset(X, CurY, XLimit, 10000);
this.SeparatorFootnote.Recalculate_Page(0, true);
this.Pages[nPageIndex].SeparatorRecalculateObject = this.SeparatorFootnote.Save_RecalculateObject();
var Bounds = this.SeparatorFootnote.Get_PageBounds(0);
CurY += Bounds.Bottom - Bounds.Top;
}
for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex) for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex)
{ {
var Footnote = this.Pages[nPageIndex].Elements[nIndex]; var Footnote = this.Pages[nPageIndex].Elements[nIndex];
...@@ -83,10 +111,21 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y, ...@@ -83,10 +111,21 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y,
/** /**
* Получаем суммарную высоту, занимаемую сносками на заданной странице. * Получаем суммарную высоту, занимаемую сносками на заданной странице.
* @param {number} nPageIndex * @param {number} nPageIndex
* @returns {number}
*/ */
CFootnotesController.prototype.Get_Height = function(nPageIndex) CFootnotesController.prototype.Get_Height = function(nPageIndex)
{ {
if (true === this.Is_EmptyPage(nPageIndex))
return 0;
var nHeight = 0; var nHeight = 0;
if (null !== this.SeparatorFootnote)
{
var Bounds = this.SeparatorFootnote.Get_PageBounds(0);
nHeight += Bounds.Bottom - Bounds.Top;
}
for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex) for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex)
{ {
var Footnote = this.Pages[nPageIndex].Elements[nIndex]; var Footnote = this.Pages[nPageIndex].Elements[nIndex];
...@@ -103,6 +142,15 @@ CFootnotesController.prototype.Get_Height = function(nPageIndex) ...@@ -103,6 +142,15 @@ CFootnotesController.prototype.Get_Height = function(nPageIndex)
*/ */
CFootnotesController.prototype.Draw = function(nPageIndex, pGraphics) CFootnotesController.prototype.Draw = function(nPageIndex, pGraphics)
{ {
if (true === this.Is_EmptyPage(nPageIndex))
return;
if (null !== this.SeparatorFootnote && null !== this.Pages[nPageIndex].SeparatorRecalculateObject)
{
this.SeparatorFootnote.Load_RecalculateObject(this.Pages[nPageIndex].SeparatorRecalculateObject);
this.SeparatorFootnote.Draw(0, pGraphics);
}
for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex) for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex)
{ {
var Footnote = this.Pages[nPageIndex].Elements[nIndex]; var Footnote = this.Pages[nPageIndex].Elements[nIndex];
...@@ -117,6 +165,16 @@ CFootnotesController.prototype.Draw = function(nPageIndex, pGraphics) ...@@ -117,6 +165,16 @@ CFootnotesController.prototype.Draw = function(nPageIndex, pGraphics)
*/ */
CFootnotesController.prototype.Shift = function(nPageIndex, dX, dY) CFootnotesController.prototype.Shift = function(nPageIndex, dX, dY)
{ {
if (true === this.Is_EmptyPage(nPageIndex))
return;
if (null !== this.SeparatorFootnote && null !== this.Pages[nPageIndex].SeparatorRecalculateObject)
{
this.SeparatorFootnote.Load_RecalculateObject(this.Pages[nPageIndex].SeparatorRecalculateObject);
this.SeparatorFootnote.Shift(0, dX, dY);
this.Pages[nPageIndex].SeparatorRecalculateObject = this.SeparatorFootnote.Save_RecalculateObject();
}
for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex) for (var nIndex = 0; nIndex < this.Pages[nPageIndex].Elements.length; ++nIndex)
{ {
var Footnote = this.Pages[nPageIndex].Elements[nIndex]; var Footnote = this.Pages[nPageIndex].Elements[nIndex];
...@@ -151,6 +209,18 @@ CFootnotesController.prototype.Is_UseInDocument = function(sFootnoteId) ...@@ -151,6 +209,18 @@ CFootnotesController.prototype.Is_UseInDocument = function(sFootnoteId)
return false; return false;
}; };
/**
* Проверяем пустая ли страница.
* @param {number} nPageIndex
* @returns {boolean}
*/
CFootnotesController.prototype.Is_EmptyPage = function(nPageIndex)
{
if (!this.Pages[nPageIndex] || this.Pages[nPageIndex].Elements.length <= 0)
return true;
return false;
};
function CFootEndnotePage() function CFootEndnotePage()
{ {
...@@ -160,6 +230,10 @@ function CFootEndnotePage() ...@@ -160,6 +230,10 @@ function CFootEndnotePage()
this.YLimit = 0; this.YLimit = 0;
this.Elements = []; this.Elements = [];
this.SeparatorRecalcObject = null;
this.ContinuationSeparatorRecalcObject = null;
this.ContinuationNoticeRecalcObject = null;
} }
CFootEndnotePage.prototype.Reset = function() CFootEndnotePage.prototype.Reset = function()
{ {
...@@ -169,6 +243,10 @@ CFootEndnotePage.prototype.Reset = function() ...@@ -169,6 +243,10 @@ CFootEndnotePage.prototype.Reset = function()
this.YLimit = 0; this.YLimit = 0;
this.Elements = []; this.Elements = [];
this.SeparatorRecalcObject = null;
this.ContinuationSeparatorRecalcObject = null;
this.ContinuationNoticeRecalcObject = null;
}; };
......
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