Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.5 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File:
  4. // oaholder.h
  5. //
  6. // Contents:
  7. // concrete IOleAdviseHolder declaration
  8. //
  9. // Classes:
  10. // COAHolder, concrete version of IOleAdviseHolder
  11. //
  12. // Functions:
  13. //
  14. // History:
  15. // 31-Jan-95 t-ScottH added Dump method to COAHolder class
  16. // 24-Jan-94 alexgo first pass converting to Cairo style
  17. // memory allocation
  18. // 11/01/93 - ChrisWe - created
  19. //
  20. //-----------------------------------------------------------------------------
  21. #ifndef _OAHOLDER_H_
  22. #define _OAHOLDER_H_
  23. #ifdef _DEBUG
  24. #include <dbgexts.h>
  25. #endif // _DEBUG
  26. //+----------------------------------------------------------------------------
  27. //
  28. // Class:
  29. // COAHolder
  30. //
  31. // Purpose:
  32. // Provides concrete implementation of IOleAdviseHolder; a helper
  33. // class that OLE implementors can use
  34. //
  35. // Interface:
  36. // IOleAdviseHolder
  37. // SendOnLinkSrcChange() - multicasts the OnLinkSrcChange
  38. // notification to any registered advise sinks that support
  39. // IAdviseSink2
  40. //
  41. // Notes:
  42. // Is hard coded to always be allocated from Task memory
  43. // (MEMCTX_TASK).
  44. //
  45. // Connection numbers run from [1..n], and while the implementation
  46. // uses an array, indexed from [0..n-1], the returned value is
  47. // one more than the array index of the sink; Advise() and
  48. // Unadvise() do the adjustment arithmetic; all of this means
  49. // that elements can't be shifted around, or they won't be found
  50. // again.
  51. //
  52. // REVIEW -- IS NOT THREAD SAFE under assumption that documents
  53. // will always be single threaded
  54. //
  55. //
  56. // History:
  57. // 31-Jan-95 t-ScottH added _DEBUG only Dump method
  58. // 11/01/93 - ChrisWe - moved declaration to oaholder.h
  59. // 10/28/93 - ChrisWe - removed use of CPtrArray
  60. // 10/28/93 - ChrisWe - file cleanup and inspection for Cairo
  61. //
  62. //-----------------------------------------------------------------------------
  63. class FAR COAHolder : public IOleAdviseHolder, public CSafeRefCount
  64. {
  65. public:
  66. COAHolder();
  67. // *** IUnknown methods ***
  68. STDMETHOD(QueryInterface) (REFIID riid, LPVOID FAR* ppv);
  69. STDMETHOD_(ULONG,AddRef) () ;
  70. STDMETHOD_(ULONG,Release) ();
  71. // *** IOleAdviseHolder methods ***
  72. STDMETHOD(Advise)(IAdviseSink FAR* pAdvSink, DWORD FAR* pdwConnection);
  73. STDMETHOD(Unadvise)(DWORD dwConnection);
  74. STDMETHOD(EnumAdvise)(IEnumSTATDATA FAR* FAR* ppenumAdvise);
  75. STDMETHOD(SendOnRename)(IMoniker FAR* pMk);
  76. STDMETHOD(SendOnSave)();
  77. STDMETHOD(SendOnClose)();
  78. // non-interface methods
  79. HRESULT SendOnLinkSrcChange(IMoniker FAR* pmk);
  80. #ifdef _DEBUG
  81. HRESULT Dump(char **ppszDump, ULONG ulFlag, int nIndentLevel);
  82. // need to be able to access COAHolder private data members in the
  83. // following debugger extension APIs
  84. // this allows the debugger extension APIs to copy memory from the
  85. // debuggee process memory to the debugger's process memory
  86. // this is required since the Dump method follows pointers to other
  87. // structures and classes
  88. friend DEBUG_EXTENSION_API(dump_oaholder);
  89. friend DEBUG_EXTENSION_API(dump_deflink);
  90. friend DEBUG_EXTENSION_API(dump_defobject);
  91. #endif // _DEBUG
  92. private:
  93. ~COAHolder();
  94. #define COAHOLDER_GROWBY 5 /* number of array elements to add each realloc */
  95. IAdviseSink FAR *FAR *m_ppIAS; // array of advise sinks
  96. int m_iSize; // size of array of advise sinks
  97. SET_A5;
  98. };
  99. #endif // _OAHOLDER_H_
  100.