Commit b1c5afa1 authored by Ilya Kirillov's avatar Ilya Kirillov

Added ability to view the original and final files for reviewing.

parent 7a3d838b
...@@ -1548,6 +1548,11 @@ function CDocument(DrawingDocument, isMainLogicDocument) ...@@ -1548,6 +1548,11 @@ function CDocument(DrawingDocument, isMainLogicDocument)
// Нужно ли проверять тип лока у ContentControl при проверке залоченности выделенных объектов // Нужно ли проверять тип лока у ContentControl при проверке залоченности выделенных объектов
this.CheckContentControlsLock = true; this.CheckContentControlsLock = true;
this.ViewModeInReview = {
mode : 0, // -1 - исходный, 0 - со всеми изменениями, 1 - результат
isFastCollaboration : false
};
// Класс для работы со сносками // Класс для работы со сносками
this.Footnotes = new CFootnotesController(this); this.Footnotes = new CFootnotesController(this);
this.LogicDocumentController = new CLogicDocumentController(this); this.LogicDocumentController = new CLogicDocumentController(this);
...@@ -6829,7 +6834,7 @@ CDocument.prototype.OnKeyDown = function(e) ...@@ -6829,7 +6834,7 @@ CDocument.prototype.OnKeyDown = function(e)
} }
else if (e.KeyCode == 83 && false === this.IsViewMode() && true === e.CtrlKey) // Ctrl + S - save else if (e.KeyCode == 83 && false === this.IsViewMode() && true === e.CtrlKey) // Ctrl + S - save
{ {
this.DrawingDocument.m_oWordControl.m_oApi.asc_Save(false); this.Api.asc_Save(false);
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if (e.KeyCode == 85 && true === e.CtrlKey) // Ctrl + U - делаем текст подчеркнутым else if (e.KeyCode == 85 && true === e.CtrlKey) // Ctrl + U - делаем текст подчеркнутым
...@@ -6890,17 +6895,38 @@ CDocument.prototype.OnKeyDown = function(e) ...@@ -6890,17 +6895,38 @@ CDocument.prototype.OnKeyDown = function(e)
} }
else if (e.KeyCode === 112 && true === e.ShiftKey) else if (e.KeyCode === 112 && true === e.ShiftKey)
{ {
this.Api.asc_AddContentControl(AscCommonWord.sdttype_InlineLevel); if (true === e.CtrlKey)
{
this.BeginViewModeInReview(true);
}
else
{
this.Api.asc_AddContentControl(AscCommonWord.sdttype_InlineLevel);
}
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if (e.KeyCode === 113 && true === e.ShiftKey) else if (e.KeyCode === 113 && true === e.ShiftKey)
{ {
this.Api.asc_AddContentControl(AscCommonWord.sdttype_BlockLevel); if (true === e.CtrlKey)
{
this.BeginViewModeInReview(false);
}
else
{
this.Api.asc_AddContentControl(AscCommonWord.sdttype_BlockLevel);
}
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if (e.KeyCode === 114 && true === e.ShiftKey) else if (e.KeyCode === 114 && true === e.ShiftKey)
{ {
this.Api.asc_RemoveContentControl(); if (true === e.CtrlKey)
{
this.EndViewModeInReview();
}
else
{
this.Api.asc_RemoveContentControl();
}
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if (e.KeyCode === 115 && true === e.ShiftKey) else if (e.KeyCode === 115 && true === e.ShiftKey)
...@@ -15470,6 +15496,54 @@ CDocument.prototype.OnEndLoadScript = function() ...@@ -15470,6 +15496,54 @@ CDocument.prototype.OnEndLoadScript = function()
arrParagraphs[nIndex].Recalc_RunsCompiledPr(); arrParagraphs[nIndex].Recalc_RunsCompiledPr();
} }
}; };
CDocument.prototype.BeginViewModeInReview = function(isResult)
{
if (0 !== this.ViewModeInReview.mode)
this.EndViewModeInReview();
this.ViewModeInReview.mode = isResult ? 1 : -1;
this.ViewModeInReview.isFastCollaboration = this.CollaborativeEditing.Is_Fast();
this.CollaborativeEditing.Set_Fast(false);
this.History.SaveRedoPoints();
if (isResult)
this.Accept_AllRevisionChanges(true);
else
this.Reject_AllRevisionChanges(true);
this.CollaborativeEditing.Set_GlobalLock(true);
};
CDocument.prototype.EndViewModeInReview = function()
{
if (0 === this.ViewModeInReview.mode)
return;
this.ViewModeInReview.mode = 0;
this.CollaborativeEditing.Set_GlobalLock(false);
this.Document_Undo();
this.History.Clear_Redo();
this.History.PopRedoPoints();
if (this.ViewModeInReview.isFastCollaboration)
this.CollaborativeEditing.Set_Fast(true);
};
CDocument.prototype.StartCollaborationEditing = function()
{
this.CollaborativeEditing.Start_CollaborationEditing();
this.DrawingDocument.Start_CollaborationEditing();
this.EndViewModeInReview();
};
CDocument.prototype.EndCollaborationEditing = function()
{
this.CollaborativeEditing.End_CollaborationEditing();
};
CDocument.prototype.IsViewModeInReview = function()
{
return 0 !== this.ViewModeInReview.mode ? true : false;
};
function CDocumentSelectionState() function CDocumentSelectionState()
{ {
......
...@@ -78,6 +78,8 @@ function CHistory(Document) ...@@ -78,6 +78,8 @@ function CHistory(Document)
// Параметры для специального сохранения для локальной версии редактора // Параметры для специального сохранения для локальной версии редактора
this.UserSaveMode = false; this.UserSaveMode = false;
this.UserSavedIndex = null; // Номер точки, на которой произошло последнее сохранение пользователем (не автосохранение) this.UserSavedIndex = null; // Номер точки, на которой произошло последнее сохранение пользователем (не автосохранение)
this.StoredData = [];
} }
CHistory.prototype = CHistory.prototype =
...@@ -844,17 +846,20 @@ CHistory.prototype = ...@@ -844,17 +846,20 @@ CHistory.prototype =
} }
}, },
Have_Changes : function(IsNotUserSave) Have_Changes : function(IsNotUserSave)
{ {
var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex; if (this.Document.IsViewModeInReview())
if (-1 === this.Index && null === checkIndex && false === this.ForceSave) return false;
return false;
if (this.Index != checkIndex || true === this.ForceSave) var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex;
return true; if (-1 === this.Index && null === checkIndex && false === this.ForceSave)
return false;
return false; if (this.Index != checkIndex || true === this.ForceSave)
}, return true;
return false;
},
Get_RecalcData : function(RecalcData, arrChanges) Get_RecalcData : function(RecalcData, arrChanges)
{ {
...@@ -1221,6 +1226,29 @@ CHistory.prototype.SetRecalculateIndex = function(nIndex) ...@@ -1221,6 +1226,29 @@ CHistory.prototype.SetRecalculateIndex = function(nIndex)
{ {
this.RecIndex = Math.min(this.Index, nIndex); this.RecIndex = Math.min(this.Index, nIndex);
}; };
CHistory.prototype.SaveRedoPoints = function()
{
var arrData = [];
this.StoredData.push(arrData);
for (var nIndex = this.Index + 1, nCount = this.Points.length; nIndex < nCount; ++nIndex)
{
arrData.push(this.Points[nIndex]);
}
};
CHistory.prototype.PopRedoPoints = function()
{
if (this.StoredData.length <= 0)
return;
var arrPoints = this.StoredData[this.StoredData.length - 1];
this.Points.length = this.Index + 1;
for (var nIndex = 0, nCount = arrPoints.length; nIndex < nCount; ++nIndex)
{
this.Points[this.Index + nIndex + 1] = arrPoints[nIndex];
}
this.StoredData.length = this.StoredData.length - 1;
};
function CRC32() function CRC32()
{ {
......
...@@ -473,10 +473,10 @@ CDocument.prototype.RejectRevisionChangesBySelection = function() ...@@ -473,10 +473,10 @@ CDocument.prototype.RejectRevisionChangesBySelection = function()
this.Get_NextRevisionChange(); this.Get_NextRevisionChange();
}; };
CDocument.prototype.Accept_AllRevisionChanges = function() CDocument.prototype.Accept_AllRevisionChanges = function(isSkipCheckLock)
{ {
var RelatedParas = this.TrackRevisionsManager.Get_AllChangesRelatedParagraphs(true); var RelatedParas = this.TrackRevisionsManager.Get_AllChangesRelatedParagraphs(true);
if (false === this.Document_Is_SelectionLocked(AscCommon.changestype_None, { Type : changestype_2_ElementsArray_and_Type, Elements : RelatedParas, CheckType : AscCommon.changestype_Paragraph_Content})) if (true === isSkipCheckLock || false === this.Document_Is_SelectionLocked(AscCommon.changestype_None, { Type : changestype_2_ElementsArray_and_Type, Elements : RelatedParas, CheckType : AscCommon.changestype_Paragraph_Content}))
{ {
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_AcceptAllRevisionChanges); this.Create_NewHistoryPoint(AscDFH.historydescription_Document_AcceptAllRevisionChanges);
var LogicDocuments = this.TrackRevisionsManager.Get_AllChangesLogicDocuments(); var LogicDocuments = this.TrackRevisionsManager.Get_AllChangesLogicDocuments();
...@@ -489,7 +489,7 @@ CDocument.prototype.Accept_AllRevisionChanges = function() ...@@ -489,7 +489,7 @@ CDocument.prototype.Accept_AllRevisionChanges = function()
} }
} }
if (true === this.History.Is_LastPointEmpty()) if (true !== isSkipCheckLock && true === this.History.Is_LastPointEmpty())
{ {
this.History.Remove_LastPoint(); this.History.Remove_LastPoint();
return; return;
...@@ -502,10 +502,10 @@ CDocument.prototype.Accept_AllRevisionChanges = function() ...@@ -502,10 +502,10 @@ CDocument.prototype.Accept_AllRevisionChanges = function()
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
} }
}; };
CDocument.prototype.Reject_AllRevisionChanges = function() CDocument.prototype.Reject_AllRevisionChanges = function(isSkipCheckLock)
{ {
var RelatedParas = this.TrackRevisionsManager.Get_AllChangesRelatedParagraphs(false); var RelatedParas = this.TrackRevisionsManager.Get_AllChangesRelatedParagraphs(false);
if (false === this.Document_Is_SelectionLocked(AscCommon.changestype_None, { Type : changestype_2_ElementsArray_and_Type, Elements : RelatedParas, CheckType : AscCommon.changestype_Paragraph_Content})) if (true === isSkipCheckLock || false === this.Document_Is_SelectionLocked(AscCommon.changestype_None, { Type : changestype_2_ElementsArray_and_Type, Elements : RelatedParas, CheckType : AscCommon.changestype_Paragraph_Content}))
{ {
this.Create_NewHistoryPoint(AscDFH.historydescription_Document_RejectAllRevisionChanges); this.Create_NewHistoryPoint(AscDFH.historydescription_Document_RejectAllRevisionChanges);
var LogicDocuments = this.TrackRevisionsManager.Get_AllChangesLogicDocuments(); var LogicDocuments = this.TrackRevisionsManager.Get_AllChangesLogicDocuments();
...@@ -518,7 +518,7 @@ CDocument.prototype.Reject_AllRevisionChanges = function() ...@@ -518,7 +518,7 @@ CDocument.prototype.Reject_AllRevisionChanges = function()
} }
} }
if (true === this.History.Is_LastPointEmpty()) if (true !== isSkipCheckLock && true === this.History.Is_LastPointEmpty())
{ {
this.History.Remove_LastPoint(); this.History.Remove_LastPoint();
return; return;
......
...@@ -1467,9 +1467,8 @@ background-repeat: no-repeat;\ ...@@ -1467,9 +1467,8 @@ background-repeat: no-repeat;\
} }
if (t.ParcedDocument) { if (t.ParcedDocument) {
if (isStartEvent) { if (isStartEvent) {
AscCommon.CollaborativeEditing.Start_CollaborationEditing(); t.WordControl.m_oLogicDocument.StartCollaborationEditing();
t.asc_setDrawCollaborationMarks(true); t.asc_setDrawCollaborationMarks(true);
t.WordControl.m_oLogicDocument.DrawingDocument.Start_CollaborationEditing();
if(window['AscCommon'].g_clipboardBase && AscCommon.CollaborativeEditing.m_bFast){ if(window['AscCommon'].g_clipboardBase && AscCommon.CollaborativeEditing.m_bFast){
window['AscCommon'].g_clipboardBase.SpecialPasteButton_Hide(); window['AscCommon'].g_clipboardBase.SpecialPasteButton_Hide();
} }
...@@ -1491,7 +1490,7 @@ background-repeat: no-repeat;\ ...@@ -1491,7 +1490,7 @@ background-repeat: no-repeat;\
if (t.canUnlockDocument) { if (t.canUnlockDocument) {
t.canStartCoAuthoring = false; t.canStartCoAuthoring = false;
} else { } else {
AscCommon.CollaborativeEditing.End_CollaborationEditing(); t.WordControl.m_oLogicDocument.EndCollaborationEditing();
t.asc_setDrawCollaborationMarks(false); t.asc_setDrawCollaborationMarks(false);
} }
}; };
......
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