示例#1
0
        private IScrScriptureNote FindOrCreateAnnotation(FwStyleSheet styleSheet)
        {
            FdoCache cache = styleSheet.Cache;

            ParagraphCollection parasQuote          = new ParagraphCollection(Quote, styleSheet, cache.DefaultVernWs);
            ParagraphCollection parasDiscussion     = new ParagraphCollection(Discussion, styleSheet);
            ParagraphCollection parasRecommendation = new ParagraphCollection(Suggestion, styleSheet);
            ParagraphCollection parasResolution     = new ParagraphCollection(Resolution, styleSheet);

            if (m_guidType == Guid.Empty)
            {
                m_guidType = CmAnnotationDefnTags.kguidAnnConsultantNote;
            }
            ScrAnnotationInfo info = new ScrAnnotationInfo(m_guidType, parasDiscussion,
                                                           parasQuote, parasRecommendation, parasResolution, BeginOffset,
                                                           BeginScrBCVRef, EndScrBCVRef, m_createdDate);

            IScrScriptureNote scrNote =
                ScrNoteImportManager.FindOrCreateAnnotation(info, m_guidBegObj);

            parasQuote.WriteToCache(scrNote.QuoteOA);
            parasDiscussion.WriteToCache(scrNote.DiscussionOA);
            parasRecommendation.WriteToCache(scrNote.RecommendationOA);
            parasResolution.WriteToCache(scrNote.ResolutionOA);

            return(scrNote);
        }
示例#2
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);
            }
        }
示例#3
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);
        }
示例#4
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Used to set the value of m_guidType when either the Type or SubType is changed.
 /// This was needed so that SubType did not have to occur before Type in the XML.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private void SetGuidType()
 {
     // Both the Type and SubType fields must be available for the annotations related to
     // Editorial Checks.
     if (!(m_annotationType == XmlNoteType.PreTypesettingCheck && SubType == null))
     {
         m_guidType = ScrNoteImportManager.GetAnnotationTypeGuid(Type, SubType);
     }
 }
示例#5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Writes the list of annotations to the specified cache.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="styleSheet">The style sheet.</param>
        /// <param name="OXESADir">The OXESA directory.</param>
        /// ------------------------------------------------------------------------------------
        protected void WriteToCache(FdoCache cache, FwStyleSheet styleSheet,
                                    string OXESADir)
        {
            Scripture scr = cache.LangProject.TranslatedScriptureOA as Scripture;

            try
            {
                foreach (XmlScrNote ann in Annotations)
                {
                    ScrNoteImportManager.Initialize(scr, ann.BeginScrBCVRef.Book, OXESADir);
                    ann.WriteToCache(scr, styleSheet);
                }
            }
            finally
            {
                ScrNoteImportManager.Cleanup();
            }
        }