Ejemplo n.º 1
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.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <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);
			}
		}
Ejemplo n.º 3
0
		public void TransWithNullType()
		{
			CheckDisposed();

			AddDataToMatthew();

			// Clear the type of the existing translation.
			ScrSection section = (ScrSection)m_book.SectionsOS[1];
			ScrTxtPara para = new ScrTxtPara(Cache, section.ContentOA.ParagraphsOS.HvoArray[0]);
			CmTranslation trans = (CmTranslation)para.GetOrCreateBT();
			trans.TypeRA = null;

			// Set up a second and third invalid translations.
			para.TranslationsOC.Add(new CmTranslation());
			para.TranslationsOC.Add(new CmTranslation());

			Assert.AreEqual(para.TranslationsOC.Count, 3,
				"We expect to have three translations owned by the paragraph.");
			CmTranslation testTrans = (CmTranslation)para.GetBT();
			Assert.AreEqual(para.TranslationsOC.Count, 1,
				"We expect to have only one translation owned by the paragraph." +
				"The back translation without a type should have been deleted.");
			trans = new CmTranslation(Cache, para.TranslationsOC.HvoArray[0]);
			Assert.AreEqual(trans.TypeRA.Guid, new Guid("80a0dddb-8b4b-4454-b872-88adec6f2aba"),
				"We expect the translation to be of type back translation.");
		}