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

Added new function CDocument.CanEdit() to check whether we can edit the...

Added new function CDocument.CanEdit() to check whether we can edit the document or not. This check was added to a function that checks for locks, so there is no need to set GlobalLock in FillingForm mode and AddCommentsInView mode.
parent 599e6ca1
......@@ -36,9 +36,12 @@ var locktype_Mine = AscCommon.locktype_Mine;
if(typeof CDocument !== "undefined")
{
CDocument.prototype.Document_Is_SelectionLocked = function(CheckType, AdditionalData, DontLockInFastMode, isFillingForm)
CDocument.prototype.Document_Is_SelectionLocked = function(CheckType, AdditionalData, DontLockInFastMode, isIgnoreCanEditFlag)
{
if (true === AscCommon.CollaborativeEditing.Get_GlobalLock() && true !== isFillingForm)
if (!this.CanEdit() && true !== isIgnoreCanEditFlag)
return true;
if (true === AscCommon.CollaborativeEditing.Get_GlobalLock())
return true;
AscCommon.CollaborativeEditing.OnStart_CheckLock();
......
This diff is collapsed.
......@@ -1446,11 +1446,11 @@ Paragraph.prototype.Internal_Draw_3 = function(CurPage, pGraphics, Pr)
var DocumentComments = LogicDocument.Comments;
var Page_abs = this.Get_AbsolutePage(CurPage);
var DrawComm = ( DocumentComments.Is_Use() && (true !== LogicDocument.IsViewMode() || true === LogicDocument.CanEditCommentsInViewMode()));
var DrawComm = ( DocumentComments.Is_Use() && true !== LogicDocument.IsViewMode());
var DrawFind = LogicDocument.SearchEngine.Selection;
var DrawColl = ( undefined === pGraphics.RENDERER_PDF_FLAG ? false : true );
var DrawMMFields = (this.LogicDocument && true === this.LogicDocument.Is_HightlightMailMergeFields() ? true : false);
var DrawSolvedComments = ( DocumentComments.IsUseSolved() && (true !== LogicDocument.IsViewMode() || true === LogicDocument.CanEditCommentsInViewMode()));
var DrawSolvedComments = ( DocumentComments.IsUseSolved() && true !== LogicDocument.IsViewMode());
PDSH.Reset(this, pGraphics, DrawColl, DrawFind, DrawComm, DrawMMFields, this.Get_EndInfoByPage(CurPage - 1), DrawSolvedComments);
......@@ -6031,7 +6031,7 @@ Paragraph.prototype.Selection_SetEnd = function(X, Y, CurPage, MouseEvent, bTabl
{
var PagesCount = this.Pages.length;
if (this.bFromDocument && this.LogicDocument && false === this.LogicDocument.IsViewMode() && null === this.Parent.Is_HdrFtr(true) && null == this.Get_DocumentNext() && CurPage >= PagesCount - 1 && Y > this.Pages[PagesCount - 1].Bounds.Bottom && MouseEvent.ClickCount >= 2)
if (this.bFromDocument && this.LogicDocument && true === this.LogicDocument.CanEdit() && null === this.Parent.Is_HdrFtr(true) && null == this.Get_DocumentNext() && CurPage >= PagesCount - 1 && Y > this.Pages[PagesCount - 1].Bounds.Bottom && MouseEvent.ClickCount >= 2)
return this.Parent.Extend_ToPos(X, Y);
// Обновляем позицию курсора
......@@ -6052,10 +6052,7 @@ Paragraph.prototype.Selection_SetEnd = function(X, Y, CurPage, MouseEvent, bTabl
var LastRange = this.Lines[this.Lines.length - 1].Ranges[this.Lines[this.Lines.length - 1].Ranges.length - 1];
if (CurPage >= PagesCount - 1 && X > LastRange.W && MouseEvent.ClickCount >= 2 && Y <= this.Pages[PagesCount - 1].Bounds.Bottom)
{
if (this.bFromDocument
&& this.LogicDocument
&& false === this.LogicDocument.IsViewMode()
&& false === this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None, {
if (this.bFromDocument && false === this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None, {
Type : AscCommon.changestype_2_Element_and_Type,
Element : this,
CheckType : AscCommon.changestype_Paragraph_Content
......
......@@ -4439,7 +4439,7 @@ CTable.prototype.Selection_SetEnd = function(X, Y, CurPage, MouseEvent)
if (this.Selection.Type2 === table_Selection_Border)
{
var LogicDocument = this.LogicDocument;
if (!LogicDocument || true === LogicDocument.IsViewMode() || this.Selection.Data2.PageNum != CurPage)
if (!LogicDocument || true !== LogicDocument.CanEdit() || this.Selection.Data2.PageNum != CurPage)
return;
var _X = X;
......
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