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.

342 lines
12 KiB

  1. #ifndef OFFLINE_CPP_H
  2. #define OFFLINE_CPP_H
  3. #ifdef __cplusplus
  4. // #include <debug.h>
  5. // #include <crtfree.h>
  6. // Forward class declarations
  7. class COfflineFolderEnum;
  8. class COfflineFolder;
  9. class COfflineObjectItem;
  10. class COfflineDropTarget;
  11. #define PROP_WEBCRAWL_SIZE 0x00000001
  12. #define PROP_WEBCRAWL_FLAGS 0x00000002
  13. #define PROP_WEBCRAWL_LEVEL 0x00000004
  14. #define PROP_WEBCRAWL_ACTUALSIZE 0x00000008
  15. #define PROP_WEBCRAWL_URL 0x00000010
  16. #define PROP_WEBCRAWL_NAME 0x00000020
  17. #define PROP_WEBCRAWL_EMAILNOTF 0x00000040
  18. #define PROP_WEBCRAWL_PSWD 0x00000080
  19. #define PROP_WEBCRAWL_UNAME 0x00000100
  20. #define PROP_WEBCRAWL_DESKTOP 0x00000200
  21. #define PROP_WEBCRAWL_RESCH 0x00000400
  22. #define PROP_WEBCRAWL_COOKIE 0x00000800
  23. #define PROP_WEBCRAWL_LAST 0x00001000
  24. #define PROP_WEBCRAWL_STATUS 0x00002000
  25. #define PROP_WEBCRAWL_CHANNEL 0x00004000
  26. #define PROP_WEBCRAWL_PRIORITY 0x00008000
  27. #define PROP_WEBCRAWL_GLEAM 0x00010000
  28. #define PROP_WEBCRAWL_CHANGESONLY 0x00020000
  29. #define PROP_WEBCRAWL_CHANNELFLAGS 0x00040000
  30. #define PROP_WEBCRAWL_ALL 0x0007FFFF
  31. #define PROP_WEBCRAWL_EXTERNAL PROP_WEBCRAWL_ACTUALSIZE | PROP_WEBCRAWL_URL | \
  32. PROP_WEBCRAWL_NAME | PROP_WEBCRAWL_EMAILNOTF | \
  33. PROP_WEBCRAWL_RESCH | PROP_WEBCRAWL_LAST | \
  34. PROP_WEBCRAWL_DESKTOP | PROP_WEBCRAWL_CHANNEL |\
  35. PROP_WEBCRAWL_STATUS | PROP_WEBCRAWL_PRIORITY
  36. #define PROP_GENERAL_MASK PROP_WEBCRAWL_PSWD | PROP_WEBCRAWL_UNAME
  37. #define PROP_RECEIVING_MASK PROP_WEBCRAWL_SIZE | PROP_WEBCRAWL_FLAGS | \
  38. PROP_WEBCRAWL_CHANGESONLY | PROP_WEBCRAWL_EMAILNOTF \
  39. PROP_WEBCRAWL_PRIORITY | PROP_WEBCRAWL_LEVEL | \
  40. PROP_WEBCRAWL_CHANNELFLAGS
  41. #define PROP_SCHEDULE_MASK PROP_WEBCRAWL_CHANNELFLAGS | PROP_WEBCRAWL_RESCH
  42. // Forwawd declarations for create instance functions
  43. HRESULT COfflineObjectItem_CreateInstance(COfflineFolder *pOOFolder, UINT cidl, LPCITEMIDLIST *ppidl, REFIID riid, void **ppvOut);
  44. HRESULT DoDeleteSubscription(POOEntry);
  45. HRESULT FindURLProps(LPCTSTR, PROPVARIANT *);
  46. SUBSCRIPTIONSCHEDULE GetGroup(BOOL bDesktop, const CLSID& clsidDest,
  47. DWORD fChannelFlags, const NOTIFICATIONCOOKIE& groupCookie);
  48. inline SUBSCRIPTIONSCHEDULE GetGroup(POOEBuf pBuf)
  49. {
  50. ASSERT(pBuf);
  51. return GetGroup(pBuf->bDesktop, pBuf->clsidDest, pBuf->fChannelFlags, pBuf->groupCookie);
  52. }
  53. inline SUBSCRIPTIONSCHEDULE GetGroup(POOEntry pooe)
  54. {
  55. ASSERT(pooe);
  56. return GetGroup(pooe->bDesktop, pooe->clsidDest, pooe->fChannelFlags, pooe->groupCookie);
  57. }
  58. SUBSCRIPTIONTYPE GetItemCategory(BOOL bDesktop, const CLSID& clsidDest);
  59. inline SUBSCRIPTIONTYPE GetItemCategory(POOEBuf pBuf)
  60. {
  61. ASSERT(pBuf);
  62. return GetItemCategory(pBuf->bDesktop, pBuf->clsidDest);
  63. }
  64. inline SUBSCRIPTIONTYPE GetItemCategory(POOEntry pEntry)
  65. {
  66. ASSERT(pEntry);
  67. return GetItemCategory(pEntry->bDesktop, pEntry->clsidDest);
  68. }
  69. //////////////////////////////////////////////////////////////////////////////
  70. //
  71. // COfflineFolderEnum Object
  72. //
  73. //////////////////////////////////////////////////////////////////////////////
  74. class COfflineFolderEnum : public IEnumIDList
  75. {
  76. public:
  77. COfflineFolderEnum(DWORD grfFlags);
  78. // IUnknown Methods
  79. STDMETHODIMP QueryInterface(REFIID,void **);
  80. STDMETHODIMP_(ULONG) AddRef(void);
  81. STDMETHODIMP_(ULONG) Release(void);
  82. // IEnumIDList Methods
  83. STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched);
  84. STDMETHODIMP Skip(ULONG celt);
  85. STDMETHODIMP Reset();
  86. STDMETHODIMP Clone(LPENUMIDLIST *ppenum);
  87. // Helper functions
  88. static LPMYPIDL NewPidl(DWORD);
  89. static void FreePidl(LPMYPIDL);
  90. static void EnsureMalloc();
  91. static IMalloc *s_pMalloc;
  92. HRESULT Initialize(COfflineFolder *pFolder);
  93. protected:
  94. ~COfflineFolderEnum();
  95. UINT m_cRef; // ref count
  96. UINT m_grfFlags; // enumeration flags
  97. private:
  98. ULONG m_nCount;
  99. ULONG m_nCurrent;
  100. SUBSCRIPTIONCOOKIE *m_pCookies;
  101. COfflineFolder *m_pFolder;
  102. };
  103. //////////////////////////////////////////////////////////////////////////////
  104. //
  105. // COfflineFolder Object
  106. //
  107. //////////////////////////////////////////////////////////////////////////////
  108. class COfflineFolder : public IShellFolder,
  109. public IPersistFolder2,
  110. public IContextMenu
  111. {
  112. // COfflineFolder interfaces
  113. friend COfflineObjectItem;
  114. friend COfflineDropTarget;
  115. friend COfflineFolderEnum;
  116. friend HRESULT OfflineFolderView_CreateInstance(COfflineFolder *pOOFolder, LPCITEMIDLIST pidl, void **ppvOut);
  117. friend HRESULT OfflineFolderView_DidDragDrop(HWND, IDataObject *pdo, DWORD dwEffect);
  118. friend LPMYPIDL ScheduleDefault(LPCTSTR, LPCTSTR, COfflineFolder *);
  119. public:
  120. COfflineFolder(void);
  121. // IUnknown Methods
  122. STDMETHODIMP QueryInterface(REFIID,void **);
  123. STDMETHODIMP_(ULONG) AddRef(void);
  124. STDMETHODIMP_(ULONG) Release(void);
  125. // IShellFolder methods
  126. STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbcReserved,
  127. LPOLESTR lpszDisplayName, ULONG *pchEaten,
  128. LPITEMIDLIST *ppidl, ULONG *pdwAttributes);
  129. STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD grfFlags,
  130. LPENUMIDLIST *ppenumIDList);
  131. STDMETHODIMP BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved,
  132. REFIID riid, void **ppvOut);
  133. STDMETHODIMP BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved,
  134. REFIID riid, void **ppvObj);
  135. STDMETHODIMP CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
  136. STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, void **ppvOut);
  137. STDMETHODIMP GetAttributesOf(UINT cidl, LPCITEMIDLIST * apidl,
  138. ULONG * rgfInOut);
  139. STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
  140. REFIID riid, UINT * prgfInOut, void **ppvOut);
  141. STDMETHODIMP GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName);
  142. STDMETHODIMP SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl,
  143. LPCOLESTR lpszName, DWORD uFlags, LPITEMIDLIST * ppidlOut);
  144. // IPersist Methods
  145. STDMETHODIMP GetClassID(LPCLSID lpClassID);
  146. // IPersistFolder
  147. STDMETHODIMP Initialize(LPCITEMIDLIST pidl);
  148. // IPersistFolder2
  149. STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl);
  150. // IContextMenu Methods -- This handles the background context menus
  151. STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst,
  152. UINT idCmdLast, UINT uFlags);
  153. STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  154. STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uType,UINT *pwReserved,
  155. LPSTR pszName, UINT cchMax);
  156. protected:
  157. ~COfflineFolder();
  158. UINT _cRef;
  159. LPITEMIDLIST _pidl; // Clone;
  160. #define VIEWMODE_WEBCRAWLONLY 1
  161. UINT viewMode;
  162. };
  163. class COfflineDetails : public IShellDetails
  164. {
  165. public:
  166. COfflineDetails(HWND hwndOwner);
  167. // IUnknown members
  168. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  169. STDMETHODIMP_(ULONG) AddRef();
  170. STDMETHODIMP_(ULONG) Release();
  171. // IShellDetails Methods
  172. STDMETHODIMP GetDetailsOf(LPCITEMIDLIST pidl, UINT iColumn, LPSHELLDETAILS pDetails);
  173. STDMETHODIMP ColumnClick(UINT iColumn);
  174. private:
  175. ~COfflineDetails() {}
  176. HWND m_hwndOwner;
  177. ULONG m_cRef;
  178. };
  179. ////////////////////////////////////////////////////////////////////////////
  180. //
  181. // COfflineObjectItem Object
  182. //
  183. ////////////////////////////////////////////////////////////////////////////
  184. class COfflineObjectItem : public IContextMenu,
  185. #ifdef UNICODE
  186. public IExtractIconA,
  187. #endif
  188. public IExtractIcon,
  189. public IDataObject,
  190. public IQueryInfo
  191. {
  192. // COfflineObjectItem interfaces
  193. friend HRESULT OfflineFolderView_DidDragDrop(HWND, IDataObject *pdo, DWORD dwEffect);
  194. public:
  195. COfflineObjectItem();
  196. HRESULT Initialize(COfflineFolder *pOOFolder, UINT cidl, LPCITEMIDLIST *ppidl);
  197. // IUnknown Methods
  198. STDMETHODIMP_(ULONG) AddRef(void);
  199. STDMETHODIMP_(ULONG) Release(void);
  200. STDMETHODIMP QueryInterface(REFIID,void **);
  201. // IContextMenu Methods
  202. STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst,
  203. UINT idCmdLast, UINT uFlags);
  204. STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  205. STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uType,UINT *pwReserved,
  206. LPSTR pszName, UINT cchMax);
  207. // IDataObject Methods...
  208. STDMETHODIMP GetData(LPFORMATETC pFEIn, LPSTGMEDIUM pSTM);
  209. STDMETHODIMP GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM);
  210. STDMETHODIMP QueryGetData(LPFORMATETC pFE);
  211. STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC pFEIn, LPFORMATETC pFEOut);
  212. STDMETHODIMP SetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL fRelease);
  213. STDMETHODIMP EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC *ppEnum);
  214. STDMETHODIMP DAdvise(LPFORMATETC pFE, DWORD grfAdv, LPADVISESINK pAdvSink,
  215. LPDWORD pdwConnection);
  216. STDMETHODIMP DUnadvise(DWORD dwConnection);
  217. STDMETHODIMP EnumDAdvise(LPENUMSTATDATA *ppEnum);
  218. // IDataObject helper functions
  219. HRESULT _CreateHDROP(STGMEDIUM *pmedium);
  220. HRESULT _CreateNameMap(STGMEDIUM *pmedium);
  221. HRESULT _CreateFileDescriptor(STGMEDIUM *pSTM);
  222. HRESULT _CreateFileContents(STGMEDIUM *pSTM, LONG lindex);
  223. HRESULT _CreateURL(STGMEDIUM *pSTM);
  224. HRESULT _CreatePrefDropEffect(STGMEDIUM *pSTM);
  225. #ifdef UNICODE
  226. // IExtractIconA
  227. STDMETHODIMP GetIconLocation(UINT uFlags, LPSTR szIconFile, UINT cchMax, int * piIndex, UINT * pwFlags);
  228. STDMETHODIMP Extract(LPCSTR pszFile, UINT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIconSize);
  229. #endif
  230. // IExtractIconT Methods
  231. STDMETHODIMP GetIconLocation(UINT, LPTSTR, UINT, int *, UINT *);
  232. STDMETHODIMP Extract(LPCTSTR, UINT, HICON *, HICON *, UINT);
  233. // IQueryInfo Methods
  234. STDMETHODIMP GetInfoTip(DWORD dwFlags, WCHAR ** ppwszTip);
  235. STDMETHODIMP GetInfoFlags(DWORD *pdwFlags);
  236. protected:
  237. ~COfflineObjectItem();
  238. UINT _cRef; // reference count
  239. COfflineFolder* _pOOFolder; // back pointer to our shell folder
  240. UINT _cItems; // number of items we represent
  241. LPMYPIDL* _ppooi; // variable size array of items
  242. IUnknown *m_pUIHelper; // UI helper. For 1 item only.
  243. };
  244. class COfflineDropTarget : public IDropTarget
  245. {
  246. private:
  247. LPDATAOBJECT m_pDataObj;
  248. ULONG m_cRefs;
  249. DWORD m_grfKeyStateLast;
  250. BOOL m_fHasHDROP;
  251. BOOL m_fHasSHELLURL;
  252. BOOL m_fHasTEXT;
  253. DWORD m_dwEffectLastReturned;
  254. HWND m_hwndParent;
  255. public:
  256. COfflineDropTarget(HWND hwndParent);
  257. ~COfflineDropTarget();
  258. STDMETHODIMP QueryInterface (REFIID riid,LPVOID FAR *ppv);
  259. STDMETHODIMP_(ULONG) AddRef ();
  260. STDMETHODIMP_(ULONG) Release ();
  261. STDMETHODIMP DragEnter (LPDATAOBJECT pDataObj,
  262. DWORD grfKeyState,
  263. POINTL pt,
  264. LPDWORD pdwEffect);
  265. STDMETHODIMP DragOver (DWORD grfKeyState,
  266. POINTL pt,
  267. LPDWORD pdwEffect);
  268. STDMETHODIMP DragLeave ();
  269. STDMETHODIMP Drop (LPDATAOBJECT pDataObj,
  270. DWORD grfKeyState,
  271. POINTL pt,
  272. LPDWORD pdwEffect);
  273. DWORD GetDropEffect (LPDWORD pdwEffect);
  274. };
  275. #endif // __cplusplus
  276. #endif // OFFLINE_CPP_H