Commit 4b70384d authored by Ilya Kirillov's avatar Ilya Kirillov

Adding a footnote was added to the history, now any coauthor can work properly...

Adding a footnote was added to the history, now any coauthor can work properly with an added footnote.
parent 2c5840dc
...@@ -2291,6 +2291,8 @@ ...@@ -2291,6 +2291,8 @@
window['AscDFH'].historyitem_type_deg = 53; window['AscDFH'].historyitem_type_deg = 53;
window['AscDFH'].historyitem_type_ParaComment = 54; window['AscDFH'].historyitem_type_ParaComment = 54;
window['AscDFH'].historyitem_type_Field = 55; window['AscDFH'].historyitem_type_Field = 55;
window['AscDFH'].historyitem_type_Footnotes = 56;
window['AscDFH'].historyitem_type_FootEndNote = 57;
window['AscDFH'].historyitem_Math_AddItem = 1; // Добавляем элемент window['AscDFH'].historyitem_Math_AddItem = 1; // Добавляем элемент
window['AscDFH'].historyitem_Math_RemoveItem = 2; // Удаляем элемент window['AscDFH'].historyitem_Math_RemoveItem = 2; // Удаляем элемент
...@@ -2350,6 +2352,8 @@ ...@@ -2350,6 +2352,8 @@
window['AscDFH'].historyitem_Math_BoxForcedBreak = 56; window['AscDFH'].historyitem_Math_BoxForcedBreak = 56;
window['AscDFH'].historyitem_Math_DegreeSubSupType = 57; window['AscDFH'].historyitem_Math_DegreeSubSupType = 57;
window['AscDFH'].historyitem_Footnotes_AddFootnote = 1;
window['AscDFH'].historydescription_Cut = 0x0001; window['AscDFH'].historydescription_Cut = 0x0001;
window['AscDFH'].historydescription_PasteButtonIE = 0x0002; window['AscDFH'].historydescription_PasteButtonIE = 0x0002;
window['AscDFH'].historydescription_PasteButtonNotIE = 0x0003; window['AscDFH'].historydescription_PasteButtonNotIE = 0x0003;
......
...@@ -2032,6 +2032,7 @@ CTableId.prototype.Read_Class_FromBinary = function(Reader) ...@@ -2032,6 +2032,7 @@ CTableId.prototype.Read_Class_FromBinary = function(Reader)
case AscDFH.historyitem_type_ParaRun : Element = new AscCommonWord.ParaRun(); break; case AscDFH.historyitem_type_ParaRun : Element = new AscCommonWord.ParaRun(); break;
case AscDFH.historyitem_type_Section : Element = new AscCommonWord.CSectionPr(); break; case AscDFH.historyitem_type_Section : Element = new AscCommonWord.CSectionPr(); break;
case AscDFH.historyitem_type_Field : Element = new AscCommonWord.ParaField(); break; case AscDFH.historyitem_type_Field : Element = new AscCommonWord.ParaField(); break;
case AscDFH.historyitem_type_FootEndNote : Element = new AscCommonWord.CFootEndnote(); break;
case AscDFH.historyitem_type_DefaultShapeDefinition : Element = new AscFormat.DefaultShapeDefinition(); break; case AscDFH.historyitem_type_DefaultShapeDefinition : Element = new AscFormat.DefaultShapeDefinition(); break;
case AscDFH.historyitem_type_CNvPr : Element = new AscFormat.CNvPr(); break; case AscDFH.historyitem_type_CNvPr : Element = new AscFormat.CNvPr(); break;
...@@ -2130,31 +2131,31 @@ CTableId.prototype.Read_Class_FromBinary = function(Reader) ...@@ -2130,31 +2131,31 @@ CTableId.prototype.Read_Class_FromBinary = function(Reader)
case AscDFH.historyitem_type_Title : Element = new AscFormat.CTitle(); break; case AscDFH.historyitem_type_Title : Element = new AscFormat.CTitle(); break;
case AscDFH.historyitem_type_OleObject : Element = new AscFormat.COleObject(); break; case AscDFH.historyitem_type_OleObject : Element = new AscFormat.COleObject(); break;
case AscDFH.historyitem_type_Math : Element = new AscCommonWord.ParaMath(false); break; case AscDFH.historyitem_type_Math : Element = new AscCommonWord.ParaMath(false); break;
case AscDFH.historyitem_type_MathContent : Element = new AscCommonWord.CMathContent(); break; case AscDFH.historyitem_type_MathContent : Element = new AscCommonWord.CMathContent(); break;
case AscDFH.historyitem_type_acc : Element = new AscCommonWord.CAccent(); break; case AscDFH.historyitem_type_acc : Element = new AscCommonWord.CAccent(); break;
case AscDFH.historyitem_type_bar : Element = new AscCommonWord.CBar(); break; case AscDFH.historyitem_type_bar : Element = new AscCommonWord.CBar(); break;
case AscDFH.historyitem_type_box : Element = new AscCommonWord.CBox(); break; case AscDFH.historyitem_type_box : Element = new AscCommonWord.CBox(); break;
case AscDFH.historyitem_type_borderBox : Element = new AscCommonWord.CBorderBox(); break; case AscDFH.historyitem_type_borderBox : Element = new AscCommonWord.CBorderBox(); break;
case AscDFH.historyitem_type_delimiter : Element = new AscCommonWord.CDelimiter(); break; case AscDFH.historyitem_type_delimiter : Element = new AscCommonWord.CDelimiter(); break;
case AscDFH.historyitem_type_eqArr : Element = new AscCommonWord.CEqArray(); break; case AscDFH.historyitem_type_eqArr : Element = new AscCommonWord.CEqArray(); break;
case AscDFH.historyitem_type_frac : Element = new AscCommonWord.CFraction(); break; case AscDFH.historyitem_type_frac : Element = new AscCommonWord.CFraction(); break;
case AscDFH.historyitem_type_mathFunc : Element = new AscCommonWord.CMathFunc(); break; case AscDFH.historyitem_type_mathFunc : Element = new AscCommonWord.CMathFunc(); break;
case AscDFH.historyitem_type_groupChr : Element = new AscCommonWord.CGroupCharacter(); break; case AscDFH.historyitem_type_groupChr : Element = new AscCommonWord.CGroupCharacter(); break;
case AscDFH.historyitem_type_lim : Element = new AscCommonWord.CLimit(); break; case AscDFH.historyitem_type_lim : Element = new AscCommonWord.CLimit(); break;
case AscDFH.historyitem_type_matrix : Element = new AscCommonWord.CMathMatrix(); break; case AscDFH.historyitem_type_matrix : Element = new AscCommonWord.CMathMatrix(); break;
case AscDFH.historyitem_type_nary : Element = new AscCommonWord.CNary(); break; case AscDFH.historyitem_type_nary : Element = new AscCommonWord.CNary(); break;
case AscDFH.historyitem_type_phant : Element = new AscCommonWord.CPhantom(); break; case AscDFH.historyitem_type_phant : Element = new AscCommonWord.CPhantom(); break;
case AscDFH.historyitem_type_rad : Element = new AscCommonWord.CRadical(); break; case AscDFH.historyitem_type_rad : Element = new AscCommonWord.CRadical(); break;
case AscDFH.historyitem_type_deg_subsup : Element = new AscCommonWord.CDegreeSubSup(); break; case AscDFH.historyitem_type_deg_subsup : Element = new AscCommonWord.CDegreeSubSup(); break;
case AscDFH.historyitem_type_deg : Element = new AscCommonWord.CDegree(); break; case AscDFH.historyitem_type_deg : Element = new AscCommonWord.CDegree(); break;
case AscDFH.historyitem_type_Slide : Element = new AscCommonSlide.Slide(); break; case AscDFH.historyitem_type_Slide : Element = new AscCommonSlide.Slide(); break;
case AscDFH.historyitem_type_SlideLayout : Element = new AscCommonSlide.SlideLayout(); break; case AscDFH.historyitem_type_SlideLayout : Element = new AscCommonSlide.SlideLayout(); break;
case AscDFH.historyitem_type_SlideMaster : Element = new AscCommonSlide.MasterSlide(); break; case AscDFH.historyitem_type_SlideMaster : Element = new AscCommonSlide.MasterSlide(); break;
case AscDFH.historyitem_type_SlideComments : Element = new AscCommonSlide.SlideComments(); break; case AscDFH.historyitem_type_SlideComments : Element = new AscCommonSlide.SlideComments(); break;
case AscDFH.historyitem_type_PropLocker : Element = new AscCommonSlide.PropLocker(); break; case AscDFH.historyitem_type_PropLocker : Element = new AscCommonSlide.PropLocker(); break;
case AscDFH.historyitem_type_Theme : Element = new AscFormat.CTheme(); break; case AscDFH.historyitem_type_Theme : Element = new AscFormat.CTheme(); break;
case AscDFH.historyitem_type_GraphicFrame : Element = new AscFormat.CGraphicFrame(); break; case AscDFH.historyitem_type_GraphicFrame : Element = new AscFormat.CGraphicFrame(); break;
} }
if ( null !== Element ) if ( null !== Element )
......
...@@ -4867,9 +4867,6 @@ CDocument.prototype.Selection_SetStart = function(X, Y, MouseEvent) ...@@ -4867,9 +4867,6 @@ CDocument.prototype.Selection_SetStart = function(X, Y, MouseEvent)
} }
else if (true !== bFlowTable && nInDrawing < 0 && true === bFootnotes) else if (true !== bFlowTable && nInDrawing < 0 && true === bFootnotes)
{ {
if (docpostype_Footnotes !== this.Get_DocPosType())
this.Selection_Remove();
this.Selection.Start = true; this.Selection.Start = true;
this.Selection.Use = true; this.Selection.Use = true;
...@@ -10409,6 +10406,10 @@ CDocument.prototype.Get_TableId = function() ...@@ -10409,6 +10406,10 @@ CDocument.prototype.Get_TableId = function()
{ {
return this.TableId; return this.TableId;
}; };
CDocument.prototype.Get_History = function()
{
return this.History;
};
CDocument.prototype.Get_CollaborativeEditing = function() CDocument.prototype.Get_CollaborativeEditing = function()
{ {
return this.CollaborativeEditing; return this.CollaborativeEditing;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
*/ */
function CFootEndnote(DocumentController) function CFootEndnote(DocumentController)
{ {
CFootEndnote.superclass.constructor.call(this, DocumentController, DocumentController.Get_DrawingDocument(), 0, 0, 0, 0, true, false, false); CFootEndnote.superclass.constructor.call(this, DocumentController, DocumentController ? DocumentController.Get_DrawingDocument() : undefined, 0, 0, 0, 0, true, false, false);
} }
AscCommon.extendClass(CFootEndnote, CDocumentContent); AscCommon.extendClass(CFootEndnote, CDocumentContent);
...@@ -50,4 +50,18 @@ CFootEndnote.prototype.GetRelaitivePageIndex = function(PageAbs) ...@@ -50,4 +50,18 @@ CFootEndnote.prototype.GetRelaitivePageIndex = function(PageAbs)
var StartPageAbs = this.Get_StartPage_Absolute(); var StartPageAbs = this.Get_StartPage_Absolute();
var PagesCount = this.Get_PagesCount(); var PagesCount = this.Get_PagesCount();
return Math.max(0, Math.min(PagesCount - 1, PageAbs - StartPageAbs)); return Math.max(0, Math.min(PagesCount - 1, PageAbs - StartPageAbs));
}; };
\ No newline at end of file CFootEndnote.prototype.Write_ToBinary2 = function(Writer)
{
Writer.WriteLong(AscDFH.historyitem_type_FootEndNote);
CFootEndnote.superclass.Write_ToBinary2.call(this, Writer);
};
CFootEndnote.prototype.Read_FromBinary2 = function(Reader)
{
Reader.GetLong(); // Должен вернуть historyitem_type_DocumentContent
CFootEndnote.superclass.Read_FromBinary2.call(this, Reader);
};
//--------------------------------------------------------export----------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CFootEndnote = CFootEndnote;
\ No newline at end of file
...@@ -93,6 +93,11 @@ CFootnotesController.prototype.Create_Footnote = function() ...@@ -93,6 +93,11 @@ CFootnotesController.prototype.Create_Footnote = function()
{ {
var NewFootnote = new CFootEndnote(this); var NewFootnote = new CFootEndnote(this);
this.Footnote[NewFootnote.Get_Id()] = NewFootnote; this.Footnote[NewFootnote.Get_Id()] = NewFootnote;
var oHistory = this.LogicDocument.Get_History();
oHistory.Add(this, {Type : AscDFH.historyitem_Footnotes_AddFootnote, Id : NewFootnote.Get_Id()});
return NewFootnote; return NewFootnote;
}; };
/** /**
...@@ -261,7 +266,9 @@ CFootnotesController.prototype.Is_EmptyPage = function(nPageIndex) ...@@ -261,7 +266,9 @@ CFootnotesController.prototype.Is_EmptyPage = function(nPageIndex)
return false; return false;
}; };
CFootnotesController.prototype.Refresh_RecalcData = function(Data)
{
};
CFootnotesController.prototype.Refresh_RecalcData2 = function(nRelPageIndex) CFootnotesController.prototype.Refresh_RecalcData2 = function(nRelPageIndex)
{ {
var nAbsPageIndex = nRelPageIndex; var nAbsPageIndex = nRelPageIndex;
...@@ -398,6 +405,85 @@ CFootnotesController.prototype.EndSelection = function(X, Y, PageAbs, MouseEvent ...@@ -398,6 +405,85 @@ CFootnotesController.prototype.EndSelection = function(X, Y, PageAbs, MouseEvent
this.Selection.Footnotes[this.Selection.Start.Footnote.Get_Id()] = this.Selection.Start.Footnote; this.Selection.Footnotes[this.Selection.Start.Footnote.Get_Id()] = this.Selection.Start.Footnote;
} }
}; };
CFootnotesController.prototype.Undo = function()
{
var Type = Data.Type;
switch (Type)
{
case AscDFH.historyitem_Footnotes_AddFootnote:
{
this.Footnote[Data.Id] = g_oTableId.Get_ById(Data.Id);
break;
}
}
};
CFootnotesController.prototype.Redo = function()
{
var Type = Data.Type;
switch (Type)
{
case AscDFH.historyitem_Footnotes_AddFootnote:
{
delete this.Footnote[Data.Id];
break;
}
}
};
CFootnotesController.prototype.Save_Changes = function(Data, Writer)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
Writer.WriteLong(AscDFH.historyitem_type_Footnotes);
var Type = Data.Type;
// Пишем тип
Writer.WriteLong(Type);
switch (Type)
{
case AscDFH.historyitem_Footnotes_AddFootnote:
{
// String : Id
Writer.WriteString2(Data.Id);
break;
}
}
return Writer;
};
CFootnotesController.prototype.Save_Changes2 = function(Data, Writer)
{
};
CFootnotesController.prototype.Load_Changes = function(Reader, Reader2)
{
// Сохраняем изменения из тех, которые используются для Undo/Redo в бинарный файл.
// Long : тип класса
// Long : тип изменений
var ClassType = Reader.GetLong();
if (AscDFH.historyitem_type_Footnotes != ClassType)
return;
var Type = Reader.GetLong();
switch (Type)
{
case AscDFH.historyitem_Footnotes_AddFootnote:
{
// String : Id
var Id = Reader.GetString2();
this.Footnote[Id] = g_oTableId.Get_ById(Id);
break;
}
}
return true;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area // Private area
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -503,7 +589,6 @@ CFootnotesController.prototype.CanTargetUpdate = function() ...@@ -503,7 +589,6 @@ CFootnotesController.prototype.CanTargetUpdate = function()
}; };
CFootnotesController.prototype.RecalculateCurPos = function() CFootnotesController.prototype.RecalculateCurPos = function()
{ {
// TODO: Доделать селект и курсор
if (null !== this.CurFootnote) if (null !== this.CurFootnote)
return this.CurFootnote.RecalculateCurPos(); return this.CurFootnote.RecalculateCurPos();
...@@ -511,17 +596,8 @@ CFootnotesController.prototype.RecalculateCurPos = function() ...@@ -511,17 +596,8 @@ CFootnotesController.prototype.RecalculateCurPos = function()
}; };
CFootnotesController.prototype.GetCurPage = function() CFootnotesController.prototype.GetCurPage = function()
{ {
// TODO: Доделать селект и курсор if (null !== this.CurFootnote)
return this.CurFootnote.Get_StartPage_Absolute();
if (true === this.Selection.Use)
{
}
else
{
if (null !== this.CurFootnote)
return this.CurFootnote.Get_StartPage_Absolute();
}
return -1; return -1;
}; };
......
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