contnr.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**************************************************************************
  2. THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF
  3. ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. PARTICULAR PURPOSE.
  6. Copyright 1998 Microsoft Corporation. All Rights Reserved.
  7. **************************************************************************/
  8. /**************************************************************************
  9. File: contnr.h
  10. Description: This file contains the complete class specification of an
  11. ActiveX control container. This purpose of this container
  12. is to test a single control being hosted.
  13. **************************************************************************/
  14. #ifndef _CONTAINER_H_
  15. #define _CONTAINER_H_
  16. /**************************************************************************
  17. #include statements
  18. **************************************************************************/
  19. #include <ocidl.h>
  20. #include <mshtmhst.h>
  21. /**************************************************************************
  22. class definitions
  23. **************************************************************************/
  24. class CContainer : public IOleClientSite,
  25. public IOleInPlaceSite,
  26. public IOleInPlaceFrame,
  27. public IOleControlSite,
  28. public IDocHostUIHandler,
  29. public IDispatch
  30. {
  31. private:
  32. ULONG m_cRefs; // ref count
  33. HWND m_hwnd; // window handle of the container
  34. HWND m_hwndStatus; // status window handle
  35. IUnknown *m_punk; // IUnknown of contained object
  36. int m_scrollbars;
  37. int m_allowScripts, m_restrictAlreadySet;
  38. public:
  39. CContainer();
  40. ~CContainer();
  41. public:
  42. // *** IUnknown Methods ***
  43. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  44. STDMETHOD_(ULONG, AddRef)(void);
  45. STDMETHOD_(ULONG, Release)(void);
  46. // *** IOleClientSite Methods ***
  47. STDMETHOD (SaveObject)();
  48. STDMETHOD (GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMk);
  49. STDMETHOD (GetContainer)(LPOLECONTAINER *ppContainer);
  50. STDMETHOD (ShowObject)();
  51. STDMETHOD (OnShowWindow)(BOOL fShow);
  52. STDMETHOD (RequestNewObjectLayout)();
  53. // *** IOleWindow Methods ***
  54. STDMETHOD (GetWindow) (HWND * phwnd);
  55. STDMETHOD (ContextSensitiveHelp) (BOOL fEnterMode);
  56. // *** IOleInPlaceSite Methods ***
  57. STDMETHOD (CanInPlaceActivate) (void);
  58. STDMETHOD (OnInPlaceActivate) (void);
  59. STDMETHOD (OnUIActivate) (void);
  60. STDMETHOD (GetWindowContext) (IOleInPlaceFrame ** ppFrame, IOleInPlaceUIWindow ** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  61. STDMETHOD (Scroll) (SIZE scrollExtent);
  62. STDMETHOD (OnUIDeactivate) (BOOL fUndoable);
  63. STDMETHOD (OnInPlaceDeactivate) (void);
  64. STDMETHOD (DiscardUndoState) (void);
  65. STDMETHOD (DeactivateAndUndo) (void);
  66. STDMETHOD (OnPosRectChange) (LPCRECT lprcPosRect);
  67. // *** IOleInPlaceUIWindow Methods ***
  68. STDMETHOD (GetBorder)(LPRECT lprectBorder);
  69. STDMETHOD (RequestBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  70. STDMETHOD (SetBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  71. STDMETHOD (SetActiveObject)(IOleInPlaceActiveObject * pActiveObject,
  72. LPCOLESTR lpszObjName);
  73. // *** IOleInPlaceFrame Methods ***
  74. STDMETHOD (InsertMenus)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  75. STDMETHOD (SetMenu)(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  76. STDMETHOD (RemoveMenus)(HMENU hmenuShared);
  77. STDMETHOD (SetStatusText)(LPCOLESTR pszStatusText);
  78. STDMETHOD (EnableModeless)(BOOL fEnable);
  79. STDMETHOD (TranslateAccelerator)(LPMSG lpmsg, WORD wID);
  80. // *** IOleControlSite Methods ***
  81. STDMETHOD (OnControlInfoChanged)(void);
  82. STDMETHOD (LockInPlaceActive)(BOOL fLock);
  83. STDMETHOD (GetExtendedControl)(IDispatch **ppDisp);
  84. STDMETHOD (TransformCoords)(POINTL *pptlHimetric, POINTF *pptfContainer, DWORD dwFlags);
  85. STDMETHOD (TranslateAccelerator)(LPMSG pMsg, DWORD grfModifiers);
  86. STDMETHOD (OnFocus)(BOOL fGotFocus);
  87. STDMETHOD (ShowPropertyFrame)(void);
  88. // *** IDispatch Methods ***
  89. STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  90. STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  91. STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
  92. STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  93. // *** IDocHostUIHandler Methods ***
  94. STDMETHOD (ShowContextMenu)(DWORD dwID, POINT __RPC_FAR *ppt, IUnknown __RPC_FAR *pcmdtReserved, IDispatch __RPC_FAR *pdispReserved);
  95. STDMETHOD (GetHostInfo)(DOCHOSTUIINFO __RPC_FAR *pInfo);
  96. STDMETHOD (ShowUI)(DWORD dwID, IOleInPlaceActiveObject __RPC_FAR *pActiveObject, IOleCommandTarget __RPC_FAR *pCommandTarget, IOleInPlaceFrame __RPC_FAR *pFrame, IOleInPlaceUIWindow __RPC_FAR *pDoc);
  97. STDMETHOD (HideUI)(void);
  98. STDMETHOD (UpdateUI)(void);
  99. STDMETHOD (OnDocWindowActivate)(BOOL fActivate);
  100. STDMETHOD (OnFrameWindowActivate)(BOOL fActivate);
  101. STDMETHOD (ResizeBorder)(LPCRECT prcBorder, IOleInPlaceUIWindow __RPC_FAR *pUIWindow, BOOL fRameWindow);
  102. STDMETHOD (TranslateAccelerator)(LPMSG lpMsg, const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID);
  103. STDMETHOD (GetOptionKeyPath)(LPOLESTR __RPC_FAR *pchKey, DWORD dw);
  104. STDMETHOD (GetDropTarget)(IDropTarget __RPC_FAR *pDropTarget, IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget);
  105. STDMETHOD (GetExternal)(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch);
  106. STDMETHOD (TranslateUrl)(DWORD dwTranslate, OLECHAR __RPC_FAR *pchURLIn, OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut);
  107. STDMETHOD (FilterDataObject)(IDataObject __RPC_FAR *pDO, IDataObject __RPC_FAR *__RPC_FAR *ppDORet);
  108. public:
  109. void add(BSTR clsid);
  110. void remove();
  111. void setParent(HWND hwndParent);
  112. void setLocation(int x, int y, int width, int height);
  113. void setVisible(BOOL fVisible);
  114. void setFocus(BOOL fFocus);
  115. void setStatusWindow(HWND hwndStatus);
  116. void translateKey(MSG msg);
  117. void setScrollbars(int scroll);
  118. void setAllowScripts(int s) { m_allowScripts=s; }
  119. int getAllowScripts() { return m_allowScripts; }
  120. int getRestrictAlreadySet() { return m_restrictAlreadySet; }
  121. IDispatch *getDispatch();
  122. IUnknown * getUnknown();
  123. BOOL SetRect(RECT *prc);
  124. };
  125. #endif