internal static UnsafeNativeMethods.ITfCompositionView GetCurrentCompositionView(UnsafeNativeMethods.ITfDocumentMgr documentMgr)
 {
     UnsafeNativeMethods.ITfContext tfContext;
     documentMgr.GetBase(out tfContext);
     UnsafeNativeMethods.ITfCompositionView composition = FrameworkTextComposition.GetComposition(tfContext);
     Marshal.ReleaseComObject(tfContext);
     return(composition);
 }
Esempio n. 2
0
        internal static UnsafeNativeMethods.ITfCompositionView GetCurrentCompositionView(UnsafeNativeMethods.ITfDocumentMgr documentMgr)
        {
            UnsafeNativeMethods.ITfContext context;

            documentMgr.GetBase(out context);

            UnsafeNativeMethods.ITfCompositionView view = GetComposition(context);

            Marshal.ReleaseComObject(context);

            return(view);
        }
        private static UnsafeNativeMethods.ITfCompositionView GetComposition(UnsafeNativeMethods.ITfContext context)
        {
            UnsafeNativeMethods.ITfCompositionView[]    array = new UnsafeNativeMethods.ITfCompositionView[1];
            UnsafeNativeMethods.ITfContextComposition   tfContextComposition = (UnsafeNativeMethods.ITfContextComposition)context;
            UnsafeNativeMethods.IEnumITfCompositionView enumITfCompositionView;
            tfContextComposition.EnumCompositions(out enumITfCompositionView);
            int num;

            enumITfCompositionView.Next(1, array, out num);
            Marshal.ReleaseComObject(enumITfCompositionView);
            return(array[0]);
        }
 internal static void CompleteCurrentComposition(UnsafeNativeMethods.ITfDocumentMgr documentMgr)
 {
     UnsafeNativeMethods.ITfContext tfContext;
     documentMgr.GetBase(out tfContext);
     UnsafeNativeMethods.ITfCompositionView composition = FrameworkTextComposition.GetComposition(tfContext);
     if (composition != null)
     {
         UnsafeNativeMethods.ITfContextOwnerCompositionServices tfContextOwnerCompositionServices = tfContext as UnsafeNativeMethods.ITfContextOwnerCompositionServices;
         tfContextOwnerCompositionServices.TerminateComposition(composition);
         Marshal.ReleaseComObject(composition);
     }
     Marshal.ReleaseComObject(tfContext);
 }
Esempio n. 5
0
        //------------------------------------------------------
        //
        //  Internal Events
        //
        //------------------------------------------------------

        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        /// <summary>
        ///     Get ITfContextView of the context.
        /// </summary>
        private static UnsafeNativeMethods.ITfCompositionView GetComposition(UnsafeNativeMethods.ITfContext context)
        {
            UnsafeNativeMethods.ITfContextComposition   contextComposition;
            UnsafeNativeMethods.IEnumITfCompositionView enumCompositionView;
            UnsafeNativeMethods.ITfCompositionView[]    compositionViews = new UnsafeNativeMethods.ITfCompositionView[1];
            int fetched;

            contextComposition = (UnsafeNativeMethods.ITfContextComposition)context;
            contextComposition.EnumCompositions(out enumCompositionView);

            enumCompositionView.Next(1, compositionViews, out fetched);

            Marshal.ReleaseComObject(enumCompositionView);
            return(compositionViews[0]);
        }
        public override void Complete()
        {
//             VerifyAccess();

            UnsafeNativeMethods.ITfContext context = GetTransitoryContext();
            UnsafeNativeMethods.ITfContextOwnerCompositionServices compositionService = context as UnsafeNativeMethods.ITfContextOwnerCompositionServices;
            UnsafeNativeMethods.ITfCompositionView composition = GetComposition(context);

            if (composition != null)
            {
                // Terminate composition if there is a composition view.
                compositionService.TerminateComposition(composition);
                Marshal.ReleaseComObject(composition);
            }

            Marshal.ReleaseComObject(context);
        }
Esempio n. 7
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        internal static void CompleteCurrentComposition(UnsafeNativeMethods.ITfDocumentMgr documentMgr)
        {
            UnsafeNativeMethods.ITfContext context;

            documentMgr.GetBase(out context);

            UnsafeNativeMethods.ITfCompositionView composition = GetComposition(context);

            if (composition != null)
            {
                UnsafeNativeMethods.ITfContextOwnerCompositionServices compositionService = context as UnsafeNativeMethods.ITfContextOwnerCompositionServices;

                // Terminate composition if there is a composition view.
                compositionService.TerminateComposition(composition);
                Marshal.ReleaseComObject(composition);
            }

            Marshal.ReleaseComObject(context);
        }
        private UnsafeNativeMethods.ITfCompositionView GetComposition(UnsafeNativeMethods.ITfContext context) 
        {
            UnsafeNativeMethods.ITfContextComposition contextComposition; 
            UnsafeNativeMethods.IEnumITfCompositionView enumCompositionView;
            UnsafeNativeMethods.ITfCompositionView[] compositionViews = new UnsafeNativeMethods.ITfCompositionView[1];
            int fetched;
 
            contextComposition = (UnsafeNativeMethods.ITfContextComposition)context;
            contextComposition.EnumCompositions(out enumCompositionView); 
 
            enumCompositionView.Next(1, compositionViews, out fetched);
 
            Marshal.ReleaseComObject(enumCompositionView);
            return compositionViews[0];

        } 
Esempio n. 9
0
 public void OnEndComposition(UnsafeNativeMethods.ITfCompositionView view)
 {
 }
Esempio n. 10
0
 public void OnUpdateComposition(UnsafeNativeMethods.ITfCompositionView view, UnsafeNativeMethods.ITfRange rangeNew)
 {
 }
Esempio n. 11
0
        //------------------------------------------------------
        //
        //  Public Methods - ITfContextOwnerCompositionSink
        //
        //------------------------------------------------------

        #region ITfContextOwnerCompositionSink

        public void OnStartComposition(UnsafeNativeMethods.ITfCompositionView view, out bool ok)
        {
            // Return true in ok to start the composition.
            ok = true;
        }