Exemplo n.º 1
0
        public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
        {
            if (null == DataAdviseHolder)
            {
                ComDebug.ReportInfo("{0}.IDataObject.DAdvise -> not implemented!", GetType().Name);
                connection = 0;
                return(ComReturnValue.E_NOTIMPL);
            }
            else
            {
                ComDebug.ReportInfo("{0}.IDataObject.DAdvise {1}, {2}", GetType().Name, DataObjectHelper.FormatEtcToString(pFormatetc), advf);

                try
                {
                    if (pFormatetc.cfFormat != 0)               // if a special format is required
                    {
                        int res = QueryGetData(ref pFormatetc); // ask the render helper for availability of that format
                        if (res != ComReturnValue.S_OK)         // if the required format is not available
                        {
                            connection = 0;                     //  return an invalid connection cookie
                            return(res);                        // and the error
                        }
                    }
                    FORMATETC etc = pFormatetc;
                    DataAdviseHolder.Advise((IDataObject)this, ref etc, advf, adviseSink, out var conn);
                    connection = conn;
                    return(ComReturnValue.NOERROR);
                }
                catch (Exception e)
                {
                    ComDebug.ReportError("{0}.IDataObject.DAdvise exception: {1}", GetType().Name, e);
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds an advisory connection for the specified format.
        /// </summary>
        /// <param name="pFormatetc">The format for which this sink is called for changes.</param>
        /// <param name="advf">Advisory flags to specify callback behavior.</param>
        /// <param name="adviseSink">The IAdviseSink to call for this connection.</param>
        /// <param name="connection">Returns the new connection's ID.</param>
        /// <returns>An HRESULT.</returns>
        public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
        {
            // Check that the specified advisory flags are supported.
            const ADVF ADVF_ALLOWED = ADVF.ADVF_NODATA | ADVF.ADVF_ONLYONCE | ADVF.ADVF_PRIMEFIRST;

            if ((int)((advf | ADVF_ALLOWED) ^ ADVF_ALLOWED) != 0)
            {
                connection = 0;
                return(OLE_E_ADVISENOTSUPPORTED);
            }

            // Create and insert an entry for the connection list
            var entry = new AdviseEntry(ref pFormatetc, advf, adviseSink);

            connections.Add(nextConnectionId, entry);
            connection = nextConnectionId;
            nextConnectionId++;

            // If the ADVF_PRIMEFIRST flag is specified and the data exists,
            // raise the DataChanged event now.
            if ((advf & ADVF.ADVF_PRIMEFIRST) == ADVF.ADVF_PRIMEFIRST)
            {
                KeyValuePair <FORMATETC, STGMEDIUM> dataEntry;
                if (GetDataEntry(ref pFormatetc, out dataEntry))
                {
                    RaiseDataChanged(connection, ref dataEntry);
                }
            }

            // S_OK
            return(0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a connection between a data object and an advisory sink. This method is called by an object
        /// that supports an advisory sink and enables the advisory sink to be notified of changes in the object's data.</summary>
        /// <returns>This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY,
        /// as well as the following:
        /// ValueDescriptionS_OK -- The advisory connection was created.
        /// E_NOTIMPL -- This method is not implemented on the data object.
        /// DV_E_LINDEX -- There is an invalid value for <see cref="F:System.Runtime.InteropServices.ComTypes.FORMATETC.lindex"/>;
        ///   currently, only -1 is supported.
        /// DV_E_FORMATETC -- There is an invalid value for the <paramref name="pFormatetc"/> parameter.
        /// OLE_E_ADVISENOTSUPPORTED -- The data object does not support change notification.</returns>
        /// <param name="pFormatetc">A <see cref="T:System.Runtime.InteropServices.ComTypes.FORMATETC"/> structure,
        /// passed by reference, that defines the format, target device, aspect, and medium that will be used for
        /// future notifications.</param>
        /// <param name="advf">One of the ADVF values that specifies a group of flags for controlling the advisory
        /// connection.</param>
        /// <param name="adviseSink">A pointer to the IAdviseSink interface on the advisory sink that will receive
        /// the change notification.</param>
        /// <param name="connection">When this method returns, contains a pointer to a DWORD token that identifies
        /// this connection. You can use this token later to delete the advisory connection by passing it to
        /// <see cref="M:System.Runtime.InteropServices.ComTypes.IDataObject.DUnadvise(System.Int32)"/>.
        /// If this value is zero, the connection was not established. This parameter is passed uninitialized.</param>
        public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
        {
            // Check that the specified advisory flags are supported.
            const ADVF c_advfAllowed = ADVF.ADVF_NODATA | ADVF.ADVF_ONLYONCE | ADVF.ADVF_PRIMEFIRST;
            if ((int)((advf | c_advfAllowed) ^ c_advfAllowed) != 0)
            {
                connection = 0;
                return OLE_E_ADVISENOTSUPPORTED;
            }

            // Create and insert an entry for the connection list
            var entry = new AdviseEntry
            {
                Format = pFormatetc,
                Advf = advf,
                Sink = adviseSink,
            };
            m_connections.Add(m_nextConnectionId, entry);
            connection = m_nextConnectionId;
            m_nextConnectionId++;

            // If the ADVF_PRIMEFIRST flag is specified and the data exists,
            // raise the DataChanged event now.
            if ((advf & ADVF.ADVF_PRIMEFIRST) == ADVF.ADVF_PRIMEFIRST)
            {
                OleData dataEntry;
                if (GetDataEntry(ref pFormatetc, out dataEntry))
                    RaiseDataChanged(connection, ref dataEntry);
            }

            return 0;
        }
Exemplo n.º 4
0
		/// <summary>
		/// Adds an advisory connection for the specified format.
		/// </summary>
		/// <param name="pFormatetc">The format for which this sink is called for changes.</param>
		/// <param name="advf">Advisory flags to specify callback behavior.</param>
		/// <param name="adviseSink">The IAdviseSink to call for this connection.</param>
		/// <param name="connection">Returns the new connection's ID.</param>
		/// <returns>An HRESULT.</returns>
		public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) {
			// Check that the specified advisory flags are supported.
			const ADVF ADVF_ALLOWED = ADVF.ADVF_NODATA | ADVF.ADVF_ONLYONCE | ADVF.ADVF_PRIMEFIRST;
			if ((int) ((advf | ADVF_ALLOWED) ^ ADVF_ALLOWED) != 0) {
				connection = 0;
				return OLE_E_ADVISENOTSUPPORTED;
			}

			// Create and insert an entry for the connection list
			var entry = new AdviseEntry(ref pFormatetc, advf, adviseSink);
			connections.Add(nextConnectionId, entry);
			connection = nextConnectionId;
			nextConnectionId++;

			// If the ADVF_PRIMEFIRST flag is specified and the data exists,
			// raise the DataChanged event now.
			if ((advf & ADVF.ADVF_PRIMEFIRST) == ADVF.ADVF_PRIMEFIRST) {
				KeyValuePair<FORMATETC, STGMEDIUM> dataEntry;
				if (GetDataEntry(ref pFormatetc, out dataEntry))
					RaiseDataChanged(connection, ref dataEntry);
			}

			// S_OK
			return 0;
		}
Exemplo n.º 5
0
 void IOleObject.Advise(IAdviseSink pAdvSink, out uint pdwConnection)
 {
     if (_AdviseHolder == null)
     {
         Natives.CreateOleAdviseHolder(out _AdviseHolder);
     }
     _AdviseHolder.Advise(pAdvSink, out pdwConnection);
 }
Exemplo n.º 6
0
 // IDataObject methods
 int IDataObject.DAdvise(FORMATETC[] e, uint adv, IAdviseSink sink, out uint cookie) {
   STATDATA sdata = new STATDATA();
   sdata.ADVF = adv;
   sdata.FORMATETC = e[0];
   sdata.pAdvSink = sink;
   cookie = this.map.Add(sdata);
   sdata.dwConnection = cookie;
   return 0;
 }
Exemplo n.º 7
0
 int IOleDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     if (_wrapped is IOleDataObject ole)
     {
         return(ole.DAdvise(ref pFormatetc, advf, adviseSink, out connection));
     }
     connection = 0;
     return(OLE_E_ADVISENOTSUPPORTED);
 }
Exemplo n.º 8
0
 int IComDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink pAdvSink, out int pdwConnection)
 {
     Debug.WriteLineIf(CompModSwitches.DataObject.TraceVerbose, "DAdvise");
     if (innerData is OleConverter)
     {
         return(((OleConverter)innerData).OleDataObject.DAdvise(ref pFormatetc, advf, pAdvSink, out pdwConnection));
     }
     pdwConnection = 0;
     return((int)HRESULT.E_NOTIMPL);
 }
Exemplo n.º 9
0
 public static int Advise(this System.Windows.IDataObject dataObject, IAdviseSink sink, string format, ADVF advf)
 {
     FORMATETC formatETC;
     DataObjectExtensions.FillFormatETC(format, TYMED.TYMED_HGLOBAL | TYMED.TYMED_FILE | TYMED.TYMED_ISTREAM | TYMED.TYMED_ISTORAGE | TYMED.TYMED_GDI | TYMED.TYMED_MFPICT | TYMED.TYMED_ENHMF, out formatETC);
     int connection;
     int errorCode = ((System.Runtime.InteropServices.ComTypes.IDataObject)dataObject).DAdvise(ref formatETC, advf, sink, out connection);
     if (errorCode != 0)
         Marshal.ThrowExceptionForHR(errorCode);
     return connection;
 }
Exemplo n.º 10
0
        // IDataObject methods
        int IDataObject.DAdvise(FORMATETC[] e, uint adv, IAdviseSink sink, out uint cookie)
        {
            STATDATA sdata = new STATDATA();

            sdata.ADVF         = adv;
            sdata.FORMATETC    = e[0];
            sdata.pAdvSink     = sink;
            cookie             = this.map.Add(sdata);
            sdata.dwConnection = cookie;
            return(0);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Sets up an advisory connection to the data object.
        /// </summary>
        /// <param name="dataObject">The data object on which to set the advisory connection.</param>
        /// <param name="sink">The advisory sink.</param>
        /// <param name="format">The format on which to callback on.</param>
        /// <param name="advf">Advisory flags. Can be 0.</param>
        /// <returns>The ID of the newly created advisory connection.</returns>
        public static int Advise(IDataObject dataObject, IAdviseSink sink, string format, ADVF advf)
        {
            // Internally, we'll listen for any TYMED
            FillFormatETC(format, TYMED_ANY, out FORMATETC formatETC);

            int hr = dataObject.DAdvise(ref formatETC, advf, sink, out int connection);

            if (hr != 0)
            {
                Marshal.ThrowExceptionForHR(hr);
            }
            return(connection);
        }
Exemplo n.º 12
0
        int IDataObject.DAdvise(FORMATETC[] e, uint adv, IAdviseSink sink, out uint cookie)
        {
            Utilities.ArgumentNotNull(nameof(e), e);

            var sdata = new STATDATA();

            sdata.ADVF         = adv;
            sdata.FORMATETC    = e[0];
            sdata.pAdvSink     = sink;
            cookie             = this.map.Add(sdata);
            sdata.dwConnection = cookie;
            return(0);
        }
Exemplo n.º 13
0
        int IDataObject.DAdvise(FORMATETC[] e, uint adv, IAdviseSink sink, out uint cookie)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            STATDATA sdata = new STATDATA();

            sdata.ADVF         = adv;
            sdata.FORMATETC    = e[0];
            sdata.pAdvSink     = sink;
            cookie             = this.map.Add(sdata);
            sdata.dwConnection = cookie;
            return(0);
        }
Exemplo n.º 14
0
        int IDataObject.DAdvise(FORMATETC[] e, uint adv, IAdviseSink sink, out uint cookie)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            STATDATA sdata = new STATDATA();

            sdata.ADVF = adv;
            sdata.FORMATETC = e[0];
            sdata.pAdvSink = sink;
            cookie = this.map.Add(sdata);
            sdata.dwConnection = cookie;
            return 0;
        }
Exemplo n.º 15
0
 public int DAdvise(ref FORMATETC formatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     if (((advf | ADVF.ADVF_NODATA | ADVF.ADVF_PRIMEFIRST | ADVF.ADVF_ONLYONCE) ^ (ADVF.ADVF_NODATA | ADVF.ADVF_PRIMEFIRST | ADVF.ADVF_ONLYONCE)) != (ADVF)0)
     {
         connection = 0;
         return -2147221501;
     }
     else
     {
         this.connections.Add(this.nextConnectionId, new AdviseEntry(ref formatetc, advf, adviseSink));
         connection = this.nextConnectionId;
         ++this.nextConnectionId;
         KeyValuePair<FORMATETC, STGMEDIUM> dataEntry;
         if ((advf & ADVF.ADVF_PRIMEFIRST) == ADVF.ADVF_PRIMEFIRST && this.GetDataEntry(ref formatetc, out dataEntry))
             this.RaiseDataChanged(connection, ref dataEntry);
         return 0;
     }
 }
Exemplo n.º 16
0
        public void Advise(IAdviseSink pAdvise, out int pdwConnection)
        {
            int conn = -1;

            Invoke("Advise", () =>
            {
                ComDebug.ReportInfo("ManagedOleAdviseHolder.Advise (before calling Advise)", conn);
                _oleAdviseHolder.Advise(pAdvise, out conn);
                ComDebug.ReportInfo("ManagedOleAdviseHolder.Advise has given out cookie={0}", conn);
            }
                   );

            if (!(-1 != conn))
            {
                throw new InvalidOperationException(nameof(conn) + " should be != -1");
            }

            pdwConnection = conn;
        }
Exemplo n.º 17
0
 public int DAdvise(ref FORMATETC formatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     if (((advf | ADVF.ADVF_NODATA | ADVF.ADVF_PRIMEFIRST | ADVF.ADVF_ONLYONCE) ^ (ADVF.ADVF_NODATA | ADVF.ADVF_PRIMEFIRST | ADVF.ADVF_ONLYONCE)) != (ADVF)0)
     {
         connection = 0;
         return(-2147221501);
     }
     else
     {
         this.connections.Add(this.nextConnectionId, new AdviseEntry(ref formatetc, advf, adviseSink));
         connection = this.nextConnectionId;
         ++this.nextConnectionId;
         KeyValuePair <FORMATETC, STGMEDIUM> dataEntry;
         if ((advf & ADVF.ADVF_PRIMEFIRST) == ADVF.ADVF_PRIMEFIRST && this.GetDataEntry(ref formatetc, out dataEntry))
         {
             this.RaiseDataChanged(connection, ref dataEntry);
         }
         return(0);
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// Creates a connection between a data object and an advisory sink. This method is called by an object
        /// that supports an advisory sink and enables the advisory sink to be notified of changes in the object's data.</summary>
        /// <returns>This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY,
        /// as well as the following:
        /// ValueDescriptionS_OK -- The advisory connection was created.
        /// E_NOTIMPL -- This method is not implemented on the data object.
        /// DV_E_LINDEX -- There is an invalid value for <see cref="F:System.Runtime.InteropServices.ComTypes.FORMATETC.lindex"/>;
        ///   currently, only -1 is supported.
        /// DV_E_FORMATETC -- There is an invalid value for the <paramref name="pFormatetc"/> parameter.
        /// OLE_E_ADVISENOTSUPPORTED -- The data object does not support change notification.</returns>
        /// <param name="pFormatetc">A <see cref="T:System.Runtime.InteropServices.ComTypes.FORMATETC"/> structure,
        /// passed by reference, that defines the format, target device, aspect, and medium that will be used for
        /// future notifications.</param>
        /// <param name="advf">One of the ADVF values that specifies a group of flags for controlling the advisory
        /// connection.</param>
        /// <param name="adviseSink">A pointer to the IAdviseSink interface on the advisory sink that will receive
        /// the change notification.</param>
        /// <param name="connection">When this method returns, contains a pointer to a DWORD token that identifies
        /// this connection. You can use this token later to delete the advisory connection by passing it to
        /// <see cref="M:System.Runtime.InteropServices.ComTypes.IDataObject.DUnadvise(System.Int32)"/>.
        /// If this value is zero, the connection was not established. This parameter is passed uninitialized.</param>
        public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
        {
            // Check that the specified advisory flags are supported.
            const ADVF c_advfAllowed = ADVF.ADVF_NODATA | ADVF.ADVF_ONLYONCE | ADVF.ADVF_PRIMEFIRST;

            if ((int)((advf | c_advfAllowed) ^ c_advfAllowed) != 0)
            {
                connection = 0;
                return(OLE_E_ADVISENOTSUPPORTED);
            }

            // Create and insert an entry for the connection list
            var entry = new AdviseEntry
            {
                Format = pFormatetc,
                Advf   = advf,
                Sink   = adviseSink,
            };

            m_connections.Add(m_nextConnectionId, entry);
            connection = m_nextConnectionId;
            m_nextConnectionId++;

            // If the ADVF_PRIMEFIRST flag is specified and the data exists,
            // raise the DataChanged event now.
            if ((advf & ADVF.ADVF_PRIMEFIRST) == ADVF.ADVF_PRIMEFIRST)
            {
                OleData dataEntry;
                if (GetDataEntry(ref pFormatetc, out dataEntry))
                {
                    RaiseDataChanged(connection, ref dataEntry);
                }
            }

            return(0);
        }
Exemplo n.º 19
0
 public virtual void Advise(IAdviseSink sink, out uint cookie){
   cookie = eventSinks.Add(sink);
 }
Exemplo n.º 20
0
        /// <summary>
        /// Sets up an advisory connection to the data object.
        /// </summary>
        /// <param name="dataObject">The data object on which to set the advisory connection.</param>
        /// <param name="sink">The advisory sink.</param>
        /// <param name="format">The format on which to callback on.</param>
        /// <param name="advf">Advisory flags. Can be 0.</param>
        /// <returns>The ID of the newly created advisory connection.</returns>
        public static int Advise(this System.Runtime.InteropServices.ComTypes.IDataObject dataObject, IAdviseSink sink, string format, ADVF advf)
        {
            // Internally, we'll listen for any TYMED
            FORMATETC formatETC;

            FillFormatETC(format, TYMED_ANY, out formatETC);

            int connection;
            int hr = dataObject.DAdvise(ref formatETC, advf, sink, out connection);

            if (hr != 0)
            {
                Marshal.ThrowExceptionForHR(hr);
            }
            return(connection);
        }
Exemplo n.º 21
0
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     Console.WriteLine("DAdvise");
     throw new NotImplementedException();
 }
Exemplo n.º 22
0
 int IComDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     connection = 0;
     return(HRESULT.E_NOTIMPL.Code);
 }
Exemplo n.º 23
0
 int IDataObject.DAdvise(FormatEtc[] pFormatetc, uint ADVF, IAdviseSink pAdvSink, out uint pdwConnection)
 {
     pdwConnection = 0;
     return(Natives.E_NOTIMPL);
 }
Exemplo n.º 24
0
		public uint DAdvise(ref FORMATETC a, int advf, IAdviseSink pAdvSink, out uint pdwConnection)
		{
			Trace.WriteLine("DAdvise");

			pdwConnection = 0;

			return (uint)E_NOTIMPL;
		}
Exemplo n.º 25
0
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     throw new NotImplementedException();
 }
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     return DataObject.DAdvise(ref pFormatetc, advf, adviseSink, out connection);
 }
Exemplo n.º 27
0
 public uint DAdvise(ref FORMATETC a, int advf, IAdviseSink advSink, out uint connection)
 {
     connection = 0;
     return(E_NOTIMPL);
 }
Exemplo n.º 28
0
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     throw Marshal.GetExceptionForHR(OLE_E_ADVISENOTSUPPORTED);
 }
 int System.Runtime.InteropServices.ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     Marshal.ThrowExceptionForHR(NativeMethods.OLE_E_ADVISENOTSUPPORTED);
     throw new NotImplementedException();
 }
 int IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     Marshal.ThrowExceptionForHR(NativeMethods.OLE_E_ADVISENOTSUPPORTED);
     throw new NotImplementedException();
 }
Exemplo n.º 31
0
 public int DAdvise([In] ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     connection = -1;
     return((int)S_FALSE);
 }
Exemplo n.º 32
0
        /// <summary>
        /// Sets up an advisory connection to the data object.
        /// </summary>
        /// <param name="dataObject">The data object on which to set the advisory connection.</param>
        /// <param name="sink">The advisory sink.</param>
        /// <param name="format">The format on which to callback on.</param>
        /// <param name="advf">Advisory flags. Can be 0.</param>
        /// <returns>The ID of the newly created advisory connection.</returns>
        public static int Advise(this IDataObject dataObject, IAdviseSink sink, string format, ADVF advf)
        {
            // Internally, we'll listen for any TYMED
            FORMATETC formatETC;
            FillFormatETC(format, TYMED_ANY, out formatETC);

            int connection;
            int hr = dataObject.DAdvise(ref formatETC, advf, sink, out connection);
            if (hr != 0)
                Marshal.ThrowExceptionForHR(hr);
            return connection;
        }
Exemplo n.º 33
0
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     throw Marshal.GetExceptionForHR(OLE_E_ADVISENOTSUPPORTED);
 }
Exemplo n.º 34
0
 int System.Runtime.InteropServices.ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink pAdvSink, out int pdwConnection)
 {
     throw null;
 }
Exemplo n.º 35
0
 int System.Runtime.InteropServices.ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf,
                                                                 IAdviseSink adviseSink, out int connection)
 {
     throw new NotImplementedException();
     //return _innerComDataObject.DAdvise(ref pFormatetc, advf, adviseSink, out connection);
 }
Exemplo n.º 36
0
		public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
		{
			if (null == DataAdviseHolder)
			{
				ComDebug.ReportInfo("{0}.IDataObject.DAdvise -> not implemented!", this.GetType().Name);
				connection = 0;
				return ComReturnValue.E_NOTIMPL;
			}
			else
			{
				ComDebug.ReportInfo("{0}.IDataObject.DAdvise {1}, {2}", this.GetType().Name, DataObjectHelper.FormatEtcToString(pFormatetc), advf);

				try
				{
					if (pFormatetc.cfFormat != 0) // if a special format is required
					{
						int res = QueryGetData(ref pFormatetc); // ask the render helper for availability of that format
						if (res != ComReturnValue.S_OK) // if the required format is not available
						{
							connection = 0; //  return an invalid connection cookie
							return res; // and the error
						}
					}
					FORMATETC etc = pFormatetc;
					int conn = 0;
					DataAdviseHolder.Advise((IDataObject)this, ref etc, advf, adviseSink, out conn);
					connection = conn;
					return ComReturnValue.NOERROR;
				}
				catch (Exception e)
				{
					ComDebug.ReportError("{0}.IDataObject.DAdvise exception: {1}", this.GetType().Name, e);
					throw;
				}
			}
		}
Exemplo n.º 37
0
 public static extern int OleCreateEx(ref GUID rclsid, ref GUID riid, uint dwFlags, uint renderopt, uint cFormats, ref uint rgAdvf, ref tagFORMATETC rgFormatEtc, ref IAdviseSink lpAdviseSink, ref uint rgdwConnection, ref IOleClientSite pClientSite, ref IStorage pStg, ref IntPtr ppvObj);
Exemplo n.º 38
0
 int IComDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink pAdvSink, out int pdwConnection) {
     Debug.WriteLineIf(CompModSwitches.DataObject.TraceVerbose, "DAdvise");
     if (innerData is OleConverter) {
         return ((OleConverter)innerData).OleDataObject.DAdvise(ref pFormatetc, advf, pAdvSink, out pdwConnection);
     }
     pdwConnection = 0;
     return (NativeMethods.E_NOTIMPL);
 }
Exemplo n.º 39
0
 /// <include file='doc\EditorView.uex' path='docs/doc[@for="OleEditorView.Advise"]/*' />
 public virtual void Advise(IAdviseSink sink, out uint cookie)
 {
     cookie = eventSinks.Add(sink);
 }
Exemplo n.º 40
0
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 41
0
 public AdviseEntry(ref FORMATETC format, ADVF advf, IAdviseSink sink)
 {
     this.format = format;
     this.advf = advf;
     this.sink = sink;
 }
Exemplo n.º 42
0
 public AdviseEntry(ref FORMATETC format, ADVF advf, IAdviseSink sink)
 {
     this.format = format;
     this.advf   = advf;
     this.sink   = sink;
 }
Exemplo n.º 43
0
 public void Advise(IAdviseSink pAdvise, out int pdwConnection)
 {
     pdwConnection = _advises.Count + 1; // this is the cookie: Attention: cookies with a value of 0 will not be accepted, so we increment count by 1 to have always a cookie > 0
     _advises.Add(pAdvise);
     ComDebug.ReportInfo("{0}.Advise giving out cookie={1}", GetType().Name, pdwConnection);
 }
Exemplo n.º 44
0
 public int DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
 {
     return(innerData.DAdvise(pFormatetc, advf, adviseSink, out connection));
 }
Exemplo n.º 45
0
		int IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection) {
			Marshal.ThrowExceptionForHR(NativeMethods.OLE_E_ADVISENOTSUPPORTED);
			throw new NotImplementedException();
		}
Exemplo n.º 46
0
 int IComDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink pAdvSink, out int pdwConnection)
 {
     if (_innerData is OleConverter)
     {
         return ((OleConverter)_innerData).OleDataObject.DAdvise(ref pFormatetc, advf, pAdvSink, out pdwConnection);
     }
     pdwConnection = 0;
     return (NativeMethods.E_NOTIMPL);
 }
Exemplo n.º 47
0
 public static extern int OleCreateFromFileEx(ref GUID rclsid, [In][MarshalAs(UnmanagedType.LPWStr)] string lpszFileName, ref GUID riid, uint dwFlags, uint renderopt, uint cFormats, ref uint rgAdvf, ref tagFORMATETC rgFormatEtc, ref IAdviseSink lpAdviseSink, ref uint rgdwConnection, ref IOleClientSite pClientSite, ref IStorage pStg, ref IntPtr ppvObj);