diff --git a/common/wordcopypaste.js b/common/wordcopypaste.js index 2b6feefba4..998447d477 100644 --- a/common/wordcopypaste.js +++ b/common/wordcopypaste.js @@ -8437,6 +8437,27 @@ PasteProcessor.prototype = Index: -1 }; } + } else if ("w:sdt" === nodeName && node.getAttribute && node.getAttribute("checkbox")) { + + let checkedFont = node.getAttribute("checkboxfontchecked"); + if (!checkedFont) { + checkedFont = Asc.c_oAscSdtCheckBoxDefaults.CheckedFont; + } + + this.oFonts[checkedFont] = { + Name: g_fontApplication.GetFontNameDictionary(checkedFont, true), + Index: -1 + }; + + let uncheckedFont = node.getAttribute("checkboxfontunchecked"); + if (!uncheckedFont) { + uncheckedFont = Asc.c_oAscSdtCheckBoxDefaults.UncheckedFont; + } + + this.oFonts[uncheckedFont] = { + Name: g_fontApplication.GetFontNameDictionary(uncheckedFont, true), + Index: -1 + }; } else { var src = node.getAttribute("src"); if (src && !this._checkSkipMath(node)) @@ -10800,9 +10821,8 @@ PasteProcessor.prototype = // // //

- // - // - // + // + // //

// // @@ -10850,7 +10870,7 @@ PasteProcessor.prototype = // // //

- // Choice 1 + // //

// // @@ -10969,14 +10989,15 @@ PasteProcessor.prototype = } }; + let isForm = node && node.attributes && checkBoolAttr(node.attributes["form"]); let isBlockLevelSdt = node.getElementsByTagName("p").length > 0; - let levelSdt = isBlockLevelSdt ? + let levelSdt = isBlockLevelSdt && !isForm ? new CBlockLevelSdt(this.oLogicDocument, this.oDocument) : new CInlineLevelSdt(); let checkBox, dropdown, comboBox; let isContentAdded = false; - let plcHdrText, isForm; + let plcHdrText; if (node && node.attributes) { let _type = getType(node.attributes); @@ -11009,7 +11030,6 @@ PasteProcessor.prototype = levelSdt.SetShowingPlcHdr(true); } - isForm = checkBoolAttr(node.attributes["form"]); if (AscCommon.IsSupportOFormFeature() && isForm) { this._applyFormProperties(node, levelSdt); } @@ -11019,11 +11039,15 @@ PasteProcessor.prototype = if (checkBox) { oPr = this._createCheckBoxPr(node, getCharCode); levelSdt.ApplyCheckBoxPr(oPr); + isContentAdded = true; + if (node.attributes["text"]) { + levelSdt.SetCheckBoxLabel(node.attributes["text"].value); + } } let id = node.attributes["id"]; if (id && id.value) { - levelSdt.Pr.Id = id.value; + levelSdt.SetContentControlId(id.value); } comboBox = _type === "combobox"; diff --git a/word/Editor/StructuredDocumentTags/BlockLevel.js b/word/Editor/StructuredDocumentTags/BlockLevel.js index 62a6d3edc9..623fa6ea5f 100644 --- a/word/Editor/StructuredDocumentTags/BlockLevel.js +++ b/word/Editor/StructuredDocumentTags/BlockLevel.js @@ -2043,6 +2043,12 @@ CBlockLevelSdt.prototype.SetCheckBoxPr = function(oCheckBoxPr) { if (undefined === this.Pr.CheckBox || !this.Pr.CheckBox.IsEqual(oCheckBoxPr)) { + if (oCheckBoxPr && AscFonts.IsCheckSymbols) + { + AscFonts.FontPickerByCharacter.getFontBySymbol(oCheckBoxPr.GetCheckedSymbol()); + AscFonts.FontPickerByCharacter.getFontBySymbol(oCheckBoxPr.GetUncheckedSymbol()); + } + History.Add(new CChangesSdtPrCheckBox(this, this.Pr.CheckBox, oCheckBoxPr)); this.Pr.CheckBox = oCheckBoxPr; } diff --git a/word/Editor/StructuredDocumentTags/InlineLevel.js b/word/Editor/StructuredDocumentTags/InlineLevel.js index 4ed818232b..5e6db9db8a 100644 --- a/word/Editor/StructuredDocumentTags/InlineLevel.js +++ b/word/Editor/StructuredDocumentTags/InlineLevel.js @@ -2300,6 +2300,12 @@ CInlineLevelSdt.prototype.SetCheckBoxPr = function(oCheckBoxPr) { if (undefined === this.Pr.CheckBox || !this.Pr.CheckBox.IsEqual(oCheckBoxPr)) { + if (oCheckBoxPr && AscFonts.IsCheckSymbols) + { + AscFonts.FontPickerByCharacter.getFontBySymbol(oCheckBoxPr.GetCheckedSymbol()); + AscFonts.FontPickerByCharacter.getFontBySymbol(oCheckBoxPr.GetUncheckedSymbol()); + } + var _oCheckBox = oCheckBoxPr ? oCheckBoxPr.Copy() : undefined; History.Add(new CChangesSdtPrCheckBox(this, this.Pr.CheckBox, _oCheckBox)); this.Pr.CheckBox = _oCheckBox; diff --git a/word/Editor/StructuredDocumentTags/SdtBase.js b/word/Editor/StructuredDocumentTags/SdtBase.js index 9935e8dbf3..af1a55751c 100644 --- a/word/Editor/StructuredDocumentTags/SdtBase.js +++ b/word/Editor/StructuredDocumentTags/SdtBase.js @@ -1088,6 +1088,10 @@ CSdtBase.prototype.MoveCursorOutsideForm = function(isBefore) }; CSdtBase.prototype.GetFieldMaster = function() { + let mainForm = this.GetMainForm(); + if (mainForm && mainForm !== this) + return mainForm.GetFieldMaster(); + let formPr = this.GetFormPr(); if (!formPr) return null;