/// <summary>
 /// Initialize the drag and drop manager with its context. Note that this object
 /// is initialized in the 3 stages: construction, replacement of MSHTML DropTarget
 /// implementation, and finally installation of drag and drop event handlers for
 /// the drag target control. The 3-step initialization is required because MSHTML
 /// also initializes in stages and our initialization must correspond to its/
 /// </summary>
 /// <param name="context">presentation editor context</param>
 public MshtmlEditorDragAndDropTarget(IHtmlMarshallingTarget context, IDataFormatHandlerFactory dataFormats) : base(dataFormats)
 {
     // store reference to context
     htmlMarshallingTarget = context;
 }
 /// <summary>
 /// Initialize the drag and drop manager with its context. Note that this object
 /// is initialized in the 3 stages: construction, replacement of MSHTML DropTarget
 /// implementation, and finally installation of drag and drop event handlers for
 /// the drag target control. The 3-step initialization is required because MSHTML
 /// also initializes in stages and our initialization must correspond to its/
 /// </summary>
 /// <param name="dataFormats">the data format factory</param>
 public DragAndDropTarget(IDataFormatHandlerFactory dataFormats)
 {
     dataFormatFactory = dataFormats;
 }
 /// <summary>
 /// Initialize the drag and drop manager with its context. Note that this object
 /// is initialized in the 3 stages: construction, replacement of MSHTML DropTarget
 /// implementation, and finally installation of drag and drop event handlers for
 /// the drag target control. The 3-step initialization is required because MSHTML
 /// also initializes in stages and our initialization must correspond to its/
 /// </summary>
 /// <param name="context">presentation editor context</param>
 public MshtmlEditorDragAndDropTarget(IHtmlMarshallingTarget context, IDataFormatHandlerFactory dataFormats) : base(dataFormats)
 {
     // store reference to context
     htmlMarshallingTarget = context;
 }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        public virtual void Dispose()
        {
            _internetSecurityManager.ReleaseInnerSecurityManager();

            PostEditorEvent -= new MshtmlEditor.EditDesignerEventHandler(HtmlEditorControl_PostEditorEvent);
            HandleClear -= new HtmlEditorSelectionOperationEventHandler(TryMoveIntoNextTable);

            if (components != null)
            {
                components.Dispose();
            }

            // detach behaviors
            DetachBehaviors();

            // dispose drag and drop manager
            if (mshtmlEditorDragAndDropTarget != null)
            {
                mshtmlEditorDragAndDropTarget.Dispose();
                mshtmlEditorDragAndDropTarget = null;
            }

            if (_dataFormatHandlerFactory != null)
            {
                _dataFormatHandlerFactory.Dispose();
                _dataFormatHandlerFactory = null;
            }

            if (_damageServices != null)
                _damageServices.Dispose();

            // dispose link navigator
            if (linkNavigator != null)
                linkNavigator.Dispose();

            if (_mshtmlEditor != null)
            {
                _mshtmlEditor.DocumentComplete -= new EventHandler(_mshtmlEditor_DocumentComplete);
                _mshtmlEditor.DocumentEvents.GotFocus -= htmlEditor_GotFocus;
                _mshtmlEditor.DocumentEvents.LostFocus -= htmlEditor_LostFocus;
                _mshtmlEditor.DocumentEvents.KeyDown -= new HtmlEventHandler(DocumentEvents_KeyDown);
                _mshtmlEditor.DocumentEvents.KeyUp -= new HtmlEventHandler(DocumentEvents_KeyUp);
                _mshtmlEditor.DocumentEvents.KeyPress -= new HtmlEventHandler(DocumentEvents_KeyPress);
                _mshtmlEditor.DocumentEvents.MouseDown -= new HtmlEventHandler(DocumentEvents_MouseDown);
                _mshtmlEditor.DocumentEvents.MouseUp -= new HtmlEventHandler(DocumentEvents_MouseUp);
                _mshtmlEditor.DocumentEvents.SelectionChanged -= new EventHandler(DocumentEvents_SelectionChanged);
                _mshtmlEditor.DisplayChanged -= new EventHandler(_mshtmlEditor_DisplayChanged);
                _mshtmlEditor.DocumentEvents.Click -= new HtmlEventHandler(DocumentEvents_Click);
                _mshtmlEditor.CommandKey -= new KeyEventHandler(_mshtmlEditor_CommandKey);
                _mshtmlEditor.BeforeShowContextMenu -= new EventHandler(_mshtmlEditor_BeforeShowContextMenu);
                _mshtmlEditor.DropTargetHandler = null;
                _mshtmlEditor.PreHandleEvent -= new HtmlEditDesignerEventHandler(OnPreHandleEvent);
                _mshtmlEditor.MshtmlControl.DLControlFlagsChanged -= new EventHandler(_mshtmlControl_DLControlFlagsChanged);
                _mshtmlEditor.TranslateAccelerator -= new HtmlEditDesignerEventHandler(_mshtmlEditor_TranslateAccelerator);

                if (ShouldCacheEditor())
                {
                    _mshtmlEditor.Active = false;
                    _editorCache = new CachedEditorAndSecurityManager { Editor = _mshtmlEditor, SecurityManager = _internetSecurityManager };
                }
                else
                {
                    _mshtmlEditor.Dispose();
                    _mshtmlEditor = null;
                }
            }
        }
 /// <summary>
 /// Initialize the drag and drop manager with its context. Note that this object
 /// is initialized in the 3 stages: construction, replacement of MSHTML DropTarget
 /// implementation, and finally installation of drag and drop event handlers for
 /// the drag target control. The 3-step initialization is required because MSHTML
 /// also initializes in stages and our initialization must correspond to its/
 /// </summary>
 /// <param name="dataFormats">the data format factory</param>
 public DragAndDropTarget(IDataFormatHandlerFactory dataFormats)
 {
     dataFormatFactory = dataFormats;
 }