Commit a410e150 authored by Ilya Kirillov's avatar Ilya Kirillov

Wokred on various locking types of an inline content control class

parent 85823ec0
......@@ -381,19 +381,27 @@ CDocumentContent.prototype.CheckContentControlDeletingLock = function()
};
Paragraph.prototype.Document_Is_SelectionLocked = function(CheckType)
{
var isSelectionUse = this.IsSelectionUse();
var arrContentControls = this.GetSelectedContentControls();
for (var nIndex = 0, nCount = arrContentControls.length; nIndex < nCount; ++nIndex)
{
if (arrContentControls[nIndex].IsSelectionUse() === isSelectionUse)
arrContentControls[nIndex].Document_Is_SelectionLocked(CheckType);
}
var bCheckContentControl = false;
switch ( CheckType )
{
case AscCommon.changestype_Paragraph_Content:
case AscCommon.changestype_Paragraph_Properties:
case AscCommon.changestype_Paragraph_Properties:
case AscCommon.changestype_Document_Content:
case AscCommon.changestype_Document_Content_Add:
case AscCommon.changestype_Image_Properties:
{
this.Lock.Check( this.Get_Id() );
bCheckContentControl = true;
break;
}
{
this.Lock.Check( this.Get_Id() );
bCheckContentControl = true;
break;
}
case AscCommon.changestype_Remove:
{
// Если у нас нет выделения, и курсор стоит в начале, мы должны проверить в том же порядке, в каком
......@@ -647,6 +655,35 @@ CBlockLevelSdt.prototype.CheckContentControlDeletingLock = function()
this.Content.CheckContentControlEditingLock();
};
CInlineLevelSdt.prototype.Document_Is_SelectionLocked = function(CheckType)
{
var nContentControlLock = this.GetContentControlLock();
if ((AscCommon.changestype_Paragraph_Content === CheckType
|| AscCommon.changestype_Remove === CheckType
|| AscCommon.changestype_Delete === CheckType
|| AscCommon.changestype_Document_Content === CheckType
|| AscCommon.changestype_Document_Content_Add === CheckType)
&& this.IsSelectionUse()
&& this.IsSelectedAll())
{
if (AscCommonWord.sdtlock_SdtContentLocked === nContentControlLock || AscCommonWord.sdtlock_SdtLocked === nContentControlLock)
{
return AscCommon.CollaborativeEditing.Add_CheckLock(true);
}
}
else if ((AscCommon.changestype_Paragraph_Content === CheckType
|| AscCommon.changestype_Remove === CheckType
|| AscCommon.changestype_Delete === CheckType
|| AscCommon.changestype_Document_Content === CheckType
|| AscCommon.changestype_Document_Content_Add === CheckType
|| AscCommon.changestype_Image_Properties === CheckType)
&& (AscCommonWord.sdtlock_SdtContentLocked === nContentControlLock
|| AscCommonWord.sdtlock_ContentLocked === nContentControlLock))
{
return AscCommon.CollaborativeEditing.Add_CheckLock(true);
}
};
CTableCell.prototype.CheckContentControlEditingLock = function()
{
if (this.Row && this.Row.Table && this.Row.Table.Parent && this.Row.Table.Parent.CheckContentControlEditingLock)
......
......@@ -11984,6 +11984,34 @@ Paragraph.prototype.GetTargetPos = function()
{
return this.Internal_Recalculate_CurPos(this.CurPos.ContentPos, false, false, true);
};
Paragraph.prototype.GetSelectedContentControls = function()
{
var arrContentControls = [];
if (true === this.Selection.Use)
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (StartPos > EndPos)
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
for (var Index = StartPos; Index <= EndPos; ++Index)
{
if (this.Content[Index].GetSelectedContentControls)
this.Content[Index].GetSelectedContentControls(arrContentControls);
}
}
else
{
if (this.Content[this.CurPos.ContentPos].GetSelectedContentControls)
this.Content[this.CurPos.ContentPos].GetSelectedContentControls(arrContentControls);
}
return arrContentControls;
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
......
......@@ -2736,6 +2736,30 @@ CParagraphContentWithParagraphLikeContent.prototype.SelectThisElement = function
return true;
};
CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContentControls = function(arrContentControls)
{
if (true === this.Selection.Use)
{
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if (StartPos > EndPos)
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
for (var Index = StartPos; Index <= EndPos; ++Index)
{
if (this.Content[Index].GetSelectedContentControls)
this.Content[Index].GetSelectedContentControls(arrContentControls);
}
}
else
{
if (this.Content[this.State.ContentPos].GetSelectedContentControls)
this.Content[this.State.ContentPos].GetSelectedContentControls(arrContentControls);
}
};
//----------------------------------------------------------------------------------------------------------------------
// Функции, которые должны быть реализованы в классах наследниках
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -407,6 +407,7 @@ CInlineLevelSdt.prototype.SetContentControlLock = function(nLockType)
};
CInlineLevelSdt.prototype.GetContentControlLock = function()
{
return sdtlock_SdtContentLocked;
return (undefined !== this.Pr.Lock ? this.Pr.Lock : sdtlock_Unlocked);
};
//----------------------------------------------------------------------------------------------------------------------
......@@ -457,6 +458,11 @@ CInlineLevelSdt.prototype.IsStopCursorOnEntryExit = function()
{
return true;
};
CInlineLevelSdt.prototype.GetSelectedContentControls = function(arrContentControls)
{
arrContentControls.push(this);
CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContentControls.call(this, arrContentControls);
};
//--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CInlineLevelSdt = CInlineLevelSdt;
......
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