Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Compares the translations of the footnote.
        /// </summary>
        /// <param name="expectedTrans">The expected translation</param>
        /// <param name="actualTrans">The actual translation</param>
        /// <param name="currentParaHvo">The current footnote paragraph hvo.</param>
        /// ------------------------------------------------------------------------------------
        private void CompareFootnoteTrans(CmTranslation expectedTrans, CmTranslation actualTrans,
                                          int currentParaHvo)
        {
            if (expectedTrans == null)
            {
                Assert.IsNull(actualTrans,
                              "Found an unexpected translation for paragraph hvo " + currentParaHvo);
                return;
            }
            Assert.IsNotNull(actualTrans, "Translation missing for paragraph hvo " + currentParaHvo);

            // The list of translation writing systems will be set to all the possible
            // writing systems with the InMemoryCache version of GetUsedScriptureTransWsForPara.
            List <int> transWs = m_inMemoryCache.Cache.GetUsedScriptureTransWsForPara(currentParaHvo);

            foreach (int ws in transWs)
            {
                ITsString tssExpected = expectedTrans.Translation.GetAlternativeTss(ws);
                ITsString tssActual   = actualTrans.Translation.GetAlternativeTss(ws);

                if (tssExpected == null || tssExpected.Length == 0)
                {
                    Assert.IsTrue(tssActual == null || tssActual.Length == 0,
                                  "Found an unexpected translation for WS " + ws);
                    continue;
                }

                AssertEx.AreTsStringsEqual(tssExpected, tssActual);
            }
        }
Ejemplo n.º 2
0
        public void TemplateCreatedForCurLang()
        {
            CheckDisposed();

            int germanBtWs = InMemoryFdoCache.s_wsHvos.De;

            CreatePartialExodusBT(InMemoryFdoCache.s_wsHvos.De);
            m_btDraftView.ViewConstructorWS = germanBtWs;
            m_btDraftView.RefreshDisplay();
            m_btDraftView.SetInsertionPoint(0, 1, 0, 0, true);

            // Generate the section template
            m_btDraftView.TeEditingHelper.GenerateTranslationCVNumsForSection();

            StTxtPara     para       = (StTxtPara)m_book.SectionsOS[1].ContentOA.ParagraphsOS[0];
            CmTranslation transPara1 = (CmTranslation)para.GetBT();

            para = (StTxtPara)m_book.SectionsOS[1].ContentOA.ParagraphsOS[1];
            CmTranslation transPara2 = (CmTranslation)para.GetBT();

            para = (StTxtPara)m_book.SectionsOS[1].ContentOA.ParagraphsOS[2];
            CmTranslation transPara3 = (CmTranslation)para.GetBT();

            Assert.AreEqual("11BT Verse one", transPara1.Translation.GetAlternative(germanBtWs).Text);
            Assert.AreEqual("3", transPara2.Translation.GetAlternative(germanBtWs).Text);
            Assert.AreEqual("4 5", transPara3.Translation.GetAlternative(germanBtWs).Text);
        }
Ejemplo n.º 3
0
        public void FindNextBackTrans_SectionContentToHead_HeadFinished()
        {
            CheckDisposed();

            // Mark the first section head paragraph BT as finished and add a second section
            // head paragraph
            IScrSection    section2 = m_book.SectionsOS[1];
            StTxtPara      para     = (StTxtPara)section2.HeadingOA.ParagraphsOS[0];
            ICmTranslation trans    = new CmTranslation(Cache, para.TranslationsOC.HvoArray[0]);

            m_btDraftView.SetTransStatus(trans, BackTranslationStatus.Finished);
            para = m_scrInMemoryCache.AddSectionHeadParaToSection(section2.Hvo, "Heading 2B",
                                                                  ScrStyleNames.SectionHead);
            m_inMemoryCache.AddBtToMockedParagraph(para, Cache.DefaultAnalWs);
            m_btDraftView.RefreshDisplay();

            m_btDraftView.SetInsertionPoint((int)ScrSection.ScrSectionTags.kflidContent,
                                            0, 0, 0);

            m_btDraftView.CallNextUnfinishedBackTrans();
            SelectionHelper helper = m_btDraftView.EditingHelper.CurrentSelection;

            Assert.AreEqual(0, helper.IchAnchor);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(1, m_btDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(1, m_btDraftView.ParagraphIndex);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            m_btDraftView.EditingHelper.CurrentSelection.LevelInfo[2].tag);
            Assert.IsFalse(m_btDraftView.TeEditingHelper.InBookTitle);
        }
Ejemplo n.º 4
0
        public void ExportBookSection_MultipleBT()
        {
            Cache.LangProject.AnalysisWssRC.Add(InMemoryFdoCache.s_wsHvos.Hbo);
            Cache.LangProject.CurAnalysisWssRS.Append(InMemoryFdoCache.s_wsHvos.Hbo);
            int         wsAnal       = Cache.DefaultAnalWs;
            IScrSection introSection = m_scrInMemoryCache.AddIntroSectionToMockedBook(m_book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(introSection.Hvo, "Introduccion",
                                                           ScrStyleNames.IntroSectionHead);
            StTxtPara introPara = AddPara(introSection, ScrStyleNames.NormalParagraph);

            AddVerse(introPara, 0, 0, "Texto de introduccion");

            // Add a back translation for the default analysis language.
            CmTranslation trans = (CmTranslation)m_scrInMemoryCache.AddTransToMockedParagraph(introPara,
                                                                                              LangProject.kguidTranBackTranslation, wsAnal);

            trans.Translation.SetAlternative("Default BT", wsAnal);
            trans.Status.SetAlternative("finished", wsAnal);

            // Add a back translation for Hebrew.
            trans.Translation.SetAlternative("Hbo BT", InMemoryFdoCache.s_wsHvos.Hbo);

            StringWriter  stream = new StringWriter();
            XmlTextWriter writer = new XmlTextWriter(stream);

            writer.Formatting = Formatting.None;
            m_exporter        = new ExportXml(null, Cache, null, ExportWhat.AllBooks, 0, 0, 0,
                                              "ExportBookSection_IntroWithNotes");
            // Initialize writing systems for export (required to export back translations), but
            // called from ExportTE.
            ReflectionHelper.CallMethod(m_exporter, "InitializeExportWs", null);
            ReflectionHelper.SetField(m_exporter, "m_writer", writer);
            string sCanon = "ot";

            ReflectionHelper.CallMethod(m_exporter, "ExportBook", sCanon, m_book, null);

            XmlDocument actual = new XmlDocument();

            actual.Load(new StringReader(stream.ToString()));
            string strExpected = "<book ID=\"GEN\"><titleGroup short=\"Genesis\"><title type=\"main\">" +
                                 "<trGroup><tr>Genesis</tr></trGroup></title></titleGroup>" +
                                 "<introduction><section><sectionHead><trGroup><tr>Introduction</tr></trGroup></sectionHead>" +
                                 "<p><trGroup><tr><userCS type=\"Paragraph\">Some intro text</userCS></tr>" +
                                 "<bt xml:lang=\"en\" status=\"finished\">Default BT</bt><bt xml:lang=\"hbo\">Hbo BT</bt></trGroup>" +
                                 "<chapterEnd ID=\"GEN.0\"/></p></section></introduction></book>";

            XmlDocument expected = new XmlDocument();

            expected.Load(new StringReader(strExpected));

            string strDifference;

            if (!XmlHelper.CompareXmlNodes(expected.ChildNodes, actual.ChildNodes, out strDifference))
            {
                Assert.Fail(strDifference);
            }
        }
Ejemplo n.º 5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Update the status of a back translation if it was modified (from finished or checked
        /// to unfinished).
        /// </summary>
        /// <param name="hvoTrans">A translation that was changed (probably a back translation)
        /// </param>
        /// <param name="ivMin">in CmTranslation, this is the hvo of the writing system of the
        /// string that has changed</param>
        /// <param name="cvIns">the number of items inserted?</param>
        /// <param name="cvDel">the number of items deleted?</param>
        /// ------------------------------------------------------------------------------------
        protected override void DoEffectsOfPropChange(int hvoTrans, int ivMin, int cvIns, int cvDel)
        {
            CmTranslation trans = new CmTranslation(m_cache, hvoTrans);

            if (trans.TypeRA.Guid == LangProject.kguidTranBackTranslation)
            {
                MarkCurrentBackTranslationAsUnfinished(trans, ivMin);
            }
        }
Ejemplo n.º 6
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Mark specified back translation as unfinished. This should be called when the back
 /// translation is modified.
 /// </summary>
 /// <param name="translation">The translation.</param>
 /// <param name="hvoWs">The hvo of the current back translation writing system</param>
 /// ------------------------------------------------------------------------------------
 private void MarkCurrentBackTranslationAsUnfinished(CmTranslation translation, int hvoWs)
 {
     if (m_cache.IsRealObject(hvoWs, LgWritingSystem.kclsidLgWritingSystem))
     {
         // We have confirmed that this hvo is for a writing system.
         // set the specified alternate writing system to unfinished.
         string status = translation.Status.GetAlternative(hvoWs);
         if (status != null && status != BackTranslationStatus.Unfinished.ToString())
         {
             translation.Status.SetAlternative(BackTranslationStatus.Unfinished.ToString(), hvoWs);
         }
     }
 }
Ejemplo n.º 7
0
        public void FindPrevBackTrans_SectionContentsToSectionHead_HeadFinished()
        {
            CheckDisposed();

            IScrSection    section = m_book.SectionsOS[0];
            ICmTranslation trans   = new CmTranslation(Cache,
                                                       ((StTxtPara)section.HeadingOA.ParagraphsOS[0]).TranslationsOC.HvoArray[0]);

            m_btDraftView.SetTransStatus(trans, BackTranslationStatus.Finished);

            m_btDraftView.SetInsertionPoint(0, 0, 0, 0, false);

            m_btDraftView.CallPrevUnfinishedBackTrans();
            SelectionHelper helper = m_btDraftView.EditingHelper.CurrentSelection;

            Assert.AreEqual(0, helper.IchAnchor);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(-1, m_btDraftView.TeEditingHelper.SectionIndex);
            Assert.IsTrue(m_btDraftView.TeEditingHelper.InBookTitle);
        }
Ejemplo n.º 8
0
        protected override CmObject GetObjectToMonitor(int hvo)
        {
            if (m_cache.GetClassOfObject(hvo) != CmTranslation.kclsidCmTranslation)
            {
                return(null);
            }
            // Return result unless it is disqualified somehow.
            CmTranslation result = CmObject.CreateFromDBObject(m_cache, hvo) as CmTranslation;
            StTxtPara     para   = result.Owner as StTxtPara;

            if (para == null)
            {
                return(null);                // not a translation of Scripture...unlikely unless this is hooked up to some unexpected view.
            }
            // Make sure the paragraph belongs to Scripture.
            if (!ScrTxtPara.IsScripturePara(para.Hvo, m_cache))
            {
                return(null);          // not Scripture
            }
            return(result);            // finally!
        }
Ejemplo n.º 9
0
        public void FindPrevBackTrans_SectionHeadToTitle_TitleChecked()
        {
            CheckDisposed();

            CmTranslation trans = new CmTranslation(Cache,
                                                    ((StTxtPara)m_book.TitleOA.ParagraphsOS[0]).TranslationsOC.HvoArray[0]);

            m_btDraftView.SetTransStatus(trans, BackTranslationStatus.Checked);

            m_btDraftView.SetInsertionPoint((int)ScrSection.ScrSectionTags.kflidHeading,
                                            0, 0, 0);

            m_btDraftView.CallPrevUnfinishedBackTrans();
            SelectionHelper helper = m_btDraftView.EditingHelper.CurrentSelection;

            Assert.AreEqual(0, helper.IchAnchor);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_btDraftView.ParagraphIndex);
            Assert.IsFalse(m_btDraftView.TeEditingHelper.InBookTitle);
        }
Ejemplo n.º 10
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the section index and paragraph index for the specified object, when this
        /// method assumes is an StTxtPara.
        /// </summary>
        /// <param name="obj">An ICmObject associated with an annotation (i.e. the annotation's
        /// BeginObjectRA) which is assumed to be an StTxtPara.</param>
        /// <param name="iNewNoteSection">The index of the section, or -1 if the index cannot
        /// be determined.</param>
        /// <param name="iNewNotePara">The index of paragraph, or int.MaxValue if the index
        /// cannot be determined.</param>
        /// ------------------------------------------------------------------------------------
        private void GetLocationInfoForObj(ICmObject obj, out int iNewNoteSection, out int iNewNotePara)
        {
            iNewNoteSection = -1;
            iNewNotePara    = int.MaxValue;

            if (obj is StTxtPara)
            {
                StTxtPara para = (StTxtPara)obj;
                iNewNotePara = para.IndexInOwner;
                ScrSection section = ScrSection.GetSectionFromParagraph(para);
                if (section != null)
                {
                    iNewNoteSection = section.IndexInBook;
                }
            }
            else if (obj is CmTranslation)
            {
                CmTranslation trans = (CmTranslation)obj;
                Debug.Assert(trans.Owner is StTxtPara);
                GetLocationInfoForObj(trans.Owner, out iNewNoteSection, out iNewNotePara);
            }
        }
Ejemplo n.º 11
0
        public void FindNextBackTrans_TitleToSectionHead_SectionHeadChecked()
        {
            CheckDisposed();

            IScrSection    section = m_book.SectionsOS[0];
            ICmTranslation trans   = new CmTranslation(Cache,
                                                       ((StTxtPara)section.HeadingOA.ParagraphsOS[0]).TranslationsOC.HvoArray[0]);

            m_btDraftView.SetTransStatus(trans, BackTranslationStatus.Checked);

            m_btDraftView.SetInsertionPoint((int)ScrBook.ScrBookTags.kflidTitle, 0, 0);

            m_btDraftView.CallNextUnfinishedBackTrans();
            SelectionHelper helper = m_btDraftView.EditingHelper.CurrentSelection;

            Assert.AreEqual(0, helper.IchAnchor);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_btDraftView.ParagraphIndex);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidContent,
                            m_btDraftView.EditingHelper.CurrentSelection.LevelInfo[2].tag);
            Assert.IsFalse(m_btDraftView.TeEditingHelper.InBookTitle);
        }
Ejemplo n.º 12
0
        public void FindPrevBackTrans_SectionParaToPara_PrevParaFinished()
        {
            CheckDisposed();

            IScrSection    section = m_book.SectionsOS[1];
            ICmTranslation trans   = new CmTranslation(Cache,
                                                       ((StTxtPara)section.ContentOA.ParagraphsOS[0]).TranslationsOC.HvoArray[0]);

            m_btDraftView.SetTransStatus(trans, BackTranslationStatus.Finished);

            m_btDraftView.SetInsertionPoint(0, 1, 1, 0, false);

            m_btDraftView.CallPrevUnfinishedBackTrans();
            SelectionHelper helper = m_btDraftView.EditingHelper.CurrentSelection;

            Assert.AreEqual(0, helper.IchAnchor);
            Assert.AreEqual(0, m_btDraftView.TeEditingHelper.BookIndex);
            Assert.AreEqual(1, m_btDraftView.TeEditingHelper.SectionIndex);
            Assert.AreEqual(0, m_btDraftView.ParagraphIndex);
            Assert.AreEqual((int)ScrSection.ScrSectionTags.kflidHeading,
                            m_btDraftView.EditingHelper.CurrentSelection.LevelInfo[2].tag);
            Assert.IsFalse(m_btDraftView.TeEditingHelper.InBookTitle);
        }
Ejemplo n.º 13
0
        public void GetAnnotationLocationInfo_BTLongerThanVern()
        {
            CheckDisposed();

            int wsBt = Cache.DefaultAnalWs;
            // Add a section
            IScrSection   section    = m_scr.ScriptureBooksOS[0].SectionsOS[1];
            StTxtPara     para       = (StTxtPara)section.ContentOA.ParagraphsOS[0];
            CmTranslation transPara1 = (CmTranslation)para.GetOrCreateBT();

            // The text "11BT Verse one" is already added, but we add a couple more verses...
            m_scrInMemoryCache.AddRunToMockedTrans(transPara1, wsBt, ". ", null);
            m_scrInMemoryCache.AddRunToMockedTrans(transPara1, wsBt, "2", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedTrans(transPara1, wsBt, "BT verse two. ", null);
            section.AdjustReferences();

            // Set up a simple selection in the first back translation paragraph.
            m_btDraftView.SelectRangeOfChars(0, 1, 0, 0, 25);

            CmObject  topObj, bottomObj;
            int       wsSelector;
            int       startOffset, endOffset;
            ITsString tssQuote;
            BCVRef    startRef, endRef;

            m_btDraftView.TeEditingHelper.GetAnnotationLocationInfo(out topObj, out bottomObj, out wsSelector,
                                                                    out startOffset, out endOffset, out tssQuote, out startRef, out endRef);

            Assert.AreEqual(transPara1.Hvo, topObj.Hvo);
            Assert.AreEqual(transPara1.Hvo, bottomObj.Hvo);
            Assert.AreEqual(wsBt, wsSelector);
            Assert.AreEqual(0, startOffset);
            Assert.AreEqual(25, endOffset);
            Assert.AreEqual(new BCVRef(2, 1, 1), startRef);
            Assert.AreEqual(new BCVRef(2, 1, 2), endRef);
            Assert.AreEqual("BT Verse one. BT verse", tssQuote.Text);
        }
Ejemplo n.º 14
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a Back Translation for the stuff in Exodus with the following layout:
        ///
        ///			()
        ///		   BT Heading 1
        ///	BT Intro text
        ///		   BT Heading 2
        ///	(1)1BT Verse one.
        ///
        ///	(1) = chapter number 1
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void CreatePartialExodusBT(int wsAnal)
        {
            IScrBook      book    = ScrBook.FindBookByID(m_scr, 2);
            IScrSection   section = book.SectionsOS[0];
            ScrTxtPara    para    = new ScrTxtPara(Cache, section.HeadingOA.ParagraphsOS.HvoArray[0]);
            CmTranslation trans   = (CmTranslation)para.GetOrCreateBT();

            m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Heading 1", null);

            para  = new ScrTxtPara(Cache, section.ContentOA.ParagraphsOS.HvoArray[0]);
            trans = (CmTranslation)para.GetOrCreateBT();
            m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Intro text", null);

            section = book.SectionsOS[1];
            para    = new ScrTxtPara(Cache, section.HeadingOA.ParagraphsOS.HvoArray[0]);
            trans   = (CmTranslation)para.GetOrCreateBT();
            m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Heading 2", null);

            para  = new ScrTxtPara(Cache, section.ContentOA.ParagraphsOS.HvoArray[0]);
            trans = (CmTranslation)para.GetOrCreateBT();
            m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "1", ScrStyleNames.ChapterNumber);
            m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "1", ScrStyleNames.VerseNumber);
            m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Verse one", null);
        }
Ejemplo n.º 15
0
        public void ExportBookSection_BTIntroWithNotes()
        {
            int         wsAnal       = Cache.DefaultAnalWs;
            IScrSection introSection = m_scrInMemoryCache.AddIntroSectionToMockedBook(m_book.Hvo);

            m_scrInMemoryCache.AddSectionHeadParaToSection(introSection.Hvo, "Introduccion",
                                                           ScrStyleNames.IntroSectionHead);
            StTxtPara introPara = AddPara(introSection, ScrStyleNames.NormalParagraph);

            AddVerse(introPara, 0, 0, "Texto de introduccion");
            CmTranslation trans = (CmTranslation)m_scrInMemoryCache.AddTransToMockedParagraph(introPara,
                                                                                              LangProject.kguidTranBackTranslation, wsAnal);

            trans.Translation.SetAlternative("Introduction text", wsAnal);
            ScrScriptureNote note = (ScrScriptureNote)m_scrInMemoryCache.AddAnnotation(trans,
                                                                                       01001000, NoteType.Consultant, "This is a basic note about the BT of an intro.");

            note.ResolutionStatus = NoteStatus.Open;
            note.BeginOffset      = 0;
            note.EndOffset        = 5;
            note.WsSelector       = wsAnal;

            DateTime now    = DateTime.Now;
            string   strNow = now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss.ff");

            note.DateCreated  = now;
            note.DateModified = now;

            StringWriter  stream = new StringWriter();
            XmlTextWriter writer = new XmlTextWriter(stream);

            writer.Formatting = Formatting.None;
            m_exporter        = new ExportXml(null, Cache, null, ExportWhat.AllBooks, 0, 0, 0,
                                              "ExportBookSection_IntroWithNotes");
            // Initialize writing systems for export (required to export back translations), but
            // called from ExportTE.
            ReflectionHelper.CallMethod(m_exporter, "InitializeExportWs", null);
            ReflectionHelper.SetField(m_exporter, "m_writer", writer);
            string sCanon = "ot";

            ReflectionHelper.CallMethod(m_exporter, "ExportBook", sCanon, m_book, null);

            XmlDocument actual = new XmlDocument();

            actual.Load(new StringReader(stream.ToString()));
            string strExpected = "<book ID=\"GEN\"><titleGroup short=\"Genesis\"><title type=\"main\">" +
                                 "<trGroup><tr>Genesis</tr></trGroup></title></titleGroup>" +
                                 "<introduction><section><sectionHead><trGroup><tr>Introduction</tr></trGroup></sectionHead>" +
                                 "<p><annotation type=\"consultantNote\" status=\"0\" oxesRef=\"GEN.1.0\" beginOffset=\"0\" " +
                                 "endOffset=\"5\" languageInFocus=\"en\">" +
                                 "<created>" + strNow + "</created><modified>" + strNow + "</modified>" +
                                 "<resolved /><notationDiscussion><para xml:lang=\"en\">" +
                                 "<run>This is a basic note about the BT of an intro.</run></para></notationDiscussion></annotation>" +
                                 "<trGroup><tr><userCS type=\"Paragraph\">Some intro text</userCS></tr>" +
                                 "<bt xml:lang=\"en\">Texto de introduccion</bt></trGroup>" +
                                 "<chapterEnd ID=\"GEN.0\"/></p></section></introduction></book>";

            XmlDocument expected = new XmlDocument();

            expected.Load(new StringReader(strExpected));

            string strDifference;

            if (!XmlHelper.CompareXmlNodes(expected.ChildNodes, actual.ChildNodes, out strDifference))
            {
                Assert.Fail(strDifference);
            }
        }
Ejemplo n.º 16
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This is the main interesting method of displaying objects and fragments of them.
        /// A Scripture is displayed by displaying its Books;
        /// and a Book is displayed by displaying its Title and Sections;
        /// and a Section is diplayed by displaying its Heading and Content;
        /// which are displayed by using the standard view constructor for StText.
        /// </summary>
        /// <param name="vwenv"></param>
        /// <param name="hvo"></param>
        /// <param name="frag"></param>
        /// ------------------------------------------------------------------------------------
        public override void Display(IVwEnv vwenv, int hvo, int frag)
        {
            CheckDisposed();

            switch (frag)
            {
            case (int)FootnoteFrags.kfrScripture:
            case (int)ScrFrags.kfrScripture:
            {
                // This fragment should only be used on full refresh - clear the user prompt
                // flags so they will be shown again.
                ClearUserPromptUpdates();

                // We add this lazy - we will expand some of it immediately, but the non-
                // visible parts will remain lazy!
                vwenv.NoteDependency(new int[] { m_cache.LangProject.TranslatedScriptureOAHvo },
                                     new int[] { (int)Scripture.ScriptureTags.kflidScriptureBooks }, 1);
                vwenv.AddLazyVecItems(BooksTag, this,
                                      frag == (int)ScrFrags.kfrScripture ? (int)ScrFrags.kfrBook : (int)FootnoteFrags.kfrBook);

                // Add a 48 point gap at the bottom of the view
                if (!PrintLayout && (frag != (int)FootnoteFrags.kfrScripture))
                {
                    vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0);
                }
                break;
            }

            case (int)ScrFrags.kfrBook:
            {
                vwenv.OpenDiv();
                vwenv.AddObjProp((int)ScrBook.ScrBookTags.kflidTitle, this,
                                 (int)StTextFrags.kfrText);
                vwenv.AddLazyVecItems((int)ScrBook.ScrBookTags.kflidSections, this,
                                      (int)ScrFrags.kfrSection);

                // Add a 48 point gap at the bottom of the view
                if (!PrintLayout && m_fShowTailingSpace)
                {
                    vwenv.AddSimpleRect(ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0);
                }

                if (!PrintLayout)
                {
                    InsertBookSeparator(hvo, vwenv);
                }
                vwenv.CloseDiv();
                break;
            }

            case (int)ScrFrags.kfrSection:
            {
                vwenv.OpenDiv();
                vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidHeading, this,
                                 (int)StTextFrags.kfrText);
                vwenv.AddObjProp((int)ScrSection.ScrSectionTags.kflidContent, this,
                                 (int)StTextFrags.kfrText);
                vwenv.CloseDiv();
                break;
            }

            case (int)StTextFrags.kfrPara:
                if (PrintLayout || !m_fDisplayInTable)
                {
                    // We are displaying Scripture or a print layout view
                    base.Display(vwenv, hvo, frag);
                }
                else
                {
                    // We are displaying a back translation or Scripture in draftview in a table
                    // Open a table to display the BT para in column 1, and the icon in column 2.
                    VwLength vlTable;                             // we use this to specify that the table takes 100% of the width.
                    vlTable.nVal = 10000;
                    vlTable.unit = VwUnit.kunPercent100;

                    VwLength vlColumn;                             // and this one to specify 90% for the text
                    vlColumn.nVal = DisplayTranslation ? 9000 : 10000;
                    vlColumn.unit = VwUnit.kunPercent100;

                    int nColumns = DisplayTranslation ? 2 : 1;

                    vwenv.OpenTable(nColumns,                 // One or two columns.
                                    vlTable,                  // Table uses 100% of available width.
                                    0,                        // Border thickness.
                                    VwAlignment.kvaLeft,      // Default alignment.
                                    VwFramePosition.kvfpVoid, // No border.
                                                              //VwFramePosition.kvfpBox,
                                                              //VwRule.kvrlAll, // rule lines between cells
                                    VwRule.kvrlNone,
                                    0,                        //No space between cells.
                                    0,                        //No padding inside cells.
                                    false);

                    // Specify column widths. The first argument is the number of columns,
                    // not a column index.
                    vwenv.MakeColumns(nColumns, vlColumn);
                    vwenv.OpenTableBody();
                    vwenv.OpenTableRow();

                    // Display paragraph in the first cell
                    vwenv.OpenTableCell(1, 1);
                    InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this);
                    vwenv.CloseTableCell();

                    if (DisplayTranslation)
                    {
                        // Stylesheet should never be null for a VC that displays BTs, but to be safe...
                        Debug.Assert(m_stylesheet != null);
                        if (m_stylesheet != null)
                        {
                            StPara       para       = new StPara(m_cache, hvo);
                            ITsTextProps styleRules = para.StyleRules;
                            if (styleRules == null)
                            {
                                Debug.Fail("Style Rules should not be null");
                                styleRules = NormalStyle;
                            }
                            string       paraStyleName = styleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
                            ITsTextProps ttp           = m_stylesheet.GetStyleRgch(0, paraStyleName);
                            Debug.Assert(ttp != null);
                            if (ttp != null)
                            {
                                int var;
                                int spaceBefore = ttp.GetIntPropValues((int)FwTextPropType.ktptSpaceBefore, out var);
                                if (spaceBefore > 0)
                                {
                                    vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, var, spaceBefore);
                                }
                            }
                        }
                        // BT status icon in the next cell, not editable
                        vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
                                              (int)TptEditable.ktptNotEditable);
                        vwenv.OpenTableCell(1, 1);
                        vwenv.AddObjVec((int)StTxtPara.StTxtParaTags.kflidTranslations, this, (int)ScrFrags.kfrBtTranslationStatus);
                        vwenv.CloseTableCell();
                    }

                    // Close table
                    vwenv.CloseTableRow();
                    vwenv.CloseTableBody();
                    vwenv.CloseTable();
                }
                break;

            case (int)ScrFrags.kfrBtTranslationStatus:
            {
                CmTranslation trans = new CmTranslation(m_cache, hvo);
                if (trans != null)
                {
                    string          status = trans.Status.GetAlternative(m_wsDefault);
                    stdole.IPicture picture;
                    if (status == BackTranslationStatus.Checked.ToString())
                    {
                        picture = m_CheckedPic;
                    }
                    else if (status == BackTranslationStatus.Finished.ToString())
                    {
                        picture = m_FinishedPic;
                    }
                    else
                    {
                        picture = m_UnfinishedPic;
                    }

                    vwenv.OpenDiv();
                    vwenv.AddPicture(picture, -1, 0, 0);
                    vwenv.NoteDependency(new int[] { hvo },
                                         new int[] { (int)CmTranslation.CmTranslationTags.kflidStatus }, 1);
                    vwenv.CloseDiv();
                }
            }
            break;

            default:
                base.Display(vwenv, hvo, frag);
                break;
            }
        }