Beispiel #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Writes this category to the the specified annotation, creating a new category if
        /// needed.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        internal void WriteToCache(IScrScriptureNote ann)
        {
            int ws = (string.IsNullOrEmpty(IcuLocale) ? ann.Cache.DefaultAnalWs :
                      ScrNoteImportManager.GetWsForLocale(IcuLocale));

            ICmPossibility category;

            if (CategoryPath.IndexOf(StringUtils.kChObject) != -1)
            {
                // The category specified the full path of the category possibility.
                category = ann.Cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA.FindOrCreatePossibility(
                    CategoryPath, ws);
            }
            else
            {
                // The category does not contain a delimiter, so we may need to search
                // the entire possibility tree for a matching category in case it is a
                // sub-possibility.
                category = ann.Cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA.FindOrCreatePossibility(
                    CategoryPath, ws, false);
            }

            IFdoReferenceSequence <ICmPossibility> categoryList = ann.CategoriesRS;

            if (!categoryList.Contains(category))
            {
                categoryList.Add(category);
            }
        }
Beispiel #2
0
        /// -----------------------------------------------------------------------------------
        /// <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);
        }