/// ----------------------------------------------------------------------------------- /// <summary> /// Convert each of the child paragraphs into an ITsString object, and add that object /// to the given list. If the paragraph's writing system cannot be found, then the /// specified default writing system is used. /// </summary> /// ----------------------------------------------------------------------------------- public StTxtParaBldr BuildParagraph(FwStyleSheet styleSheet, int wsDefault) { StTxtParaBldr bldr; int wsPara = (string.IsNullOrEmpty(IcuLocale) ? wsDefault : ScrNoteImportManager.GetWsForLocale(IcuLocale)); bldr = new StTxtParaBldr(styleSheet.Cache); string stylename = (string.IsNullOrEmpty(StyleName) ? ScrStyleNames.Remark : StyleName); bldr.ParaStylePropsProxy = StyleProxyListManager.GetXmlParaStyleProxy( stylename, ContextValues.Annotation, wsDefault); foreach (XmlTextRun run in Runs) { int ws = (string.IsNullOrEmpty(run.IcuLocale) ? wsPara : ScrNoteImportManager.GetWsForLocale(run.IcuLocale)); run.AddToParaBldr(bldr, ws, styleSheet); } // OXES supports mixed text so this is designed to handle text that // is found in the "para" tag but not in any "span" or "a" tag. if (!string.IsNullOrEmpty(m_text)) { XmlTextRun extraText = new XmlTextRun(); extraText.Text = m_text; extraText.AddToParaBldr(bldr, wsPara, styleSheet); } return(bldr); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the specified file. /// </summary> /// <param name="filename">The name of the OXESA file.</param> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="e">Exception that was encountered or null</param> /// <returns>A loaded ScrAnnotationsList</returns> /// ------------------------------------------------------------------------------------ public static XmlScrAnnotationsList LoadFromFile(string filename, FdoCache cache, FwStyleSheet styleSheet, out Exception e) { XmlScrAnnotationsList list = XmlSerializationHelper.DeserializeFromFile <XmlScrAnnotationsList>(filename, true, out e); if (cache != null && styleSheet != null && list != null) { try { StyleProxyListManager.Initialize(styleSheet); list.WriteToCache(cache, styleSheet, Path.GetDirectoryName(filename)); } finally { StyleProxyListManager.Cleanup(); } } return(list ?? new XmlScrAnnotationsList()); }