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.

191 lines
5.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. ccdata.h
  7. prototypes for the CComponentData
  8. FILE HISTORY:
  9. */
  10. #ifndef _CCDATA_H
  11. #define _CCDATA_H
  12. #ifndef __mmc_h__
  13. #include <mmc.h>
  14. #endif
  15. #ifndef _TFSINT_H
  16. #include <tfsint.h>
  17. #endif
  18. /*---------------------------------------------------------------------------
  19. Forward declarations
  20. ---------------------------------------------------------------------------*/
  21. /*---------------------------------------------------------------------------
  22. Class: CComponentData
  23. This is a wrapper around the IComponentData facilities provided
  24. by TFSCore.
  25. ---------------------------------------------------------------------------*/
  26. class CComponentData :
  27. public IComponentData,
  28. public IExtendPropertySheet2,
  29. public IExtendContextMenu,
  30. public IPersistStreamInit,
  31. public ISnapinHelp
  32. {
  33. public:
  34. CComponentData();
  35. virtual ~CComponentData();
  36. public:
  37. DeclareIUnknownMembers(IMPL)
  38. // Implementation for these interfaces is provided by TFSCore
  39. DeclareIComponentDataMembers(IMPL)
  40. DeclareIExtendPropertySheetMembers(IMPL)
  41. DeclareIExtendContextMenuMembers(IMPL)
  42. DeclareISnapinHelpMembers(IMPL)
  43. // These have to be implemented by the derived classes
  44. DeclareIPersistStreamInitMembers(PURE)
  45. // manadatory callback members
  46. DeclareITFSCompDataCallbackMembers(PURE)
  47. // not required members
  48. STDMETHOD(OnNotifyPropertyChange)(THIS_ LPDATAOBJECT pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM lParam) { return E_NOTIMPL; }
  49. public:
  50. HRESULT FinalConstruct();
  51. void FinalRelease();
  52. protected:
  53. LONG m_cRef;
  54. SPITFSComponentData m_spTFSComponentData;
  55. SPIComponentData m_spComponentData;
  56. SPIExtendPropertySheet m_spExtendPropertySheet;
  57. SPIExtendContextMenu m_spExtendContextMenu;
  58. SPISnapinHelp m_spSnapinHelp;
  59. private:
  60. // This class does NOT show up in our QI maps, this is purely
  61. // intended for passing down to the ITFSComponent
  62. // This is valid for as long as we have a valid m_spTFSComponentData
  63. class EITFSCompDataCallback : public ITFSCompDataCallback
  64. {
  65. public:
  66. DeclareIUnknownMembers(IMPL)
  67. DeclareIPersistStreamInitMembers(IMPL)
  68. DeclareITFSCompDataCallbackMembers(IMPL)
  69. // not required members
  70. STDMETHOD(OnNotifyPropertyChange)(THIS_ LPDATAOBJECT pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM lParam);
  71. } m_ITFSCompDataCallback;
  72. friend class EITFSCompDataCallback;
  73. };
  74. /*---------------------------------------------------------------------------
  75. Inlined functions
  76. ---------------------------------------------------------------------------*/
  77. inline STDMETHODIMP CComponentData::Initialize(LPUNKNOWN punk)
  78. {
  79. Assert(m_spComponentData);
  80. return m_spComponentData->Initialize(punk);
  81. }
  82. inline STDMETHODIMP CComponentData::CreateComponent(LPCOMPONENT *ppComp)
  83. {
  84. Assert(m_spComponentData);
  85. return m_spComponentData->CreateComponent(ppComp);
  86. }
  87. inline STDMETHODIMP CComponentData::Notify(LPDATAOBJECT pDataObject,
  88. MMC_NOTIFY_TYPE event,
  89. LPARAM arg, LPARAM param)
  90. {
  91. Assert(m_spComponentData);
  92. return m_spComponentData->Notify(pDataObject, event, arg, param);
  93. }
  94. inline STDMETHODIMP CComponentData::Destroy()
  95. {
  96. Assert(m_spComponentData);
  97. return m_spComponentData->Destroy();
  98. }
  99. inline STDMETHODIMP CComponentData::QueryDataObject(MMC_COOKIE cookie,
  100. DATA_OBJECT_TYPES type, LPDATAOBJECT *ppDataObject)
  101. {
  102. Assert(m_spComponentData);
  103. return m_spComponentData->QueryDataObject(cookie, type, ppDataObject);
  104. }
  105. inline STDMETHODIMP CComponentData::CompareObjects(LPDATAOBJECT pA, LPDATAOBJECT pB)
  106. {
  107. Assert(m_spComponentData);
  108. return m_spComponentData->CompareObjects(pA, pB);
  109. }
  110. inline STDMETHODIMP CComponentData::GetDisplayInfo(SCOPEDATAITEM *pScopeDataItem)
  111. {
  112. Assert(m_spComponentData);
  113. return m_spComponentData->GetDisplayInfo(pScopeDataItem);
  114. }
  115. inline STDMETHODIMP CComponentData::CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,
  116. LONG_PTR handle, LPDATAOBJECT pDataObject)
  117. {
  118. Assert(m_spExtendPropertySheet);
  119. return m_spExtendPropertySheet->CreatePropertyPages(lpProvider, handle, pDataObject);
  120. }
  121. inline STDMETHODIMP CComponentData::QueryPagesFor(LPDATAOBJECT pDataObject)
  122. {
  123. Assert(m_spExtendPropertySheet);
  124. return m_spExtendPropertySheet->QueryPagesFor(pDataObject);
  125. }
  126. inline STDMETHODIMP CComponentData::GetWatermarks(LPDATAOBJECT pDataObject,
  127. HBITMAP * lphWatermark,
  128. HBITMAP * lphHeader,
  129. HPALETTE * lphPalette,
  130. BOOL * bStretch)
  131. {
  132. Assert(m_spExtendPropertySheet);
  133. return m_spExtendPropertySheet->GetWatermarks(pDataObject, lphWatermark, lphHeader, lphPalette, bStretch);
  134. }
  135. inline STDMETHODIMP CComponentData::AddMenuItems(LPDATAOBJECT pDataObject,
  136. LPCONTEXTMENUCALLBACK pCallback, long *pInsertionAllowed)
  137. {
  138. Assert(m_spExtendContextMenu);
  139. return m_spExtendContextMenu->AddMenuItems(pDataObject, pCallback, pInsertionAllowed);
  140. }
  141. inline STDMETHODIMP CComponentData::Command(long nCommandId, LPDATAOBJECT pDataObject)
  142. {
  143. Assert(m_spExtendContextMenu);
  144. return m_spExtendContextMenu->Command(nCommandId, pDataObject);
  145. }
  146. inline STDMETHODIMP CComponentData::GetHelpTopic(LPOLESTR* lpCompiledHelpFile)
  147. {
  148. Assert(m_spSnapinHelp);
  149. return m_spSnapinHelp->GetHelpTopic(lpCompiledHelpFile);
  150. }
  151. #endif