コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void CreateTestData()
        {
            ITsStrFactory strfact = TsStrFactoryClass.Create();

            //Jude
            IScrBook jude = m_scrInMemoryCache.AddBookToMockedScripture(65, "Jude");

            m_scrInMemoryCache.AddTitleToMockedBook(jude.Hvo, "Jude");

            // Jude Scripture section
            IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(jude.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, "First section", "Section Head");
            StTxtPara judePara = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo, "Paragraph");

            m_scrInMemoryCache.AddRunToMockedPara(judePara, "1", ScrStyleNames.ChapterNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara, "1", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara, "This is the first verse", null);

            // Insert footnote into para 1 of Jude
            ITsStrBldr bldr     = judePara.Contents.UnderlyingTsString.GetBldr();
            StFootnote foot     = ScrFootnote.InsertFootnoteAt(jude, 0, bldr, 10, "#");
            StTxtPara  footPara = new StTxtPara();

            foot.ParagraphsOS.Append(footPara);
            footPara.StyleRules = StyleUtils.ParaStyleTextProps(ScrStyleNames.NormalFootnoteParagraph);
            footPara.Contents.UnderlyingTsString = strfact.MakeString("This is text for the footnote.", Cache.DefaultVernWs);
            judePara.Contents.UnderlyingTsString = bldr.GetString();

            section.AdjustReferences();
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void CreateTestData()
        {
            ITsStrFactory strfact = TsStrFactoryClass.Create();

            //James
            IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(59, "James");

            m_scrInMemoryCache.AddTitleToMockedBook(book.Hvo, "James");

            // James first section
            IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, "Paul tells people", "Section Head");
            StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo, "Paragraph");

            m_scrInMemoryCache.AddRunToMockedPara(para, "1", "Chapter Number");
            m_scrInMemoryCache.AddRunToMockedPara(para, "1", "Verse Number");
            m_scrInMemoryCache.AddRunToMockedPara(para, "and the earth was without form and void and darkness covered the face of the deep", null);
            section.AdjustReferences();

            // James section2
            IScrSection section2 = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(section2.Hvo, "Paul tells people more", "Section Head");
            StTxtPara para2 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo, "Paragraph");

            m_scrInMemoryCache.AddRunToMockedPara(para2, "2", "Chapter Number");
            m_scrInMemoryCache.AddRunToMockedPara(para2, "1", "Verse Number");
            m_scrInMemoryCache.AddRunToMockedPara(para2, "paul expounds on the nature of reality", null);
            StTxtPara para3 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo, "Paragraph");

            m_scrInMemoryCache.AddRunToMockedPara(para3, "2", "Verse Number");
            m_scrInMemoryCache.AddRunToMockedPara(para3, "the existentialists are all wrong", null);

            // insert footnotes into para 2 of James
            ITsTextProps normalFootnoteParaProps = StyleUtils.ParaStyleTextProps(ScrStyleNames.NormalFootnoteParagraph);
            ITsStrBldr   jamesBldr = para2.Contents.UnderlyingTsString.GetBldr();
            int          iFootIch  = 10;

            for (int i = 0; i < 2; i++)
            {
                StFootnote foot     = ScrFootnote.InsertFootnoteAt(book, i, jamesBldr, iFootIch, "a");
                StTxtPara  footPara = new StTxtPara();
                foot.ParagraphsOS.Append(footPara);
                footPara.StyleRules = normalFootnoteParaProps;
                footPara.Contents.UnderlyingTsString = strfact.MakeString("This is footnote text for footnote " + i.ToString(), Cache.DefaultVernWs);
                iFootIch += 20;
            }
            para2.Contents.UnderlyingTsString = jamesBldr.GetString();
            section2.AdjustReferences();

            //Jude
            m_Jude = m_scrInMemoryCache.AddBookToMockedScripture(65, "Jude");
            m_scrInMemoryCache.AddTitleToMockedBook(m_Jude.Hvo, "Jude");

            //Jude intro section
            IScrSection judeSection = m_scrInMemoryCache.AddSectionToMockedBook(m_Jude.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(judeSection.Hvo, "Introduction", "Intro Section Head");
            StTxtPara judePara = m_scrInMemoryCache.AddParaToMockedSectionContent(judeSection.Hvo, "Intro Paragraph");

            m_scrInMemoryCache.AddRunToMockedPara(judePara, "The Letter from Jude was written to warn against" +
                                                  " false teachers who claimed to be believers. In this brief letter, which is similar in" +
                                                  " content to 2 Peter the writer encourages his readers “to fight on for the faith which" +
                                                  " once and for all God has given to his people.", null);
            judeSection.AdjustReferences();
            // Insert BT (in two different writing systems) of intro paragraph
            ICmTranslation transEn = m_inMemoryCache.AddBtToMockedParagraph(judePara, InMemoryFdoCache.s_wsHvos.En);
            ICmTranslation transDe = m_inMemoryCache.AddBtToMockedParagraph(judePara, InMemoryFdoCache.s_wsHvos.De);

            // Jude Scripture section
            IScrSection judeSection2 = m_scrInMemoryCache.AddSectionToMockedBook(m_Jude.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(judeSection2.Hvo, "First section", "Section Head");
            StTxtPara judePara2 = m_scrInMemoryCache.AddParaToMockedSectionContent(judeSection2.Hvo, "Paragraph");

            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "1", ScrStyleNames.ChapterNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "1", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "This is the first verse", null);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "2", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "This is the second verse", null);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "3", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "This is the third verse", null);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "4", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedPara(judePara2, "This is the fourth verse", null);

            // Insert footnotes into para 1 of Jude
            ITsStrBldr bldr = judePara.Contents.UnderlyingTsString.GetBldr();

            iFootIch = 10;
            for (int i = 0; i < 4; i++)
            {
                StFootnote foot     = ScrFootnote.InsertFootnoteAt(m_Jude, i, bldr, iFootIch, "a");
                StTxtPara  footPara = new StTxtPara();
                foot.ParagraphsOS.Append(footPara);
                footPara.StyleRules = normalFootnoteParaProps;
                footPara.Contents.UnderlyingTsString = strfact.MakeString("This is text for footnote " + i.ToString(), Cache.DefaultVernWs);
                iFootIch += 30;
                // Insert ORC for footnote into BT (in both writing systems)
                m_scrInMemoryCache.AddFootnoteORCtoTrans(transEn, i, InMemoryFdoCache.s_wsHvos.En, foot);
                m_scrInMemoryCache.AddFootnoteORCtoTrans(transDe, i, InMemoryFdoCache.s_wsHvos.De, foot);
            }
            judePara.Contents.UnderlyingTsString = bldr.GetString();

            // Insert footnotes into para 2 of Jude
            bldr     = judePara2.Contents.UnderlyingTsString.GetBldr();
            iFootIch = 10;
            for (int i = 0; i < 4; i++)
            {
                StFootnote foot     = ScrFootnote.InsertFootnoteAt(m_Jude, i + 4, bldr, iFootIch, "a");
                StTxtPara  footPara = new StTxtPara();
                foot.ParagraphsOS.Append(footPara);
                footPara.StyleRules = normalFootnoteParaProps;
                footPara.Contents.UnderlyingTsString = strfact.MakeString("This is text for footnote " + (i + 4).ToString(), Cache.DefaultVernWs);
                iFootIch += 20;
            }
            judePara2.Contents.UnderlyingTsString = bldr.GetString();
            judeSection2.AdjustReferences();
        }