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.

157 lines
6.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: idldata.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _INC_SHELL_IDLDATA_H
  11. #define _INC_SHELL_IDLDATA_H
  12. #include "fmtetc.h"
  13. //
  14. // Clipboard Format for IDLData object.
  15. //
  16. #define ICFHDROP 0
  17. #define ICFFILENAME 1
  18. #define ICFNETRESOURCE 2
  19. #define ICFFILECONTENTS 3
  20. #define ICFFILEGROUPDESCRIPTORA 4
  21. #define ICFFILENAMEMAPW 5
  22. #define ICFFILENAMEMAP 6
  23. #define ICFHIDA 7
  24. #define ICFOFFSETS 8
  25. #define ICFPRINTERFRIENDLYNAME 9
  26. #define ICFPRIVATESHELLDATA 10
  27. #define ICFHTML 11
  28. #define ICFFILENAMEW 12
  29. #define ICFFILEGROUPDESCRIPTORW 13
  30. #define ICFPREFERREDDROPEFFECT 14
  31. #define ICFPERFORMEDDROPEFFECT 15
  32. #define ICFLOGICALPERFORMEDDROPEFFECT 16
  33. #define ICFSHELLURL 17
  34. #define ICFINDRAGLOOP 18
  35. #define ICF_DRAGCONTEXT 19
  36. #define ICF_TARGETCLSID 20
  37. #define ICF_MAX 21
  38. #define g_cfNetResource CIDLData::m_rgcfGlobal[ICFNETRESOURCE]
  39. #define g_cfHIDA CIDLData::m_rgcfGlobal[ICFHIDA]
  40. #define g_cfOFFSETS CIDLData::m_rgcfGlobal[ICFOFFSETS]
  41. #define g_cfPrinterFriendlyName CIDLData::m_rgcfGlobal[ICFPRINTERFRIENDLYNAME]
  42. #define g_cfFileName CIDLData::m_rgcfGlobal[ICFFILENAME]
  43. #define g_cfFileContents CIDLData::m_rgcfGlobal[ICFFILECONTENTS]
  44. #define g_cfFileGroupDescriptorA CIDLData::m_rgcfGlobal[ICFFILEGROUPDESCRIPTORA]
  45. #define g_cfFileGroupDescriptorW CIDLData::m_rgcfGlobal[ICFFILEGROUPDESCRIPTORW]
  46. #define g_cfFileNameMapW CIDLData::m_rgcfGlobal[ICFFILENAMEMAPW]
  47. #define g_cfFileNameMapA CIDLData::m_rgcfGlobal[ICFFILENAMEMAP]
  48. #define g_cfPrivateShellData CIDLData::m_rgcfGlobal[ICFPRIVATESHELLDATA]
  49. #define g_cfHTML CIDLData::m_rgcfGlobal[ICFHTML]
  50. #define g_cfFileNameW CIDLData::m_rgcfGlobal[ICFFILENAMEW]
  51. #define g_cfPreferredDropEffect CIDLData::m_rgcfGlobal[ICFPREFERREDDROPEFFECT]
  52. #define g_cfPerformedDropEffect CIDLData::m_rgcfGlobal[ICFPERFORMEDDROPEFFECT]
  53. #define g_cfLogicalPerformedDropEffect CIDLData::m_rgcfGlobal[ICFLOGICALPERFORMEDDROPEFFECT]
  54. #define g_cfShellURL CIDLData::m_rgcfGlobal[ICFSHELLURL]
  55. #define g_cfInDragLoop CIDLData::m_rgcfGlobal[ICFINDRAGLOOP]
  56. #define g_cfDragContext CIDLData::m_rgcfGlobal[ICF_DRAGCONTEXT]
  57. #define g_cfTargetCLSID CIDLData::m_rgcfGlobal[ICF_TARGETCLSID]
  58. // Most places will only generate one so minimize the number of changes in the code (bad idea!)
  59. #ifdef UNICODE
  60. #define g_cfFileNameMap g_cfFileNameMapW
  61. #else
  62. #define g_cfFileNameMap g_cfFileNameMapA
  63. #endif
  64. class CIDLData : public IDataObject
  65. {
  66. public:
  67. CIDLData(LPCITEMIDLIST pidlFolder,
  68. UINT cidl,
  69. LPCITEMIDLIST *apidl,
  70. IShellFolder *psfOwner = NULL,
  71. IDataObject *pdtInner = NULL);
  72. virtual ~CIDLData(void);
  73. //
  74. // IUnknown methods.
  75. //
  76. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  77. STDMETHODIMP_(ULONG) AddRef(void);
  78. STDMETHODIMP_(ULONG) Release(void);
  79. //
  80. // IDataObject methods.
  81. //
  82. STDMETHODIMP GetData(FORMATETC *pFmtEtc, STGMEDIUM *pstm);
  83. STDMETHODIMP GetDataHere(FORMATETC *pFmtEtc, STGMEDIUM *pstm);
  84. STDMETHODIMP QueryGetData(FORMATETC *pFmtEtc);
  85. STDMETHODIMP GetCanonicalFormatEtc(FORMATETC *pFmtEtcIn, FORMATETC *pFmtEtcOut);
  86. STDMETHODIMP SetData(FORMATETC *pFmtEtc, STGMEDIUM *pstm, BOOL fRelease);
  87. STDMETHODIMP EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC *ppEnum);
  88. STDMETHODIMP DAdvise(FORMATETC *pFmtEtc, DWORD grfAdv, LPADVISESINK pAdvSink, DWORD *pdwConnection);
  89. STDMETHODIMP DUnadvise(DWORD dwConnection);
  90. STDMETHODIMP EnumDAdvise(LPENUMSTATDATA *ppEnum);
  91. static HRESULT CreateInstance(IDataObject **ppOut,
  92. LPCITEMIDLIST pidlFolder,
  93. UINT cidl,
  94. LPCITEMIDLIST *apidl,
  95. IShellFolder *psfOwner = NULL,
  96. IDataObject *pdtInner = NULL);
  97. static HRESULT CreateInstance(CIDLData **ppOut,
  98. LPCITEMIDLIST pidlFolder,
  99. UINT cidl,
  100. LPCITEMIDLIST *apidl,
  101. IShellFolder *psfOwner = NULL,
  102. IDataObject *pdtInner = NULL);
  103. void InitializeClipboardFormats(void);
  104. HRESULT Clone(UINT *acf, UINT ccf, IDataObject **ppdtobjOut);
  105. HRESULT CloneForMoveCopy(IDataObject **ppdtobjOut);
  106. HRESULT CtorResult(void) const
  107. { return m_hrCtor; }
  108. virtual IShellFolder *GetFolder(void) const;
  109. protected:
  110. //
  111. // These are defined for compatibility with the original shell code.
  112. //
  113. enum { MAX_FORMATS = ICF_MAX };
  114. LONG m_cRef;
  115. IShellFolder *m_psfOwner;
  116. DWORD m_dwOwnerData;
  117. HRESULT m_hrCtor;
  118. IDataObject *m_pdtobjInner;
  119. FORMATETC m_rgFmtEtc[MAX_FORMATS];
  120. STGMEDIUM m_rgMedium[MAX_FORMATS];
  121. bool m_bEnumFormatCalled;
  122. static CLIPFORMAT m_rgcfGlobal[ICF_MAX];
  123. static const LARGE_INTEGER m_LargeIntZero;
  124. virtual HRESULT ProvideFormats(CEnumFormatEtc *pEnumFormatEtc);
  125. private:
  126. typedef HGLOBAL HIDA;
  127. HIDA HIDA_Create(LPCITEMIDLIST pidlFolder, UINT cidl, LPCITEMIDLIST *apidl);
  128. //
  129. // Prevent copy.
  130. //
  131. CIDLData(const CIDLData& rhs);
  132. CIDLData& operator = (const CIDLData& rhs);
  133. };
  134. #endif _INC_SHELL_IDLDATA_H