Exemplo n.º 1
0
		public void GoToNextPara_MultiParaRangeSelection()
		{
			CheckDisposed();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal |
				DummyBasicViewVc.DisplayType.kDuplicateParagraphs);
			m_basicView.Show();
			m_basicView.RefreshDisplay();

			m_SelectionHelper = new DummySelectionHelper(null, m_basicView);

			// Make a bottom-up selection, just to be sure we're not using the anchor instead of
			// the top.
			SetSelection(0, 0, 0, 0, 2, 1, 1, false); // Set end
			SetSelection(0, 1, 0, 0, 1, 12, 12, true); // Set anchor
			IVwSelection vwsel = m_SelectionHelper.SetSelection(true);
			Assert.IsNotNull(vwsel, "No selection made");
			((RootSiteEditingHelper)m_basicView.EditingHelper).GoToNextPara();

			// We expect that the selection will be at the start of the second paragraph in
			// the selected range.
			SelectionHelper selectionHelper = SelectionHelper.GetSelectionInfo(null, m_basicView);
			Assert.IsFalse(selectionHelper.IsRange);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.Anchor, selectionHelper, 0,
				0, 0, 0, false, 2, m_flidContainingTexts, 0, 0,
				(int)StText.StTextTags.kflidParagraphs, 1, 0);
		}
Exemplo n.º 2
0
		public void GoToNextPara_LastParaInView()
		{
			CheckDisposed();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal |
				DummyBasicViewVc.DisplayType.kDuplicateParagraphs);
			m_basicView.Show();
			m_basicView.RefreshDisplay();

			m_SelectionHelper = new DummySelectionHelper(null, m_basicView);
			SetSelection(0, 1, 1, 0, 2, 6, 0, true);
			IVwSelection vwsel = m_SelectionHelper.SetSelection(true);
			Assert.IsNotNull(vwsel, "No selection made");
			Assert.IsTrue(m_basicView.IsSelectionVisible(null), "Selection is not visible");
			((RootSiteEditingHelper)m_basicView.EditingHelper).GoToNextPara();

			// We expect that the selection will be unchanged.
			SelectionHelper selectionHelper = SelectionHelper.GetSelectionInfo(null, m_basicView);
			Assert.IsTrue(selectionHelper.IsRange);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.Anchor, selectionHelper, 0,
				2, 6, 0, true, 2, m_flidContainingTexts, 0, 1,
				(int)StText.StTextTags.kflidParagraphs, 1, 0);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.End, selectionHelper, 0,
				2, 0, 0, false, 2, m_flidContainingTexts, 0, 1,
				(int)StText.StTextTags.kflidParagraphs, 1, 0);
		}
Exemplo n.º 3
0
		public void GoToNextPara_FirstFlidInNextObject()
		{
			CheckDisposed();

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kBookFootnoteDetailsSeparateParas);
			m_basicView.Show();
			m_basicView.RefreshDisplay();

			m_SelectionHelper = new DummySelectionHelper(null, m_basicView);
			SetSelection(0, 0, 0, 0, 0, 0, 0, true);
			IVwSelection vwsel = m_SelectionHelper.SetSelection(true);
			Assert.IsNotNull(vwsel, "No selection made");
			Assert.IsTrue(m_basicView.IsSelectionVisible(null), "Selection is not visible");
			((RootSiteEditingHelper)m_basicView.EditingHelper).GoToNextPara();

			// We expect that the selection will be at the start of the second footnote's marker.
			SelectionHelper selectionHelper = SelectionHelper.GetSelectionInfo(null, m_basicView);
			Assert.IsFalse(selectionHelper.IsRange);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.Anchor, selectionHelper, 0,
				0, 0, 0, false, 1, -1, -1, -1, m_flidContainingTexts, 0, 1);
		}
Exemplo n.º 4
0
		public void GoToNextPara_NextFlid()
		{
			CheckDisposed();

			// Add a title to the book
			m_scrInMemoryCache.AddTitleToMockedBook(m_hvoRoot, "The First Book of the Law given by Moses");

			ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal |
				DummyBasicViewVc.DisplayType.kBookTitle);
			m_basicView.Show();
			m_basicView.RefreshDisplay();

			// Set the IP at the beginning of the only (0th) instance of the only (0th) paragraph
			// of the only (0th) instance of the second (1th) footnote of the book we're displaying.
			m_SelectionHelper = new DummySelectionHelper(null, m_basicView);
			SetSelection(0, 1, 0, 0, 2, 0, 0, true);
			IVwSelection vwsel = m_SelectionHelper.SetSelection(true);
			Assert.IsNotNull(vwsel, "No selection made");
			Assert.IsTrue(m_basicView.IsSelectionVisible(null), "Selection is not visible");
			((RootSiteEditingHelper)m_basicView.EditingHelper).GoToNextPara();

			// We expect that the selection will be at the start of the book title.
			SelectionHelper selectionHelper = SelectionHelper.GetSelectionInfo(null, m_basicView);
			Assert.IsFalse(selectionHelper.IsRange);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.Anchor, selectionHelper, 0,
				0, 0, 0, false, 2, (int)ScrBook.ScrBookTags.kflidTitle, 0, 0,
				(int)StText.StTextTags.kflidParagraphs, 0, 0);
		}
Exemplo n.º 5
0
		public void SetSelection_DifferingLevelInfos()
		{
			CheckDisposed();

			ShowForm(Lng.English | Lng.French, DummyBasicViewVc.DisplayType.kAll);

			// test with Anchor == End, but different LevelInfos!
			m_SelectionHelper = new DummySelectionHelper(null, m_basicView);
			SetSelection(0, 1, 1, 0, 0, 6, 6, true);
			SetSelection(0, 2, 1, 0, 0, 6, 6, false);

			IVwSelection vwsel = m_SelectionHelper.SetSelection(true);
			Assert.IsNotNull(vwsel, "No selection made");
			Assert.IsTrue(m_basicView.IsSelectionVisible(null), "Selection is not visible");

			SelectionHelper selectionHelper = SelectionHelper.GetSelectionInfo(null, m_basicView);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.Anchor, selectionHelper, 0,
				0, 6, 0, false, 2, m_flidContainingTexts, 0, 1,
				(int)StText.StTextTags.kflidParagraphs, 1, 0);
			CheckSelectionHelperValues(SelectionHelper.SelLimitType.End, selectionHelper, 0, 0,
				6, 0, true, 2,  m_flidContainingTexts, 0, 2,
				(int)StText.StTextTags.kflidParagraphs, 1, 0);
		}
Exemplo n.º 6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets the selection at the specified character position in the specified instance of
		/// the specified paragraph in the specified instance of the specified footnote.
		/// </summary>
		/// <param name="cPropPrevFootnoteVec">Count of previous instances the vector of
		/// footnotes is displayed in the view</param>
		/// <param name="iFootnote">Index of footnote</param>
		/// <param name="cPropPrevParaVec">Count of previous instances the vector of paragraphs is
		/// displayed in the view</param>
		/// <param name="iPara">Index of paragraph</param>
		/// <param name="ichAnchor">Start character</param>
		/// <param name="ichEnd">End character</param>
		/// <returns>The made selection</returns>
		/// ------------------------------------------------------------------------------------
		protected IVwSelection MakeSelection(int cPropPrevFootnoteVec, int iFootnote,
			int cPropPrevParaVec, int iPara, int ichAnchor, int ichEnd)
		{
			m_SelectionHelper = new DummySelectionHelper(null, m_basicView);

			SetSelection(cPropPrevFootnoteVec, iFootnote, cPropPrevParaVec, iPara, 0, ichAnchor, ichEnd, true);

			// Now that all the preparation to set the IP is done, set it.
			IVwSelection vwsel = m_SelectionHelper.SetSelection(m_basicView, true, true);
			Application.DoEvents();

			return vwsel;
		}