GetSelEndInfo() private method

Get information about the selection
private GetSelEndInfo ( bool fEnd ) : bool
fEnd bool true to get information about the end of the selection, /// otherwise false.
return bool
Esempio n. 1
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Gets all information about a selection by calling <c>IVwSelection.AllTextSelInfo</c>.
		/// </summary>
		/// <param name="vwSel">The selection to get info for, or <c>null</c> to get current
		/// selection.</param>
		/// <param name="rootSite">The root site</param>
		/// <returns>A new <see cref="SelectionHelper"/> object</returns>
		/// -----------------------------------------------------------------------------------
		public static SelectionHelper GetSelectionInfo(IVwSelection vwSel, IVwRootSite rootSite)
		{
			if (s_mockedSelectionHelper != null)
				return s_mockedSelectionHelper;

			if (vwSel == null || !vwSel.IsValid)
			{
				if (rootSite == null || rootSite.RootBox == null)
					return null;
				vwSel = rootSite.RootBox.Selection;
				if (vwSel == null || !vwSel.IsValid)
					return null;
			}

			Debug.Assert(vwSel.IsValid);
			SelectionHelper helper = new SelectionHelper(vwSel, rootSite);

			if (!helper.GetSelEndInfo(false))
				return null;
			if (!helper.GetSelEndInfo(true))
				return null;

			return helper;
		}