コード例 #1
0
ファイル: SelectionHelper.cs プロジェクト: bbriggs/FieldWorks
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is like GetSelectionProps, except that the vvpsSoft items include all
		/// formatting MINUS the hard formatting in the text properties (ie, those derived by
		/// the view constructor and styles).
		/// </summary>
		/// <param name="vwSel">The view Selection</param>
		/// <param name="vttp">Returned array of ITsTextProps in the selection</param>
		/// <param name="vvpsSoft">Returned array of IVwPropertyStores in the selection</param>
		/// <param name="cttp">Returned count of properties</param>
		/// ------------------------------------------------------------------------------------
		public static void GetHardAndSoftCharProps(IVwSelection vwSel,
			out ITsTextProps[] vttp, out IVwPropertyStore[] vvpsSoft, out int cttp)
		{
			vttp = null;
			vvpsSoft = null;

			GetSelectionProps(vwSel, out vttp, out vvpsSoft, out cttp);

			if (cttp == 0)
				return;

			using (ArrayPtr pvTtp = MarshalEx.ArrayToNative<ITsTextProps>(cttp))
			{
				using (ArrayPtr pvVps = MarshalEx.ArrayToNative<IVwPropertyStore>(cttp))
				{
					vwSel.GetHardAndSoftCharProps(cttp, pvTtp, pvVps, out cttp);
					vttp = MarshalEx.NativeToArray<ITsTextProps>(pvTtp, cttp);
					vvpsSoft = MarshalEx.NativeToArray<IVwPropertyStore>(pvVps, cttp);
				}
			}
		}