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.

150 lines
4.9 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. HelpViewerWrapper.h
  5. Abstract:
  6. This file contains the declaration of the class used to wrap the HTML Help Viewer.
  7. Revision History:
  8. Davide Massarenti (dmassare) 01/20/2000
  9. created
  10. ******************************************************************************/
  11. #if !defined(__INCLUDED___PCH___HELPVIEWERWRAPPER_H___)
  12. #define __INCLUDED___PCH___HELPVIEWERWRAPPER_H___
  13. #include <HelpCenter.h>
  14. #include <htmlhelp.h>
  15. #include <oleacc.h>
  16. #define ID_NOTIFY_FROM_HH (12345)
  17. #define WINDOW_STYLE "HCStyle"
  18. class ATL_NO_VTABLE CPCHHelpViewerWrapper :
  19. public CComObjectRootEx<CComSingleThreadModel>,
  20. public CStockPropImpl <CPCHHelpViewerWrapper, IPCHHelpViewerWrapper, &IID_IPCHHelpViewerWrapper, &LIBID_HelpCenterTypeLib>,
  21. public CComControl <CPCHHelpViewerWrapper>,
  22. public IPersistStreamInitImpl <CPCHHelpViewerWrapper>,
  23. public IOleControlImpl <CPCHHelpViewerWrapper>,
  24. public IOleObjectImpl <CPCHHelpViewerWrapper>,
  25. public IOleInPlaceActiveObjectImpl <CPCHHelpViewerWrapper>,
  26. public IViewObjectExImpl <CPCHHelpViewerWrapper>,
  27. public IOleInPlaceObjectWindowlessImpl<CPCHHelpViewerWrapper>,
  28. public CComCoClass <CPCHHelpViewerWrapper, &CLSID_PCHHelpViewerWrapper>
  29. {
  30. static MPC::CComSafeAutoCriticalSection s_csec;
  31. static bool s_fInitialized;
  32. static DWORD s_dwLastStyle;
  33. static MPC::WStringList s_lstAvailable;
  34. //
  35. // This is the OLEACC stuff used to access the WebBrowser object inside the HTMLHelp viewer.
  36. //
  37. static HINSTANCE s_hInst;
  38. static LPFNOBJECTFROMLRESULT s_pfObjectFromLresult;
  39. ////////////////////////////////////////
  40. class ATL_NO_VTABLE ServiceProvider :
  41. public CComObjectRootEx<CComSingleThreadModel>,
  42. public IServiceProvider
  43. {
  44. CPCHHelpCenterExternal* m_parent;
  45. HWND m_hWnd;
  46. public:
  47. BEGIN_COM_MAP(ServiceProvider)
  48. COM_INTERFACE_ENTRY(IServiceProvider)
  49. END_COM_MAP()
  50. ServiceProvider();
  51. virtual ~ServiceProvider();
  52. HRESULT Attach( /*[in]*/ CPCHHelpCenterExternal* parent, /*[in]*/ HWND hWnd );
  53. void Detach( );
  54. //
  55. // IServiceProvider
  56. //
  57. STDMETHOD(QueryService)( REFGUID guidService, REFIID riid, void **ppv );
  58. };
  59. ////////////////////////////////////////
  60. CPCHHelpCenterExternal* m_parent;
  61. CPCHHelpViewerWrapper::ServiceProvider* m_ServiceProvider;
  62. bool m_fFirstTime;
  63. MPC::wstring m_szWindowStyle;
  64. HWND m_hwndHH;
  65. CComPtr<IHTMLDocument2> m_spDoc;
  66. CComPtr<IWebBrowser2> m_WB2;
  67. CComBSTR m_bstrPendingNavigation;
  68. ////////////////////////////////////////
  69. void AcquireWindowStyle();
  70. void ReleaseWindowStyle();
  71. void ExtractWebBrowser();
  72. void InternalDisplayTopic( /*[in]*/ LPCWSTR szURL );
  73. public:
  74. DECLARE_NO_REGISTRY()
  75. DECLARE_NOT_AGGREGATABLE(CPCHHelpViewerWrapper)
  76. DECLARE_PROTECT_FINAL_CONSTRUCT()
  77. BEGIN_COM_MAP(CPCHHelpViewerWrapper)
  78. COM_INTERFACE_ENTRY(IPCHHelpViewerWrapper)
  79. COM_INTERFACE_ENTRY2(IDispatch, IPCHHelpViewerWrapper)
  80. COM_INTERFACE_ENTRY(IViewObjectEx)
  81. COM_INTERFACE_ENTRY(IViewObject2)
  82. COM_INTERFACE_ENTRY(IViewObject)
  83. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  84. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  85. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  86. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  87. COM_INTERFACE_ENTRY(IOleControl)
  88. COM_INTERFACE_ENTRY(IOleObject)
  89. COM_INTERFACE_ENTRY(IPersistStreamInit)
  90. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  91. END_COM_MAP()
  92. BEGIN_PROP_MAP(CPCHHelpViewerWrapper)
  93. END_PROP_MAP()
  94. CPCHHelpViewerWrapper();
  95. virtual ~CPCHHelpViewerWrapper();
  96. BOOL ProcessWindowMessage( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0 );
  97. BOOL PreTranslateAccelerator( LPMSG pMsg, HRESULT& hRet );
  98. // IViewObjectEx
  99. DECLARE_VIEW_STATUS(0)
  100. // IOleObject
  101. STDMETHOD(SetClientSite)(IOleClientSite *pClientSite);
  102. // IPCHHelpViewerWrapper
  103. public:
  104. STDMETHOD(get_WebBrowser)( /*[out,retval]*/ IUnknown* *pVal );
  105. STDMETHOD(Navigate)( /*[in]*/ BSTR bstrURL );
  106. STDMETHOD(Print )( );
  107. };
  108. /////////////////////////////////////////////////////////////////////////////
  109. #endif // !defined(__INCLUDED___PCH___HELPVIEWERWRAPPER_H___)