Commit 48552ab3 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented function in api for removing content control wrapping.

parent a10f0edb
......@@ -1022,6 +1022,9 @@
case AscDFH.historydescription_Document_RemoveContentControl:
sString = "Document_RemoveContentControl";
break;
case AscDFH.historydescription_Document_RemoveContentControlWrapper:
sString = "Document_RemoveContentControlWrapper";
break;
}
return sString;
}
......@@ -2911,8 +2914,7 @@
window['AscDFH'].historydescription_Document_AddBlockLevelContentControl = 0x0141;
window['AscDFH'].historydescription_Document_AddInlineLevelContentControl = 0x0142;
window['AscDFH'].historydescription_Document_RemoveContentControl = 0x0143;
window['AscDFH'].historydescription_Document_RemoveContentControlWrapper = 0x0144;
......
......@@ -7303,6 +7303,65 @@ background-repeat: no-repeat;\
oLogicDocument.Document_UpdateSelectionState();
}
};
asc_docs_api.prototype.asc_RemoveContentControlWrapper = function(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_Remove
});
}
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_Content
});
}
}
Id = oContentControl.GetId();
}
if (false === isLocked)
{
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_RemoveContentControl);
oLogicDocument.RemoveContentControlWrapper(Id);
oLogicDocument.Recalculate();
oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateSelectionState();
}
};
// 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