// wvcoord.h : Declaration of the CWebViewCoord #ifndef __WEBVIEWCOORD_H_ #define __WEBVIEWCOORD_H_ #include "dxmplay.h" #include "resource.h" // main symbols #include "evtsink.h" #include "mshtml.h" #include "mshtmdid.h" EXTERN_C const CLSID CLSID_WebViewOld; // retired from service extern HRESULT FindObjectStyle(IUnknown *punkObject, CComPtr& spStyle); extern BOOL IsRTLDocument(CComPtr& spHTMLElement); class CThumbNailWrapper; class CFileListWrapper; ///////////////////////////////////////////////////////////////////////////// // CWebViewCoord class ATL_NO_VTABLE CWebViewCoord : public CComObjectRootEx, public CComCoClass, public IDispatchImpl, public IObjectSafetyImpl, public IObjectWithSiteImpl { public: CWebViewCoord(); ~CWebViewCoord(); DECLARE_REGISTRY_RESOURCEID(IDR_WEBVIEWCOORD) BEGIN_COM_MAP(CWebViewCoord) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(IWebView) COM_INTERFACE_ENTRY(IObjectSafety) COM_INTERFACE_ENTRY_IMPL(IObjectWithSite) END_COM_MAP() // IObjectWithSite overrides STDMETHOD(SetSite)(IUnknown *pClientSite); private: // // Initialization helpers (including event sinks) // HRESULT InitFolderObjects(VOID); // // CDispatchEventSink overrides // STDMETHOD(Invoke)(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr); // IWebView methods STDMETHOD(OnCSCClick)(); STDMETHOD(CSCSynchronize)(); STDMETHOD(OnCSCMouseOver)(); STDMETHOD(OnCSCMouseOut)(); // // Event handlers // STDMETHOD(OnWindowLoad)(VOID); STDMETHOD(OnWindowUnLoad)(VOID); STDMETHOD(OnFixSize)(VOID); private: HRESULT ReleaseFolderObjects(VOID); // // Objects in web view // CFileListWrapper *m_pFileListWrapper; CThumbNailWrapper *m_pThumbNailWrapper; // // Host HTML window Dispatch // IDispatch * m_pdispWindow; // // Some frequently used interfaces // CComPtr m_spDocument; CComPtr m_spDocAll; CComPtr m_spDocBody; CComPtr m_spFileListStyle; CComPtr m_spPanelStyle; CComPtr m_spRuleStyle; CComPtr m_spHeadingStyle; CComPtr m_spHeading; CComPtr m_spClientSite; // // Event sink advise cookies // DWORD m_dwFileListAdviseCookie; DWORD m_dwThumbNailAdviseCookie; DWORD m_dwHtmlWindowAdviseCookie; DWORD m_dwCSCHotTrackCookie; BOOL m_bRTLDocument; }; ///////////////////////////////////////////////////////////////////////////// // CThumbNailWrapper class CThumbNailWrapper : public CDispatchEventSink { public: CThumbNailWrapper(); ~CThumbNailWrapper(); // // Initialization // HRESULT Init(CComPtr spThumbNailCtl, CComPtr spThumbnailLabel); // // CDispatchEventSink overrides // STDMETHOD(Invoke)(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr); // // Event Handlers // HRESULT OnThumbNailReady(VOID); // // Cover for properties // HRESULT UsedSpace(CComBSTR &bstrUsed); HRESULT TotalSpace(CComBSTR &bstrTotal); HRESULT FreeSpace(CComBSTR &bstrFree); CComPtr Control(VOID) {return m_spThumbNailCtl;}; // // Methods // BOOL UpdateThumbNail(CComPtr spFolderItems); HRESULT SetDisplay(CComBSTR &bstrDisplay); HRESULT SetHeight(int iHeight); HRESULT ClearThumbNail(); private: HRESULT _SetThumbnailLabel(CComBSTR& bstrLabel); // Pointer to the control + style CComPtr m_spThumbNailCtl; CComPtr m_spThumbnailLabel; CComPtr m_spThumbNailStyle; }; ///////////////////////////////////////////////////////////////////////////// // CFileListWrapper class CFileListWrapper : public CDispatchEventSink { public: CFileListWrapper(); ~CFileListWrapper(); // Initialization HRESULT Init(CComPtr spFileList, CComPtr spInfo, CComPtr spLinks, CComPtr spPanelStyle, CComPtr spMediaPlayerSpan, CComPtr spCSCPlusMin, CComPtr spCSCText, CComPtr spCSCDetail, CComPtr spCSCButton, CComPtr spCSCStyle, CComPtr spCSCDetailStyle, CComPtr spCSCButtonStyle, CComPtr spDocument, CComPtr spWindow, CThumbNailWrapper *pThumbNailWrapper); // CDispatchEventSink overrides STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); // Event Handlers HRESULT OnSelectionChanged(VOID); // Cover function for properties CComPtr Control(VOID) {return m_spFileList;}; HRESULT SetDefaultPanelDisplay(); HRESULT OnCSCClick(); HRESULT CSCSynchronize(); HRESULT OnCSCMouseOnOff(BOOL fOn); // Needs to be called by WVCoord, so public HRESULT AdviseWebviewLinks( BOOL fAdvise ); private: // // Object pointers // CComPtr m_spFileList; CComPtr m_spInfo; CComPtr m_spLinks; CComPtr m_spPanelStyle; CComPtr m_spIMediaPlayer; CComPtr m_spMediaPlayerSpan; CComPtr m_spMediaPlayerStyle; CComPtr m_spCSCPlusMin; CComPtr m_spCSCText; CComPtr m_spCSCDetail; CComPtr m_spCSCButton; CComPtr m_spCSCStyle; CComPtr m_spCSCDetailStyle; CComPtr m_spCSCButtonStyle; CComPtr m_spDocument; CComPtr m_spWindow; CThumbNailWrapper *m_pThumbNailWrapper; CComPtr m_spFolder2; CComPtr m_spFolderItem; CComPtr m_spFolderItem2; CComPtr m_spFolderItems; CComBSTR m_bstrInfoHTML; CComBSTR m_bstrCrossLinksHTML; BOOL m_bFoundAuthor; BOOL m_bFoundComment; BOOL m_bCSCDisplayed; BOOL m_bNeverGotPanelInfo; BOOL m_bExpanded; BOOL m_bHotTracked; DWORD m_dwDateFlags; BOOL m_bRTLDocument; BOOL m_bPathIsSlow; // // Helper functions // HRESULT ClearThumbNail(); HRESULT StopMediaPlayer(); HRESULT ClearMediaPlayer(); HRESULT NoneSelected(); HRESULT MultipleSelected(long cSelection); HRESULT OneSelected(); HRESULT GetItemNameForDisplay(); HRESULT GetItemType(); HRESULT GetItemDateTime(); HRESULT GetItemSize(); HRESULT GetItemAttributes(); HRESULT GetItemAuthor(); HRESULT GetItemComment(); HRESULT GetItemHTMLInfoTip(); HRESULT GetOtherItemDetails(); HRESULT GetItemInfoTip(); HRESULT DealWithDriveInfo(); HRESULT GetCrossLink(int nFolder, UINT uIDToolTip); HRESULT GetCrossLinks(); HRESULT FormatCrossLink(LPCWSTR pwszDisplayName, LPCWSTR pwszUrlPath, UINT uIDToolTip); HRESULT DisplayInfoHTML(); HRESULT DisplayCrossLinksHTML(); HRESULT GetItemInfo(long lResId, LPWSTR wszInfoDescCanonical, CComBSTR& bstrInfoDesc, CComBSTR& bstrInfo); HRESULT IsItThisFolder(int nFolder, BOOL& bResult, LPWSTR pwszDisplayName, DWORD cchDisplayName, LPWSTR pwszPath, DWORD cchPath); HRESULT GetIMediaPlayer(CComPtr& spIMediaPlayer); // CSC functions HRESULT CSCGetStatusText(LONG lStatus, CComBSTR& bstrCSCText); HRESULT CSCGetStatusDetail(LONG lStatus, CComBSTR& bstrCSCDetail); HRESULT CSCGetStatusButton(LONG lStatus, CComBSTR& bstrCSCButton); HRESULT GetCSCFolderStatus(LONG* plStatus); HRESULT CSCShowStatusInfo(); HRESULT CSCShowStatus_FoldExpand_Toggle(); // Event handlers for setting status bar text HRESULT OnWebviewLinkEvent( BOOL fEnter ); HRESULT GetEventAnchorElement(IHTMLEventObj *pEvent, IHTMLElement **ppElt); HRESULT GetWVLinksCollection( IHTMLElementCollection **ppCollection, long *pcLinks ); }; #endif //__WEBVIEWCOORD_H_