Source code of Windows XP (NT5)
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.

233 lines
8.4 KiB

  1. #ifndef __SHDISP_H__
  2. #define __SHDISP_H__
  3. #ifdef __cplusplus
  4. EXTERN_C GUID g_guidLibSdspatch;
  5. EXTERN_C USHORT g_wMajorVerSdspatch;
  6. EXTERN_C USHORT g_wMinorVerSdspatch;
  7. #define SDSPATCH_TYPELIB g_guidLibSdspatch, g_wMajorVerSdspatch, g_wMinorVerSdspatch
  8. HRESULT MakeSafeForScripting(IUnknown** ppDisp);
  9. class CImpConPtCont;
  10. typedef CImpConPtCont *PCImpConPtCont;
  11. class CConnectionPoint;
  12. typedef CConnectionPoint *PCConnectionPoint;
  13. class CImpISupportErrorInfo;
  14. typedef CImpISupportErrorInfo *PCImpISupportErrorInfo;
  15. class CFolder;
  16. HRESULT GetItemFolder(CFolder *psdfRoot, LPCITEMIDLIST pidl, CFolder **ppsdf);
  17. HRESULT GetObjectSafely(IShellFolderView *psfv, LPCITEMIDLIST *ppidl, UINT iType);
  18. STDAPI CShellDispatch_CreateInstance(IUnknown* punkOuter, REFIID riid, void **ppv);
  19. HRESULT CFolder_Create(HWND hwnd, LPCITEMIDLIST pidl, IShellFolder *psf, REFIID riid, void **ppv);
  20. HRESULT CFolder_Create2(HWND hwnd, LPCITEMIDLIST pidl, IShellFolder *psf, CFolder **psdf);
  21. HRESULT CFolderItems_Create(CFolder *psdf, BOOL fSelected, FolderItems **ppitems);
  22. HRESULT CFolderItemsFDF_Create(CFolder *psdf, FolderItems **ppitems);
  23. HRESULT CFolderItem_Create(CFolder *psdf, LPCITEMIDLIST pidl, FolderItem **ppid);
  24. HRESULT CFolderItem_CreateFromIDList(HWND hwnd, LPCITEMIDLIST pidl, FolderItem **ppid);
  25. HRESULT CShortcut_CreateIDispatch(HWND hwnd, IShellFolder *psf, LPCITEMIDLIST pidl, IDispatch **ppid);
  26. HRESULT CSDWindow_Create(HWND hwndFldr, IDispatch ** ppsw);
  27. HRESULT CFolderItemVerbs_Create(IContextMenu *pcm, FolderItemVerbs **ppid);
  28. //==================================================================
  29. // Folder items need a way back to the folder object so define folder
  30. // object in header file...
  31. class CFolderItem;
  32. class CFolderItems;
  33. class CFolder : public Folder3,
  34. public IPersistFolder2,
  35. public CObjectSafety,
  36. public IShellService,
  37. protected CImpIDispatch,
  38. protected CObjectWithSite
  39. {
  40. friend class CFolderItem;
  41. friend class CFolderItems;
  42. friend class CShellFolderView;
  43. public:
  44. // IUnknown
  45. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  46. STDMETHODIMP_(ULONG) AddRef(void);
  47. STDMETHODIMP_(ULONG) Release(void);
  48. // IDispatch
  49. STDMETHODIMP GetTypeInfoCount(UINT * pctinfo)
  50. { return CImpIDispatch::GetTypeInfoCount(pctinfo); }
  51. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  52. { return CImpIDispatch::GetTypeInfo(itinfo, lcid, pptinfo); }
  53. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID * rgdispid)
  54. { return CImpIDispatch::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); }
  55. STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, UINT * puArgErr)
  56. { return CImpIDispatch::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }
  57. // Folder
  58. STDMETHODIMP get_Application(IDispatch **ppid);
  59. STDMETHODIMP get_Parent(IDispatch **ppid);
  60. STDMETHODIMP get_ParentFolder(Folder **ppdf);
  61. STDMETHODIMP get_Title(BSTR * pbs);
  62. STDMETHODIMP Items(FolderItems **ppid);
  63. STDMETHODIMP ParseName(BSTR bName, FolderItem **ppid);
  64. STDMETHODIMP NewFolder(BSTR bName, VARIANT vOptions);
  65. STDMETHODIMP MoveHere(VARIANT vItem, VARIANT vOptions);
  66. STDMETHODIMP CopyHere(VARIANT vItem, VARIANT vOptions);
  67. STDMETHODIMP GetDetailsOf(VARIANT vItem, int iColumn, BSTR * pbs);
  68. // Folder2
  69. STDMETHODIMP get_Self(FolderItem **ppfi);
  70. STDMETHODIMP get_OfflineStatus(LONG *pul);
  71. STDMETHODIMP Synchronize(void);
  72. STDMETHODIMP get_HaveToShowWebViewBarricade(VARIANT_BOOL *pbHaveToShowWebViewBarricade);
  73. STDMETHODIMP DismissedWebViewBarricade();
  74. // Folder3
  75. STDMETHODIMP get_ShowWebViewBarricade(VARIANT_BOOL *pbShowWebViewBarricade);
  76. STDMETHODIMP put_ShowWebViewBarricade(VARIANT_BOOL bShowWebViewBarricade);
  77. // IPersist
  78. STDMETHODIMP GetClassID(CLSID *pClassID);
  79. // IPersistFolder
  80. STDMETHODIMP Initialize(LPCITEMIDLIST pidl);
  81. // IPersistFolder2
  82. STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl);
  83. // CObjectWithSite overriding
  84. STDMETHODIMP SetSite(IUnknown *punkSite);
  85. // IShellService
  86. STDMETHODIMP SetOwner(IUnknown* punkOwner);
  87. CFolder(HWND hwnd);
  88. HRESULT Init(LPCITEMIDLIST pidl, IShellFolder *psf);
  89. HRESULT InvokeVerbHelper(VARIANT vVerb, VARIANT vArgs, LPCITEMIDLIST *ppidl, int cItems, DWORD dwSafetyOptions);
  90. HRESULT GetShellFolderView(IShellFolderView **ppsfv);
  91. private:
  92. LONG _cRef;
  93. IShellFolder *_psf;
  94. IShellFolder2 *_psf2;
  95. IShellDetails *_psd;
  96. LPITEMIDLIST _pidl;
  97. IDispatch *_pidApp; // cache app object
  98. int _fmt;
  99. HWND _hwnd;
  100. IUnknown *_punkOwner; // shell objects above this, defview
  101. ~CFolder();
  102. // Helper functions, not exported by interface
  103. STDMETHODIMP _ParentFolder(Folder **ppdf);
  104. HRESULT _MoveOrCopy(BOOL bMove, VARIANT vItem, VARIANT vOptions);
  105. IShellDetails *_GetShellDetails(void);
  106. LPCITEMIDLIST _FolderItemIDList(const VARIANT *pv);
  107. HRESULT _Application(IDispatch **ppid);
  108. BOOL _GetBarricadeValueName(LPTSTR pszValueName, UINT cch);
  109. HRESULT _SecurityCheck();
  110. };
  111. class CFolderItemVerbs;
  112. class CFolderItem : public FolderItem2,
  113. public IPersistFolder2,
  114. public CObjectSafety,
  115. public IParentAndItem,
  116. protected CImpIDispatch
  117. {
  118. friend class CFolderItemVerbs;
  119. public:
  120. // IUnknown
  121. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  122. STDMETHODIMP_(ULONG) AddRef(void);
  123. STDMETHODIMP_(ULONG) Release(void);
  124. // IDispatch
  125. STDMETHODIMP GetTypeInfoCount(UINT * pctinfo)
  126. { return CImpIDispatch::GetTypeInfoCount(pctinfo); }
  127. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  128. { return CImpIDispatch::GetTypeInfo(itinfo, lcid, pptinfo); }
  129. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID * rgdispid)
  130. { return CImpIDispatch::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); }
  131. STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, UINT * puArgErr)
  132. { return CImpIDispatch::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }
  133. // FolderItem
  134. STDMETHODIMP get_Application(IDispatch **ppid);
  135. STDMETHODIMP get_Parent(IDispatch **ppid);
  136. STDMETHODIMP get_Name(BSTR *pbs);
  137. STDMETHODIMP put_Name(BSTR bs);
  138. STDMETHODIMP get_Path(BSTR *bs);
  139. STDMETHODIMP get_GetLink(IDispatch **ppid);
  140. STDMETHODIMP get_GetFolder(IDispatch **ppid);
  141. STDMETHODIMP get_IsLink(VARIANT_BOOL * pb);
  142. STDMETHODIMP get_IsFolder(VARIANT_BOOL * pb);
  143. STDMETHODIMP get_IsFileSystem(VARIANT_BOOL * pb);
  144. STDMETHODIMP get_IsBrowsable(VARIANT_BOOL * pb);
  145. STDMETHODIMP get_ModifyDate(DATE *pdt);
  146. STDMETHODIMP put_ModifyDate(DATE dt);
  147. STDMETHODIMP get_Size(LONG *pdt);
  148. STDMETHODIMP get_Type(BSTR *pbs);
  149. STDMETHODIMP Verbs(FolderItemVerbs **ppfic);
  150. STDMETHODIMP InvokeVerb(VARIANT vVerb);
  151. // FolderItem2
  152. STDMETHODIMP InvokeVerbEx(VARIANT vVerb, VARIANT vArgs);
  153. STDMETHODIMP ExtendedProperty(BSTR bstrPropName, VARIANT *pvRet);
  154. // IPersist
  155. STDMETHODIMP GetClassID(CLSID *pClassID);
  156. // IPersistFolder
  157. STDMETHODIMP Initialize(LPCITEMIDLIST pidl);
  158. // IPersistFolder2
  159. STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl);
  160. // IParentAndItem
  161. STDMETHODIMP SetParentAndItem(LPCITEMIDLIST pidlParent, IShellFolder *psf, LPCITEMIDLIST pidl);
  162. STDMETHODIMP GetParentAndItem(LPITEMIDLIST *ppidlParent, IShellFolder **ppsf, LPITEMIDLIST *ppidl);
  163. // publics, non interface methods
  164. CFolderItem();
  165. HRESULT Init(CFolder *psdf, LPCITEMIDLIST pidl);
  166. static LPCITEMIDLIST _GetIDListFromVariant(const VARIANT *pv);
  167. private:
  168. HRESULT _CheckAttribute(ULONG ulAttr, VARIANT_BOOL *pb);
  169. HRESULT _GetUIObjectOf(REFIID riid, void **ppvOut);
  170. HRESULT _ItemName(UINT dwFlags, BSTR *pbs);
  171. HRESULT _SecurityCheck();
  172. ~CFolderItem();
  173. LONG _cRef;
  174. CFolder *_psdf; // The folder we came from...
  175. LPITEMIDLIST _pidl;
  176. };
  177. #define CMD_ID_FIRST 1
  178. #define CMD_ID_LAST 0x7fff
  179. #endif // __cplusplus
  180. #endif // __SHDISP_H__