/// ------------------------------------------------------------------------------------ /// <summary> /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses /// need to separate this from applying the properties. /// </summary> /// <param name="vwenv"></param> /// <param name="paraHvo"></param> /// <param name="frag"></param> /// <param name="fApplyProps"></param> /// <param name="contentType"></param> /// <param name="vc">The view constructor used to create the paragraphs</param> /// ------------------------------------------------------------------------------------ protected void InsertParagraphBody(IVwEnv vwenv, int paraHvo, int frag, bool fApplyProps, ContentTypes contentType, StVc vc) { vc.SetupWsAndDirectionForPara(vwenv, paraHvo); if (fApplyProps) { ApplyParagraphStyleProps(vwenv, paraHvo, vc); } // This was causing assertions in the layoutmgr // TODO (TE-5777): Should be able to do this with an in-memory stylesheet. // if (DisplayTranslation) // { // // display the back translation text as double spaced // vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight, // (int)FwTextPropVar.ktpvRelative, 20000); // } // The body of the paragraph is either editable or not. vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, vc.Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable); // Make the paragraph containing the paragraph contents. OpenPara(vwenv, paraHvo); // Cause a regenerate when the style changes...this is mainly used for Undo. vwenv.NoteDependency(new[] { paraHvo }, new[] { StParaTags.kflidStyleRules }, 1); // Insert the label if it is the first paragraph. if (vc.Label != null) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); if (ihvoItem == 0) { vwenv.AddObj(paraHvo, vc, (int)StTextFrags.kfrLabel); } } if (frag == (int)StTextFrags.kfrFootnotePara) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); // Note a dependency on the footnote options so that the footnote will // be refreshed when these are changed. // If this is the 1st paragraph in the footnote... if (ihvoItem == 0) { vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker); vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteReference); } } if (contentType == ContentTypes.kctSimpleBT) { // If a translation is being shown instead of the paragraph, then show it instead // of the text of the paragraph. vwenv.AddObj(GetTranslationForPara(paraHvo), vc, (int)StTextFrags.kfrTranslation); if (!PrintLayout) { // This dependency is here so that the "Missing" prompt will be added to the // view when the first character is typed in the contents. But to solve the // problem with losing the IP when typing (FWR-1415), the dependency is not // added in print layout views. The missing prompt seems less of a problem // than the problem with typing. vwenv.NoteDependency(new[] { paraHvo }, new[] { StTxtParaTags.kflidContents }, 1); } } else if (contentType == ContentTypes.kctSegmentBT) { vwenv.AddObjVecItems(StTxtParaTags.kflidSegments, vc, (int)StTextFrags.kfrSegmentFreeTranslations); } else if (!InsertParaContentsUserPrompt(vwenv, paraHvo)) { // Display the text paragraph contents, or its user prompt. vwenv.AddStringProp(StTxtParaTags.kflidContents, null); } // Display an "end-of-paragraph" marker if needed InsertEndOfParaMarks(vwenv, paraHvo); vwenv.CloseParagraph(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses /// need to separate this from applying the properties. /// </summary> /// <param name="vwenv"></param> /// <param name="hvo"></param> /// <param name="frag"></param> /// <param name="fApplyProps"></param> /// <param name="contentType"></param> /// <param name="vc">The view constructor used to create the paragraphs</param> /// ------------------------------------------------------------------------------------ protected void InsertParagraphBody(IVwEnv vwenv, int hvo, int frag, bool fApplyProps, ContentTypes contentType, StVc vc) { vc.SetupWsAndDirectionForPara(vwenv, hvo); if (fApplyProps) ApplyParagraphStyleProps(vwenv, hvo, vc); // This was causing assertions in the layoutmgr // TODO (TE-5777): Should be able to do this with an in-memory stylesheet. // if (DisplayTranslation) // { // // display the back translation text as double spaced // vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight, // (int)FwTextPropVar.ktpvRelative, 20000); // } // The body of the paragraph is either editable or not. vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, vc.Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable); // Make the paragraph containing the paragraph contents. OpenPara(vwenv, hvo); // Cause a regenerate when the style changes...this is mainly used for Undo. vwenv.NoteDependency(new int[] {hvo}, new int[] {(int)StPara.StParaTags.kflidStyleRules}, 1); // Insert the label if it is the first paragraph. if (vc.Label != null) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); if (ihvoItem == 0) vwenv.AddObj(hvo, vc, (int)StTextFrags.kfrLabel); } if (frag == (int)StTextFrags.kfrFootnotePara) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); // Note a dependency on the footnote options so that the footnote will // be refreshed when these are changed. int[] depHvos = { hvoOuter }; int[] depTags = { StFootnote.ktagFootnoteOptions }; vwenv.NoteDependency(depHvos, depTags, 1); // If this is the 0th paragraph in the footnote... if (ihvoItem == 0) { vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker); vwenv.AddObj(hvoOuter, /*vc.Parent != null ? vc.Parent :*/ vc, (int)StTextFrags.kfrFootnoteReference); } } if (contentType == ContentTypes.kctSimpleBT) { // If a translation is being shown instead of the paragraph, then show it instead // of the text of the paragraph. int transHvo = GetTranslationForPara(hvo); vwenv.AddObj(transHvo, vc, (int)StTextFrags.kfrTranslation); vwenv.NoteDependency(new int[] {hvo}, new int[] {(int)StTxtPara.StTxtParaTags.kflidContents}, 1); } else if (contentType == ContentTypes.kctSegmentBT) { InsertBtSegments(vc, vwenv, hvo); } else if (!InsertParaContentsUserPrompt(vwenv, hvo)) { // Display the text paragraph contents, or its user prompt. vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null); } // Display an "end-of-paragraph" marker if needed InsertEndOfParaMarks(vwenv, hvo); vwenv.CloseParagraph(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses /// need to separate this from applying the properties. /// </summary> /// <param name="vwenv"></param> /// <param name="hvo"></param> /// <param name="frag"></param> /// <param name="fApplyProps"></param> /// <param name="contentType"></param> /// <param name="vc">The view constructor used to create the paragraphs</param> /// ------------------------------------------------------------------------------------ protected void InsertParagraphBody(IVwEnv vwenv, int hvo, int frag, bool fApplyProps, ContentTypes contentType, StVc vc) { vc.SetupWsAndDirectionForPara(vwenv, hvo); if (fApplyProps) { ApplyParagraphStyleProps(vwenv, hvo, vc); } // This was causing assertions in the layoutmgr // TODO (TE-5777): Should be able to do this with an in-memory stylesheet. // if (DisplayTranslation) // { // // display the back translation text as double spaced // vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight, // (int)FwTextPropVar.ktpvRelative, 20000); // } // The body of the paragraph is either editable or not. vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, vc.Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable); // Make the paragraph containing the paragraph contents. OpenPara(vwenv, hvo); // Cause a regenerate when the style changes...this is mainly used for Undo. vwenv.NoteDependency(new int[] { hvo }, new int[] { (int)StPara.StParaTags.kflidStyleRules }, 1); // Insert the label if it is the first paragraph. if (vc.Label != null) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); if (ihvoItem == 0) { vwenv.AddObj(hvo, vc, (int)StTextFrags.kfrLabel); } } if (frag == (int)StTextFrags.kfrFootnotePara) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); // Note a dependency on the footnote options so that the footnote will // be refreshed when these are changed. int[] depHvos = { hvoOuter }; int[] depTags = { StFootnote.ktagFootnoteOptions }; vwenv.NoteDependency(depHvos, depTags, 1); // If this is the 0th paragraph in the footnote... if (ihvoItem == 0) { vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker); vwenv.AddObj(hvoOuter, /*vc.Parent != null ? vc.Parent :*/ vc, (int)StTextFrags.kfrFootnoteReference); } } if (contentType == ContentTypes.kctSimpleBT) { // If a translation is being shown instead of the paragraph, then show it instead // of the text of the paragraph. int transHvo = GetTranslationForPara(hvo); vwenv.AddObj(transHvo, vc, (int)StTextFrags.kfrTranslation); vwenv.NoteDependency(new int[] { hvo }, new int[] { (int)StTxtPara.StTxtParaTags.kflidContents }, 1); } else if (contentType == ContentTypes.kctSegmentBT) { InsertBtSegments(vc, vwenv, hvo); } else if (!InsertParaContentsUserPrompt(vwenv, hvo)) { // Display the text paragraph contents, or its user prompt. vwenv.AddStringProp((int)StTxtPara.StTxtParaTags.kflidContents, null); } // Display an "end-of-paragraph" marker if needed InsertEndOfParaMarks(vwenv, hvo); vwenv.CloseParagraph(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses /// need to separate this from applying the properties. /// </summary> /// <param name="vwenv"></param> /// <param name="paraHvo"></param> /// <param name="frag"></param> /// <param name="fApplyProps"></param> /// <param name="contentType"></param> /// <param name="vc">The view constructor used to create the paragraphs</param> /// ------------------------------------------------------------------------------------ protected void InsertParagraphBody(IVwEnv vwenv, int paraHvo, int frag, bool fApplyProps, ContentTypes contentType, StVc vc) { vc.SetupWsAndDirectionForPara(vwenv, paraHvo); if (fApplyProps) ApplyParagraphStyleProps(vwenv, paraHvo, vc); // This was causing assertions in the layoutmgr // TODO (TE-5777): Should be able to do this with an in-memory stylesheet. // if (DisplayTranslation) // { // // display the back translation text as double spaced // vwenv.set_IntProperty((int)FwTextPropType.ktptLineHeight, // (int)FwTextPropVar.ktpvRelative, 20000); // } // The body of the paragraph is either editable or not. vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, vc.Editable ? (int)TptEditable.ktptIsEditable : (int)TptEditable.ktptNotEditable); // Make the paragraph containing the paragraph contents. OpenPara(vwenv, paraHvo); // Cause a regenerate when the style changes...this is mainly used for Undo. vwenv.NoteDependency(new[] {paraHvo}, new[] {StParaTags.kflidStyleRules}, 1); // Insert the label if it is the first paragraph. if (vc.Label != null) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); if (ihvoItem == 0) vwenv.AddObj(paraHvo, vc, (int)StTextFrags.kfrLabel); } if (frag == (int)StTextFrags.kfrFootnotePara) { int lev = vwenv.EmbeddingLevel; int hvoOuter; int ihvoItem; int tagOuter; vwenv.GetOuterObject(lev - 1, out hvoOuter, out tagOuter, out ihvoItem); // Note a dependency on the footnote options so that the footnote will // be refreshed when these are changed. // If this is the 1st paragraph in the footnote... if (ihvoItem == 0) { vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteMarker); vwenv.AddObj(hvoOuter, vc, (int)StTextFrags.kfrFootnoteReference); } } if (contentType == ContentTypes.kctSimpleBT) { // If a translation is being shown instead of the paragraph, then show it instead // of the text of the paragraph. vwenv.AddObj(GetTranslationForPara(paraHvo), vc, (int)StTextFrags.kfrTranslation); if (!PrintLayout) { // This dependency is here so that the "Missing" prompt will be added to the // view when the first character is typed in the contents. But to solve the // problem with losing the IP when typing (FWR-1415), the dependency is not // added in print layout views. The missing prompt seems less of a problem // than the problem with typing. vwenv.NoteDependency(new[]{paraHvo}, new[]{StTxtParaTags.kflidContents}, 1); } } else if (contentType == ContentTypes.kctSegmentBT) { vwenv.AddObjVecItems(StTxtParaTags.kflidSegments, vc, (int)StTextFrags.kfrSegmentFreeTranslations); } else if (!InsertParaContentsUserPrompt(vwenv, paraHvo)) { // Display the text paragraph contents, or its user prompt. vwenv.AddStringProp(StTxtParaTags.kflidContents, null); } // Display an "end-of-paragraph" marker if needed InsertEndOfParaMarks(vwenv, paraHvo); vwenv.CloseParagraph(); }