public virtual void DeleteAllParagraphs() { StTxtPara para0 = m_text1.ContentsOA.ParagraphsOS[0] as StTxtPara; m_rtp.TextBuilder.SelectNode(null); TextBuilder tb = new TextBuilder(m_rtp.TextBuilder); IStTxtPara newPara = tb.AppendNewParagraph(); ParagraphBuilder pb = tb.GetParagraphBuilder(newPara.Hvo); pb.CreateSegmentNode(); pb.CreateSegmentForms(); pb.InsertSegmentForm(0, 0, LangProject.kguidAnnPunctuationInContext, "."); pb.InsertSegmentForm(0, 0, LangProject.kguidAnnWordformInContext, "xxxups"); pb.InsertSegmentForm(0, 1, LangProject.kguidAnnWordformInContext, "xxxloyala"); pb.InsertSegmentForm(0, 2, LangProject.kguidAnnWordformInContext, "xxxliranihimbi"); pb.RebuildParagraphContentFromAnnotations(); m_rtp.SelectAll(); TextSelInfo tsiBeforeDel; m_rtp.OnDelete(out tsiBeforeDel); m_rtp.ValidateStTextAnnotations(); }
public override void Initialize() { CheckDisposed(); base.Initialize(); TextBuilder tb = new TextBuilder(Cache.LangProject.TextsOC); using (new UndoRedoTaskHelper(Cache, "TextEditingTests - Undo Setup texts", "TextEditingTests - Redo Setup texts")) { // Create a mirrored text without annotations. m_text1 = tb.CreateText(true); IStTxtPara para0 = tb.AppendNewParagraph(); IStTxtPara para1 = tb.AppendNewParagraph(); // raw copy from the annotated text. // 1 2 3 4 5 6 7 8 9 // 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 // xxxpus xxxyalola xxxnihimbilira. xxxnihimbilira xxxpus xxxyalola. xxxhesyla xxxnihimbilira. para0.Contents.UnderlyingTsString = StringUtils.MakeTss(ParagraphContents[0], Cache.DefaultVernWs); para1.Contents.UnderlyingTsString = StringUtils.MakeTss(ParagraphContents[1], Cache.DefaultVernWs); } m_rtp = new MockRawTextEditor(Cache, tb); }