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.

296 lines
14 KiB

  1. #ifndef COMMONSB_INC_
  2. #define COMMONSB_INC_
  3. #include "caggunk.h"
  4. #include "fldset.h"
  5. #define ITB_ITBAR 0 // index to the Internet Toolbar
  6. typedef struct _ZONESICONNAMECACHE // Cache for zones icons and display names
  7. {
  8. HICON hiconZones;
  9. WCHAR szZonesName[MAX_ZONE_DESCRIPTION];
  10. WCHAR szIconPath[MAX_ZONE_PATH]; // we'll initially load the path, then cache the icon on demand
  11. } ZONEICONNAMECACHE, *PZONEICONNAMECACHE;
  12. class CCommonBrowser :
  13. public CAggregatedUnknown
  14. ,public IShellBrowser
  15. ,public IBrowserService3
  16. ,public IServiceProvider
  17. ,public IOleCommandTarget
  18. ,public IDockingWindowSite
  19. ,public IDockingWindowFrame
  20. ,public IInputObjectSite
  21. ,public IDropTarget
  22. ,public IShellBrowserService
  23. {
  24. public:
  25. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj) {return CAggregatedUnknown::QueryInterface(riid, ppvObj);};
  26. virtual STDMETHODIMP_(ULONG) AddRef(void) { return CAggregatedUnknown::AddRef();};
  27. virtual STDMETHODIMP_(ULONG) Release(void) { return CAggregatedUnknown::Release();};
  28. // *** IBrowserService specific methods ***
  29. virtual STDMETHODIMP GetParentSite( IOleInPlaceSite** ppipsite) ;
  30. virtual STDMETHODIMP SetTitle( IShellView* psv, LPCWSTR pszName) ;
  31. virtual STDMETHODIMP GetTitle( IShellView* psv, LPWSTR pszName, DWORD cchName) ;
  32. virtual STDMETHODIMP GetOleObject( IOleObject** ppobjv) ;
  33. // think about this one.. I'm not sure we want to expose this -- Chee
  34. // Yep soon we should have interface instead.
  35. // My impression is that we won't document this whole interface???
  36. // I am sure this has shipped at least once, looks like it is here to stay - justmann 2000-01-27
  37. virtual STDMETHODIMP GetTravelLog( ITravelLog** pptl) ;
  38. virtual STDMETHODIMP ShowControlWindow( UINT id, BOOL fShow) ;
  39. virtual STDMETHODIMP IsControlWindowShown( UINT id, BOOL *pfShown) ;
  40. virtual STDMETHODIMP IEGetDisplayName( LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags) ;
  41. virtual STDMETHODIMP IEParseDisplayName( UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST * ppidlOut) ;
  42. virtual STDMETHODIMP DisplayParseError( HRESULT hres, LPCWSTR pwszPath) ;
  43. virtual STDMETHODIMP NavigateToPidl( LPCITEMIDLIST pidl, DWORD grfHLNF) ;
  44. virtual STDMETHODIMP SetNavigateState( BNSTATE bnstate) ;
  45. virtual STDMETHODIMP GetNavigateState ( BNSTATE *pbnstate) ;
  46. virtual STDMETHODIMP NotifyRedirect ( IShellView* psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse) ;
  47. virtual STDMETHODIMP UpdateWindowList () ;
  48. virtual STDMETHODIMP UpdateBackForwardState () ;
  49. virtual STDMETHODIMP SetFlags( DWORD dwFlags, DWORD dwFlagMask) ;
  50. virtual STDMETHODIMP GetFlags( DWORD *pdwFlags) ;
  51. // Tells if it can navigate now or not.
  52. virtual STDMETHODIMP CanNavigateNow () ;
  53. virtual STDMETHODIMP GetPidl ( LPITEMIDLIST *ppidl) ;
  54. virtual STDMETHODIMP SetReferrer ( LPITEMIDLIST pidl) ;
  55. virtual STDMETHODIMP_(DWORD) GetBrowserIndex() ;
  56. virtual STDMETHODIMP GetBrowserByIndex( DWORD dwID, IUnknown **ppunk) ;
  57. virtual STDMETHODIMP GetHistoryObject( IOleObject **ppole, IStream **pstm, IBindCtx **ppbc) ;
  58. virtual STDMETHODIMP SetHistoryObject( IOleObject *pole, BOOL fIsLocalAnchor) ;
  59. virtual STDMETHODIMP CacheOLEServer( IOleObject *pole) ;
  60. virtual STDMETHODIMP GetSetCodePage( VARIANT* pvarIn, VARIANT* pvarOut) ;
  61. virtual STDMETHODIMP OnHttpEquiv( IShellView* psv, BOOL fDone, VARIANT* pvarargIn, VARIANT* pvarargOut) ;
  62. virtual STDMETHODIMP GetPalette( HPALETTE * hpal ) ;
  63. virtual STDMETHODIMP RegisterWindow( BOOL fUnregister, int swc) ;
  64. virtual STDMETHODIMP_(LRESULT) WndProcBS( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) ;
  65. virtual STDMETHODIMP OnSize(WPARAM wParam);
  66. virtual STDMETHODIMP OnCreate(LPCREATESTRUCT pcs);
  67. virtual STDMETHODIMP_(LRESULT) OnCommand(WPARAM wParam, LPARAM lParam);
  68. virtual STDMETHODIMP OnDestroy();
  69. virtual STDMETHODIMP_(LRESULT) OnNotify(NMHDR * pnm);
  70. virtual STDMETHODIMP OnSetFocus();
  71. virtual STDMETHODIMP OnFrameWindowActivateBS(BOOL fActive);
  72. virtual STDMETHODIMP ReleaseShellView( ) ;
  73. virtual STDMETHODIMP ActivatePendingView( ) ;
  74. virtual STDMETHODIMP CreateViewWindow(IShellView* psvNew, IShellView* psvOld, LPRECT prcView, HWND* phwnd);
  75. virtual STDMETHODIMP GetBaseBrowserData( LPCBASEBROWSERDATA* ppbd );
  76. virtual STDMETHODIMP_(LPBASEBROWSERDATA) PutBaseBrowserData();
  77. virtual STDMETHODIMP SetTopBrowser();
  78. virtual STDMETHODIMP UpdateSecureLockIcon(int eSecureLock);
  79. virtual STDMETHODIMP Offline(int iCmd);
  80. virtual STDMETHODIMP InitializeDownloadManager();
  81. virtual STDMETHODIMP InitializeTransitionSite();
  82. virtual STDMETHODIMP GetFolderSetData(struct tagFolderSetData* pfsd) { *pfsd = _fsd; return S_OK; };
  83. virtual STDMETHODIMP CreateBrowserPropSheetExt(REFIID, LPVOID *);
  84. virtual STDMETHODIMP SetActivateState(UINT uActivate);
  85. virtual STDMETHODIMP AllowViewResize(BOOL f);
  86. virtual STDMETHODIMP _Initialize(HWND hwnd, IUnknown *pauto);
  87. // Temporarily in interface, needs to be brought local
  88. virtual STDMETHODIMP_(UINT) _get_itbLastFocus() {return _itbLastFocus; };
  89. virtual STDMETHODIMP _put_itbLastFocus(UINT itbLastFocus) {_itbLastFocus = itbLastFocus; return S_OK;};
  90. virtual STDMETHODIMP _UIActivateView(UINT uState) ;
  91. // BEGIN REVIEW: review names and need of each.
  92. //
  93. // this first set could be basebrowser only members. no one overrides
  94. virtual STDMETHODIMP _CancelPendingNavigationAsync() ;
  95. virtual STDMETHODIMP _MaySaveChanges() ;
  96. virtual STDMETHODIMP _PauseOrResumeView( BOOL fPaused) ;
  97. virtual STDMETHODIMP _DisableModeless() ;
  98. // rethink these... are all of these necessary?
  99. virtual STDMETHODIMP _NavigateToPidl( LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags);
  100. virtual STDMETHODIMP _TryShell2Rename( IShellView* psv, LPCITEMIDLIST pidlNew);
  101. virtual STDMETHODIMP _SwitchActivationNow( );
  102. virtual STDMETHODIMP _CancelPendingView() ;
  103. virtual STDMETHODIMP v_MayTranslateAccelerator( MSG* pmsg);
  104. virtual STDMETHODIMP _CycleFocus( LPMSG lpMsg) ;
  105. virtual STDMETHODIMP v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM * pptbi, HWND * phwnd);
  106. virtual STDMETHODIMP _SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg);
  107. virtual STDMETHODIMP_(BOOL) _HasToolbarFocus(void) ;
  108. virtual STDMETHODIMP _FixToolbarFocus(void) ;
  109. // this belongs with the toolbar set.
  110. virtual STDMETHODIMP _ExecChildren(IUnknown *punkBar, BOOL fBroadcast,
  111. const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt,
  112. VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  113. virtual STDMETHODIMP _SendChildren(HWND hwndBar, BOOL fBroadcast,
  114. UINT uMsg, WPARAM wParam, LPARAM lParam);
  115. virtual STDMETHODIMP _GetViewBorderRect(RECT* prc);
  116. virtual STDMETHODIMP _UpdateViewRectSize();
  117. virtual STDMETHODIMP _ResizeNextBorder(UINT itb);
  118. virtual STDMETHODIMP _ResizeView();
  119. virtual STDMETHODIMP _GetBorderDWHelper(IUnknown* punkSrc, LPRECT prcBorder, BOOL bUseHmonitor);
  120. virtual STDMETHODIMP _GetEffectiveClientArea(LPRECT prcBorder, HMONITOR hmon);
  121. virtual STDMETHODIMP _PositionViewWindow(HWND hwnd, LPRECT prc);
  122. //END REVIEW:
  123. // for CShellBrowser split
  124. virtual STDMETHODIMP SetAsDefFolderSettings();
  125. virtual STDMETHODIMP GetViewRect(RECT* prc);
  126. virtual STDMETHODIMP GetViewWindow(HWND * phwndView);
  127. virtual STDMETHODIMP InitializeTravelLog(ITravelLog* ptl, DWORD dw);
  128. // Desktop needs to override these:
  129. virtual STDMETHODIMP_(IStream*) v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName);
  130. // Desktop needs access to these:
  131. virtual STDMETHODIMP_(LRESULT) ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
  132. virtual STDMETHODIMP SetAcceleratorMenu(HACCEL hacc);
  133. // Shell browser overrides this.
  134. virtual STDMETHODIMP v_CheckZoneCrossing(LPCITEMIDLIST pidl) {return S_OK;};
  135. // *** IDropTarget (delegate to basesb) ***
  136. virtual STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  137. virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  138. virtual STDMETHODIMP DragLeave(void);
  139. virtual STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  140. // IOleWindow
  141. virtual STDMETHODIMP GetWindow(HWND * lphwnd);
  142. virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  143. // IShellBrowser (same as IOleInPlaceFrame)
  144. virtual STDMETHODIMP InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  145. virtual STDMETHODIMP SetMenuSB(HMENU hmenuShared, HOLEMENU holemenu, HWND hwnd);
  146. virtual STDMETHODIMP RemoveMenusSB(HMENU hmenuShared);
  147. virtual STDMETHODIMP SetStatusTextSB(LPCOLESTR lpszStatusText);
  148. virtual STDMETHODIMP EnableModelessSB(BOOL fEnable);
  149. virtual STDMETHODIMP TranslateAcceleratorSB(LPMSG lpmsg, WORD wID);
  150. virtual STDMETHODIMP BrowseObject(LPCITEMIDLIST pidl, UINT wFlags);
  151. virtual STDMETHODIMP GetViewStateStream(DWORD grfMode, LPSTREAM *ppStrm);
  152. virtual STDMETHODIMP GetControlWindow(UINT id, HWND * lphwnd);
  153. virtual STDMETHODIMP SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret);
  154. virtual STDMETHODIMP QueryActiveShellView(struct IShellView ** ppshv);
  155. virtual STDMETHODIMP OnViewWindowActive(struct IShellView * ppshv);
  156. virtual STDMETHODIMP SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags);
  157. // IServiceProvider
  158. virtual STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, LPVOID* ppvObj);
  159. // IOleCommandTarget
  160. virtual STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  161. virtual STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  162. // IDockingWindowFrame (also IOleWindow(?))
  163. virtual STDMETHODIMP AddToolbar(IUnknown* punkSrc, LPCWSTR pwszItem, DWORD dwReserved);
  164. virtual STDMETHODIMP RemoveToolbar(IUnknown* punkSrc, DWORD dwFlags);
  165. virtual STDMETHODIMP FindToolbar(LPCWSTR pwszItem, REFIID riid, LPVOID* ppvObj);
  166. // IDockingWindowSite (also IOleWindow(?))
  167. virtual STDMETHODIMP GetBorderDW(IUnknown* punkSrc, LPRECT prcBorder);
  168. virtual STDMETHODIMP RequestBorderSpaceDW(IUnknown* punkSrc, LPCBORDERWIDTHS pbw);
  169. virtual STDMETHODIMP SetBorderSpaceDW(IUnknown* punkSrc, LPCBORDERWIDTHS pbw);
  170. // IInputObjectSite
  171. virtual STDMETHODIMP OnFocusChangeIS(IUnknown* punkSrc, BOOL fSetFocus);
  172. //IShellBrowserService
  173. virtual STDMETHODIMP GetPropertyBag(DWORD dwFlags, REFIID riid, void** ppv) {return E_FAIL;}
  174. // This is the QueryInterface the aggregator implements
  175. virtual HRESULT v_InternalQueryInterface(REFIID riid, LPVOID * ppvObj);
  176. protected:
  177. CCommonBrowser(IUnknown* punkAgg);
  178. virtual ~CCommonBrowser();
  179. friend HRESULT CCommonBrowser_CreateInstance(IUnknown* pUnkOuter, IUnknown** ppunk, LPCOBJECTINFO poi);
  180. //
  181. // Notes:
  182. // The values in the _arcBorderTools array indicates the size of
  183. // the border space taken by each toolbar on each side of the
  184. // containing rectangle.
  185. //
  186. virtual STDMETHODIMP_(LPTOOLBARITEM) _GetToolbarItem(int itb);
  187. virtual STDMETHODIMP_(int) _GetToolbarCount() { return FDSA_GetItemCount(&_fdsaTBar); }
  188. virtual STDMETHODIMP_(int) _AllocToolbarItem();
  189. void _ReleaseToolbarItem(int itb, BOOL fClose);
  190. // Helper function for toolbar negotiation
  191. virtual STDMETHODIMP_(UINT) _FindTBar(IUnknown* punkSrc);
  192. virtual STDMETHODIMP _OnFocusChange(UINT itb);
  193. virtual STDMETHODIMP _CloseAndReleaseToolbars(BOOL fClose = TRUE);
  194. virtual STDMETHODIMP v_ShowHideChildWindows(BOOL fChildOnly);
  195. virtual STDMETHODIMP ShowToolbar(IUnknown* punkSrc, BOOL fShow) ;
  196. virtual STDMETHODIMP _SaveToolbars(IStream* pstm);
  197. virtual STDMETHODIMP _LoadToolbars(IStream* pstm);
  198. BOOL _TBWindowHasFocus(UINT itb);
  199. BOOL _ShouldTranslateAccelerator(MSG* pmsg);
  200. DWORD _CacheZonesIconsAndNames(BOOL fRefresh);
  201. BOOL _GetCachedZoneIconAndName(DWORD lZone, HICON *pIcon, LPTSTR pszName, DWORD cch);
  202. IInternetZoneManager * _pizm;
  203. virtual STDMETHODIMP _ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor);
  204. virtual BOOL _CanHandleAcceleratorNow(void) {return TRUE;}
  205. FDSA _fdsaTBar;
  206. TOOLBARITEM _aTBar[ITB_CSTATIC];
  207. UINT _itbLastFocus; // last one called OnFocusChange (can be -1)
  208. HRESULT _FindActiveTarget(REFIID riid, LPVOID* ppvOut);
  209. IUnknown* _punkInner;
  210. // implementations in basesb
  211. IBrowserService2* _pbsInner;
  212. IBrowserService3* _pbsInner3;
  213. IShellBrowser* _psbInner;
  214. IDropTarget* _pdtInner; // TODO: non-cached?
  215. IServiceProvider* _pspInner;
  216. IOleCommandTarget* _pctInner;
  217. IInputObjectSite* _piosInner;
  218. // desktop overrides some of these methods
  219. IBrowserService2* _pbsOuter;
  220. IBrowserService2* _pbsOuter3;
  221. LPCBASEBROWSERDATA _pbbd;
  222. HACCEL _hacc;
  223. // for view set information
  224. struct tagFolderSetData _fsd;
  225. virtual HRESULT SetInner(IUnknown* punk);
  226. };
  227. HRESULT _ConvertPathToPidl(IBrowserService2* pbs, HWND hwnd, LPCTSTR pszPath, LPITEMIDLIST * ppidl);
  228. #endif // COMMONSB_INC_