Commit f1fd009a authored by SergeyLuzyanin's avatar SergeyLuzyanin

only comments mode in presentation

parent 72ce161e
...@@ -750,8 +750,11 @@ if(typeof CComments !== "undefined") ...@@ -750,8 +750,11 @@ if(typeof CComments !== "undefined")
if(typeof CPresentation !== "undefined") if(typeof CPresentation !== "undefined")
{ {
CPresentation.prototype.Document_Is_SelectionLocked = function(CheckType, AdditionalData) CPresentation.prototype.Document_Is_SelectionLocked = function(CheckType, AdditionalData, isIgnoreCanEditFlag)
{ {
if (!this.CanEdit() && true !== isIgnoreCanEditFlag)
return true;
if ( true === AscCommon.CollaborativeEditing.Get_GlobalLock() ) if ( true === AscCommon.CollaborativeEditing.Get_GlobalLock() )
return true; return true;
if(this.Slides.length === 0) if(this.Slides.length === 0)
......
...@@ -433,7 +433,7 @@ MoveCommentState.prototype = ...@@ -433,7 +433,7 @@ MoveCommentState.prototype =
onMouseUp: function(e, x, y, pageIndex) onMouseUp: function(e, x, y, pageIndex)
{ {
if(!this.drawingObjects.isViewMode() && editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_MoveComment, this.comment.Get_Id()) === false) if(editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_MoveComment, this.comment.Get_Id(), editor.WordControl.m_oLogicDocument.IsEditCommentsMode()) === false)
{ {
History.Create_NewPoint(AscDFH.historydescription_Presentation_MoveComments); History.Create_NewPoint(AscDFH.historydescription_Presentation_MoveComments);
var tracks = this.drawingObjects.arrTrackObjects; var tracks = this.drawingObjects.arrTrackObjects;
......
...@@ -658,9 +658,15 @@ CPresentation.prototype = ...@@ -658,9 +658,15 @@ CPresentation.prototype =
return this.Api.isViewMode; return this.Api.isViewMode;
}, },
IsEditCommentsMode: function()
{
return (this.Api.restrictions === Asc.c_oAscRestrictionType.OnlyComments);
},
CanEdit: function() CanEdit: function()
{ {
if (this.IsViewMode()) if (this.IsViewMode() ||this.IsEditCommentsMode())
return false; return false;
return true; return true;
...@@ -3225,14 +3231,19 @@ CPresentation.prototype = ...@@ -3225,14 +3231,19 @@ CPresentation.prototype =
} }
} }
} }
else if ( e.KeyCode == 89 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + Y - Redo else if ( e.KeyCode == 89 && true === e.CtrlKey ) // Ctrl + Y - Redo
{ {
if(this.CanEdit() || this.IsEditCommentsMode()){
this.Document_Redo(); this.Document_Redo();
}
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if ( e.KeyCode == 90 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + Z - Undo else if ( e.KeyCode == 90 && true === e.CtrlKey ) // Ctrl + Z - Undo
{ {
if(this.CanEdit() || this.IsEditCommentsMode()){
this.Document_Undo(); this.Document_Undo();
}
bRetValue = keydownresult_PreventAll; bRetValue = keydownresult_PreventAll;
} }
else if ( e.KeyCode == 93 || 57351 == e.KeyCode /*в Opera такой код*/ || (e.KeyCode == 121 && true === e.ShiftKey /*shift + f10*/)) // контекстное меню else if ( e.KeyCode == 93 || 57351 == e.KeyCode /*в Opera такой код*/ || (e.KeyCode == 121 && true === e.ShiftKey /*shift + f10*/)) // контекстное меню
...@@ -3348,7 +3359,7 @@ CPresentation.prototype = ...@@ -3348,7 +3359,7 @@ CPresentation.prototype =
OnKeyPress : function(e) OnKeyPress : function(e)
{ {
if ( true === editor.isViewMode ) if (!this.CanEdit())
return false; return false;
var oCurSlide = this.Slides[this.CurPage]; var oCurSlide = this.Slides[this.CurPage];
...@@ -5425,7 +5436,7 @@ CPresentation.prototype = ...@@ -5425,7 +5436,7 @@ CPresentation.prototype =
this.Slides[this.CurPage].commentX += W; this.Slides[this.CurPage].commentX += W;
this.Slides[this.CurPage].commentY += H; this.Slides[this.CurPage].commentY += H;
if(this.Document_Is_SelectionLocked(AscCommon.changestype_AddComment, Comment) === false) if(this.Document_Is_SelectionLocked(AscCommon.changestype_AddComment, Comment, this.IsEditCommentsMode()) === false)
{ {
for(var i = this.Slides[this.CurPage].slideComments.comments.length - 1; i > -1; --i) for(var i = this.Slides[this.CurPage].slideComments.comments.length - 1; i > -1; --i)
{ {
...@@ -5452,7 +5463,7 @@ CPresentation.prototype = ...@@ -5452,7 +5463,7 @@ CPresentation.prototype =
EditComment : function(Id, CommentData) EditComment : function(Id, CommentData)
{ {
if(this.Document_Is_SelectionLocked(AscCommon.changestype_MoveComment, Id) === false) if(this.Document_Is_SelectionLocked(AscCommon.changestype_MoveComment, Id, this.IsEditCommentsMode()) === false)
{ {
History.Create_NewPoint(AscDFH.historydescription_Presentation_ChangeComment); History.Create_NewPoint(AscDFH.historydescription_Presentation_ChangeComment);
var comment = g_oTableId.Get_ById(Id); var comment = g_oTableId.Get_ById(Id);
...@@ -5530,6 +5541,8 @@ CPresentation.prototype = ...@@ -5530,6 +5541,8 @@ CPresentation.prototype =
CanAddComment : function() CanAddComment : function()
{ {
if (!this.CanEdit() && !this.IsEditCommentsMode())
return false;
return true; return true;
}, },
......
...@@ -4385,7 +4385,7 @@ background-repeat: no-repeat;\ ...@@ -4385,7 +4385,7 @@ background-repeat: no-repeat;\
if (null == this.WordControl.m_oLogicDocument) if (null == this.WordControl.m_oLogicDocument)
return; return;
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_MoveComment, Id)) if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_MoveComment, Id, this.WordControl.m_oLogicDocument.IsEditCommentsMode()))
{ {
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Presentation_RemoveComment); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Presentation_RemoveComment);
this.WordControl.m_oLogicDocument.RemoveComment(Id, true); this.WordControl.m_oLogicDocument.RemoveComment(Id, true);
......
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