Compare commits

...

5 Commits

Author SHA1 Message Date
a3e8339c9b Fix bug #55868
Fix the problem with selection after undo/redo
2022-03-03 16:41:06 +03:00
8b5a088408 Fix bug #55866
Fix the problem with reverse selection when adding checkbox
2022-03-03 16:25:03 +03:00
1ed02174b2 For bug #55833
Fix the problem with creating non empty image form
2022-03-02 16:57:29 +03:00
be85148d32 Fix bug #55502
Fix the problem with adding checkboxes by text selection
2022-02-22 14:30:33 +03:00
d5a98c6335 For bug #55502 2022-02-16 15:11:16 +03:00

83
api.js
View File

@ -75,27 +75,78 @@
isLoadFonts = true;
AscFonts.FontPickerByCharacter.getFontBySymbol(nUncheckedSymbol);
}
function private_ApplyPrToCheckBox(oCC)
{
if (!oCC)
return;
if (oFormPr)
{
oCC.SetFormPr(oFormPr);
oCC.UpdatePlaceHolderTextPrForForm();
}
if (oCommonPr)
oCC.SetContentControlPr(oCommonPr);
}
function private_PerformAddCheckBox()
{
oLogicDocument.RemoveTextSelection();
if (!oLogicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Content))
{
oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox);
var oCC = oLogicDocument.AddContentControlCheckBox(oPr);
if (oCC && oFormPr)
if (oLogicDocument.IsTextSelectionUse())
{
let arrSelectedParagraphs = oLogicDocument.GetSelectedParagraphs();
// Выделяем целиком параграфы, чтобы после действия все добавленные чекбоксы попали в выделение
let nSelectDirection = oLogicDocument.GetSelectDirection();
for (let nIndex = 0, nCount = arrSelectedParagraphs.length; nIndex < nCount; ++nIndex)
{
oCC.SetFormPr(oFormPr);
oCC.UpdatePlaceHolderTextPrForForm();
arrSelectedParagraphs[nIndex].SelectAll(nSelectDirection);
}
if (oCC && oCommonPr)
oCC.SetContentControlPr(oCommonPr);
let oState = oLogicDocument.SaveDocumentState(false);
oLogicDocument.UpdateInterface();
oLogicDocument.Recalculate();
oLogicDocument.FinalizeAction();
if (arrSelectedParagraphs.length > 0
&& !oLogicDocument.IsSelectionLocked(AscCommon.changestype_None, {
Type : AscCommon.changestype_2_ElementsArray_and_Type,
Elements : arrSelectedParagraphs,
CheckType : AscCommon.changestype_Paragraph_Content
}))
{
oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox);
oLogicDocument.RemoveSelection();
for (let nIndex = 0, nCount = arrSelectedParagraphs.length; nIndex < nCount; ++nIndex)
{
let oCC = arrSelectedParagraphs[nIndex].AddCheckBoxToStartPos(oPr);
private_ApplyPrToCheckBox(oCC);
}
oLogicDocument.LoadDocumentState(oState);
oLogicDocument.UpdateInterface();
oLogicDocument.Recalculate();
oLogicDocument.FinalizeAction();
}
else
{
oLogicDocument.LoadDocumentState(oState);
}
}
else
{
oLogicDocument.RemoveTextSelection();
if (!oLogicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Content))
{
oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox);
var oCC = oLogicDocument.AddContentControlCheckBox(oPr);
private_ApplyPrToCheckBox(oCC);
oLogicDocument.UpdateInterface();
oLogicDocument.Recalculate();
oLogicDocument.FinalizeAction();
}
}
}
@ -130,6 +181,12 @@
oCC.UpdatePlaceHolderTextPrForForm();
oCC.ConvertFormToFixed();
oCC.SetPictureFormPr(new AscCommon.CSdtPictureFormPr());
if (!oCC.IsPlaceHolder())
{
oLogicDocument.Recalculate(true);
oCC.UpdatePictureFormLayout();
}
}
if (oCC && oCommonPr)