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.

107 lines
5.1 KiB

  1. #ifndef _DHUIHAND_H
  2. #define _DHUIHAND_H
  3. class CDocHostUIHandler :
  4. public IDocHostUIHandler2
  5. , public IObjectWithSite
  6. , public IOleCommandTarget
  7. , public IDispatch
  8. {
  9. public:
  10. // *** IUnknown methods ***
  11. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID *ppv);
  12. STDMETHOD_(ULONG,AddRef)(THIS);
  13. STDMETHOD_(ULONG,Release)(THIS);
  14. // IDocHostUIHandler
  15. virtual HRESULT STDMETHODCALLTYPE ShowContextMenu(
  16. DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved);
  17. virtual HRESULT STDMETHODCALLTYPE GetHostInfo(DOCHOSTUIINFO *pInfo);
  18. virtual HRESULT STDMETHODCALLTYPE ShowUI(
  19. DWORD dwID, IOleInPlaceActiveObject *pActiveObject,
  20. IOleCommandTarget *pCommandTarget, IOleInPlaceFrame *pFrame,
  21. IOleInPlaceUIWindow *pDoc);
  22. virtual HRESULT STDMETHODCALLTYPE HideUI(void);
  23. virtual HRESULT STDMETHODCALLTYPE UpdateUI(void);
  24. virtual HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable);
  25. virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(BOOL fActivate);
  26. virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(BOOL fActivate);
  27. virtual HRESULT STDMETHODCALLTYPE ResizeBorder(
  28. LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow);
  29. virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(
  30. LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID);
  31. virtual HRESULT STDMETHODCALLTYPE GetOptionKeyPath(BSTR *pbstrKey, DWORD dw);
  32. virtual HRESULT STDMETHODCALLTYPE GetDropTarget(
  33. IDropTarget *pDropTarget, IDropTarget **ppDropTarget);
  34. virtual HRESULT STDMETHODCALLTYPE GetExternal(IDispatch **ppDisp);
  35. virtual HRESULT STDMETHODCALLTYPE TranslateUrl(DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut);
  36. virtual HRESULT STDMETHODCALLTYPE FilterDataObject(IDataObject *pDO, IDataObject **ppDORet);
  37. // IDocHostUIHandler2
  38. virtual HRESULT STDMETHODCALLTYPE GetOverrideKeyPath(LPOLESTR *pchKey, DWORD dw);
  39. // IObjectWithSite
  40. virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *punkSite);
  41. virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
  42. // IOleCommandTarget
  43. virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup,
  44. ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  45. virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup,
  46. DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  47. //IDispatch
  48. virtual STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) { return E_NOTIMPL; };
  49. virtual STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) { return E_NOTIMPL; };
  50. virtual STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames,
  51. LCID lcid, DISPID *rgDispId) { return E_NOTIMPL; };
  52. virtual STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid,
  53. LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
  54. EXCEPINFO *pExcepInfo, UINT *puArgErr);
  55. CDocHostUIHandler::CDocHostUIHandler(void);
  56. CDocHostUIHandler::~CDocHostUIHandler(void);
  57. protected:
  58. HRESULT GetAltExternal(IDispatch **ppDisp);
  59. void ShowErrorDialog(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, DWORD dwflags);
  60. HRESULT ShowMessage(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, DWORD dwflags);
  61. void ShowFindDialog(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, DWORD dwflags);
  62. HRESULT ShowPageSetupDialog(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, DWORD dwflags);
  63. HRESULT ShowPrintDialog(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, DWORD dwflags);
  64. HRESULT DoTemplatePrinting(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, BOOL fPREVIEW);
  65. HRESULT DoTemplatePageSetup(VARIANTARG *pvarargIn);
  66. HRESULT ShowPropertysheetDialog(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut, DWORD dwflags);
  67. HRESULT ShowPropertysheetDialogHelper(int cUnk, IUnknown ** apUnk, HWND hwndOwner,
  68. IServiceProvider * pServiceProvider, IUnknown * punkBrowseDefault);
  69. HRESULT GetCommonPages(int cUnk, IUnknown **apUnk, CAUUID *pca);
  70. HRESULT ClsidToMoniker(VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  71. IUnknown * _punkSite;
  72. IOleInPlaceFrame * _pOleInPlaceFrame;
  73. HMENU _hBrowseMenu;
  74. HMENU _hEditMenu;
  75. IDispatch * _pExternal;
  76. IHTMLOptionsHolder * _pOptionsHolder;
  77. BOOL IsFindDialogUp(IWebBrowser2* pwb, IHTMLWindow2** ppWindow);
  78. public:
  79. //to block more then one preview
  80. LONG IncrementPreviewCnt() { return InterlockedIncrement(&m_cPreviewIsUp); };
  81. LONG DecrementPreviewCnt() { ASSERT( 0 != m_cPreviewIsUp ); return InterlockedDecrement(&m_cPreviewIsUp); };
  82. private:
  83. LONG m_cRef;
  84. LONG m_cPreviewIsUp;
  85. };
  86. BSTR GetFindText(IWebBrowser2* pwb);
  87. void PutFindText(IWebBrowser2* pwb, LPCWSTR pwszFindText);
  88. #define STR_FIND_DIALOG_NAME TEXT("__IE_FindDialog")
  89. #define STR_FIND_DIALOG_TEXT TEXT("__IE_FindDialogText")
  90. #define STR_PRINT_PREVIEW_NAME TEXT("__IE_PRINTPREVIEW_TEMPLATE")
  91. #endif //_DHUIHAND_H