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.

338 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. public IExtractIconA,
  186. public IExtractIcon,
  187. public IDataObject,
  188. public IQueryInfo
  189. {
  190. // COfflineObjectItem interfaces
  191. friend HRESULT OfflineFolderView_DidDragDrop(HWND, IDataObject *pdo, DWORD dwEffect);
  192. public:
  193. COfflineObjectItem();
  194. HRESULT Initialize(COfflineFolder *pOOFolder, UINT cidl, LPCITEMIDLIST *ppidl);
  195. // IUnknown Methods
  196. STDMETHODIMP_(ULONG) AddRef(void);
  197. STDMETHODIMP_(ULONG) Release(void);
  198. STDMETHODIMP QueryInterface(REFIID,void **);
  199. // IContextMenu Methods
  200. STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst,
  201. UINT idCmdLast, UINT uFlags);
  202. STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  203. STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uType,UINT *pwReserved,
  204. LPSTR pszName, UINT cchMax);
  205. // IDataObject Methods...
  206. STDMETHODIMP GetData(LPFORMATETC pFEIn, LPSTGMEDIUM pSTM);
  207. STDMETHODIMP GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM);
  208. STDMETHODIMP QueryGetData(LPFORMATETC pFE);
  209. STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC pFEIn, LPFORMATETC pFEOut);
  210. STDMETHODIMP SetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL fRelease);
  211. STDMETHODIMP EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC *ppEnum);
  212. STDMETHODIMP DAdvise(LPFORMATETC pFE, DWORD grfAdv, LPADVISESINK pAdvSink,
  213. LPDWORD pdwConnection);
  214. STDMETHODIMP DUnadvise(DWORD dwConnection);
  215. STDMETHODIMP EnumDAdvise(LPENUMSTATDATA *ppEnum);
  216. // IDataObject helper functions
  217. HRESULT _CreateHDROP(STGMEDIUM *pmedium);
  218. HRESULT _CreateNameMap(STGMEDIUM *pmedium);
  219. HRESULT _CreateFileDescriptor(STGMEDIUM *pSTM);
  220. HRESULT _CreateFileContents(STGMEDIUM *pSTM, LONG lindex);
  221. HRESULT _CreateURL(STGMEDIUM *pSTM);
  222. HRESULT _CreatePrefDropEffect(STGMEDIUM *pSTM);
  223. // IExtractIconA
  224. STDMETHODIMP GetIconLocation(UINT uFlags, LPSTR szIconFile, UINT cchMax, int * piIndex, UINT * pwFlags);
  225. STDMETHODIMP Extract(LPCSTR pszFile, UINT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIconSize);
  226. // IExtractIconT Methods
  227. STDMETHODIMP GetIconLocation(UINT, LPTSTR, UINT, int *, UINT *);
  228. STDMETHODIMP Extract(LPCTSTR, UINT, HICON *, HICON *, UINT);
  229. // IQueryInfo Methods
  230. STDMETHODIMP GetInfoTip(DWORD dwFlags, WCHAR ** ppwszTip);
  231. STDMETHODIMP GetInfoFlags(DWORD *pdwFlags);
  232. protected:
  233. ~COfflineObjectItem();
  234. UINT _cRef; // reference count
  235. COfflineFolder* _pOOFolder; // back pointer to our shell folder
  236. UINT _cItems; // number of items we represent
  237. LPMYPIDL* _ppooi; // variable size array of items
  238. IUnknown *m_pUIHelper; // UI helper. For 1 item only.
  239. };
  240. class COfflineDropTarget : public IDropTarget
  241. {
  242. private:
  243. LPDATAOBJECT m_pDataObj;
  244. ULONG m_cRefs;
  245. DWORD m_grfKeyStateLast;
  246. BOOL m_fHasHDROP;
  247. BOOL m_fHasSHELLURL;
  248. BOOL m_fHasTEXT;
  249. DWORD m_dwEffectLastReturned;
  250. HWND m_hwndParent;
  251. public:
  252. COfflineDropTarget(HWND hwndParent);
  253. ~COfflineDropTarget();
  254. STDMETHODIMP QueryInterface (REFIID riid,LPVOID FAR *ppv);
  255. STDMETHODIMP_(ULONG) AddRef ();
  256. STDMETHODIMP_(ULONG) Release ();
  257. STDMETHODIMP DragEnter (LPDATAOBJECT pDataObj,
  258. DWORD grfKeyState,
  259. POINTL pt,
  260. LPDWORD pdwEffect);
  261. STDMETHODIMP DragOver (DWORD grfKeyState,
  262. POINTL pt,
  263. LPDWORD pdwEffect);
  264. STDMETHODIMP DragLeave ();
  265. STDMETHODIMP Drop (LPDATAOBJECT pDataObj,
  266. DWORD grfKeyState,
  267. POINTL pt,
  268. LPDWORD pdwEffect);
  269. DWORD GetDropEffect (LPDWORD pdwEffect);
  270. };
  271. #endif // __cplusplus
  272. #endif // OFFLINE_CPP_H