Commit 94675b97 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented sending own cursor position for other co-authors in footnotes....

Implemented sending own cursor position for other co-authors in footnotes. Fixed several bugs with save/restore selection state after loading changes in footnotes.
parent fd0a922d
......@@ -10306,8 +10306,6 @@ CDocument.prototype.Get_DocumentPositionFromObject = function(PosArray)
};
CDocument.prototype.Get_CursorLogicPosition = function()
{
// TODO: Обработка сносок
var nDocPosType = this.Get_DocPosType();
if (docpostype_HdrFtr === nDocPosType)
{
......@@ -10317,6 +10315,12 @@ CDocument.prototype.Get_CursorLogicPosition = function()
return this.private_GetLogicDocumentPosition(HdrFtr.Get_DocumentContent());
}
}
else if (docpostype_Footnotes === nDocPosType)
{
var oFootnote = this.Footnotes.GetCurFootnote();
if (oFootnote)
return this.private_GetLogicDocumentPosition(oFootnote);
}
else
{
return this.private_GetLogicDocumentPosition(this);
......@@ -10382,7 +10386,7 @@ CDocument.prototype.Update_ForeignCursor = function(CursorInfo, UserId, Show, Us
if (!CursorInfo)
{
this.Remove_ForeignCursor(UserId)
this.Remove_ForeignCursor(UserId);
return;
}
......@@ -10395,7 +10399,7 @@ CDocument.prototype.Update_ForeignCursor = function(CursorInfo, UserId, Show, Us
var Run = this.TableId.Get_ById(RunId);
if (!Run)
{
this.Remove_ForeignCursor(UserId)
this.Remove_ForeignCursor(UserId);
return;
}
......@@ -16704,6 +16708,7 @@ function CDocumentFootnotesRangeEngine()
this.m_oLastFootnote = null; // Если не задана ищем до конца
this.m_arrFootnotes = [];
this.m_bForceStop = false;
}
CDocumentFootnotesRangeEngine.prototype.Init = function(oFirstFootnote, oLastFootnote)
{
......@@ -16712,13 +16717,15 @@ CDocumentFootnotesRangeEngine.prototype.Init = function(oFirstFootnote, oLastFoo
};
CDocumentFootnotesRangeEngine.prototype.Add = function(oFootnote)
{
if (!oFootnote)
if (!oFootnote || true === this.m_bForceStop)
return;
if (this.m_arrFootnotes.length <= 0 && null !== this.m_oFirstFootnote)
{
if (this.m_oFirstFootnote === oFootnote)
this.m_arrFootnotes.push(oFootnote);
else if (this.m_oLastFootnote === oFootnote)
this.m_bForceStop = true;
}
else if (this.m_arrFootnotes.length >= 1 && null !== this.m_oLastFootnote)
{
......@@ -16732,6 +16739,9 @@ CDocumentFootnotesRangeEngine.prototype.Add = function(oFootnote)
};
CDocumentFootnotesRangeEngine.prototype.IsRangeFull = function()
{
if (true === this.m_bForceStop)
return true;
if (null !== this.m_oLastFootnote && this.m_arrFootnotes.length >= 1 && this.m_oLastFootnote === this.m_arrFootnotes[this.m_arrFootnotes.length - 1])
return true;
......
......@@ -317,6 +317,10 @@ CFootnotesController.prototype.Get_PageContentStartPos = function(PageAbs)
//TODO: Реализовать
return {X : 0, Y : 0, XLimit : 0, YLimit : 0};
};
CFootnotesController.prototype.GetCurFootnote = function()
{
return this.CurFootnote;
};
/**
* Проверяем попадание в сноски на заданной странице.
* @param X
......@@ -2388,15 +2392,30 @@ CFootnotesController.prototype.RestoreDocumentStateAfterLoadChanges = function(S
var arrNewFootnotesList = this.private_GetFootnotesLogicRange(StartFootnote, EndFootnote);
if (arrNewFootnotesList.length < 1)
{
if (null !== EndFootnote)
{
EndFootnote.Selection_Remove();
this.private_SetCurrentFootnoteNoSelection(EndFootnote);
}
else if (null !== StartFootnote)
{
StartFootnote.Selection_Remove();
this.private_SetCurrentFootnoteNoSelection(StartFootnote);
}
else
{
this.LogicDocument.EndFootnotesEditing();
return;
}
}
else if (arrNewFootnotesList.length === 1)
{
this.Selection.Use = true;
this.Selection.Direction = 0;
this.Selection.Footnotes = {};
this.Selection.Start.Footnote = StartFootnote;
this.Selection.End.Footnote = StartFootnote;
this.CurFootnote = StartFootnote;
this.Selection.Footnotes[StartFootnote.Get_Id()] = StartFootnote;
......@@ -2437,16 +2456,6 @@ CFootnotesController.prototype.RestoreDocumentStateAfterLoadChanges = function(S
this.Selection.Footnotes[EndFootnote.Get_Id()] = EndFootnote;
if (1 !== this.Selection.Direction)
{
var Temp = StartFootnote;
StartFootnote = EndFootnote;
EndFootnote = Temp;
}
this.Selection.Start.Footnote = StartFootnote;
this.Selection.End.Footnote = EndFootnote;
if (arrFootnotesList[0] === StartFootnote)
{
StartFootnote.Set_DocPosType(docpostype_Content);
......@@ -2472,6 +2481,16 @@ CFootnotesController.prototype.RestoreDocumentStateAfterLoadChanges = function(S
EndFootnote.Set_DocPosType(docpostype_Content);
EndFootnote.Select_All(1);
}
if (1 !== this.Selection.Direction)
{
var Temp = StartFootnote;
StartFootnote = EndFootnote;
EndFootnote = Temp;
}
this.Selection.Start.Footnote = StartFootnote;
this.Selection.End.Footnote = EndFootnote;
}
}
};
......
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