Source code of Windows XP (NT5)
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.

113 lines
5.7 KiB

  1. /*************************************************************************/
  2. /* Copyright (C) 1999 Microsoft Corporation */
  3. /* File: CCObj.h */
  4. /* Description: Contains holder for container objects. */
  5. /*************************************************************************/
  6. #ifndef __CCOBJ_H
  7. #define __CCOBJ_H
  8. //#include "BBtn.h"
  9. #include "chobj.h"
  10. /*************************************************************************/
  11. /* Class: CContainerObject */
  12. /* Description: Object that contains container. This is a simple wrapper */
  13. /* inorder to have really just one cobtainer site, but at the same time */
  14. /* support the windowless activation. We pass in this object instead of */
  15. /* the real site, so we can track which windowless object has focus and */
  16. /* or capture. */
  17. /*************************************************************************/
  18. class CContainerObject:
  19. // #### BEGIN CONTAINER SUPPORT ####
  20. public IOleClientSite,
  21. //public IOleInPlaceFrame,
  22. //public IOleControlSite,
  23. public IOleInPlaceSiteWindowless,
  24. public IOleContainer,
  25. // public IMFOleInPlaceSiteWindowless,
  26. public IObjectWithSite,
  27. public IPropertyBag
  28. // #### END CONTAINER SUPPORT ####
  29. {
  30. protected:
  31. CContainerObject(){Init();};
  32. public:
  33. virtual ~CContainerObject(){ATLTRACE(TEXT("In the CContainerObject object destructor \n")); ;};
  34. CContainerObject(IUnknown* pUnknown, CHostedObject* pObj);
  35. STDMETHOD(QueryInterface)(const IID& iid, void**ppv);
  36. STDMETHOD_(ULONG,AddRef)( void);
  37. STDMETHOD_(ULONG,Release)( void);
  38. // needed to initialize this object
  39. HRESULT SetObjects(IUnknown* pUnknown, CHostedObject* pObj);
  40. HRESULT InvalidateObjectRect();
  41. // IOleClientSite
  42. STDMETHOD(SaveObject)(){ATLTRACENOTIMPL(_T("IOleClientSite::SaveObject"));}
  43. STDMETHOD(GetMoniker)(DWORD /*dwAssign*/, DWORD /*dwWhichMoniker*/, IMoniker** /*ppmk*/){ATLTRACENOTIMPL(_T("IOleClientSite::GetMoniker"));}
  44. STDMETHOD(GetContainer)(IOleContainer** ppContainer);
  45. STDMETHOD(ShowObject)();
  46. STDMETHOD(OnShowWindow)(BOOL fShow);
  47. STDMETHOD(RequestNewObjectLayout)(){ATLTRACENOTIMPL(_T("IOleClientSite::RequestNewObjectLayout"));}
  48. // IOleWindow
  49. STDMETHOD(GetWindow)(HWND *phwnd);
  50. STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
  51. //IOleInPlaceSite
  52. STDMETHOD(CanInPlaceActivate)();
  53. STDMETHOD(OnUIActivate)();
  54. STDMETHOD(OnInPlaceActivate)();
  55. STDMETHOD(GetWindowContext)(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO pFrameInfo);
  56. STDMETHOD(OnUIDeactivate)(BOOL fUndoable);
  57. STDMETHOD(OnInPlaceDeactivate)();
  58. STDMETHOD(DiscardUndoState)();
  59. STDMETHOD(DeactivateAndUndo)();
  60. STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect);
  61. STDMETHOD(Scroll)(SIZE scrollExtant);
  62. //IOleInPlaceSiteEx
  63. STDMETHOD(OnInPlaceActivateEx)(BOOL* pfNoRedraw, DWORD dwFlags);
  64. STDMETHOD(OnInPlaceDeactivateEx)(BOOL fNoRedraw);
  65. STDMETHOD(RequestUIActivate)();
  66. STDMETHOD(CanWindowlessActivate)();
  67. STDMETHOD(GetCapture)();
  68. STDMETHOD(SetCapture)(BOOL fCapture);
  69. STDMETHOD(GetFocus)();
  70. STDMETHOD(SetFocus)(BOOL fFocus);
  71. STDMETHOD(GetDC)(LPCRECT /*pRect*/, DWORD /*grfFlags*/, HDC* phDC);
  72. STDMETHOD(ReleaseDC)(HDC hDC);
  73. STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase);
  74. STDMETHOD(InvalidateRgn)(HRGN hRGN = NULL, BOOL fErase = FALSE);
  75. STDMETHOD(ScrollRect)(INT /*dx*/, INT /*dy*/, LPCRECT /*pRectScroll*/, LPCRECT /*pRectClip*/);
  76. STDMETHOD(AdjustRect)(LPRECT /*prc*/);
  77. STDMETHOD(OnDefWindowMessage)(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult);
  78. // IMFOleInPlaceSiteWindowless
  79. STDMETHOD(SetHostedObject)(LONG lVoid);
  80. // IOleContainer
  81. STDMETHOD(ParseDisplayName)(IBindCtx* /*pbc*/, LPOLESTR /*pszDisplayName*/, ULONG* /*pchEaten*/, IMoniker** /*ppmkOut*/);
  82. STDMETHOD(EnumObjects)(DWORD /*grfFlags*/, IEnumUnknown** ppenum);
  83. STDMETHOD(LockContainer)(BOOL fLock);
  84. //IObjectWithSite
  85. STDMETHOD(SetSite)(IUnknown *pUnkSite){ATLTRACENOTIMPL(_T("IObjectWithSite::SetSite"));}
  86. STDMETHOD(GetSite)(REFIID riid, void **ppvSite);
  87. //IPropertyBag
  88. STDMETHOD(Read)(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
  89. STDMETHOD(Write)(LPCOLESTR pszPropName, VARIANT* pVar){ATLTRACENOTIMPL(_T("IPropertyBag::Write"));}
  90. protected: // helper functions
  91. void Init();
  92. inline HRESULT GetWindowlessSite(CComPtr<IOleInPlaceSiteWindowless>& pSite);
  93. inline HRESULT GetContainer(CComPtr<IOleContainer>& pContainer);
  94. HRESULT ParsePropertyBag(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
  95. private: // private member variables
  96. CHostedObject* m_pObj; // object which we are hosting
  97. CComPtr<IUnknown> m_pUnkContainer; // pointer to our container
  98. CComPtr<IOleInPlaceFrame> m_spInPlaceFrame; // cached up pointer
  99. CComPtr<IOleInPlaceUIWindow> m_spInPlaceUIWindow; // cached up pointer
  100. long m_lRefCount;
  101. unsigned long m_bLocked:1;
  102. };/* end of class CContainerObject */
  103. #endif // end of __CCOBJ_H
  104. /*************************************************************************/
  105. /* End of file: CCObj.h */
  106. /*************************************************************************/