Beispiel #1
0
        /// <summary>
        /// Get the array of SelLevInfo corresponding to one end point of a selection.
        /// </summary>
        /// <param name="vwselNew"></param>
        /// <param name="fEndPoint">True if we want the end of the selection. False if we want the anchor.</param>
        /// <returns></returns>
        protected static SelLevInfo[] GetOneEndPointOfSelection(IVwSelection vwselNew, bool fEndPoint)
        {
            // Get the info about the other end of the selection.
            int cvsli = vwselNew.CLevels(fEndPoint) - 1;

            SelLevInfo[] rgvsliEnd;
            using (ArrayPtr prgvsli = MarshalEx.ArrayToNative <SelLevInfo>(cvsli))
            {
                int          ihvoRoot, tagTextProp, cpropPrevious, ich, ws;
                bool         fAssocPrev;
                ITsTextProps ttpSelProps;
                vwselNew.AllSelEndInfo(fEndPoint, out ihvoRoot, cvsli, prgvsli,
                                       out tagTextProp, out cpropPrevious, out ich,
                                       out ws, out fAssocPrev, out ttpSelProps);
                rgvsliEnd = MarshalEx.NativeToArray <SelLevInfo>(prgvsli, cvsli);
            }
            return(rgvsliEnd);
        }
Beispiel #2
0
		/// <summary>
		/// Get the array of SelLevInfo corresponding to one end point of a selection.
		/// </summary>
		/// <param name="vwselNew"></param>
		/// <param name="fEndPoint">True if we want the end of the selection. False if we want the anchor.</param>
		/// <returns></returns>
		protected static SelLevInfo[] GetOneEndPointOfSelection(IVwSelection vwselNew, bool fEndPoint)
		{
			// Get the info about the other end of the selection.
			int ihvoRoot, tagTextProp, cpropPrevious, ich, ws;
			bool fAssocPrev;
			ITsTextProps ttpSelProps;
			int cvsli = vwselNew.CLevels(fEndPoint) - 1;
			SelLevInfo[] rgvsliEnd;
			using (ArrayPtr prgvsli = MarshalEx.ArrayToNative(cvsli, typeof(SelLevInfo)))
			{
				vwselNew.AllSelEndInfo(fEndPoint, out ihvoRoot, cvsli, prgvsli,
					out tagTextProp, out cpropPrevious, out ich,
					out ws, out fAssocPrev, out ttpSelProps);
				rgvsliEnd = (SelLevInfo[])MarshalEx.NativeToArray(prgvsli, cvsli,
						typeof(SelLevInfo));
			}
			return rgvsliEnd;
		}