示例#1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Writes this response to the the specified annotation
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void WriteToCache(IScrScriptureNote ann, FwStyleSheet styleSheet)
        {
            ParagraphCollection parasResponse = new ParagraphCollection(Paragraphs, styleSheet);

            ParagraphCollection.ParaMatchType type;
            int matchIndex = FindMatchingResponse(parasResponse, ann.ResponsesOS, out type);

            switch (type)
            {
            case ParagraphCollection.ParaMatchType.Exact:
            case ParagraphCollection.ParaMatchType.Contains:
                break;                         // we can ignore the new response -- it's a subset of the old.

            case ParagraphCollection.ParaMatchType.IsContained:
                IStJournalText oldText = ann.ResponsesOS[matchIndex];
                oldText.ParagraphsOS.Clear();
                parasResponse.WriteToCache(oldText);
                break;

            case ParagraphCollection.ParaMatchType.None:
                IStJournalText newText = ann.Cache.ServiceLocator.GetInstance <IStJournalTextFactory>().Create();
                ann.ResponsesOS.Add(newText);
                parasResponse.WriteToCache(newText);
                break;
            }
        }
示例#2
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);
        }