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.

125 lines
4.8 KiB

  1. #ifndef __SHOCX_H__
  2. #define __SHOCX_H__
  3. #include "cnctnpt.h"
  4. #include "dspsprt.h"
  5. #include "expdsprt.h"
  6. //
  7. // shocx.h
  8. //
  9. #define _INTERFACEOFOBJECT 1
  10. #define _CLSIDOFOBJECT 2
  11. class CShellOcx: public CShellEmbedding, // IOleObject, IOleInPlacceObject, IOleInPlaceActiveObject,
  12. // IViewObject2, IPersistStorage
  13. public IPersistStreamInit,
  14. public IPersistPropertyBag,
  15. public IOleControl, // OnAmbientPropertyChange
  16. public IDispatch,
  17. public IProvideClassInfo2,
  18. protected CImpIConnectionPointContainer,
  19. protected CImpIDispatch
  20. {
  21. public:
  22. // *** IUnknown *** (we multiply inherit from IUnknown, disambiguate here)
  23. virtual STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj)
  24. { return CShellEmbedding::QueryInterface(riid, ppvObj); }
  25. virtual STDMETHODIMP_(ULONG) AddRef(void)
  26. { return CShellEmbedding::AddRef(); }
  27. virtual STDMETHODIMP_(ULONG) Release(void)
  28. { return CShellEmbedding::Release(); }
  29. // *** IPersistStreamInit ***
  30. virtual STDMETHODIMP GetClassID(CLSID *pClassID) {return CShellEmbedding::GetClassID(pClassID);} // IPersistStorage implementation
  31. virtual STDMETHODIMP IsDirty(void) {return _fDirty ? S_OK : S_FALSE;}
  32. virtual STDMETHODIMP Load(IStream *pStm) PURE;
  33. virtual STDMETHODIMP Save(IStream *pStm, BOOL fClearDirty) PURE;
  34. virtual STDMETHODIMP GetSizeMax(ULARGE_INTEGER *pcbSize);
  35. virtual STDMETHODIMP InitNew(void) PURE;
  36. // *** IPersistPropertyBag ***
  37. virtual STDMETHODIMP Load(IPropertyBag *pBag, IErrorLog *pErrorLog) PURE;
  38. virtual STDMETHODIMP Save(IPropertyBag *pBag, BOOL fClearDirty, BOOL fSaveAllProperties) PURE;
  39. // *** IOleControl ***
  40. virtual STDMETHODIMP GetControlInfo(LPCONTROLINFO pCI);
  41. virtual STDMETHODIMP OnMnemonic(LPMSG pMsg);
  42. virtual STDMETHODIMP OnAmbientPropertyChange(DISPID dispid);
  43. virtual STDMETHODIMP FreezeEvents(BOOL bFreeze);
  44. // *** IDispatch ***
  45. virtual STDMETHODIMP GetTypeInfoCount(UINT FAR* pctinfo)
  46. { return CImpIDispatch::GetTypeInfoCount(pctinfo); }
  47. virtual STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo)
  48. { return CImpIDispatch::GetTypeInfo(itinfo, lcid, pptinfo); }
  49. virtual STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, UINT cNames, LCID lcid, DISPID FAR* rgdispid);
  50. virtual STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pdispparams, VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, UINT FAR* puArgErr)
  51. { return CImpIDispatch::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); }
  52. // *** CImpIConnectionPointContainer ***
  53. virtual STDMETHODIMP EnumConnectionPoints(LPENUMCONNECTIONPOINTS * ppEnum);
  54. // *** IProvideClassInfo2 ***
  55. virtual STDMETHODIMP GetClassInfo(LPTYPEINFO * ppTI);
  56. virtual STDMETHODIMP GetGUID(DWORD dwGuidKind, GUID *pGUID);
  57. // IPropertyNotifySink stuff.
  58. //
  59. inline void PropertyChanged(DISPID dispid) {
  60. m_cpPropNotify.OnChanged(dispid);
  61. }
  62. /*
  63. ** CShellEmbedding stuff
  64. */
  65. // *** IOleObject ***
  66. virtual STDMETHODIMP EnumVerbs(IEnumOLEVERB **ppEnumOleVerb);
  67. virtual STDMETHODIMP SetClientSite(IOleClientSite *pClientSite);
  68. // *** IViewObject ***
  69. virtual STDMETHODIMP Draw(DWORD, LONG, void *, DVTARGETDEVICE *, HDC, HDC,
  70. const RECTL *, const RECTL *, BOOL (*)(ULONG_PTR), ULONG_PTR);
  71. /*
  72. ** CShellOcx specific stuff
  73. */
  74. CShellOcx(IUnknown* punkOuter, LPCOBJECTINFO poi, const OLEVERB* pverbs=NULL, const OLEVERB* pdesignverbs=NULL);
  75. ~CShellOcx();
  76. protected:
  77. // from CShellEmbedding
  78. virtual HRESULT v_InternalQueryInterface(REFIID riid, LPVOID * ppvObj);
  79. virtual CConnectionPoint* _FindCConnectionPointNoRef(BOOL fdisp, REFIID iid);
  80. ITypeInfo *_pClassTypeInfo; // ITypeInfo of class
  81. const OLEVERB* _pDesignVerbs; // verb list for design mode -- run mode is in CShellEmbedding
  82. // Ambient Properties we care about
  83. IDispatch* _pDispAmbient;
  84. BOOL _GetAmbientProperty(DISPID dispid, VARTYPE vt, void *pData);
  85. int _nDesignMode; // MODE_UNKNOWN, MODE_TRUE, MODE_FALSE
  86. BOOL _IsDesignMode(void); // TRUE means we have a design-mode container
  87. BOOL _fEventsFrozen:1;
  88. CConnectionPoint m_cpEvents;
  89. CConnectionPoint m_cpPropNotify;
  90. } ;
  91. // _nDesignMode,etc flags
  92. #define MODE_UNKNOWN -1 // mode has not yet been determined
  93. #define MODE_TRUE 1
  94. #define MODE_FALSE 0
  95. // CConnectionPoint types:
  96. #define SINK_TYPE_EVENT 0
  97. #define SINK_TYPE_PROPNOTIFY 1
  98. #endif // __SHOCX_H__