From 22cbda0f3a1878959a66eed0ba64402a3766c5ab Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 29 Oct 2025 18:14:30 +0300 Subject: [PATCH 1/4] [de] Don't return complex form if it is a labeled checkbox --- api.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api.js b/api.js index 9a45bf5..bcb19d4 100644 --- a/api.js +++ b/api.js @@ -80,7 +80,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; AscFonts.FontPickerByCharacter.getFontBySymbol(nUncheckedSymbol); } - function private_ApplyPrToCheckBox(oCC) + function private_ApplyPrToCheckBox(oCC, checkBoxPr) { if (!oCC) return; @@ -94,7 +94,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; else private_CheckFormKey(oCC, oLogicDocument); } - + if (oCommonPr) oCC.SetContentControlPr(oCommonPr); } @@ -128,7 +128,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; for (let nIndex = 0, nCount = arrSelectedParagraphs.length; nIndex < nCount; ++nIndex) { let oCC = arrSelectedParagraphs[nIndex].AddCheckBoxToStartPos(oPr); - private_ApplyPrToCheckBox(oCC); + private_ApplyPrToCheckBox(oCC, oPr); } oLogicDocument.LoadDocumentState(oState); @@ -149,7 +149,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox); var oCC = oLogicDocument.AddContentControlCheckBox(oPr); - private_ApplyPrToCheckBox(oCC); + private_ApplyPrToCheckBox(oCC, oPr); oLogicDocument.UpdateInterface(); oLogicDocument.Recalculate(); @@ -464,8 +464,10 @@ window["AscOForm"] = window.AscOForm = AscOForm; return null; let mainForm = form.GetMainForm(); + if (!mainForm || !mainForm.IsComplexForm() || mainForm.IsLabeledCheckBox()) + return null; - return (mainForm.IsComplexForm() ? mainForm : null); + return mainForm; }; window['Asc']['asc_docs_api'].prototype['asc_ConvertFormToJson'] = window['Asc']['asc_docs_api'].prototype.asc_ConvertFormToJson = function(form) { From 1daac752fae3e2731ac5ad3f8560134235f714b4 Mon Sep 17 00:00:00 2001 From: EvgeniyIgol Date: Sat, 1 Nov 2025 12:58:45 +0300 Subject: [PATCH 2/4] Add data for macro writing --- api.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api.js b/api.js index bcb19d4..b284b3c 100644 --- a/api.js +++ b/api.js @@ -122,7 +122,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; CheckType : AscCommon.changestype_Paragraph_Content })) { - oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox); + oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox, undefined, undefined, true); oLogicDocument.RemoveSelection(); for (let nIndex = 0, nCount = arrSelectedParagraphs.length; nIndex < nCount; ++nIndex) @@ -146,7 +146,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; oLogicDocument.RemoveTextSelection(); if (!oLogicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)) { - oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox); + oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlCheckBox, undefined, undefined, true); var oCC = oLogicDocument.AddContentControlCheckBox(oPr); private_ApplyPrToCheckBox(oCC, oPr); @@ -182,7 +182,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; oLogicDocument.RemoveTextSelection(); if (!oLogicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)) { - oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlPicture); + oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlPicture, undefined, undefined, true); // 150x32pt for Signature let w = isSignature ? 150 / 72 * 25.4 : undefined; @@ -309,7 +309,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; oLogicDocument.RemoveTextSelection(); if (!oLogicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)) { - oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlList); + oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlList, undefined, undefined, isComboBox); var oCC; if (isComboBox) @@ -344,7 +344,7 @@ window["AscOForm"] = window.AscOForm = AscOForm; oLogicDocument.RemoveTextSelection(); if (!oLogicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)) { - oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlList); + oLogicDocument.StartAction(AscDFH.historydescription_Document_AddContentControlList, undefined, undefined, true); let dateTimePr = null; let formPr = null; From 4678111e19d664a740305f4a32d6513ec45e3e34 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 18 Nov 2025 12:16:31 +0300 Subject: [PATCH 3/4] For bug #78163 Check symbols before specifying the default form value --- api.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api.js b/api.js index b284b3c..d4133e6 100644 --- a/api.js +++ b/api.js @@ -493,7 +493,17 @@ window["AscOForm"] = window.AscOForm = AscOForm; if (!form || !form.IsForm()) return; - return this.private_SetFormValue(form.GetId(), value); + if (typeof(value) === "string") + { + let _t = this; + AscFonts.FontPickerByCharacter.checkText(value, this, function() { + _t.private_SetFormValue(form.GetId(), value); + }); + } + else + { + this.private_SetFormValue(form.GetId(), value); + } }; window['Asc']['asc_docs_api'].prototype['asc_GetFormValue'] = window['Asc']['asc_docs_api'].prototype.asc_GetFormValue = function(formId) { From f2901a3dc74138d611a6c6ef0cc2df5b622728d1 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 25 Nov 2025 21:51:40 +0300 Subject: [PATCH 4/4] Fix bug #77996 Don't allow to insert other forms inside a fixed labeled checkbox --- api.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api.js b/api.js index d4133e6..58b1730 100644 --- a/api.js +++ b/api.js @@ -737,6 +737,10 @@ window["AscOForm"] = window.AscOForm = AscOForm; { let form = logicDocument.GetContentControl(); + let mainForm = form ? form.GetMainForm() : null; + if (mainForm && mainForm.IsLabeledCheckBox()) + return mainForm.MoveCursorOutsideForm(false); + if (!form || !form.IsForm() || (form.IsComplexForm() && !isComplex)) return;