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.

150 lines
4.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. dataobj.h
  7. Implementation for data objects in the MMC
  8. FILE HISTORY:
  9. */
  10. #ifndef _DATAOBJ_H
  11. #define _DATAOBJ_H
  12. #ifndef _COMPDATA_H_
  13. #include "compdata.h"
  14. #endif
  15. #ifndef _EXTRACT_H
  16. #include "extract.h"
  17. #endif
  18. #ifndef _DYNEXT_H
  19. #include "dynext.h"
  20. #endif
  21. class CDataObject :
  22. public IDataObject
  23. {
  24. public:
  25. DeclareIUnknownMembers(IMPL)
  26. DeclareIDataObjectMembers(IMPL)
  27. // Derived class should override this for custom behavior
  28. virtual HRESULT QueryGetMoreData(LPFORMATETC lpFormatEtc)
  29. { return E_INVALIDARG; }
  30. virtual HRESULT GetMoreDataHere(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpMedium)
  31. { return DV_E_CLIPFORMAT; }
  32. public:
  33. // Construction/Destruction
  34. // Normal constructor
  35. CDataObject() :
  36. m_cRef(1),
  37. m_pbMultiSelData(NULL),
  38. m_cbMultiSelData(0),
  39. m_bMultiSelDobj(FALSE),
  40. m_pDynExt(NULL)
  41. {
  42. DEBUG_INCREMENT_INSTANCE_COUNTER(CDataObject);
  43. };
  44. virtual ~CDataObject()
  45. {
  46. DEBUG_DECREMENT_INSTANCE_COUNTER(CDataObject);
  47. if (m_pbMultiSelData)
  48. delete m_pbMultiSelData;
  49. };
  50. // Clipboard formats that are required by the console
  51. public:
  52. static unsigned int m_cfNodeType;
  53. static unsigned int m_cfNodeTypeString;
  54. static unsigned int m_cfDisplayName;
  55. static unsigned int m_cfCoClass; // Required by the console
  56. static unsigned int m_cfMultiSel; // Required for multiple selection
  57. static unsigned int m_cfMultiSelDobj; // Required for multiple selection
  58. static unsigned int m_cfDynamicExtension;
  59. static unsigned int m_cfNodeId2;
  60. static unsigned int m_cfInternal;
  61. // Standard IDataObject methods
  62. public:
  63. // Implementation
  64. public:
  65. void SetType(DATA_OBJECT_TYPES type)
  66. { Assert(m_internal.m_type == CCT_UNINITIALIZED); m_internal.m_type = type; }
  67. void SetCookie(MMC_COOKIE cookie) { m_internal.m_cookie = cookie; }
  68. void SetString(LPTSTR lpString) { m_internal.m_string = lpString; }
  69. void SetClsid(const CLSID& clsid) { m_internal.m_clsid = clsid; }
  70. void SetVirtualIndex(int nIndex) { m_internal.m_index = nIndex; }
  71. BOOL HasVirtualIndex() { return m_internal.m_index != -1; }
  72. int GetVirtualIndex() { return m_internal.m_index; }
  73. void SetMultiSelData(BYTE* pbMultiSelData, UINT cbMultiSelData)
  74. {
  75. m_pbMultiSelData = pbMultiSelData;
  76. m_cbMultiSelData = cbMultiSelData;
  77. }
  78. void SetMultiSelDobj()
  79. {
  80. m_bMultiSelDobj = TRUE;
  81. }
  82. HRESULT SetTFSComponentData(ITFSComponentData *pTFSCompData)
  83. {
  84. m_spTFSComponentData.Set(pTFSCompData);
  85. return hrOK;
  86. }
  87. void SetInnerIUnknown(IUnknown *punk)
  88. {
  89. m_spUnknownInner.Set(punk);
  90. }
  91. void SetDynExt(CDynamicExtensions * pDynExt) { m_pDynExt = pDynExt; }
  92. CDynamicExtensions * GetDynExt() { return m_pDynExt; }
  93. protected:
  94. HRESULT Create(const void* pBuffer, int len, LPSTGMEDIUM lpMedium);
  95. ITFSNode* GetDataFromComponentData();
  96. private:
  97. HRESULT CreateNodeTypeData(LPSTGMEDIUM lpMedium);
  98. HRESULT CreateNodeTypeStringData(LPSTGMEDIUM lpMedium);
  99. HRESULT CreateDisplayName(LPSTGMEDIUM lpMedium);
  100. HRESULT CreateInternal(LPSTGMEDIUM lpMedium);
  101. HRESULT CreateCoClassID(LPSTGMEDIUM lpMedium);
  102. HRESULT CreateMultiSelData(LPSTGMEDIUM lpMedium);
  103. HRESULT CreateNodeId2(LPSTGMEDIUM lpMedium);
  104. INTERNAL m_internal;
  105. // pointer to the ComponentData
  106. private:
  107. long m_cRef;
  108. SPITFSComponentData m_spTFSComponentData;
  109. BYTE* m_pbMultiSelData;
  110. UINT m_cbMultiSelData;
  111. BOOL m_bMultiSelDobj;
  112. CDynamicExtensions *m_pDynExt;
  113. // pointer to inner unknown
  114. SPIUnknown m_spUnknownInner;
  115. };
  116. #endif