/// ------------------------------------------------------------------------------------ /// <summary> /// Adjusts the references of the section and creates any needed BT's /// </summary> /// <param name="hvoText">The StText that was changed</param> /// <param name="ivMin">the starting index where the change occurred</param> /// <param name="cvIns">the number of paragraphs inserted</param> /// <param name="cvDel">the number of paragraphs deleted</param> /// ------------------------------------------------------------------------------------ protected override void DoEffectsOfPropChange(int hvoText, int ivMin, int cvIns, int cvDel) { if (cvIns == 0 && cvDel == 0) { return; // Nothing actually changed } int flid = m_cache.GetOwningFlidOfObject(hvoText); StText text = new StText(m_cache, hvoText, false, false); FdoOwningSequence <IStPara> paras = text.ParagraphsOS; // Create back translations for any new paragraphs if (flid == (int)ScrSection.ScrSectionTags.kflidContent || flid == (int)ScrSection.ScrSectionTags.kflidHeading || flid == (int)ScrBook.ScrBookTags.kflidTitle) { for (int iPara = ivMin; iPara < ivMin + cvIns; iPara++) { ScrTxtPara para = new ScrTxtPara(m_cache, paras.HvoArray[iPara]); para.GetOrCreateBT(); } } // Adjust section references for section contents if we have some paragraphs left if (flid == (int)ScrSection.ScrSectionTags.kflidContent && paras.Count > 0) { ScrTxtPara.AdjustSectionRefsForStTextParaChg(text, ivMin); } // If we show boundary markers and we insert or delete a paragraph, we have to // update the marker of the previous paragraph as well, as that might // now be no longer the last paragraph (and thus needs to show the paragraph // marker instead of the section marker). if (((cvIns > 0 && cvDel == 0) || (cvIns == 0 && cvDel > 0)) && ivMin > 0 && Options.ShowFormatMarksSetting) { text.Cache.PropChanged(null, PropChangeType.kpctNotifyAll, hvoText, (int)StText.StTextTags.kflidParagraphs, ivMin - 1, 1, 1); } }
/// ------------------------------------------------------------------------------------ /// <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); }