1*cdf0e10cSrcweir // SOActiveX.h : Declaration of the CSOActiveX 2*cdf0e10cSrcweir 3*cdf0e10cSrcweir #ifndef __SOACTIVEX_H_ 4*cdf0e10cSrcweir #define __SOACTIVEX_H_ 5*cdf0e10cSrcweir 6*cdf0e10cSrcweir #include "resource.h" // main symbols 7*cdf0e10cSrcweir 8*cdf0e10cSrcweir #pragma warning (disable:4505) 9*cdf0e10cSrcweir // permanently suppress "unreferenced local function has been removed" warning 10*cdf0e10cSrcweir 11*cdf0e10cSrcweir #pragma warning (push,1) 12*cdf0e10cSrcweir #pragma warning (disable:4265) 13*cdf0e10cSrcweir 14*cdf0e10cSrcweir #include <ExDispID.h> 15*cdf0e10cSrcweir #include <ExDisp.h> 16*cdf0e10cSrcweir #include <shlguid.h> 17*cdf0e10cSrcweir 18*cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER >= 1300) 19*cdf0e10cSrcweir #undef _DEBUG 20*cdf0e10cSrcweir #endif 21*cdf0e10cSrcweir #include <atlctl.h> 22*cdf0e10cSrcweir 23*cdf0e10cSrcweir #include "so_activex.h" 24*cdf0e10cSrcweir 25*cdf0e10cSrcweir #pragma warning (pop) 26*cdf0e10cSrcweir 27*cdf0e10cSrcweir class SODispatchInterceptor; 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir enum SOVersion { 30*cdf0e10cSrcweir SO_NOT_DETECTED = 0, 31*cdf0e10cSrcweir SO_52, 32*cdf0e10cSrcweir SO_60, 33*cdf0e10cSrcweir SO_61, 34*cdf0e10cSrcweir SO_UNKNOWN, 35*cdf0e10cSrcweir OO_10, 36*cdf0e10cSrcweir OO_11, 37*cdf0e10cSrcweir OO_UNKNOWN 38*cdf0e10cSrcweir }; 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////// 41*cdf0e10cSrcweir // CSOActiveX 42*cdf0e10cSrcweir class ATL_NO_VTABLE CSOActiveX : 43*cdf0e10cSrcweir public CComObjectRootEx<CComSingleThreadModel>, 44*cdf0e10cSrcweir public IDispatchImpl<ISOActiveX, &IID_ISOActiveX, &LIBID_SO_ACTIVEXLib>, 45*cdf0e10cSrcweir public CComControl<CSOActiveX>, 46*cdf0e10cSrcweir public IPersistStreamInitImpl<CSOActiveX>, 47*cdf0e10cSrcweir public IOleControlImpl<CSOActiveX>, 48*cdf0e10cSrcweir public IOleObjectImpl<CSOActiveX>, 49*cdf0e10cSrcweir public IOleInPlaceActiveObjectImpl<CSOActiveX>, 50*cdf0e10cSrcweir public IViewObjectExImpl<CSOActiveX>, 51*cdf0e10cSrcweir public IOleInPlaceObjectWindowlessImpl<CSOActiveX>, 52*cdf0e10cSrcweir // public IConnectionPointContainerImpl<CSOActiveX>, 53*cdf0e10cSrcweir public CComCoClass<CSOActiveX, &CLSID_SOActiveX>, 54*cdf0e10cSrcweir // public CProxy_ItryPluginEvents< CSOActiveX >, 55*cdf0e10cSrcweir public IPersistPropertyBagImpl< CSOActiveX >, 56*cdf0e10cSrcweir public IProvideClassInfo2Impl< &CLSID_SOActiveX, 57*cdf0e10cSrcweir &DIID__ISOActiveXEvents, 58*cdf0e10cSrcweir &LIBID_SO_ACTIVEXLib >, 59*cdf0e10cSrcweir public IObjectSafetyImpl< CSOActiveX, 60*cdf0e10cSrcweir INTERFACESAFE_FOR_UNTRUSTED_DATA > 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir protected: 63*cdf0e10cSrcweir CComPtr<IWebBrowser2> mWebBrowser2; 64*cdf0e10cSrcweir DWORD mCookie; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir CComPtr<IDispatch> mpDispFactory; 67*cdf0e10cSrcweir CComPtr<IDispatch> mpDispFrame; 68*cdf0e10cSrcweir CComPtr<IDispatch> mpInstanceLocker; 69*cdf0e10cSrcweir CComPtr<IDispatch> mpDispWin; 70*cdf0e10cSrcweir OLECHAR* mCurFileUrl; 71*cdf0e10cSrcweir BOOL mbLoad; 72*cdf0e10cSrcweir BOOL mbViewOnly; 73*cdf0e10cSrcweir WNDCLASS mPWinClass; 74*cdf0e10cSrcweir HWND mParentWin; 75*cdf0e10cSrcweir HWND mOffWin; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir SODispatchInterceptor* mpDispatchInterceptor; 78*cdf0e10cSrcweir SOVersion mnVersion; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir BOOL mbReadyForActivation; 81*cdf0e10cSrcweir CComPtr<IDispatch> mpDispTempFile; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir BOOL mbDrawLocked; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir public: 86*cdf0e10cSrcweir CSOActiveX(); 87*cdf0e10cSrcweir ~CSOActiveX(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX) 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir DECLARE_PROTECT_FINAL_CONSTRUCT() 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir BEGIN_COM_MAP(CSOActiveX) 94*cdf0e10cSrcweir COM_INTERFACE_ENTRY(ISOActiveX) 95*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IDispatch) 96*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IViewObjectEx) 97*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IViewObject2) 98*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IViewObject) 99*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) 100*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleInPlaceObject) 101*cdf0e10cSrcweir COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) 102*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) 103*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleControl) 104*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleObject) 105*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IPersistStreamInit) 106*cdf0e10cSrcweir COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) 107*cdf0e10cSrcweir // COM_INTERFACE_ENTRY(IConnectionPointContainer) 108*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IProvideClassInfo) 109*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IProvideClassInfo2) 110*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IPersistPropertyBag) 111*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IObjectSafety) 112*cdf0e10cSrcweir END_COM_MAP() 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir BEGIN_PROP_MAP(CSOActiveX) 115*cdf0e10cSrcweir PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) 116*cdf0e10cSrcweir PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) 117*cdf0e10cSrcweir // Example entries 118*cdf0e10cSrcweir // PROP_ENTRY("Property Description", dispid, clsid) 119*cdf0e10cSrcweir // PROP_PAGE(CLSID_StockColorPage) 120*cdf0e10cSrcweir END_PROP_MAP() 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir BEGIN_CONNECTION_POINT_MAP(CSOActiveX) 123*cdf0e10cSrcweir END_CONNECTION_POINT_MAP() 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir BEGIN_MSG_MAP(CSOActiveX) 126*cdf0e10cSrcweir CHAIN_MSG_MAP(CComControl<CSOActiveX>) 127*cdf0e10cSrcweir DEFAULT_REFLECTION_HANDLER() 128*cdf0e10cSrcweir END_MSG_MAP() 129*cdf0e10cSrcweir // Handler prototypes: 130*cdf0e10cSrcweir // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 131*cdf0e10cSrcweir // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 132*cdf0e10cSrcweir // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir // IViewObjectEx 137*cdf0e10cSrcweir DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE) 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir // ISOActiveX 140*cdf0e10cSrcweir public: 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ); 143*cdf0e10cSrcweir STDMETHOD(Invoke)( DISPID dispidMember, 144*cdf0e10cSrcweir REFIID riid, 145*cdf0e10cSrcweir LCID lcid, 146*cdf0e10cSrcweir WORD wFlags, 147*cdf0e10cSrcweir DISPPARAMS* pDispParams, 148*cdf0e10cSrcweir VARIANT* pvarResult, 149*cdf0e10cSrcweir EXCEPINFO* pExcepInfo, 150*cdf0e10cSrcweir UINT* puArgErr); 151*cdf0e10cSrcweir STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ); 152*cdf0e10cSrcweir STDMETHOD(Load) ( LPSTREAM pStm ); 153*cdf0e10cSrcweir STDMETHOD(InitNew) (); 154*cdf0e10cSrcweir HRESULT OnDrawAdvanced(ATL_DRAWINFO& di); 155*cdf0e10cSrcweir HRESULT OnDraw(ATL_DRAWINFO& di); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir HRESULT SetLayoutManagerProps(); 158*cdf0e10cSrcweir HRESULT CreateFrameOldWay( HWND hwnd, int width, int height ); 159*cdf0e10cSrcweir HRESULT GetUnoStruct( OLECHAR* sStructName, CComPtr<IDispatch>& pdispResult ); 160*cdf0e10cSrcweir HRESULT LoadURLToFrame(); 161*cdf0e10cSrcweir HRESULT CallDispatchMethod( OLECHAR* sUrl, CComVariant* sArgNames, CComVariant* sArgVal, unsigned int count ); 162*cdf0e10cSrcweir HRESULT CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal ); 163*cdf0e10cSrcweir HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl ); 164*cdf0e10cSrcweir HRESULT Cleanup(); 165*cdf0e10cSrcweir HRESULT TerminateOffice(); 166*cdf0e10cSrcweir HRESULT GetURL( const OLECHAR* url, 167*cdf0e10cSrcweir const OLECHAR* target ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir void CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* pbsc, BYTE* pBytes, DWORD dwSize ); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir SOVersion GetVersionConnected(); 173*cdf0e10cSrcweir }; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir #endif //__SOACTIVEX_H_ 176*cdf0e10cSrcweir 177