Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add an annotation to a language project.
        /// </summary>
        /// <param name="testBase">in-memory cache to use for testing</param>
        /// <param name="noteText">text to include in discussion</param>
        /// <param name="startRef"></param>
        /// <param name="endRef"></param>
        /// <param name="topPara">Begin IStTxtPara to annotate</param>
        /// <param name="bottomPara">End IStTxtPara to annotate</param>
        /// <returns>a new annotation</returns>
        /// ------------------------------------------------------------------------------------
        internal static IScrScriptureNote AddAnnotation(ScrInMemoryFdoTestBase testBase, string noteText,
                                                        ScrReference startRef, ScrReference endRef, ICmObject topPara, ICmObject bottomPara)
        {
            ILangProject        lp          = testBase.Cache.LangProject;
            IScrBookAnnotations annotations = lp.TranslatedScriptureOA.BookAnnotationsOS[startRef.Book - 1];
            IScrScriptureNote   note        = annotations.InsertNote(startRef, endRef, topPara, bottomPara,
                                                                     StandardNoteType(testBase.Cache).Guid);

            IStTxtPara discussionPara = (IStTxtPara)note.DiscussionOA.ParagraphsOS[0];

            testBase.AddRunToMockedPara(discussionPara, noteText, testBase.Cache.DefaultAnalWs);

            note.DateCreated = new DateTime(s_Ticks++);

            return(note);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Inserts a note referencing the currently selected paragraph.
        /// </summary>
        /// <param name="noteType">Type of note</param>
        /// <param name="startRef">reference at beginning of selection</param>
        /// <param name="endRef">reference at end of selection</param>
        /// <param name="topObj">The object where quoted text begins.</param>
        /// <param name="bottomObj">The object where quoted text ends.</param>
        /// <param name="startOffset">The starting character offset.</param>
        /// <param name="endOffset">The ending character offset.</param>
        /// <param name="tssQuote">The text of the quote.</param>
        /// <returns>The inserted note</returns>
        /// ------------------------------------------------------------------------------------
        public virtual IScrScriptureNote InsertNote(ICmAnnotationDefn noteType, BCVRef startRef,
                                                    BCVRef endRef, ICmObject topObj, ICmObject bottomObj,
                                                    int startOffset, int endOffset, ITsString tssQuote)
        {
            CheckDisposed();

            int iPos;

            IScrBookAnnotations annotations = m_scr.BookAnnotationsOS[startRef.Book - 1];

            StTxtParaBldr quoteParaBldr = new StTxtParaBldr(m_cache);

            quoteParaBldr.ParaStyleName = ScrStyleNames.Remark;
            quoteParaBldr.StringBuilder.ReplaceTsString(0, 0, tssQuote);
            IScrScriptureNote annotation = annotations.InsertNote(startRef, endRef, topObj, bottomObj,
                                                                  noteType.Guid, startOffset, endOffset, quoteParaBldr, null, null, null,
                                                                  out iPos);

            RegisterScrollCallBack(startRef.Book, iPos);

            // REVIEW: Do we need to create a synch record?
            return(annotation);
        }