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.

1626 lines
66 KiB

  1. #ifndef _DEFVIEWP_H_
  2. #define _DEFVIEWP_H_
  3. #include "defview.h"
  4. #include <mshtmhst.h>
  5. #include "urlmon.h"
  6. #include <perhist.h>
  7. #include "inetsmgr.h"
  8. #include <cowsite.h>
  9. #include "ViewState.h"
  10. #include "webvw.h"
  11. #include "runtask.h"
  12. #include "enumuicommand.h"
  13. #include "tlist.h"
  14. // not used in any of our ISF implementations, but needed for legacy ISF implementations
  15. #include "defviewlegacy.h"
  16. class CBackgroundInfoTip; // Used for the background processing of InfoTips
  17. class CDefview;
  18. class CDVDropTarget // dvdt
  19. {
  20. public:
  21. HRESULT DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
  22. HRESULT DragOver(DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
  23. HRESULT DragLeave();
  24. HRESULT Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  25. void LeaveAndReleaseData();
  26. void ReleaseDataObject();
  27. void ReleaseCurrentDropTarget();
  28. IDataObject * _pdtobj; // from DragEnter()/Drop()
  29. RECT _rcLockWindow; // WindowRect of hwnd for DAD_ENTER
  30. int _itemOver; // item we are visually dragging over
  31. BOOL _fItemOverNotADropTarget; // the item we are currently dragging over was found not to be a drop target
  32. BOOL _fIgnoreSource; // drag is coming from webview / active desktop
  33. IDropTarget * _pdtgtCur; // current drop target, derived from hit testing
  34. DWORD _dwEffectOut; // last *pdwEffect out
  35. DWORD _grfKeyState; // cached key state
  36. POINT _ptLast; // last dragged position
  37. AUTO_SCROLL_DATA _asd; // for auto scrolling
  38. DWORD _dwLastTime; // for auto-opening folders
  39. };
  40. //
  41. // This is a proxy IDropTarget object, which wraps Trident's droptarget.
  42. //
  43. class CHostDropTarget : public IDropTarget
  44. {
  45. public:
  46. // IUnknown
  47. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  48. STDMETHODIMP_(ULONG) AddRef(void) ;
  49. STDMETHODIMP_(ULONG) Release(void);
  50. // IDropTarget
  51. STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  52. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  53. STDMETHODIMP DragLeave(void);
  54. STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  55. IDropTarget* _pdtFrame; // Drop target of the frame
  56. };
  57. class CSFVSite : public IOleInPlaceSite,
  58. public IOleClientSite,
  59. public IOleDocumentSite,
  60. public IServiceProvider,
  61. public IOleCommandTarget,
  62. public IDocHostUIHandler,
  63. public IOleControlSite,
  64. public IInternetSecurityManager,
  65. public IDispatch //For ambient properties.
  66. {
  67. friend CHostDropTarget;
  68. public:
  69. CSFVSite() { ASSERT(_peds == NULL); }
  70. ~CSFVSite() {
  71. if (_peds) {
  72. _peds->Release();
  73. _peds = NULL;
  74. }
  75. }
  76. // IUnknown
  77. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  78. STDMETHODIMP_(ULONG) AddRef(void) ;
  79. STDMETHODIMP_(ULONG) Release(void);
  80. // IOleWindow
  81. STDMETHODIMP GetWindow(HWND *phwnd);
  82. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  83. // IOleInPlaceSite
  84. STDMETHODIMP CanInPlaceActivate(void);
  85. STDMETHODIMP OnInPlaceActivate(void);
  86. STDMETHODIMP OnUIActivate(void);
  87. STDMETHODIMP GetWindowContext(
  88. IOleInPlaceFrame **ppFrame,
  89. IOleInPlaceUIWindow **ppDoc,
  90. LPRECT lprcPosRect,
  91. LPRECT lprcClipRect,
  92. LPOLEINPLACEFRAMEINFO lpFrameInfo);
  93. STDMETHODIMP Scroll(SIZE scrollExtant);
  94. STDMETHODIMP OnUIDeactivate(BOOL fUndoable);
  95. STDMETHODIMP OnInPlaceDeactivate(void);
  96. STDMETHODIMP DiscardUndoState(void);
  97. STDMETHODIMP DeactivateAndUndo(void);
  98. STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect);
  99. // IOleClientSite
  100. STDMETHODIMP SaveObject(void);
  101. STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk);
  102. STDMETHODIMP GetContainer(IOleContainer **ppContainer);
  103. STDMETHODIMP ShowObject(void);
  104. STDMETHODIMP OnShowWindow(BOOL fShow);
  105. STDMETHODIMP RequestNewObjectLayout(void);
  106. // IOleDocumentSite
  107. STDMETHODIMP ActivateMe(IOleDocumentView *pviewToActivate);
  108. // IServiceProvider
  109. STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void **ppv);
  110. // IOleCommandTarget
  111. STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  112. STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  113. // IOleControlSite
  114. STDMETHODIMP OnControlInfoChanged() { return E_NOTIMPL; };
  115. STDMETHODIMP LockInPlaceActive(BOOL fLock) { return E_NOTIMPL; };
  116. STDMETHODIMP GetExtendedControl(IDispatch **ppDisp) { *ppDisp = NULL; return E_NOTIMPL; };
  117. STDMETHODIMP TransformCoords(POINTL *pPtlHimetric, POINTF *pPtfContainer,DWORD dwFlags) { return E_NOTIMPL; };
  118. STDMETHODIMP TranslateAccelerator(MSG *pMsg,DWORD grfModifiers);
  119. STDMETHODIMP OnFocus(BOOL fGotFocus) { return E_NOTIMPL; };
  120. STDMETHODIMP ShowPropertyFrame(void) { return E_NOTIMPL; };
  121. // IDocHostUIHandler
  122. STDMETHODIMP ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved);
  123. STDMETHODIMP GetHostInfo(DOCHOSTUIINFO *pInfo);
  124. STDMETHODIMP ShowUI(DWORD dwID, IOleInPlaceActiveObject *pActiveObject,
  125. IOleCommandTarget *pCommandTarget, IOleInPlaceFrame *pFrame,
  126. IOleInPlaceUIWindow *pDoc);
  127. STDMETHODIMP HideUI(void);
  128. STDMETHODIMP UpdateUI(void);
  129. STDMETHODIMP EnableModeless(BOOL fEnable);
  130. STDMETHODIMP OnDocWindowActivate(BOOL fActivate);
  131. STDMETHODIMP OnFrameWindowActivate(BOOL fActivate);
  132. STDMETHODIMP ResizeBorder(
  133. LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow);
  134. STDMETHODIMP TranslateAccelerator(
  135. LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID);
  136. STDMETHODIMP GetOptionKeyPath(BSTR *pbstrKey, DWORD dw);
  137. STDMETHODIMP GetDropTarget(
  138. IDropTarget *pDropTarget, IDropTarget **ppDropTarget);
  139. STDMETHODIMP GetExternal(IDispatch **ppDisp);
  140. STDMETHODIMP TranslateUrl(DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut);
  141. STDMETHODIMP FilterDataObject(IDataObject *pDO, IDataObject **ppDORet);
  142. // IInternetSecurityManager
  143. STDMETHODIMP SetSecuritySite(IInternetSecurityMgrSite *pSite) { return INET_E_DEFAULT_ACTION; };
  144. STDMETHODIMP GetSecuritySite(IInternetSecurityMgrSite **ppSite) { return INET_E_DEFAULT_ACTION; };
  145. STDMETHODIMP MapUrlToZone(LPCWSTR pwszUrl, DWORD * pdwZone, DWORD dwFlags) { return INET_E_DEFAULT_ACTION; };
  146. STDMETHODIMP GetSecurityId(LPCWSTR pwszUrl, BYTE * pbSecurityId, DWORD * pcbSecurityId, DWORD_PTR dwReserved) { return INET_E_DEFAULT_ACTION; };
  147. STDMETHODIMP ProcessUrlAction(LPCWSTR pwszUrl, DWORD dwAction, BYTE * pPolicy, DWORD cbPolicy, BYTE * pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved);
  148. STDMETHODIMP QueryCustomPolicy(LPCWSTR pwszUrl, REFGUID guidKey, BYTE ** ppPolicy, DWORD * pcbPolicy, BYTE * pContext, DWORD cbContext, DWORD dwReserved) { return INET_E_DEFAULT_ACTION; };
  149. STDMETHODIMP SetZoneMapping(DWORD dwZone, LPCWSTR pszPattern, DWORD dwFlags) { return INET_E_DEFAULT_ACTION; };
  150. STDMETHODIMP GetZoneMappings(DWORD dwZone, IEnumString ** ppenumString, DWORD dwFlags) { return INET_E_DEFAULT_ACTION; };
  151. // IDispatch
  152. STDMETHODIMP GetTypeInfoCount(unsigned int *pctinfo)
  153. { return E_NOTIMPL; };
  154. STDMETHODIMP GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo **pptinfo)
  155. { return E_NOTIMPL; };
  156. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgdispid)
  157. { return E_NOTIMPL; };
  158. STDMETHODIMP Invoke(DISPID dispidMember, REFIID iid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams,
  159. VARIANT *pvarResult, EXCEPINFO *pexcepinfo,UINT *puArgErr);
  160. CHostDropTarget _dt;
  161. IExpDispSupport * _peds;
  162. };
  163. class CSFVFrame : public IOleInPlaceFrame,
  164. public IAdviseSink,
  165. public IPropertyNotifySink //for READYSTATE
  166. {
  167. public:
  168. enum
  169. {
  170. UNDEFINEDVIEW = -3,
  171. NOEXTVIEW = -2,
  172. HIDEEXTVIEW = -1,
  173. } ;
  174. CSFVFrame() : _fReadyStateComplete(TRUE), _pOleObj(NULL), _bgColor(CLR_INVALID)
  175. {
  176. }
  177. ~CSFVFrame();
  178. // IUnknown
  179. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  180. STDMETHODIMP_(ULONG) AddRef(void) ;
  181. STDMETHODIMP_(ULONG) Release(void);
  182. // IOleWindow
  183. STDMETHODIMP GetWindow(HWND *phwnd);
  184. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  185. // IOleInPlaceUIWindow
  186. STDMETHODIMP GetBorder(LPRECT lprectBorder);
  187. STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS pborderwidths);
  188. STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS pborderwidths);
  189. STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName);
  190. // IOleInPlaceFrame
  191. STDMETHODIMP InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  192. STDMETHODIMP SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  193. STDMETHODIMP RemoveMenus(HMENU hmenuShared);
  194. STDMETHODIMP SetStatusText(LPCOLESTR pszStatusText);
  195. STDMETHODIMP EnableModeless(BOOL fEnable);
  196. STDMETHODIMP TranslateAccelerator(LPMSG lpmsg, WORD wID);
  197. // IAdviseSink
  198. STDMETHODIMP_(void) OnDataChange(FORMATETC *, STGMEDIUM *);
  199. STDMETHODIMP_(void) OnViewChange(DWORD dwAspect, LONG lindex);
  200. STDMETHODIMP_(void) OnRename(IMoniker *);
  201. STDMETHODIMP_(void) OnSave();
  202. STDMETHODIMP_(void) OnClose();
  203. // IPropertyNotifySink
  204. STDMETHODIMP OnChanged(DISPID dispid);
  205. STDMETHODIMP OnRequestEdit(DISPID dispid);
  206. private:
  207. friend class CSFVSite;
  208. CSFVSite _cSite;
  209. friend class CDefView;
  210. class CBindStatusCallback : public IBindStatusCallback
  211. , public IServiceProvider
  212. {
  213. friend CSFVFrame;
  214. protected:
  215. // IUnknown
  216. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  217. STDMETHODIMP_(ULONG) AddRef(void) ;
  218. STDMETHODIMP_(ULONG) Release(void);
  219. // IServiceProvider
  220. STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void **ppv);
  221. // IBindStatusCallback
  222. STDMETHODIMP OnStartBinding(
  223. DWORD grfBSCOption,
  224. IBinding *pib);
  225. STDMETHODIMP GetPriority(
  226. LONG *pnPriority);
  227. STDMETHODIMP OnLowResource(
  228. DWORD reserved);
  229. STDMETHODIMP OnProgress(
  230. ULONG ulProgress,
  231. ULONG ulProgressMax,
  232. ULONG ulStatusCode,
  233. LPCWSTR szStatusText);
  234. STDMETHODIMP OnStopBinding(
  235. HRESULT hresult,
  236. LPCWSTR szError);
  237. STDMETHODIMP GetBindInfo(
  238. DWORD *grfBINDINFOF,
  239. BINDINFO *pbindinfo);
  240. STDMETHODIMP OnDataAvailable(
  241. DWORD grfBSCF,
  242. DWORD dwSize,
  243. FORMATETC *pformatetc,
  244. STGMEDIUM *pstgmed);
  245. STDMETHODIMP OnObjectAvailable(
  246. REFIID riid,
  247. IUnknown *punk);
  248. };
  249. friend class CBindStatusCallback;
  250. CBindStatusCallback _bsc;
  251. //
  252. // External views stuff
  253. //
  254. // We have DocObject extensions and IShellView extensions
  255. // A (DocObject) extension can
  256. public:
  257. HRESULT InitObj(IUnknown* pObj, LPCITEMIDLIST pidlHere, int iView);
  258. // If we have a moniker, then we are either currently showing it or we are trying to show it.
  259. // (Old code explicitly checked current view and pending view -- this is easier.)
  260. BOOL IsWebView(void) { return _szCurrentWebViewMoniker[0]!=L'\0'; }
  261. HRESULT _HasFocusIO();
  262. HRESULT _UIActivateIO(BOOL fActivate, MSG *pMsg);
  263. HWND GetExtendedViewWindow();
  264. HRESULT SetRect(LPRECT prc);
  265. HRESULT GetCommandTarget(IOleCommandTarget** ppct);
  266. // allow the frame to handle the choice on delegation on translate accelerator...
  267. HRESULT OnTranslateAccelerator(LPMSG pmsg, BOOL* pbTabOffLastTridentStop);
  268. HRESULT _GetHTMLBackgroundColor(COLORREF *pclr); // used in defview.cpp
  269. #ifdef DEBUG
  270. void _ShowWebViewContent();
  271. #endif
  272. private:
  273. COLORREF _bgColor; //Icon text background color for active desktop
  274. UINT _uState:2; // SVUIA_* for _pOleObj (extended view)
  275. IOleObject* _pOleObj;
  276. IOleDocumentView* _pDocView;
  277. IOleInPlaceActiveObject* _pActive;
  278. IViewObject *_pvoActive;
  279. void _CleanUpOleObj(IOleObject* pOleObj);
  280. void _CleanUpOleObjAndDt(IOleObject* pOleObj);
  281. void _CleanupNewOleObj();
  282. void _CleanupOldDocObject(void);
  283. WCHAR _szCurrentWebViewMoniker[MAX_PATH];
  284. HRESULT _GetCurrentWebViewMoniker(LPWSTR wszCurrentMoniker, DWORD cchCurrentMoniker);
  285. HRESULT ShowWebView(LPCWSTR pszMoniker);
  286. HRESULT HideWebView();
  287. HRESULT _CreateNewOleObjFromMoniker(LPCWSTR wszMoniker, IOleObject **ppOleObj);
  288. HRESULT _ShowExtView_Helper(IOleObject* pOleObj);
  289. HRESULT _SwitchToNewOleObj();
  290. HRESULT _GetCurrentZone(IOleObject *pOleObj, VARIANT *pvar);
  291. HRESULT _UpdateZonesStatusPane(IOleObject *pOleObj);
  292. //Fields that store details about the new OLE object while we wait for
  293. //it to reach a READYSTATE_INTERACTIVE.
  294. IOleObject* _pOleObjNew;
  295. BOOL _fSwitchedToNewOleObj;
  296. BOOL _SetupReadyStateNotifyCapability();
  297. BOOL _RemoveReadyStateNotifyCapability();
  298. DWORD _dwConnectionCookie;
  299. BOOL _fReadyStateInteractiveProcessed;
  300. BOOL _fReadyStateComplete;
  301. IOleObject* _pOleObjReadyState;
  302. };
  303. class CCallback
  304. {
  305. public:
  306. CCallback(IShellFolderViewCB* psfvcb) : _psfvcb(psfvcb)
  307. {
  308. if (_psfvcb)
  309. {
  310. _psfvcb->AddRef();
  311. _psfvcb->QueryInterface(IID_PPV_ARG(IFolderFilter, &_psff));
  312. }
  313. }
  314. ~CCallback()
  315. {
  316. ATOMICRELEASE(_psfvcb);
  317. ATOMICRELEASE(_psff);
  318. }
  319. IShellFolderViewCB *GetSFVCB()
  320. {
  321. return _psfvcb;
  322. }
  323. IFolderFilter *GetISFF()
  324. {
  325. return _psff;
  326. }
  327. HRESULT SetCallback(IShellFolderViewCB* pNewCB, IShellFolderViewCB** ppOldCB)
  328. {
  329. // We Release the callback for us, and then AddRef it for the caller who now
  330. // owns the object, which does nothing
  331. *ppOldCB = _psfvcb;
  332. ATOMICRELEASE(_psff);
  333. _psfvcb = pNewCB;
  334. if (pNewCB)
  335. {
  336. pNewCB->AddRef();
  337. pNewCB->QueryInterface(IID_PPV_ARG(IFolderFilter, &_psff));
  338. }
  339. return S_OK;
  340. }
  341. // Default implementation of SFVM_GETVIEWS replacement SFVM_GETVIEWINFOTEMPLATE
  342. HRESULT OnGetWebViewTemplate(DWORD pv, UINT uViewMode, SFVM_WEBVIEW_TEMPLATE_DATA* pvit);
  343. // For legacy SFVM_GETVIEWS implementation:
  344. HRESULT TryLegacyGetViews(SFVM_WEBVIEW_TEMPLATE_DATA* pvit);
  345. HRESULT OnRefreshLegacy(void* pv, BOOL fPrePost);
  346. void _GetExtViews(BOOL bForce);
  347. int GetViewIdFromGUID(SHELLVIEWID const *pvid, SFVVIEWSDATA** ppItem);
  348. CViewsList _lViews;
  349. BOOL _bGotViews;
  350. HRESULT CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
  351. {
  352. HRESULT hr;
  353. if (_psfvcb)
  354. {
  355. hr = _psfvcb->MessageSFVCB(uMsg, wParam, lParam);
  356. // NOTE: if SFVM_GETVIEWDATA is no longer needed, we can nuke this
  357. switch (uMsg)
  358. {
  359. HANDLE_MSG(0, SFVM_REFRESH, OnRefreshLegacy);
  360. }
  361. if (FAILED(hr))
  362. {
  363. switch (uMsg)
  364. {
  365. HANDLE_MSG(0, SFVM_GETWEBVIEW_TEMPLATE, OnGetWebViewTemplate);
  366. }
  367. }
  368. }
  369. else
  370. {
  371. hr = E_NOTIMPL;
  372. }
  373. return hr;
  374. }
  375. BOOL HasCB()
  376. {
  377. return _psfvcb != NULL;
  378. }
  379. private:
  380. IShellFolderViewCB* _psfvcb;
  381. IFolderFilter* _psff;
  382. };
  383. // Variable Column stuff
  384. typedef struct
  385. {
  386. TCHAR szName[MAX_COLUMN_NAME_LEN];
  387. DWORD cChars; // number of characters wide for default
  388. DWORD fmt;
  389. DWORD csFlags; // SHCOLSTATE flags
  390. DWORD tsFlags; // SHTRANSCOLSTATE flags
  391. } COL_INFO;
  392. #define SHTRANSCOLSTATE_TILEVIEWCOLUMN 0x00000001
  393. //Possible values for _iCustomizable
  394. #define YES_CUSTOMIZABLE 1
  395. #define DONTKNOW_IF_CUSTOMIZABLE 0
  396. #define NOT_CUSTOMIZABLE -2
  397. // For communicating with the background property extractor
  398. class CBackgroundDefviewInfo
  399. {
  400. public:
  401. CBackgroundDefviewInfo (LPCITEMIDLIST pidl, UINT uId);
  402. virtual ~CBackgroundDefviewInfo (void);
  403. LPCITEMIDLIST GetPIDL (void) const { return(_pidl); }
  404. UINT GetId() const { return(_uId); }
  405. private:
  406. const LPCITEMIDLIST _pidl;
  407. UINT _uId;
  408. };
  409. class CBackgroundColInfo : public CBackgroundDefviewInfo
  410. {
  411. private:
  412. CBackgroundColInfo (void);
  413. public:
  414. CBackgroundColInfo (LPCITEMIDLIST pidl, UINT uId, UINT uiCol, STRRET& strRet);
  415. ~CBackgroundColInfo (void);
  416. UINT GetColumn (void) const { return(_uiCol); }
  417. LPCTSTR GetText (void) const { return(&_szText[0]); }
  418. private:
  419. const UINT _uiCol;
  420. TCHAR _szText[MAX_COLUMN_NAME_LEN];
  421. };
  422. // The number of "columns" shown in tileview.
  423. // FEATURE:
  424. // We may want to allow this as a registry setting. Or perhaps
  425. // in the desktop.ini. Or perhaps pesisted as per-folder view state?
  426. // Currently, we'll set this two 2 subitems, per spec.
  427. #define TILEVIEWLINES 2
  428. // For communicating with the background file type properties task (for tileview)
  429. class CBackgroundTileInfo : public CBackgroundDefviewInfo
  430. {
  431. private:
  432. CBackgroundTileInfo (void);
  433. public:
  434. CBackgroundTileInfo (LPCITEMIDLIST pidl, UINT uId, UINT rguColumns[], UINT cColumns);
  435. ~CBackgroundTileInfo (void);
  436. UINT* GetColumns (void) { return(_rguColumns); }
  437. UINT GetColumnCount (void)const { return(_cColumns); }
  438. private:
  439. UINT _rguColumns[TILEVIEWLINES];
  440. const UINT _cColumns;
  441. };
  442. class CBackgroundGroupInfo : public CBackgroundDefviewInfo
  443. {
  444. public:
  445. CBackgroundGroupInfo (LPCITEMIDLIST pidl, UINT uId, DWORD dwGroupId);
  446. BOOL VerifyGroupExists(HWND hwnd, ICategorizer* pcat);
  447. DWORD GetGroupId() { return(_dwGroupId); }
  448. private:
  449. DWORD _dwGroupId;
  450. };
  451. // CDefviewEnumTask is defview's IEnumIDList manager.
  452. // This object is used on the UI thread from defview
  453. // and on the task scheduler when it is doing background work.
  454. // All the UI-thread functions are called out as public methods
  455. // during which this object often calls back into CDefView.
  456. //
  457. class CDefviewEnumTask : public CRunnableTask
  458. {
  459. public:
  460. CDefviewEnumTask(CDefView *pdsv, DWORD dwId);
  461. // IRunnableTask
  462. STDMETHODIMP RunInitRT(void);
  463. STDMETHODIMP InternalResumeRT(void);
  464. // Called from defview from UI thread:
  465. HRESULT FillObjectsToDPA(BOOL fInteractive);
  466. HRESULT FillObjectsDPAToDone();
  467. HRESULT FillObjectsDoneToView();
  468. UINT DPACount() { return _hdpaEnum ? DPA_GetPtrCount(_hdpaEnum) : 0; }
  469. LPCITEMIDLIST* DPAArray() { return _hdpaEnum ? (LPCITEMIDLIST*)DPA_GetPtrPtr(_hdpaEnum) : NULL; }
  470. BOOL _DeleteFromPending(LPCITEMIDLIST pidl);
  471. void _AddToPending(LPCITEMIDLIST pidl);
  472. private:
  473. ~CDefviewEnumTask();
  474. static int CALLBACK _CompareExactCanonical(void *p1, void *p2, LPARAM lParam);
  475. PFNDPACOMPARE _GetCanonicalCompareFunction(void);
  476. LPARAM _GetCanonicalCompareBits();
  477. void _SortForFilter(HDPA hdpa);
  478. void _FilterDPAs(HDPA hdpa, HDPA hdpaOld);
  479. CDefView *_pdsv;
  480. IEnumIDList *_peunk;
  481. HDPA _hdpaEnum;
  482. BOOL _fEnumSorted;
  483. BOOL _fBackground;
  484. HRESULT _hrRet;
  485. HDPA _hdpaPending; // list of refs to SHCNE_CREATEd items while we were enumerating
  486. DWORD _dwId;
  487. };
  488. class CDUIView;
  489. #ifdef _X86_
  490. //
  491. // App compat bug 90885.
  492. //
  493. // Hijaak 5.0 grovels through the CDefView class looking for the
  494. // IShellBrowser (whose value it learned from CWM_GETISHELLBROWSER).
  495. // It then assumes that the field right in front of the IShellBrowser
  496. // is the IShellFolder. Unfortunately, since we derive from
  497. // CObjectWithSite and the browser is our site, they accidentally
  498. // find the copy inside CObjectWithSite and then treat CObjectWithSite's
  499. // vtbl as if were an IShellFolder. They then crash, taking the process
  500. // with it. Said process anybody who instantiates a DefView, like Explorer.
  501. // Or anybody who uses a common dialog, which is pretty much everybody.
  502. //
  503. // Here's the dummy IShellFolder-like object we give them.
  504. //
  505. extern const LPVOID c_FakeHijaakFolder;
  506. //
  507. // And here's the class that ensures that the dummy IShellFolder
  508. // comes right before the IShellBrowser. This replaces the
  509. // problematic CObjectWithSite.
  510. //
  511. class CHijaakObjectWithSite : public IObjectWithSite {
  512. public:
  513. //*** IObjectWithSite ***
  514. STDMETHOD(SetSite)(IUnknown *punkSite) {
  515. IUnknown_Set(&_punkSite, punkSite);
  516. return S_OK;
  517. }
  518. STDMETHOD(GetSite)(REFIID riid, void **ppvSite) {
  519. if (_punkSite)
  520. return _punkSite->QueryInterface(riid, ppvSite);
  521. *ppvSite = NULL;
  522. return E_FAIL;
  523. }
  524. CHijaakObjectWithSite() : _psfHijaak(&c_FakeHijaakFolder) { }
  525. ~CHijaakObjectWithSite() {ATOMICRELEASE(_punkSite);}
  526. const LPVOID *_psfHijaak;
  527. IShellBrowser *_psb;
  528. IUnknown *_punkSite;
  529. };
  530. #endif
  531. #define SWITCHTOVIEW_BOTH 0x0
  532. #define SWITCHTOVIEW_NOWEBVIEW 0x1
  533. #define SWITCHTOVIEW_WEBVIEWONLY 0x2
  534. //
  535. // Class definition of CDefView
  536. //
  537. class CDefView : // dsv
  538. public IShellView2,
  539. public IFolderView,
  540. public IShellFolderView,
  541. public IOleCommandTarget, // so psb can talk to extended views
  542. public IDropTarget,
  543. public IViewObject,
  544. public IDefViewFrame, // TODO: remove - currently only used by shell\ext\ftp
  545. public IDefViewFrame3,
  546. public IServiceProvider,
  547. public IDocViewSite,
  548. public IInternetSecurityMgrSite,
  549. public IPersistIDList,
  550. public IDVGetEnum,
  551. #ifdef _X86_
  552. public CHijaakObjectWithSite,
  553. #else
  554. public CObjectWithSite,
  555. #endif
  556. public IContextMenuSite,
  557. public IDefViewSafety,
  558. public IUICommandTarget,
  559. public CWVTASKITEM // webview implementation helper class
  560. {
  561. public:
  562. CDefView(IShellFolder *pshf, IShellFolderViewCB* psfvcb, IShellView* psvOuter);
  563. STDMETHODIMP Init();
  564. // IUnknown
  565. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  566. STDMETHODIMP_(ULONG) AddRef(void) ;
  567. STDMETHODIMP_(ULONG) Release(void);
  568. // IShellView
  569. STDMETHODIMP GetWindow(HWND *phwnd);
  570. STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  571. STDMETHODIMP EnableModeless(BOOL fEnable);
  572. STDMETHODIMP Refresh();
  573. STDMETHODIMP CreateViewWindow(IShellView *pPrev, LPCFOLDERSETTINGS pfs, IShellBrowser *psb, RECT *prc, HWND *phWnd);
  574. STDMETHODIMP DestroyViewWindow();
  575. STDMETHODIMP UIActivate(UINT uState);
  576. STDMETHODIMP GetCurrentInfo(LPFOLDERSETTINGS lpfs);
  577. STDMETHODIMP TranslateAccelerator(LPMSG pmsg);
  578. STDMETHODIMP AddPropertySheetPages(DWORD dwReserved, LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam);
  579. STDMETHODIMP SaveViewState();
  580. STDMETHODIMP SelectItem(LPCITEMIDLIST pidlItem, UINT uFlags);
  581. STDMETHODIMP GetItemObject(UINT uItem, REFIID riid, void **ppv);
  582. // IShellView2
  583. STDMETHODIMP GetView(SHELLVIEWID* pvid, ULONG uView);
  584. STDMETHODIMP CreateViewWindow2(LPSV2CVW2_PARAMS pParams);
  585. STDMETHODIMP HandleRename(LPCITEMIDLIST pidl);
  586. STDMETHODIMP SelectAndPositionItem(LPCITEMIDLIST pidlItem, UINT uFlags, POINT *ppt);
  587. // IFolderView
  588. STDMETHODIMP GetCurrentViewMode(UINT *pViewMode);
  589. STDMETHODIMP SetCurrentViewMode(UINT ViewMode);
  590. STDMETHODIMP GetFolder(REFIID ridd, void **ppv);
  591. STDMETHODIMP Item(int iItemIndex, LPITEMIDLIST *ppidl);
  592. STDMETHODIMP ItemCount(UINT uFlags, int *pcItems);
  593. STDMETHODIMP Items(UINT uFlags, REFIID riid, void **ppv);
  594. STDMETHODIMP GetSelectionMarkedItem(int *piItem);
  595. STDMETHODIMP GetFocusedItem(int *piItem);
  596. STDMETHODIMP GetItemPosition(LPCITEMIDLIST pidl, POINT* ppt);
  597. STDMETHODIMP GetSpacing(POINT* ppt);
  598. STDMETHODIMP GetDefaultSpacing(POINT* ppt);
  599. STDMETHODIMP GetAutoArrange();
  600. STDMETHODIMP SelectItem(int iItem, DWORD dwFlags);
  601. STDMETHODIMP SelectAndPositionItems(UINT cidl, LPCITEMIDLIST* apidl, POINT* apt, DWORD dwFlags);
  602. // IShellFolderView
  603. STDMETHODIMP Rearrange(LPARAM lParamSort);
  604. STDMETHODIMP GetArrangeParam(LPARAM *plParamSort);
  605. STDMETHODIMP ArrangeGrid();
  606. STDMETHODIMP AutoArrange();
  607. STDMETHODIMP AddObject(LPITEMIDLIST pidl, UINT *puItem);
  608. STDMETHODIMP GetObject(LPITEMIDLIST *ppidl, UINT uItem);
  609. STDMETHODIMP RemoveObject(LPITEMIDLIST pidl, UINT *puItem);
  610. STDMETHODIMP GetObjectCount(UINT *puCount);
  611. STDMETHODIMP SetObjectCount(UINT uCount, UINT dwFlags);
  612. STDMETHODIMP UpdateObject(LPITEMIDLIST pidlOld, LPITEMIDLIST pidlNew, UINT *puItem);
  613. STDMETHODIMP RefreshObject(LPITEMIDLIST pidl, UINT *puItem);
  614. STDMETHODIMP SetRedraw(BOOL bRedraw);
  615. STDMETHODIMP GetSelectedCount(UINT *puSelected);
  616. STDMETHODIMP GetSelectedObjects(LPCITEMIDLIST **pppidl, UINT *puItems);
  617. STDMETHODIMP IsDropOnSource(IDropTarget *pDropTarget);
  618. STDMETHODIMP GetDragPoint(POINT *ppt);
  619. STDMETHODIMP GetDropPoint(POINT *ppt);
  620. STDMETHODIMP MoveIcons(IDataObject *pDataObject);
  621. STDMETHODIMP SetItemPos(LPCITEMIDLIST pidl, POINT *ppt);
  622. STDMETHODIMP IsBkDropTarget(IDropTarget *pDropTarget);
  623. STDMETHODIMP SetClipboard(BOOL bMove);
  624. STDMETHODIMP SetPoints(IDataObject *pDataObject);
  625. STDMETHODIMP GetItemSpacing(ITEMSPACING *pSpacing);
  626. STDMETHODIMP SetCallback(IShellFolderViewCB* pNewCB, IShellFolderViewCB** ppOldCB);
  627. STDMETHODIMP Select(UINT dwFlags);
  628. STDMETHODIMP QuerySupport(UINT * pdwSupport);
  629. STDMETHODIMP SetAutomationObject(IDispatch *pdisp);
  630. // IOleCommandTarget
  631. STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  632. STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  633. // IDropTarget
  634. STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
  635. { return _dvdt.DragEnter(pdtobj, grfKeyState, ptl, pdwEffect); }
  636. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
  637. { return _dvdt.DragOver(grfKeyState, ptl, pdwEffect); }
  638. STDMETHODIMP DragLeave()
  639. { return _dvdt.DragLeave(); }
  640. STDMETHODIMP Drop(IDataObject *pdtobj,
  641. DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
  642. { return _dvdt.Drop(pdtobj, grfKeyState, pt, pdwEffect); }
  643. // IViewObject
  644. STDMETHODIMP Draw(DWORD, LONG, void *, DVTARGETDEVICE *, HDC, HDC,
  645. const RECTL *, const RECTL *, int (*)(ULONG_PTR), ULONG_PTR);
  646. STDMETHODIMP GetColorSet(DWORD, LONG, void *, DVTARGETDEVICE *, HDC,
  647. LOGPALETTE **);
  648. STDMETHODIMP Freeze(DWORD, LONG, void *, DWORD *);
  649. STDMETHODIMP Unfreeze(DWORD);
  650. STDMETHODIMP SetAdvise(DWORD, DWORD, IAdviseSink *);
  651. STDMETHODIMP GetAdvise(DWORD *, DWORD *, IAdviseSink **);
  652. // IDefViewFrame
  653. STDMETHODIMP GetShellFolder(IShellFolder **ppsf);
  654. // IDefViewFrame3
  655. STDMETHODIMP GetWindowLV(HWND * phwnd);
  656. STDMETHODIMP OnResizeListView();
  657. STDMETHODIMP ShowHideListView();
  658. STDMETHODIMP ReleaseWindowLV(void);
  659. STDMETHODIMP DoRename();
  660. // IContextMenuSite
  661. STDMETHODIMP DoContextMenuPopup(IUnknown* punkCM, UINT fFlags, POINT pt);
  662. // IPersist
  663. STDMETHODIMP GetClassID(LPCLSID lpClassID) {return E_NOTIMPL;}
  664. // IPersistIDList
  665. STDMETHODIMP SetIDList(LPCITEMIDLIST pidl) {return E_NOTIMPL;}
  666. STDMETHODIMP GetIDList(LPITEMIDLIST *ppidl) { *ppidl = _GetViewPidl(); return *ppidl ? S_OK : E_FAIL;}
  667. // IServiceProvider
  668. STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void **ppv);
  669. // IDocViewSite
  670. STDMETHODIMP OnSetTitle(VARIANTARG *pvTitle);
  671. // IDVGetEnum
  672. STDMETHODIMP SetEnumReadyCallback(PFDVENUMREADYBALLBACK pfn, void *pvData);
  673. STDMETHODIMP CreateEnumIDListFromContents(LPCITEMIDLIST pidlFolder, DWORD dwEnumFlags, IEnumIDList **ppenum);
  674. // IDefViewSafety
  675. STDMETHODIMP IsSafePage();
  676. // IUICommandTarget
  677. STDMETHODIMP get_Name(REFGUID guidCanonicalName, IShellItemArray *psiItemArray, LPWSTR *ppszName);
  678. STDMETHODIMP get_Icon(REFGUID guidCanonicalName, IShellItemArray *psiItemArray, LPWSTR *ppszIcon);
  679. STDMETHODIMP get_Tooltip(REFGUID guidCanonicalName, IShellItemArray *psiItemArray, LPWSTR *ppszInfotip);
  680. STDMETHODIMP get_State(REFGUID guidCanonicalName, IShellItemArray *psiItemArray, UISTATE* puisState);
  681. STDMETHODIMP Invoke(REFGUID guidCanonicalName, IShellItemArray *psiItemArray, IBindCtx *pbc);
  682. // Helper functions for IUICommandTarget implementation:
  683. IShellItemArray *_CreateSelectionShellItemArray(void);
  684. IShellItemArray* _GetFolderAsShellItemArray();
  685. HRESULT _CheckAttribs(IShellItemArray *psiItemArray, DWORD dwAttribMask, DWORD dwAttribValue, UISTATE* puisState);
  686. HRESULT _GetFullPathNameAt(IShellItemArray *psiItemArray,DWORD dwIndex,LPOLESTR *ppszPath);
  687. static HRESULT _CanWrite(IUnknown* pv,IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  688. static HRESULT _CanRename(IUnknown* pv,IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  689. static HRESULT _CanMove(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  690. static HRESULT _CanCopy(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  691. static HRESULT _CanPublish(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  692. static HRESULT _CanShare(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  693. static HRESULT _CanEmail(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  694. static BOOL _DoesStaticMenuHaveVerb(IShellItemArray *psiItemArray, LPCWSTR pszVerb);
  695. static HRESULT _CanPrint(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  696. static HRESULT _HasPrintVerb(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  697. static HRESULT _CanDelete(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  698. BOOL _IsSystemDrive(void);
  699. static HRESULT _CanViewDrives(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  700. static HRESULT _CanHideDrives(IUnknown* pv,IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  701. static HRESULT _CanViewFolder(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  702. static HRESULT _CanHideFolder(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  703. static HRESULT _HasPreviousVersions(IUnknown* pv, IShellItemArray *psiItemArray, BOOL fOkToBeSlow, UISTATE* puisState);
  704. HRESULT _DoVerb(IShellItemArray *psiItemArray, LPCSTR pszVerbA);
  705. HRESULT _DoDropOnClsid(REFCLSID clsidDrop,IDataObject* pdo);
  706. static HRESULT _OnNewFolder(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  707. static HRESULT _OnRename(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  708. static HRESULT _OnMove(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  709. static HRESULT _OnCopy(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  710. static HRESULT _OnPublish(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  711. static HRESULT _OnShare(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  712. static HRESULT _OnEmail(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  713. static HRESULT _OnPrint(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  714. static HRESULT _OnDelete(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  715. HRESULT RemoveBarricade (void);
  716. static HRESULT _OnView(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  717. static HRESULT _OnHide(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  718. static HRESULT _OnAddRemovePrograms(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  719. static HRESULT _OnSearchFiles(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  720. const WVTASKITEM* _FindTaskItem(REFGUID guidCanonicalName);
  721. static HRESULT _OnPreviousVersions(IUnknown* pv, IShellItemArray *psiItemArray, IBindCtx *pbc);
  722. DWORD _DefaultColumnState(UINT iCol);
  723. BOOL _IsColumnHidden(UINT iCol);
  724. BOOL _IsColumnInListView(UINT iCol);
  725. BOOL _IsDetailsColumn(UINT iCol);
  726. BOOL _IsTileViewColumn(UINT iCol);
  727. HRESULT AddColumnsToMenu(HMENU hm, DWORD dwBase);
  728. UINT _RealToVisibleCol(UINT uRealCol);
  729. UINT _VisibleToRealCol(UINT uVisCol);
  730. // handle messages
  731. LRESULT _OnCreate(HWND hWnd);
  732. LRESULT _OnNotify(NMHDR *pnm);
  733. LRESULT _TBNotify(NMHDR *pnm);
  734. LRESULT _OnLVNotify(NM_LISTVIEW *plvn);
  735. LRESULT _OnBeginDrag(NM_LISTVIEW *pnm);
  736. int _FindItem(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidlFound, BOOL fSamePtr, BOOL fForwards = TRUE);
  737. int _FindItemHint(LPCITEMIDLIST pidl, int iItem);
  738. int _UpdateObject(LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew);
  739. void _AddOrUpdateItem(LPCITEMIDLIST pidlOld, LPITEMIDLIST pidlNew);
  740. int _RefreshObject(LPITEMIDLIST *ppidl);
  741. int _RemoveObject(LPCITEMIDLIST pidl, BOOL fSamePtr);
  742. BOOL _GetItemPosition(LPCITEMIDLIST pidl, POINT *ppt);
  743. BOOL _IsPositionedView();
  744. void _OnGetInfoTip(NMLVGETINFOTIP *plvn);
  745. void _OnRename(LPCITEMIDLIST* ppidl);
  746. LPITEMIDLIST _ObjectExists(LPCITEMIDLIST pidl, BOOL fGlobal);
  747. UINT _GetExplorerFlag();
  748. // private stuff
  749. void PropagateOnViewChange(DWORD dwAspect, LONG lindex);
  750. void PropagateOnClose();
  751. BOOL OnActivate(UINT uState);
  752. BOOL OnDeactivate();
  753. BOOL HasCurrentViewWindowFocus();
  754. HWND ViewWindowSetFocus();
  755. void _OnWinIniChange(WPARAM wParam, LPCTSTR pszSection);
  756. void _OnWinIniChangeDesktop(WPARAM wParam, LPCTSTR pszSection);
  757. void _SetFolderColors();
  758. DWORD _LVStyleFromView();
  759. DWORD _LVExStyleFromView();
  760. BOOL _GetColorsFromHTMLdoc(COLORREF *clrTextBk, COLORREF *clrHotlight);
  761. void _SetFocus();
  762. void _UpdateUnderlines();
  763. void _SetSysImageList();
  764. void _SetTileview();
  765. void _BestFit();
  766. UINT _ValidateViewMode(UINT uViewMode);
  767. UINT _GetDefaultViewMode();
  768. void _GetDeferredViewSettings(UINT* puViewMode);
  769. HRESULT _SelectAndPosition(int iItem, UINT uFlags, POINT *ppt);
  770. HRESULT _Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  771. inline BOOL _IsOwnerData();
  772. BOOL _IsDesktop();
  773. inline BOOL _IsCommonDialog();
  774. BOOL _IsListviewVisible();
  775. HRESULT _IncludeObject(LPCITEMIDLIST pidl);
  776. HRESULT _OnDefaultCommand();
  777. HRESULT _OnStateChange(UINT code);
  778. int _AddObject(LPITEMIDLIST pidl);
  779. void _UpdateImage(int iImage);
  780. void _DismissEdit();
  781. void _OnInitMenu();
  782. HRESULT _ForwardMenuMessages(DWORD dwID, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* plResult, BOOL* pfHandled);
  783. void _RemoveThumbviewTasks();
  784. HRESULT _AddTask(IRunnableTask *pTask, REFTASKOWNERID rTID, DWORD_PTR lParam, DWORD dwPriority, DWORD grfFlags);
  785. HRESULT _ExplorerCommand(UINT idFCIDM);
  786. LRESULT _OnMenuSelect(UINT id, UINT mf, HMENU hmenu);
  787. HRESULT _AutoAutoArrange(DWORD dwReserved);
  788. // Infotip Methods (public)
  789. //
  790. HRESULT PreCreateInfotip(HWND hwndContaining, UINT_PTR uToolID, LPRECT prectTool); // ui thread
  791. HRESULT PostCreateInfotip(HWND hwndContaining, UINT_PTR uToolID, HINSTANCE hinst, UINT_PTR uInfotipID, LPARAM lParam); // bg thread
  792. HRESULT PostCreateInfotip(HWND hwndContaining, UINT_PTR uToolID, LPCWSTR pwszInfotip, LPARAM lParam); // bg thread
  793. HRESULT CreateInfotip(HWND hwndContaining, UINT_PTR uToolID, LPRECT prectTool, HINSTANCE hinst, UINT_PTR uInfotipID, LPARAM lParam);// ui thread
  794. HRESULT CreateInfotip(HWND hwndContaining, UINT_PTR uToolID, LPRECT prectTool, LPCWSTR pwszInfotip, LPARAM lParam); // ui thread
  795. HRESULT DestroyInfotip(HWND hwndContaining, UINT_PTR uToolID); // ui thread
  796. HRESULT RepositionInfotip(HWND hwndContaining, UINT_PTR uToolID, LPRECT prectTool); // ui thread
  797. HRESULT RelayInfotipMessage(HWND hwndFrom, UINT uMsg, WPARAM wParam, LPARAM lParam); // ui thread
  798. // Menu Methods (public)
  799. //
  800. void RecreateMenus();
  801. void InitViewMenu(HMENU hmInit);
  802. // Toolbar Methods (public)
  803. //
  804. void EnableToolbarButton(UINT uiCmd, BOOL bEnable);
  805. HRESULT _GetPropertyUI(IPropertyUI **pppui);
  806. int CheckCurrentViewMenuItem(HMENU hmenu);
  807. void CheckToolbar();
  808. void OnListViewDelete(int iItem, LPITEMIDLIST pidl, BOOL fCallCB);
  809. void HandleKeyDown(LV_KEYDOWN *lpnmhdr);
  810. void AddColumns();
  811. void _ShowControl(UINT uControl, int idCmd);
  812. LRESULT _OnInitMenuPopup(HMENU hmInit, int nIndex, BOOL fSystemMenu);
  813. void _SetUpMenus(UINT uState);
  814. void SelectPendingSelectedItems();
  815. inline BOOL _ItemsDeferred();
  816. void _ClearPendingSelectedItems();
  817. void AddCopyHook();
  818. int FindCopyHook(BOOL fRemoveInvalid);
  819. void RemoveCopyHook();
  820. private:
  821. HRESULT _DoContextMenuPopup(IUnknown* punkCM, UINT fFlags, POINT pt, BOOL fListviewItem);
  822. public:
  823. void ContextMenu(DWORD dwPos);
  824. LPITEMIDLIST _GetViewPidl(); // return copy of pidl of folder we're viewing
  825. BOOL _IsViewDesktop();
  826. BOOL _GetPath(LPTSTR pszPath);
  827. HRESULT _GetNameAndFlags(UINT gdnFlags, LPTSTR psz, UINT cch, DWORD *pdwFlags);
  828. BOOL _CachedIsCustomizable();
  829. LRESULT _OnDefviewEditCommand(UINT uID);
  830. HRESULT _DoMoveOrCopyTo(REFCLSID clsid,IShellItemArray *psiItemArray);
  831. LRESULT _OnCommand(IContextMenu *pcmSel, WPARAM wParam, LPARAM lParam);
  832. BOOL _OnAppCommand(UINT cmd, UINT uDevice, DWORD dwKeys);
  833. LRESULT WndSize(HWND hWnd);
  834. void FillDone();
  835. void OnLVSelectionChange(NM_LISTVIEW *plvn);
  836. void _OnLVSelectionChange(int iItem, UINT uOldState, UINT uNewState, LPARAM lParam);
  837. HRESULT FillObjectsShowHide(BOOL fInteractive);
  838. HRESULT _GetDetailsHelper(int i, DETAILSINFO *pdi);
  839. HRESULT CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
  840. BOOL HasCB()
  841. {
  842. return _cCallback.HasCB();
  843. }
  844. HRESULT _FireEvent(DISPID dispid);
  845. void _CallRefresh(BOOL fPreRefresh);
  846. void _PostSelectionChangedMessage(UINT);
  847. void _OnSelectionChanged();
  848. void _OnDelayedSelectionChange();
  849. void _PostNoItemStateChangedMessage();
  850. void _OnNoItemStateChanged();
  851. void _PostEnumDoneMessage();
  852. void _PostFillDoneMessage();
  853. void _OnEnumDoneMessage();
  854. void _OnContentsChanged();
  855. void _OnDelayedContentsChanged();
  856. void _FixupColumnsForTileview(UINT *rguColumns, UINT cColumns);
  857. HRESULT _PeekColumnsCache(PTSTR pszPath, UINT cchPath, LPCITEMIDLIST pidl, UINT rguColumns[], UINT *pcColumns);
  858. HRESULT _GetImportantColumns(LPCITEMIDLIST pidl, UINT rguColumns[], UINT *pcColumns);
  859. void _SetImportantColumns(CBackgroundTileInfo *pDVTileInfo);
  860. void _SetView(UINT fvm);
  861. HRESULT _ReloadListviewContent();
  862. HRESULT _ReloadContent(BOOL fForce = FALSE);
  863. BOOL _IsImageMode(UINT fvm)
  864. {return (fvm == FVM_THUMBNAIL) || (fvm == FVM_THUMBSTRIP); }
  865. BOOL _IsImageMode()
  866. {return (_fs.ViewMode == FVM_THUMBNAIL) || (_fs.ViewMode == FVM_THUMBSTRIP); }
  867. BOOL _IsTileMode(UINT fvm)
  868. { return (fvm == FVM_TILE); }
  869. inline BOOL _IsTileMode()
  870. { return (_fs.ViewMode == FVM_TILE); }
  871. BOOL _IsAutoArrange()
  872. { return ((_fs.fFlags & FWF_AUTOARRANGE) || (_fs.ViewMode == FVM_THUMBSTRIP)); }
  873. HRESULT _GetWebViewMoniker(LPWSTR pszMoniker, DWORD cchMoniker);
  874. HRESULT _SwitchToWebView(BOOL bShow);
  875. HRESULT _GetDefaultWebviewContent(BOOL bForFileFolderTasks);
  876. void _FreeWebViewContentData();
  877. BOOL _QueryBarricadeState();
  878. HRESULT _TryShowWebView(UINT fvmNew, UINT fvmOld);
  879. HRESULT _TryHideWebView();
  880. HRESULT _SwitchToViewFVM(UINT fvmNew, UINT uiType = SWITCHTOVIEW_BOTH);
  881. void _ShowThemeWatermark();
  882. void _ShowLegacyWatermark();
  883. void _SetThemeWatermark();
  884. void _SetLegacyWatermark(LPCTSTR pszLegacyWatermark);
  885. void _UpdateListviewColors();
  886. LRESULT _SwitchDesktopHTML(BOOL fShow);
  887. void InitSelectionMode();
  888. void _UpdateSelectionMode();
  889. void _OnMoveWindowToTop(HWND hwnd);
  890. HWND GetChildViewWindow();
  891. BOOL _InvokeCustomization();
  892. HRESULT _OnViewWindowActive();
  893. void _UpdateRegFlags();
  894. void _DoColumnsMenu(int x, int y);
  895. BOOL _HandleColumnToggle(UINT uCol, BOOL bRefresh);
  896. void _AddColumnToListView(UINT uCol, UINT uColVis);
  897. void _SameViewMoveIcons();
  898. void _MoveSelectedItems(int dx, int dy, BOOL fAbsolute);
  899. void _AddTileColumn(UINT uCol);
  900. void _RemoveTileColumns();
  901. void _ResetTileInfo(UINT uColVis, BOOL bAdded);
  902. void _RemoveTileInfo();
  903. HRESULT _GetIPersistHistoryObject(IPersistHistory **ppph);
  904. HRESULT _GetStorageStream(DWORD grfMode, IStream* *ppIStream);
  905. HRESULT _SaveGlobalViewState(void);
  906. HRESULT _LoadGlobalViewState(IStream* *ppIStream);
  907. HRESULT _ResetGlobalViewState(void);
  908. LPCITEMIDLIST _GetPIDL(int i);
  909. LPCITEMIDLIST _GetPIDLParam(LPARAM lParam, int i);
  910. int _HitTest(const POINT *ppt, BOOL fIgnoreEdge = FALSE);
  911. void _AlterEffect(DWORD grfKeyState, DWORD *pdwEffect, UINT uFlags);
  912. BOOL _IsDropOnSource(IDropTarget *pdtgt);
  913. BOOL _IsBkDropTarget(IDropTarget *pdtgt);
  914. BOOL _GetDropPoint(POINT *ppt);
  915. BOOL _GetInsertPoint(POINT *ppt);
  916. BOOL _GetDragPoint(POINT *ppt);
  917. void _GetToolTipText(UINT_PTR id, LPTSTR pszText, UINT cchText);
  918. void _GetCBText(UINT_PTR id, UINT uMsgT, UINT uMsgA, UINT uMsgW, LPTSTR psz, UINT cch);
  919. void _GetMenuHelpText(UINT_PTR id, LPTSTR pszText, UINT cchText);
  920. void _SetItemPos(LPSFV_SETITEMPOS psip);
  921. void _FullViewUpdate(BOOL fUpdateItem);
  922. void _UpdateEnumerationFlags();
  923. void _SetItemPosition(int i, int x, int y);
  924. void _GlobeAnimation(BOOL fStartSpinning, BOOL fForceStop = FALSE);
  925. void _PaintErrMsg(HWND hWnd);
  926. void _SetPoints(UINT cidl, LPCITEMIDLIST *apidl, IDataObject *pdtobj);
  927. BOOL _GetItemSpacing(ITEMSPACING *pis);
  928. LRESULT _OnSetClipboard(BOOL bMove);
  929. LRESULT _OnClipboardChange();
  930. void _RestoreAllGhostedFileView();
  931. BOOL _ShouldShowWebView();
  932. void _ShowViewEarly();
  933. BOOL _SetupNotifyData();
  934. DWORD _GetEnumFlags();
  935. // Arrange
  936. BOOL _InitArrangeMenu(HMENU hmenuCtx);
  937. BOOL _ArrangeBy(UINT idCmd);
  938. BOOL _InitExtendedGroups(ICategoryProvider* pcp, HMENU hmenuCtx, int iIndex, int* piIdToCheck);
  939. // Grouping
  940. void _ToggleGrouping();
  941. void _GroupBy(int iColumn);
  942. BOOL _IsSlowGroup(const GUID *pguid);
  943. BOOL _CategorizeOnGUID(const GUID* pguid, const SHCOLUMNID* pscid);
  944. BOOL _CategorizeOnSCID(const SHCOLUMNID* pscid);
  945. void _OnCategoryTaskAdd();
  946. void _OnCategoryTaskDone();
  947. DWORD _GetGroupForItem(int iItem, LPCITEMIDLIST pidl);
  948. BOOL _LoadCategory(GUID *pguidGroupID);
  949. HRESULT _OnRearrange(LPARAM lParamSort, BOOL fAllowToggle);
  950. // Thumbnail Support
  951. HRESULT ExtractItem(UINT *puIndex, int iItem, LPCITEMIDLIST pidl, BOOL fBackground, BOOL fForce, DWORD dwMaxPriority);
  952. DWORD _GetOverlayMask(LPCITEMIDLIST pidl);
  953. HRESULT UpdateImageForItem(DWORD dwTaskID, HBITMAP hImage, int iItem, LPCITEMIDLIST pidl,
  954. LPCWSTR pszPath, FILETIME ftDateStamp, BOOL fCache, DWORD dwPriority);
  955. HRESULT _SafeAddImage(BOOL fQuick, IMAGECACHEINFO* prgInfo, UINT* piImageIndex, int iListID);
  956. HRESULT TaskUpdateItem(LPCITEMIDLIST pidl, int iItem, DWORD dwMask, LPCWSTR pszPath,
  957. FILETIME ftDateStamp, int iThumbnail, HBITMAP hBmp, DWORD dwItemID);
  958. void _UpdateThumbnail(int iItem, int iImage, LPCITEMIDLIST pidl);
  959. void _CleanupUpdateThumbnail(DSV_UPDATETHUMBNAIL* putn);
  960. COLORREF _GetBackColor();
  961. void _CacheDefaultThumbnail(LPCITEMIDLIST pidl, int* piIcon);
  962. HRESULT _CreateOverlayThumbnail(int iIndex, HBITMAP* phbmOverlay, HBITMAP* phbmMask);
  963. int _MapIndexPIDLToID(int iIndex, LPCITEMIDLIST pidl);
  964. int _MapIDToIndex(int iID);
  965. void _ThumbnailMapInit();
  966. void _ThumbnailMapClear();
  967. void _SetThumbview();
  968. void _ResetThumbview();
  969. void _GetThumbnailSize(SIZE *psize);
  970. HRESULT CreateDefaultThumbnail(int iIndex, HBITMAP * phBmpThumbnail, BOOL fCorner);
  971. int ViewGetIconIndex(LPCITEMIDLIST pidl);
  972. ULONG _ApproxItemsPerView();
  973. void _DoThumbnailReadAhead();
  974. HRESULT _GetDefaultTypeExtractor(LPCITEMIDLIST pidl, IExtractImage **ppExt);
  975. DWORD _Attributes(LPCITEMIDLIST pidl, DWORD dwAttribs);
  976. HRESULT _EnumThings(UINT uWhat, IEnumIDList **ppenum);
  977. void _ClearPostedMsgs(HWND hwnd);
  978. HDPA _dpaThumbnailMap;
  979. IShellImageStore* _pDiskCache;
  980. IImageCache3* _pImageCache;
  981. DWORD _dwRecClrDepth;
  982. int _iMaxCacheSize;
  983. int _iWriteTaskCount;
  984. SIZE _sizeThumbnail;
  985. HPALETTE _hpalOld;
  986. COLORREF _rgbBackColor;
  987. ULONG_PTR _tokenGdiplus;
  988. HRESULT _GetBrowserPalette(HPALETTE* phpal);
  989. LONG _cRef;
  990. CDVDropTarget _dvdt;
  991. CViewState _vs;
  992. IShellView *_psvOuter; // May be NULL
  993. IShellFolder *_pshf;
  994. IShellFolder2 *_pshf2;
  995. IShellFolder *_pshfParent;
  996. IShellFolder2 *_pshf2Parent;
  997. LPITEMIDLIST _pidlRelative;
  998. LPITEMIDLIST _pidlSelectAndPosition;
  999. UINT _uSelectAndPositionFlags;
  1000. #ifndef _X86_
  1001. // In the _X86_ case, the _psb is inside the CHijaakObjectWithSite
  1002. IShellBrowser *_psb;
  1003. #endif
  1004. ICommDlgBrowser *_pcdb; // extended ICommDlgBrowser
  1005. FOLDERSETTINGS _fs;
  1006. IContextMenu *_pcmSel; // pcm for selected objects.
  1007. IContextMenu *_pcmFile; // this is for the File menu only (you can't re-use a contextmenu once QueryContextMenu has been called)
  1008. IContextMenu *_pcmContextMenuPopup; // pcm for TrackPopupMenu usage
  1009. IShellItemArray *_pSelectionShellItemArray; // selection object for the current selection
  1010. IShellItemArray *_pFolderShellItemArray; // shellItemArray for this folder.
  1011. IShellIcon *_psi; // for getting icon fast
  1012. IShellIconOverlay *_psio; // For getting iconOverlay fast
  1013. CLSID _clsid; // the clsid of this pshf;
  1014. ICategorizer* _pcat;
  1015. HDSA _hdaCategories;
  1016. int _iLastFoundCat;
  1017. int _iIncrementCat;
  1018. HWND _hwndMain;
  1019. HWND _hwndView;
  1020. HWND _hwndListview;
  1021. HWND _hwndInfotip; // infotip control
  1022. HWND _hwndStatic;
  1023. HACCEL _hAccel;
  1024. int _fmt;
  1025. UINT _uState; // SVUIA_*
  1026. HMENU _hmenuCur;
  1027. ULONG _uRegister;
  1028. POINT _ptDrop;
  1029. POINT _ptDragAnchor; // start of the drag
  1030. int _itemCur; // The current item in the drop target
  1031. IDropTarget *_pdtgtBack; // of the background (shell folder)
  1032. IShellDetails *_psd;
  1033. UINT _cxChar;
  1034. LPCITEMIDLIST _pidlMonitor;
  1035. LONG _lFSEvents;
  1036. TBBUTTON* _pbtn;
  1037. int _cButtons; // count of buttons that are showing by default
  1038. int _cTotalButtons; // count of buttons including those hidden by default
  1039. IShellTaskScheduler2 *_pScheduler;
  1040. CDUIView *_pDUIView;
  1041. BITBOOL _fSlowGroup:1;
  1042. BITBOOL _fInBackgroundGrouping: 1;
  1043. BITBOOL _bDragSource:1;
  1044. BITBOOL _bDropAnchor:1;
  1045. BITBOOL _fUserPositionedItems:1;
  1046. BITBOOL _bHaveCutStuff:1;
  1047. BITBOOL _bClipViewer:1;
  1048. BITBOOL _fShowAllObjects:1;
  1049. BITBOOL _fInLabelEdit:1;
  1050. BITBOOL _fDisabled:1;
  1051. BITBOOL _bBkFilling:1;
  1052. BITBOOL _bContextMenuMode:1;
  1053. BITBOOL _bMouseMenu:1;
  1054. BITBOOL _fHasDeskWallPaper:1;
  1055. BITBOOL _fShowCompColor:1;
  1056. BITBOOL _bRegisteredDragDrop:1;
  1057. BITBOOL _fEnumFailed:1; // TRUE if enum failed.
  1058. BITBOOL _fGetWindowLV:1; // DVOC has grabbed the listview (it set the owner, repositioned it)
  1059. BITBOOL _fClassic:1; // SSF_WIN95CLASSIC setting/restriction
  1060. BITBOOL _fCombinedView:1; // Implies a regional listview layered on top of an extended view (the desktop with AD on)
  1061. BITBOOL _fCycleFocus:1; // 1=got callback to do CycleFocus
  1062. BITBOOL _fSelectionChangePending:1;
  1063. BITBOOL _fNoItemStateChangePending:1;
  1064. BITBOOL _fCanActivateNow:1; // FALSE from creation until we can be activated, TRUE implies we can SHDVID_CANACTIVATENOW
  1065. BITBOOL _fWin95ViewState:1; // TRUE iff Advanced option set to Win95 behavior
  1066. BITBOOL _fDesktopModal:1; // TRUE iff desktop is in modal state.
  1067. BITBOOL _fDesktopRefreshPending:1; // TRUE iff a refresh of desktop was prevented because of modal state.
  1068. BITBOOL _fRefreshBuffered:1; // TRUE iff a buffered refresh is pending!
  1069. BITBOOL _fHasListViewFocus:1;
  1070. BITBOOL _bLoadedColumns:1; // TRUE after we've loaded cols from the savestream. (after we're switched to details)
  1071. BITBOOL _fIsAsyncDefView:1; // TRUE if Defview is Asynchronous
  1072. // Combined view colors that can be specified via registry or desktop.ini
  1073. BITBOOL _bAutoSelChangeTimerSet:1; // indicates if the timer to send the sel change notification to the automation obj is set
  1074. BITBOOL _fDestroying:1; // DestroyViewWindow was called
  1075. BITBOOL _fIgnoreItemChanged: 1;
  1076. BITBOOL _fReadAhead: 1;
  1077. BITBOOL _fGroupView: 1;
  1078. BITBOOL _fActivateLV: 1; // Indicates that we have to activate the
  1079. // listview rather than defview (the webview case)
  1080. BITBOOL _fAllowSearchingWindow: 1; // use "searching" window, used for user-initiated enum (and first enum)
  1081. BITBOOL _fSyncOnFillDone: 1; // set when _vs is valid for us to re-sync position information
  1082. BITBOOL _fListViewShown: 1; // TRUE iff _hwndListview is shown
  1083. BITBOOL _fListviewRedraw: 1; // TRUE iff WM_REDRAW(FALSE) on _hwndListview, for listview hack work-around
  1084. BITBOOL _fQueryWebViewData: 1; // TRUE iff SFVM_WEBVIEW_CONTENT_DATA has been queried
  1085. BITBOOL _fGlobeCanSpin:1; // Spinning globe implies navigation, only allow it to spin when the view is first created
  1086. BITBOOL _fPositionRecycleBin:1; // TRUE iff desktop AND clean install.
  1087. BITBOOL _fScrolling:1; // We are currently scrolling
  1088. BITBOOL _fRequestedTileDuringScroll:1; // Indicates we request tile column information while scrolling
  1089. BITBOOL _fSetTileViewSortedCol:1; // Indicates we have set the tileview sorted column
  1090. BITBOOL _fBackgroundStatusTextValid:1; // Is the background statusbar text still valid.
  1091. BITBOOL _fUserRejectedWebViewTemplate:1;
  1092. DWORD _crefGlobeSpin; // so the different components that want to keep the globe spinning can reference count it
  1093. DWORD _crefSearchWindow; // so the different components that want to keep the "searching" window up can reference count it
  1094. COLORREF _crCustomColors[CRID_COLORCOUNT];
  1095. UINT _idThemeWatermark;
  1096. LPTSTR _pszLegacyWatermark;
  1097. // for single click activation
  1098. DWORD _dwSelectionMode;
  1099. HWND _hwndNextViewer;
  1100. LRESULT _iStdBMOffset;
  1101. LRESULT _iViewBMOffset;
  1102. CCallback _cCallback; // Optional client callback
  1103. HDSA _hdsaSelect; // List of items that are selected.
  1104. HDSA _hdsaSCIDCache; // Cache the SCIDs so we can map SCID to column# (tileview)
  1105. int _iLastFind;
  1106. UINT _uDefToolbar;
  1107. CSFVFrame _cFrame;
  1108. ULONG _uCachedSelAttrs;
  1109. UINT _uCachedSelCount;
  1110. UINT _uSelectionStateChanged; // selection/focus change bits for _fSelectionChangePending
  1111. UINT _uAutoSelChangeState; // selection/focus change bits for _bAutoSelChangeTimerSet
  1112. DWORD _dwConnectionCookie;
  1113. CBackgroundInfoTip * _pBackgroundInfoTip; // Used for the background InfoTip
  1114. CDefviewEnumTask * _pEnumTask;
  1115. DWORD _dwEnumId;
  1116. DWORD _dwProffered; // Cookie for the SID_SFolderView service proffered
  1117. PFDVENUMREADYBALLBACK _pfnEnumReadyCallback; // Callback indicating that our enum is done and that the client
  1118. // can now get the IEnumIDList
  1119. void * _pvEnumCallbackData;
  1120. IUIElement* _pOtherPlacesHeader;
  1121. IUIElement* _pDetailsHeader;
  1122. SFVM_WEBVIEW_LAYOUT_DATA _wvLayout; // layout can change on view mode changes
  1123. SFVM_WEBVIEW_CONTENT_DATA _wvContent; // content that is static per folder
  1124. SFVM_WEBVIEW_TASKSECTION_DATA _wvTasks; // content that can change when selection changes
  1125. SFVM_WEBVIEW_THEME_DATA _wvTheme; // HACK: theme info
  1126. BOOL _fBarrierDisplayed; // TRUE if the soft barrier is currently being displayed
  1127. BOOL _fRcvdContentsChangeBeforeDuiViewCreated;
  1128. HDPA _hdpaGroupingListActive;
  1129. HDPA _hdpaGroupingListBackup;
  1130. BOOL _fGroupingMsgInFlight;
  1131. LONG _cTasksOutstanding;
  1132. LONG _cTasksCompleted;
  1133. #ifdef DEBUG
  1134. TIMEVAR(_Update);
  1135. TIMEVAR(_Fill);
  1136. TIMEVAR(_GetIcon);
  1137. TIMEVAR(_GetName);
  1138. TIMEVAR(_FSNotify);
  1139. TIMEVAR(_AddObject);
  1140. TIMEVAR(_EnumNext);
  1141. TIMEVAR(_RestoreState);
  1142. TIMEVAR(_WMNotify);
  1143. TIMEVAR(_LVChanging);
  1144. TIMEVAR(_LVChanged);
  1145. TIMEVAR(_LVDelete);
  1146. TIMEVAR(_LVGetDispInfo);
  1147. #endif
  1148. public: // TODO: Make this protected after we have finished converting the entire file.
  1149. BOOL IsSafeToDefaultVerb(void);
  1150. HRESULT _InvokeContextMenuVerb(IContextMenu* pcm, LPCSTR pszVerb, UINT uKeyFlags, DWORD dwCMMask);
  1151. HRESULT _InvokeContextMenuVerbOnSelection(LPCSTR pszVerb, UINT uKeyFlags, DWORD dwCMMask);
  1152. HRESULT _InvokeContextMenu(IContextMenu *pcm, CMINVOKECOMMANDINFOEX *pici);
  1153. void _LogDesktopLinksAndRegitems();
  1154. void _FocusOnSomething(void);
  1155. void _UpdateIcon(LPITEMIDLIST pidl, UINT iIcon);
  1156. void _UpdateColData(CBackgroundColInfo *pbgci);
  1157. void _UpdateOverlay(int iList, int iOverlay);
  1158. HRESULT _GetIconAsync(LPCITEMIDLIST pidl, int *piIcon, BOOL fCanWait);
  1159. HRESULT _GetOverlayIndexAsync(LPCITEMIDLIST pidl, int iList);
  1160. DWORD _GetNeededSecurityAction(void);
  1161. HRESULT _ZoneCheck(DWORD dwFlags, DWORD dwAllowAction);
  1162. void _ShowAndActivate();
  1163. void _RegisterWindow();
  1164. static LRESULT CALLBACK s_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  1165. LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  1166. static DWORD WINAPI BackgroundDestroyWindow(void *pvData);
  1167. private:
  1168. ~CDefView();
  1169. // View Mode Methods (private)
  1170. //
  1171. BOOL _ViewSupported(UINT uView);
  1172. void _ThumbstripSendImagePreviewFocusChangeEvent();
  1173. // Infotip Methods (private)
  1174. //
  1175. typedef struct {
  1176. HWND hwndContaining;
  1177. UINT_PTR uToolID;
  1178. RECT rectTool;
  1179. } PENDING_INFOTIP;
  1180. CList<PENDING_INFOTIP> _tlistPendingInfotips;
  1181. HRESULT _FindPendingInfotip(HWND hwndContaining, UINT_PTR uToolID, LPRECT prectTool, BOOL bRemoveAndDestroy); // ui thread
  1182. HRESULT _OnPostCreateInfotip(TOOLINFO *pti, LPARAM lParam); // ui thread
  1183. HRESULT _OnPostCreateInfotipCleanup(TOOLINFO *pti); // ui thread or bg thread
  1184. HWND _CreateInfotipControl(HWND hwndParent);
  1185. void _InitInfotipControl(HWND hwndInfotip);
  1186. // Menu Methods (private)
  1187. //
  1188. void _InitViewMenuWhenBarrierDisplayed(HMENU hmenuView); // Initializes entire view menu (for barricaded view).
  1189. void _InitViewMenuWhenBarrierNotDisplayed(HMENU hmenuView); // Initializes entire view menu (for non-barricaded view).
  1190. void _InitViewMenuViewsWhenBarrierNotDisplayed(HMENU hmenuView);// Initializes "view" subsection of view menu (for non-barricated view).
  1191. void _MergeViewMenu(HMENU hmenuViewParent, HMENU hmenuMerge); // Merges hmenuMerge into the view menu @ FCIDM_MENU_VIEW_SEP_OPTIONS
  1192. // Toolbar Methods (private)
  1193. //
  1194. BOOL _ShouldEnableToolbarButton(UINT uiCmd, DWORD dwAttr, int iIndex);
  1195. void _EnableToolbarButton(IExplorerToolbar *piet, UINT uiCmd, BOOL bEnable);
  1196. void _EnableDisableTBButtons();
  1197. void MergeToolBar(BOOL bCanRestore);
  1198. BOOL _MergeIExplorerToolbar(UINT cExtButtons);
  1199. void _CopyDefViewButton(PTBBUTTON ptbbDest, PTBBUTTON ptbbSrc);
  1200. int _GetButtons(PTBBUTTON* ppbtn, LPINT pcButtons, LPINT pcTotalButtons);
  1201. void _SetCachedToolbarSelectionAttrs(ULONG dwAttrs);
  1202. BOOL _GetCachedToolbarSelectionAttrs(ULONG *pdwAttr);
  1203. LRESULT _OnFSNotify(LONG lNotification, LPCITEMIDLIST* ppidl);
  1204. static int CALLBACK _Compare(void *p1, void *p2, LPARAM lParam);
  1205. HRESULT _Sort(void);
  1206. UINT _GetBackgroundTaskCount(REFTASKOWNERID rtid);
  1207. void _SetSortFeedback();
  1208. BOOL GetViewState();
  1209. DWORD _AttributesFromSel(DWORD dwAttrMask);
  1210. HRESULT _GetSelectionDataObject(IDataObject **pdobjSelect);
  1211. HRESULT _GetUIObjectFromItem(REFIID riid, void **ppv, UINT uItem, BOOL fSetPoints);
  1212. HRESULT _GetItemObjects(LPCITEMIDLIST **ppidl, UINT uItem, UINT *pcItems);
  1213. UINT _GetItemArray(LPCITEMIDLIST apidl[], UINT capidl, UINT uWhat);
  1214. BOOL _AllowCommand(UINT uID);
  1215. void _DoStatusBar(BOOL fInitialize);
  1216. void _UpdateStatusBar(BOOL fInitialize);
  1217. void _ShowSearchUI(BOOL fStartSearchWindow);
  1218. HRESULT _OnStartBackgroundEnum();
  1219. HRESULT _OnStopBackgroundEnum();
  1220. HRESULT _OnBackgroundEnumDone();
  1221. LRESULT _GetDisplayInfo(LV_DISPINFO *plvdi);
  1222. UINT _GetHeaderCount();
  1223. BOOL _EnsureSCIDCache();
  1224. BOOL _MapSCIDToColumn(const SHCOLUMNID *pscid, UINT *pnColumn);
  1225. HRESULT _GetSFVMViewState(UINT uViewMode, SFVM_VIEW_DATA* pvi);
  1226. HRESULT _GetSFVMViewInfoTemplate(UINT uViewMode, SFVM_WEBVIEW_TEMPLATE_DATA* pvit);
  1227. int _CompareIDsDirection(LPARAM lParam, LPCITEMIDLIST p1, LPCITEMIDLIST p2);
  1228. HRESULT _CompareIDsFallback(LPARAM lParam, LPCITEMIDLIST p1, LPCITEMIDLIST p2);
  1229. int _FreezeRecycleBin(LPPOINT ppt);
  1230. void _SetRecycleBinInDefaultPosition(POINT *ppt);
  1231. void _ClearItemPositions();
  1232. static void CALLBACK _AsyncIconTaskCallback(LPCITEMIDLIST pidl, void *pvData, void *pvHint, INT iIconIndex, INT iOpenIconIndex);
  1233. void _SetDefaultViewSettings();
  1234. HRESULT _Create_BackgrndHMENU(BOOL fViewMenuOnly, REFIID riid, void **ppv);
  1235. HRESULT _CBackgrndMenu_CreateInstance(REFIID riid, void **ppv);
  1236. friend class CSFVSite;
  1237. friend class CSFVFrame;
  1238. friend class CBkgrndEnumTask;
  1239. friend class CViewState;
  1240. friend class CDefviewEnumTask;
  1241. friend class CCategoryTask;
  1242. IDispatch *_pauto; // folder view automation object
  1243. IAdviseSink *_padvise; // advisory connection
  1244. DWORD _advise_aspect;
  1245. DWORD _advise_advf;
  1246. // Is this folder customizable using a desktop.ini?
  1247. // In other words, is this folder in a write-able media AND either it
  1248. // not have a desktop.ini OR if it is there, it is writeable!
  1249. int _iCustomizable;
  1250. HRESULT _CreateSelectionContextMenu(REFIID riid, void** ppv);
  1251. HRESULT _DoBulkRename(LPCITEMIDLIST pidlNewName);
  1252. BOOL _bReEntrantReload;
  1253. IPropertyUI *_ppui;
  1254. };
  1255. int CALLBACK GroupCompare(int iGroup1, int iGroup2, void *pvData);
  1256. class CColumnDlg
  1257. {
  1258. public:
  1259. CColumnDlg(CDefView *pdsv);
  1260. ~CColumnDlg();
  1261. HRESULT ShowDialog(HWND hwnd);
  1262. private:
  1263. void _OnInitDlg();
  1264. BOOL _SaveState();
  1265. void _MoveItem(int iDelta);
  1266. void _UpdateDlgButtons(NMLISTVIEW *pnmlv);
  1267. UINT _HelpIDForItem(int iItem, LPTSTR pszHelpFile, UINT cch);
  1268. HRESULT _GetPropertyUI(IPropertyUI **pppui);
  1269. CDefView *_pdsv;
  1270. IPropertyUI *_ppui;
  1271. HWND _hdlg;
  1272. HWND _hwndLVAll;
  1273. UINT _cColumns;
  1274. UINT *_pdwOrder;
  1275. int *_pWidths;
  1276. BOOL _bChanged;
  1277. BOOL _bLoaded;
  1278. BOOL _bUpdating; // used to block notification processing while we're updating
  1279. static BOOL_PTR CALLBACK s_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  1280. BOOL_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
  1281. };
  1282. // Thumbnail helpers
  1283. void ListView_InvalidateImageIndexes(HWND hwndList);
  1284. #define DEFVIEW_LISTCALLBACK_FLAGS (LVIF_TEXT | LVIF_IMAGE | LVIF_GROUPID | LVIF_COLUMNS)
  1285. #define PRIORITY_NORMAL ITSAT_DEFAULT_PRIORITY
  1286. #define PRIORITY_M5 (PRIORITY_NORMAL - 5 * 0x1000)
  1287. #define PRIORITY_M4 (PRIORITY_NORMAL - 4 * 0x1000)
  1288. #define PRIORITY_M3 (PRIORITY_NORMAL - 3 * 0x1000)
  1289. #define PRIORITY_M2 (PRIORITY_NORMAL - 2 * 0x1000)
  1290. #define PRIORITY_M1 (PRIORITY_NORMAL - 1 * 0x1000)
  1291. #define PRIORITY_NORMAL ITSAT_DEFAULT_PRIORITY
  1292. #define PRIORITY_P1 (PRIORITY_NORMAL + 1 * 0x1000)
  1293. #define PRIORITY_P2 (PRIORITY_NORMAL + 2 * 0x1000)
  1294. #define PRIORITY_P3 (PRIORITY_NORMAL + 3 * 0x1000)
  1295. #define PRIORITY_P4 (PRIORITY_NORMAL + 4 * 0x1000)
  1296. #define PRIORITY_P5 (PRIORITY_NORMAL + 5 * 0x1000)
  1297. // The following should be used as returns from GetLocation
  1298. #define PRIORITY_EXTRACT_FAST PRIORITY_P1
  1299. #define PRIORITY_EXTRACT_NORMAL PRIORITY_NORMAL
  1300. #define PRIORITY_EXTRACT_SLOW PRIORITY_M1
  1301. // The following are some basis for background tasks
  1302. #define PRIORITY_IMAGEEXTRACT PRIORITY_EXTRACT_NORMAL
  1303. #define PRIORITY_READAHEAD_EXTRACT PRIORITY_M2
  1304. #define PRIORITY_READAHEAD PRIORITY_M3
  1305. #define PRIORITY_UPDATEDIR PRIORITY_M3
  1306. #define PRIORITY_CACHETIDY PRIORITY_M4
  1307. // The following are some increments used for subtasks in image extraction
  1308. // They are used to alter the priorities above as in these examples, such that
  1309. // disk cache hits are faster than extracts which are faster than cache writes:
  1310. // A fast image extract (3 tasks):
  1311. // PRIORITY_IMAGEEXTRACT + PRIORITY_DELTA_FAST - PRIORITY_DELTA_DISKCACHE == 0x10000010
  1312. // PRIORITY_IMAGEEXTRACT + PRIORITY_DELTA_FAST - PRIORITY_DELTA_EXTRACT == 0x0FFFFF10
  1313. // PRIORITY_IMAGEEXTRACT + PRIORITY_DELTA_FAST - PRIORITY_DELTA_WRITE == 0x0FFFFED0
  1314. // A slow folder extract (2 tasks):
  1315. // PRIORITY_IMAGEEXTRACT - PRIORITY_DELTA_SLOW - PRIORITY_DELTA_DISKCACHE == 0x0FFFFFB0
  1316. // PRIORITY_IMAGEEXTRACT - PRIORITY_DELTA_SLOW - PRIORITY_DELTA_EXTRACT == 0x0FFFFEB0
  1317. // Notice that tasks are done in correct priority order
  1318. #define PRIORITY_DELTA_DISKCACHE 0x00000000 // This has to be the fastest task...
  1319. #define PRIORITY_DELTA_EXTRACT 0x00000100 // We want Extract to be second for most cases
  1320. #define PRIORITY_DELTA_WRITE 0x00000140 // Write tasks should be after all but the slowest extract tasks
  1321. #define PRIORITY_DELTA_FAST 0x00000010
  1322. #define PRIORITY_DELTA_SLOW 0x00000050
  1323. // Flags for _AddTask
  1324. #define ADDTASK_ATFRONT 0x00000001
  1325. #define ADDTASK_ATEND 0x00000002
  1326. #define ADDTASK_ONLYONCE 0x00000004
  1327. //
  1328. // define MAX_ICON_WAIT to be the most (in ms) we will ever wait for a
  1329. // icon to be extracted.
  1330. // define MIN_ICON_WAIT to be amount of time that has to go by
  1331. // before we start waiting again.
  1332. #define MAX_ICON_WAIT 500
  1333. #define MIN_ICON_WAIT 2500
  1334. // PRIORITIES for tasks added to the DefView background task scheduler
  1335. #define TASK_PRIORITY_BKGRND_FILL ITSAT_DEFAULT_PRIORITY
  1336. #define TASK_PRIORITY_GET_ICON ITSAT_DEFAULT_PRIORITY
  1337. #define TASK_PRIORITY_FILE_PROPS PRIORITY_M3 // This is for TileView columns, we don't want to hold icon extraction for this.
  1338. #define TASK_PRIORITY_INFOTIP ITSAT_DEFAULT_PRIORITY
  1339. #define TASK_PRIORITY_GETSTATE PRIORITY_M5 // This is not hi-pri: figuring out the task list.
  1340. #define TASK_PRIORITY_GROUP PRIORITY_P1 // Needs to be higher than icon extraction. Happens after background fill
  1341. #define DEFVIEW_THREAD_IDLE_TIMEOUT (1000 * 60 * 2)
  1342. #define DV_IDTIMER_START_ANI 1 // start the animation (after we started bk enum)
  1343. #define DV_IDTIMER_BUFFERED_REFRESH 3
  1344. #define DV_IDTIMER_NOTIFY_AUTOMATION_SELCHANGE 4
  1345. #define DV_IDTIMER_NOTIFY_AUTOMATION_NOSELCHANGE 5
  1346. #define DV_IDTIMER_DISKCACHE 6
  1347. #define DV_IDTIMER_NOTIFY_AUTOMATION_CONTENTSCHANGED 7
  1348. #define DV_IDTIMER_SCROLL_TIMEOUT 8
  1349. #define DEFSIZE_BORDER 10
  1350. #define DEFSIZE_VERTBDR 30
  1351. #define MAX_WRITECACHE_TASKS 256
  1352. #define WM_USER_DELAY_NAVIGATION (WM_USER + 0x1BA) // random - can be moved - used by DUI and CPL
  1353. INT ScaleSizeBasedUponLocalization (INT iSize);
  1354. #endif // _DEFVIEWP_H_