コード例 #1
0
        public void DeleteFootnoteSelection()
        {
            m_ScrPubCtrl.PageHeight  = 432000;        // 6 inches
            m_ScrPubCtrl.PageWidth   = 288000;        // 4 inches
            m_division.TopMargin     = 18000;         // Half inch
            m_division.BottomMargin  = 18000;
            m_division.InsideMargin  = 18000;
            m_division.OutsideMargin = 18000;
            m_ScrPubCtrl.Width       = 4 * 96;       // represents a window that is 4" wide at 96 DPI
            m_ScrPubCtrl.CreatePages();
            List <Page>     pagesToBeDrawn = m_ScrPubCtrl.PrepareToDrawPages(0, 2000);
            IVwLayoutStream layoutStream   = m_division.MainLayoutStream;
            IVwRootBox      rootbox        = layoutStream as IVwRootBox;

            // Get number of footnotes in book.
            IScripture scr = m_fdoCache.LangProject.TranslatedScriptureOA;

            Assert.AreEqual(3, scr.ScriptureBooksOS.Count);
            ScrBook james        = (ScrBook)m_fdoCache.LangProject.TranslatedScriptureOA.ScriptureBooksOS[1];
            int     numFootnotes = james.FootnotesOS.Count;

            // Select the first footnote in James.
            SelectionHelper selHelper = SelectRangeOfChars(rootbox, 2, 2, 3);

            // Delete the footnote marker selection.
            //m_footnoteView.OnKeyDown(new KeyEventArgs(Keys.Delete));
            m_ScrPubCtrl.PressKey(new KeyEventArgs(Keys.Delete));

            // Confirm that there is one less footnote in the book.
            Assert.AreEqual(numFootnotes - 1, james.FootnotesOS.Count);
        }
コード例 #2
0
        public void DeleteFootnoteSelection()
        {
            // Add a footnote to the last section in the book of Genesis. (The last section is
            // what is contained in our rootbox).
            Assert.AreEqual(3, m_book.SectionsOS.Count);
            IScrTxtPara para = (IScrTxtPara)m_book.SectionsOS[1].ContentOA.ParagraphsOS[0];

            AddFootnote(m_book, para, para.Contents.Length, "Footnote to delete");

            // Get number of footnotes in book.
            IScripture scr = Cache.LangProject.TranslatedScriptureOA;

            Assert.AreEqual(1, scr.ScriptureBooksOS.Count);
            int numFootnotes = m_book.FootnotesOS.Count;

            m_ScrPubCtrl.PageHeight  = 432000;        // 6 inches
            m_ScrPubCtrl.PageWidth   = 288000;        // 4 inches
            m_division.TopMargin     = 18000;         // Half inch
            m_division.BottomMargin  = 18000;
            m_division.InsideMargin  = 18000;
            m_division.OutsideMargin = 18000;
            m_ScrPubCtrl.Width       = 4 * 96;       // represents a window that is 4" wide at 96 DPI
            m_ScrPubCtrl.CreatePages();
            m_ScrPubCtrl.PrepareToDrawPages(0, 2000);
            IVwLayoutStream layoutStream = m_division.MainLayoutStream;
            IVwRootBox      rootbox      = layoutStream as IVwRootBox;

            // Select the first footnote in the last section of the book.
            SelectRangeOfChars(rootbox, 0, para.Contents.Length - 2, para.Contents.Length - 1);

            // Delete the footnote marker selection.
            //m_footnoteView.OnKeyDown(new KeyEventArgs(Keys.Delete));
            m_lp.Cache.ActionHandlerAccessor.EndUndoTask();             // Delete key generates own UOW
            m_ScrPubCtrl.PressKey(new KeyEventArgs(Keys.Delete));
            m_lp.Cache.ActionHandlerAccessor.BeginUndoTask("nonsence", "redo nonsence");

            // Confirm that there is one less footnote in the book.
            Assert.AreEqual(numFootnotes - 1, m_book.FootnotesOS.Count);
        }