/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlScrNote"/> class based on /// the given Scripture note. /// </summary> /// <param name="ann">The Scripture annotation.</param> /// <param name="wsDefault">The default (analysis) writing system.</param> /// <param name="lgwsf">The writing system factory.</param> /// ------------------------------------------------------------------------------------ public XmlScrNote(IScrScriptureNote ann, int wsDefault, ILgWritingSystemFactory lgwsf) : this() { m_wsDefault = wsDefault; m_lgwsf = lgwsf; ResolutionStatus = ann.ResolutionStatus; m_typeName = ann.AnnotationTypeRA.Name.get_String(WritingSystemServices.FallbackUserWs(ann.Cache)).Text; m_guidType = ann.AnnotationTypeRA.Guid; SetNoteType(ann); m_startRef = ann.BeginRef; if (ann.BeginRef != ann.EndRef) { m_endRef = ann.EndRef; } if (ann.BeginObjectRA != null) { m_guidBegObj = ann.BeginObjectRA.Guid; } if (ann.BeginObjectRA != ann.EndObjectRA && ann.EndObjectRA != null) { m_guidEndObj = ann.EndObjectRA.Guid; } BeginOffset = ann.BeginOffset; EndOffset = ann.EndOffset; m_createdDate = ann.DateCreated; m_modifiedDate = ann.DateModified; m_resolvedDate = ann.DateResolved; Quote = XmlNotePara.GetParagraphList(ann.QuoteOA, m_wsDefault, m_lgwsf); Discussion = XmlNotePara.GetParagraphList(ann.DiscussionOA, m_wsDefault, m_lgwsf); Suggestion = XmlNotePara.GetParagraphList(ann.RecommendationOA, m_wsDefault, m_lgwsf); Resolution = XmlNotePara.GetParagraphList(ann.ResolutionOA, m_wsDefault, m_lgwsf); Categories = XmlNoteCategory.GetCategoryList(ann, m_lgwsf); Responses = XmlNoteResponse.GetResponsesList(ann, m_wsDefault, m_lgwsf); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the specified text as a new hyperlink run with the text 'my link' to the /// specified paragraph /// </summary> /// <param name="para">The paragraph to add to</param> /// <param name="href">The href.</param> /// ------------------------------------------------------------------------------------ private void AddHyperTo(XmlNotePara para, string href) { XmlHyperlinkRun run = new XmlHyperlinkRun(); run.Text = "my link"; run.Href = href; para.Runs.Add(run); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the specified text to a new paragraph (where each string is the text of a new /// paragraph) /// </summary> /// <param name="paraList">The list of paragraphs to add to</param> /// <param name="paras">The text of the paragraphs to add</param> /// ------------------------------------------------------------------------------------ private void AddParasTo(List<XmlNotePara> paraList, params string[] paras) { foreach (string paraText in paras) { XmlNotePara newPara = new XmlNotePara(); XmlTextRun run = new XmlTextRun(); run.Text = paraText; newPara.Runs.Add(run); paraList.Add(newPara); } }