Example #1
0
        UnmanagedMethods.HRESULT IDropTarget.DragEnter(IOleDataObject pDataObj, int grfKeyState, long pt, ref DropEffect pdwEffect)
        {
            var dispatch = _tl?.Input;

            if (dispatch == null)
            {
                pdwEffect = DropEffect.None;
                return(UnmanagedMethods.HRESULT.S_OK);
            }
            _currentDrag = pDataObj as IDataObject;
            if (_currentDrag == null)
            {
                _currentDrag = new OleDataObject(pDataObj);
            }

            var args = new RawDragEvent(
                _dragDevice,
                RawDragEventType.DragEnter,
                _target,
                GetDragLocation(pt),
                _currentDrag,
                ConvertDropEffect(pdwEffect),
                ConvertKeyState(grfKeyState)
                );

            dispatch(args);
            pdwEffect = ConvertDropEffect(args.Effects);

            return(UnmanagedMethods.HRESULT.S_OK);
        }
Example #2
0
        /// <summary>
        /// Gets the file list.
        /// </summary>
        /// <param name="xd4b53aa4023f2377">The xd4b53aa4023f2377.</param>
        /// <returns></returns>
        internal static string[] GetFileList(IOleDataObject xd4b53aa4023f2377)
        {
            string[]  strArray   = null;
            FORMATETC pformatetc = new FORMATETC();
            STGMEDIUM pmedium    = new STGMEDIUM();

            pformatetc.cfFormat = 15;
            pformatetc.tymed    = TYMED.TYMED_HGLOBAL;
            pformatetc.dwAspect = DVASPECT.DVASPECT_CONTENT;
            if (xd4b53aa4023f2377.GetData(ref pformatetc, ref pmedium) != 0)
            {
                return(null);
            }
            int           num      = DragQueryFile(pmedium.unionmember, -1, null, 0);
            StringBuilder lpszFile = new StringBuilder(260);

            if (num > 0)
            {
                strArray = new string[num];
                for (int i = 0; i < num; i++)
                {
                    DragQueryFile(pmedium.unionmember, i, lpszFile, lpszFile.Capacity);
                    strArray[i] = lpszFile.ToString();
                }
            }
            ReleaseStgMedium(ref pmedium);
            return(strArray);
        }
        /// <summary>
        /// Create an OleDataObject from a native Ole data object
        /// </summary>
        /// <param name="odo">native ole data object</param>
        /// <returns>newly created OleDataObject</returns>
        public static OleDataObject CreateFrom(IOleDataObject odo)
        {
            OleDataObject oleDataObject = new OleDataObject();

            oleDataObject.m_dataObject = odo;
            return(oleDataObject);
        }
        /// <summary>
        /// Helper to cal the Mshtml DragDrop routine using .NET DragEventArgs
        /// </summary>
        /// <param name="e">event args</param>
        private void CallMshtmlDragDrop(DragEventArgs e, bool allowExceptions)
        {
            if (mshtmlDropTargetImpl == null)
            {
                return;
            }

            try
            {
                // extract ole data object
                IOleDataObject oleDataObject = SafeExtractOleDataObject(e.Data);

                // convert data types
                POINT      pt         = new POINT(); pt.x = e.X; pt.y = e.Y;
                DROPEFFECT dropEffect = ConvertDropEffect(e.AllowedEffect);
                MK         keyState   = ConvertKeyState(e.KeyState);

                // call mshtml
                mshtmlDropTargetImpl.Drop(oleDataObject, keyState, pt, ref dropEffect);

                // copy any changes to the dropEffect back into the event args
                e.Effect = ConvertDropEffect(dropEffect);
            }
            catch (Exception)
            {
                if (allowExceptions)
                {
                    throw;
                }
            }
        }
        /// <summary>
        /// Incorporates the source data into the target window, removes target feedback, and releases the data object
        /// </summary>
        /// <param name="pDataObj">Pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation</param>
        /// <param name="grfKeyState">Current state of the keyboard modifier keys on the keyboard</param>
        /// <param name="pt">POINTL structure containing the current cursor coordinates in screen coordinates</param>
        /// <param name="pdwEffect">Pointer to the current effect flag. Valid values are from the enumeration DROPEFFECT</param>
        void OpenLiveWriter.Interop.Com.IDropTarget.Drop(IOleDataObject pDataObj, MK grfKeyState, POINT pt, ref DROPEFFECT pdwEffect)
        {
            Debug.Fail("Unexpected call to IDropTarget.Drop");

            if (mshtmlDropTargetImpl != null)
            {
                mshtmlDropTargetImpl.Drop(pDataObj, grfKeyState, pt, ref pdwEffect);
            }
        }
Example #6
0
 int IShellExtInit.Initialize(IntPtr xdceb127ad2fd117b, IntPtr x4b9447f495c6b4a1, IntPtr x9a3377d64b14bf3d)
 {
     xdd09610a7ca17912 = null;
     try
     {
         if (xdceb127ad2fd117b != IntPtr.Zero)
         {
             StringBuilder path = new StringBuilder(260);
             x443cc432acaadb1d.SHGetPathFromIDList(xdceb127ad2fd117b, path);
             x8b5b49efcd08ae0a = path.ToString();
         }
         if (x4b9447f495c6b4a1 != IntPtr.Zero)
         {
             xdd09610a7ca17912 = Marshal.GetObjectForIUnknown(x4b9447f495c6b4a1);
             if (xdd09610a7ca17912 is IOleDataObject)
             {
                 IOleDataObject obj2 = xdd09610a7ca17912 as IOleDataObject;
                 x58c3a0df2fc736ea = x443cc432acaadb1d.x0810e12d53bb2dfb(obj2);
                 obj2 = null;
             }
         }
         if (x58c3a0df2fc736ea == null)
         {
             x58c3a0df2fc736ea = new string[0];
         }
         if (!OnInitialize())
         {
             return(x443cc432acaadb1d.x15f59d42384ec1d4);
         }
         if (!OnInitializeEx(xdd09610a7ca17912 as IOleDataObject))
         {
             return(x443cc432acaadb1d.x15f59d42384ec1d4);
         }
     }
     catch
     {
         return(x443cc432acaadb1d.x15f59d42384ec1d4);
     }
     finally
     {
         if ((xdd09610a7ca17912 != null) && (xdd09610a7ca17912 is IOleDataObject))
         {
             Marshal.ReleaseComObject(xdd09610a7ca17912);
         }
         xdd09610a7ca17912 = null;
     }
     return(0);
 }
        int IShellExtInit.Initialize(IntPtr xdceb127ad2fd117b, IntPtr x4b9447f495c6b4a1, IntPtr x9a3377d64b14bf3d)
        {
            IOleDataObject objectForIUnknown = null;

            try
            {
                if (x4b9447f495c6b4a1 != IntPtr.Zero)
                {
                    objectForIUnknown = Marshal.GetObjectForIUnknown(x4b9447f495c6b4a1) as IOleDataObject;
                    if (objectForIUnknown != null)
                    {
                        Files = x443cc432acaadb1d.GetFileList(objectForIUnknown);
                    }
                }
                if (Files == null)
                {
                    Files = new string[0];
                }
                if (!OnInitialize())
                {
                    return(x443cc432acaadb1d.x15f59d42384ec1d4);
                }
                if (!OnInitializeEx(objectForIUnknown))
                {
                    return(x443cc432acaadb1d.x15f59d42384ec1d4);
                }
            }
            catch
            {
                return(x443cc432acaadb1d.x15f59d42384ec1d4);
            }
            finally
            {
                if (objectForIUnknown != null)
                {
                    Marshal.ReleaseComObject(objectForIUnknown);
                }
            }
            return(0);
        }
Example #8
0
 public UnhandledDropTarget(DataObjectMeister dataObject, DataFormatHandlerContext handlerContext, OpenLiveWriter.Interop.Com.IDropTarget unhandledDropTarget)
     : base(dataObject, handlerContext)
 {
     _unhandledDropTarget = unhandledDropTarget;
     _oleDataObject       = MshtmlEditorDragAndDropTarget.ExtractOleDataObject(DataMeister.IDataObject);
 }
Example #9
0
 public int FilterDataObject(IOleDataObject pDO, out IOleDataObject ppDORet)
 {
     //  Debug.WriteLine("FilterDataObject");
     ppDORet = null;
     return(HRESULT.E_NOTIMPL);
 }
 /// <summary>
 /// Called by MSHTML to allow the host to replace the MSHTML data object
 /// </summary>
 /// <param name="pDO">Pointer to an IDataObject interface supplied by MSHTML</param>
 /// <param name="ppDORet">Address of a pointer variable that receives an IDataObject interface pointer supplied by the host</param>
 /// <returns>Returns S_OK if the data object is replaced, or S_FALSE if it's not replaced</returns>
 int IDocHostUIHandler2.FilterDataObject(IOleDataObject pDO, out IOleDataObject ppDORet)
 {
     // do not filter data object
     ppDORet = pDO;
     return HRESULT.S_FALSE;
 }
Example #11
0
 protected virtual bool OnInitializeEx(IOleDataObject dataObject)
 {
     return(true);
 }
 public virtual int FilterDataObject(IOleDataObject pDO, out IOleDataObject ppDORet)
 {
     // do not filter data object
     ppDORet = pDO;
     return(HRESULT.S_FALSE);
 }
Example #13
0
 public OleDataObject(IOleDataObject wrapped)
 {
     _wrapped = wrapped;
 }
 public virtual int FilterDataObject(IOleDataObject pDO, out IOleDataObject ppDORet)
 {
     // do not filter data object
     ppDORet = pDO;
     return HRESULT.S_FALSE;
 }
        public IOleDataObject SafeExtractOleDataObject(IDataObject dataObject)
        {
            IOleDataObject oleDataObject = ExtractOleDataObject(dataObject);

            return(oleDataObject ?? emptyDataObject);
        }
 /// <summary>
 /// Create an OleDataObject from a native Ole data object
 /// </summary>
 /// <param name="odo">native ole data object</param>
 /// <returns>newly created OleDataObject</returns>
 public static OleDataObject CreateFrom(IOleDataObject odo)
 {
     OleDataObject oleDataObject = new OleDataObject();
     oleDataObject.m_dataObject = odo;
     return oleDataObject;
 }
        public int FilterDataObject(IOleDataObject pDO, out IOleDataObject ppDORet)
        {
            // log access to method
            LOG("IDocHostUIHandler", "FilterDataObject");

            return docHostUIHandler.FilterDataObject(pDO, out ppDORet);
        }
        /// <summary>
        /// Incorporates the source data into the target window, removes target feedback, and releases the data object
        /// </summary>
        /// <param name="pDataObj">Pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation</param>
        /// <param name="grfKeyState">Current state of the keyboard modifier keys on the keyboard</param>
        /// <param name="pt">POINTL structure containing the current cursor coordinates in screen coordinates</param>
        /// <param name="pdwEffect">Pointer to the current effect flag. Valid values are from the enumeration DROPEFFECT</param>
        void OpenLiveWriter.Interop.Com.IDropTarget.Drop(IOleDataObject pDataObj, MK grfKeyState, POINT pt, ref DROPEFFECT pdwEffect)
        {
            Debug.Fail("Unexpected call to IDropTarget.Drop");

            if (mshtmlDropTargetImpl != null)
            {
                mshtmlDropTargetImpl.Drop(pDataObj, grfKeyState, pt, ref pdwEffect);
            }
        }
 public UnhandledDropTarget(DataObjectMeister dataObject, DataFormatHandlerContext handlerContext, OpenLiveWriter.Interop.Com.IDropTarget unhandledDropTarget)
     : base(dataObject, handlerContext)
 {
     _unhandledDropTarget = unhandledDropTarget;
     _oleDataObject = MshtmlEditorDragAndDropTarget.ExtractOleDataObject(DataMeister.IDataObject);
 }
Example #20
0
 public int FilterDataObject(IOleDataObject pDO, out IOleDataObject ppDORet)
 {
     //  Debug.WriteLine("FilterDataObject");
     ppDORet = null;
     return HRESULT.E_NOTIMPL;
 }
Example #21
0
 public static extern int DoDragDrop(
     IOleDataObject pDataObject,  // Pointer to the data object
     IDropSource pDropSource,	  // Pointer to the source
     DROPEFFECT dwOKEffect,       // Effects allowed by the source
     ref DROPEFFECT pdwEffect    // Pointer to effects on the source
     );
Example #22
0
 public static extern int DoDragDrop(
     IOleDataObject pDataObject, // Pointer to the data object
     IDropSource pDropSource,    // Pointer to the source
     DROPEFFECT dwOKEffect,      // Effects allowed by the source
     ref DROPEFFECT pdwEffect    // Pointer to effects on the source
     );
Example #23
0
 /// <summary>
 /// X0810e12d53bb2dfbs the specified xd4b53aa4023f2377.
 /// </summary>
 /// <param name="xd4b53aa4023f2377">The xd4b53aa4023f2377.</param>
 /// <returns></returns>
 internal static string[] x0810e12d53bb2dfb(IOleDataObject xd4b53aa4023f2377)
 {
     return(GetFileList(xd4b53aa4023f2377));
 }