Commit 187b5675 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented function for changing content control properties.

parent 02ed3a83
......@@ -1025,6 +1025,9 @@
case AscDFH.historydescription_Document_RemoveContentControlWrapper:
sString = "Document_RemoveContentControlWrapper";
break;
case AscDFH.historydescription_Document_ChangeContentControlProperties:
sString = "Document_ChangeContentControlProperties";
break;
}
return sString;
}
......@@ -2915,6 +2918,7 @@
window['AscDFH'].historydescription_Document_AddInlineLevelContentControl = 0x0142;
window['AscDFH'].historydescription_Document_RemoveContentControl = 0x0143;
window['AscDFH'].historydescription_Document_RemoveContentControlWrapper = 0x0144;
window['AscDFH'].historydescription_Document_ChangeContentControlProperties = 0x0145;
......
......@@ -629,8 +629,10 @@ CBlockLevelSdt.prototype.Document_Is_SelectionLocked = function(CheckType, bChec
var nContentControlLock = this.GetContentControlLock();
if (AscCommon.changestype_ContentControl_Remove === CheckType
|| AscCommon.changestype_ContentControl_Properties === CheckType)
if (AscCommon.changestype_ContentControl_Properties === CheckType)
return this.Lock.Check(this.GetId());
if (AscCommon.changestype_ContentControl_Remove === CheckType)
this.Lock.Check(this.GetId());
if (isCheckContentControlLock
......
......@@ -375,6 +375,31 @@ CInlineLevelSdt.prototype.GetContentControlLock = function()
{
return (undefined !== this.Pr.Lock ? this.Pr.Lock : sdtlock_Unlocked);
};
CInlineLevelSdt.prototype.SetContentControlPr = function(oPr)
{
if (!oPr)
return;
if (undefined !== oPr.Tag)
this.SetTag(oPr.Tag);
if (undefined !== oPr.Id)
this.SetContentControlId(oPr.Id);
if (undefined !== oPr.Lock)
this.SetContentControlLock(oPr.Lock);
};
CInlineLevelSdt.prototype.GetContentControlPr = function()
{
var oPr = new CContentControlPr();
oPr.Tag = this.Pr.Tag;
oPr.Id = this.Pr.Id;
oPr.Lock = this.Pr.Lock;
oPr.InternalId = this.GetId();
return oPr;
};
//----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -7355,13 +7355,68 @@ background-repeat: no-repeat;\
if (false === isLocked)
{
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_RemoveContentControl);
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_RemoveContentControlWrapper);
oLogicDocument.RemoveContentControlWrapper(Id);
oLogicDocument.Recalculate();
oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateSelectionState();
}
};
asc_docs_api.prototype.asc_SetContentControlProperties = function(oContentControlPr, Id)
{
var oLogicDocument = this.WordControl.m_oLogicDocument;
if (!oLogicDocument)
return;
var isLocked = true;
var oContentControl = null;
if (undefined === Id)
{
var oInfo = oLogicDocument.GetSelectedElementsInfo();
var oInlineControl = oInfo.GetInlineLevelSdt();
var oBlockControl = oInfo.GetBlockLevelSdt();
if (oInlineControl)
oContentControl = oInlineControl;
else if (oBlockControl)
oContentControl = oBlockControl;
}
else
{
oContentControl = AscCommon.g_oTableId.Get_ById(Id);
}
if (oContentControl && oContentControl.GetContentControlType)
{
if (AscCommonWord.sdttype_BlockLevel === oContentControl.GetContentControlType())
{
isLocked = oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None, {
Type : AscCommon.changestype_2_ElementsArray_and_Type,
Elements : [oContentControl],
CheckType : AscCommon.changestype_ContentControl_Properties
});
}
else if (AscCommonWord.sdttype_InlineLevel === oContentControl.GetContentControlType())
{
var oParagraph = oContentControl.GetParagraph();
if (oParagraph)
{
isLocked = oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None, {
Type : AscCommon.changestype_2_ElementsArray_and_Type,
Elements : [oParagraph],
CheckType : AscCommon.changestype_Paragraph_Properties
});
}
}
}
if (false === isLocked)
{
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_ChangeContentControlProperties);
oContentControl.SetContentControlPr(oContentControlPr);
oLogicDocument.Document_UpdateInterfaceState();
}
};
// input
asc_docs_api.prototype.Begin_CompositeInput = function()
......
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