1 /* 2 * ReactOS Explorer 3 * 4 * Copyright 2009 Andrew Hill <ash77@reactos.org> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 #pragma once 22 23 class CCommonBrowser : 24 public CComCoClass<CCommonBrowser, &CLSID_CCommonBrowser>, 25 public CComObjectRootEx<CComMultiThreadModelNoCS>, 26 public IShellBrowser, 27 public IBrowserService3, 28 public IServiceProvider, 29 public IOleCommandTarget, 30 public IDockingWindowSite, 31 public IDockingWindowFrame, 32 public IInputObjectSite, 33 public IDropTarget, 34 public IShellBrowserService 35 { 36 private: 37 public: 38 CCommonBrowser(); 39 ~CCommonBrowser(); 40 41 // *** IServiceProvider methods *** 42 virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); 43 44 // *** IOleCommandTarget methods *** 45 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); 46 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 47 48 // *** IBrowserService methods *** 49 virtual HRESULT STDMETHODCALLTYPE GetParentSite(IOleInPlaceSite **ppipsite); 50 virtual HRESULT STDMETHODCALLTYPE SetTitle(IShellView *psv, LPCWSTR pszName); 51 virtual HRESULT STDMETHODCALLTYPE GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName); 52 virtual HRESULT STDMETHODCALLTYPE GetOleObject(IOleObject **ppobjv); 53 virtual HRESULT STDMETHODCALLTYPE GetTravelLog(ITravelLog **pptl); 54 virtual HRESULT STDMETHODCALLTYPE ShowControlWindow(UINT id, BOOL fShow); 55 virtual HRESULT STDMETHODCALLTYPE IsControlWindowShown(UINT id, BOOL *pfShown); 56 virtual HRESULT STDMETHODCALLTYPE IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags); 57 virtual HRESULT STDMETHODCALLTYPE IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPITEMIDLIST *ppidlOut); 58 virtual HRESULT STDMETHODCALLTYPE DisplayParseError(HRESULT hres, LPCWSTR pwszPath); 59 virtual HRESULT STDMETHODCALLTYPE NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF); 60 virtual HRESULT STDMETHODCALLTYPE SetNavigateState(BNSTATE bnstate); 61 virtual HRESULT STDMETHODCALLTYPE GetNavigateState(BNSTATE *pbnstate); 62 virtual HRESULT STDMETHODCALLTYPE NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse); 63 virtual HRESULT STDMETHODCALLTYPE UpdateWindowList(); 64 virtual HRESULT STDMETHODCALLTYPE UpdateBackForwardState(); 65 virtual HRESULT STDMETHODCALLTYPE SetFlags(DWORD dwFlags, DWORD dwFlagMask); 66 virtual HRESULT STDMETHODCALLTYPE GetFlags(DWORD *pdwFlags); 67 virtual HRESULT STDMETHODCALLTYPE CanNavigateNow(); 68 virtual HRESULT STDMETHODCALLTYPE GetPidl(LPITEMIDLIST *ppidl); 69 virtual HRESULT STDMETHODCALLTYPE SetReferrer(LPCITEMIDLIST pidl); 70 virtual DWORD STDMETHODCALLTYPE GetBrowserIndex(); 71 virtual HRESULT STDMETHODCALLTYPE GetBrowserByIndex(DWORD dwID, IUnknown **ppunk); 72 virtual HRESULT STDMETHODCALLTYPE GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc); 73 virtual HRESULT STDMETHODCALLTYPE SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor); 74 virtual HRESULT STDMETHODCALLTYPE CacheOLEServer(IOleObject *pole); 75 virtual HRESULT STDMETHODCALLTYPE GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut); 76 virtual HRESULT STDMETHODCALLTYPE OnHttpEquiv(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut); 77 virtual HRESULT STDMETHODCALLTYPE GetPalette(HPALETTE *hpal); 78 virtual HRESULT STDMETHODCALLTYPE RegisterWindow(BOOL fForceRegister, int swc); 79 80 // *** IBrowserService2 methods *** 81 virtual LRESULT STDMETHODCALLTYPE WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 82 virtual HRESULT STDMETHODCALLTYPE SetAsDefFolderSettings(); 83 virtual HRESULT STDMETHODCALLTYPE GetViewRect(RECT *prc); 84 virtual HRESULT STDMETHODCALLTYPE OnSize(WPARAM wParam); 85 virtual HRESULT STDMETHODCALLTYPE OnCreate(struct tagCREATESTRUCTW *pcs); 86 virtual LRESULT STDMETHODCALLTYPE OnCommand(WPARAM wParam, LPARAM lParam); 87 virtual HRESULT STDMETHODCALLTYPE OnDestroy(); 88 virtual LRESULT STDMETHODCALLTYPE OnNotify(struct tagNMHDR *pnm); 89 virtual HRESULT STDMETHODCALLTYPE OnSetFocus(); 90 virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivateBS(BOOL fActive); 91 virtual HRESULT STDMETHODCALLTYPE ReleaseShellView(); 92 virtual HRESULT STDMETHODCALLTYPE ActivatePendingView(); 93 virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd); 94 virtual HRESULT STDMETHODCALLTYPE CreateBrowserPropSheetExt(REFIID riid, void **ppv); 95 virtual HRESULT STDMETHODCALLTYPE GetViewWindow(HWND *phwndView); 96 virtual HRESULT STDMETHODCALLTYPE GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd); 97 virtual LPBASEBROWSERDATA STDMETHODCALLTYPE PutBaseBrowserData(); 98 virtual HRESULT STDMETHODCALLTYPE InitializeTravelLog(ITravelLog *ptl, DWORD dw); 99 virtual HRESULT STDMETHODCALLTYPE SetTopBrowser(); 100 virtual HRESULT STDMETHODCALLTYPE Offline(int iCmd); 101 virtual HRESULT STDMETHODCALLTYPE AllowViewResize(BOOL f); 102 virtual HRESULT STDMETHODCALLTYPE SetActivateState(UINT u); 103 virtual HRESULT STDMETHODCALLTYPE UpdateSecureLockIcon(int eSecureLock); 104 virtual HRESULT STDMETHODCALLTYPE InitializeDownloadManager(); 105 virtual HRESULT STDMETHODCALLTYPE InitializeTransitionSite(); 106 virtual HRESULT STDMETHODCALLTYPE _Initialize(HWND hwnd, IUnknown *pauto); 107 virtual HRESULT STDMETHODCALLTYPE _CancelPendingNavigationAsync(); 108 virtual HRESULT STDMETHODCALLTYPE _CancelPendingView(); 109 virtual HRESULT STDMETHODCALLTYPE _MaySaveChanges(); 110 virtual HRESULT STDMETHODCALLTYPE _PauseOrResumeView(BOOL fPaused); 111 virtual HRESULT STDMETHODCALLTYPE _DisableModeless(); 112 virtual HRESULT STDMETHODCALLTYPE _NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags); 113 virtual HRESULT STDMETHODCALLTYPE _TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew); 114 virtual HRESULT STDMETHODCALLTYPE _SwitchActivationNow(); 115 virtual HRESULT STDMETHODCALLTYPE _ExecChildren(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut); 116 virtual HRESULT STDMETHODCALLTYPE _SendChildren(HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam); 117 virtual HRESULT STDMETHODCALLTYPE GetFolderSetData(struct tagFolderSetData *pfsd); 118 virtual HRESULT STDMETHODCALLTYPE _OnFocusChange(UINT itb); 119 virtual HRESULT STDMETHODCALLTYPE v_ShowHideChildWindows(BOOL fChildOnly); 120 virtual UINT STDMETHODCALLTYPE _get_itbLastFocus(); 121 virtual HRESULT STDMETHODCALLTYPE _put_itbLastFocus(UINT itbLastFocus); 122 virtual HRESULT STDMETHODCALLTYPE _UIActivateView(UINT uState); 123 virtual HRESULT STDMETHODCALLTYPE _GetViewBorderRect(RECT *prc); 124 virtual HRESULT STDMETHODCALLTYPE _UpdateViewRectSize(); 125 virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorder(UINT itb); 126 virtual HRESULT STDMETHODCALLTYPE _ResizeView(); 127 virtual HRESULT STDMETHODCALLTYPE _GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon); 128 virtual IStream *STDMETHODCALLTYPE v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName); 129 virtual LRESULT STDMETHODCALLTYPE ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); 130 virtual HRESULT STDMETHODCALLTYPE SetAcceleratorMenu(HACCEL hacc); 131 virtual int STDMETHODCALLTYPE _GetToolbarCount(); 132 virtual LPTOOLBARITEM STDMETHODCALLTYPE _GetToolbarItem(int itb); 133 virtual HRESULT STDMETHODCALLTYPE _SaveToolbars(IStream *pstm); 134 virtual HRESULT STDMETHODCALLTYPE _LoadToolbars(IStream *pstm); 135 virtual HRESULT STDMETHODCALLTYPE _CloseAndReleaseToolbars(BOOL fClose); 136 virtual HRESULT STDMETHODCALLTYPE v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd); 137 virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor); 138 virtual UINT STDMETHODCALLTYPE _FindTBar(IUnknown *punkSrc); 139 virtual HRESULT STDMETHODCALLTYPE _SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg); 140 virtual HRESULT STDMETHODCALLTYPE v_MayTranslateAccelerator(MSG *pmsg); 141 virtual HRESULT STDMETHODCALLTYPE _GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor); 142 virtual HRESULT STDMETHODCALLTYPE v_CheckZoneCrossing(LPCITEMIDLIST pidl); 143 144 // *** IBrowserService3 methods *** 145 virtual HRESULT STDMETHODCALLTYPE _PositionViewWindow(HWND, RECT *); 146 virtual HRESULT STDMETHODCALLTYPE IEParseDisplayNameEx(UINT, PCWSTR, DWORD, LPITEMIDLIST *); 147 148 // *** IShellBrowser methods *** 149 virtual HRESULT STDMETHODCALLTYPE InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths); 150 virtual HRESULT STDMETHODCALLTYPE SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject); 151 virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB(HMENU hmenuShared); 152 virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText); 153 virtual HRESULT STDMETHODCALLTYPE EnableModelessSB(BOOL fEnable); 154 virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB(MSG *pmsg, WORD wID); 155 virtual HRESULT STDMETHODCALLTYPE BrowseObject(LPCITEMIDLIST pidl, UINT wFlags); 156 virtual HRESULT STDMETHODCALLTYPE GetViewStateStream(DWORD grfMode, IStream **ppStrm); 157 virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd); 158 virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret); 159 virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(struct IShellView **ppshv); 160 virtual HRESULT STDMETHODCALLTYPE OnViewWindowActive(struct IShellView *ppshv); 161 virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags); 162 163 // *** IShellBowserService methods *** 164 virtual HRESULT STDMETHODCALLTYPE GetPropertyBag(long flags, REFIID riid, void **ppvObject); 165 166 // *** IOleWindow methods *** 167 virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); 168 virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); 169 170 // *** IDockingWindowSite methods *** 171 virtual HRESULT STDMETHODCALLTYPE GetBorderDW(IUnknown* punkObj, LPRECT prcBorder); 172 virtual HRESULT STDMETHODCALLTYPE RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw); 173 virtual HRESULT STDMETHODCALLTYPE SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw); 174 175 // *** IDockingWindowFrame methods *** 176 virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags); 177 virtual HRESULT STDMETHODCALLTYPE RemoveToolbar(IUnknown *punkSrc, DWORD dwRemoveFlags); 178 virtual HRESULT STDMETHODCALLTYPE FindToolbar(LPCWSTR pwszItem, REFIID riid, void **ppv); 179 180 // *** IInputObjectSite specific methods *** 181 virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus); 182 183 // *** IDropTarget methods *** 184 virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); 185 virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); 186 virtual HRESULT STDMETHODCALLTYPE DragLeave(); 187 virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); 188 189 DECLARE_REGISTRY_RESOURCEID(IDR_COMMONBROWSER) 190 DECLARE_NOT_AGGREGATABLE(CCommonBrowser) 191 192 DECLARE_PROTECT_FINAL_CONSTRUCT() 193 194 BEGIN_COM_MAP(CCommonBrowser) 195 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) 196 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 197 COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService) 198 COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2) 199 COM_INTERFACE_ENTRY_IID(IID_IBrowserService3, IBrowserService3) 200 COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser) 201 COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService) 202 COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite) 203 COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite) 204 COM_INTERFACE_ENTRY_IID(IID_IDockingWindowFrame, IDockingWindowFrame) 205 COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) 206 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) 207 END_COM_MAP() 208 }; 209