1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski // SOActiveX.h : Declaration of the CSOActiveX 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielski #ifndef __SOACTIVEX_H_ 27*b1cdbd2cSJim Jagielski #define __SOACTIVEX_H_ 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski #include "resource.h" // main symbols 30*b1cdbd2cSJim Jagielski #include <ExDispID.h> 31*b1cdbd2cSJim Jagielski #include <ExDisp.h> 32*b1cdbd2cSJim Jagielski #include <shlguid.h> 33*b1cdbd2cSJim Jagielski #include <atlctl.h> 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski #include "so_activex.h" 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski ///////////////////////////////////////////////////////////////////////////// 38*b1cdbd2cSJim Jagielski // CSOActiveX 39*b1cdbd2cSJim Jagielski class ATL_NO_VTABLE CSOActiveX : 40*b1cdbd2cSJim Jagielski public CComObjectRootEx<CComSingleThreadModel>, 41*b1cdbd2cSJim Jagielski public IDispatchImpl<ISOActiveX, &IID_ISOActiveX, &LIBID_SO_ACTIVEXLib>, 42*b1cdbd2cSJim Jagielski public CComControl<CSOActiveX>, 43*b1cdbd2cSJim Jagielski public IPersistStreamInitImpl<CSOActiveX>, 44*b1cdbd2cSJim Jagielski public IOleControlImpl<CSOActiveX>, 45*b1cdbd2cSJim Jagielski public IOleObjectImpl<CSOActiveX>, 46*b1cdbd2cSJim Jagielski public IOleInPlaceActiveObjectImpl<CSOActiveX>, 47*b1cdbd2cSJim Jagielski public IViewObjectExImpl<CSOActiveX>, 48*b1cdbd2cSJim Jagielski public IOleInPlaceObjectWindowlessImpl<CSOActiveX>, 49*b1cdbd2cSJim Jagielski // public IConnectionPointContainerImpl<CSOActiveX>, 50*b1cdbd2cSJim Jagielski public CComCoClass<CSOActiveX, &CLSID_SOActiveX>, 51*b1cdbd2cSJim Jagielski // public CProxy_ItryPluginEvents< CSOActiveX >, 52*b1cdbd2cSJim Jagielski public IPersistPropertyBagImpl< CSOActiveX >, 53*b1cdbd2cSJim Jagielski public IProvideClassInfo2Impl< &CLSID_SOActiveX, 54*b1cdbd2cSJim Jagielski &DIID__ISOActiveXEvents, 55*b1cdbd2cSJim Jagielski &LIBID_SO_ACTIVEXLib >, 56*b1cdbd2cSJim Jagielski public IObjectSafetyImpl< CSOActiveX, 57*b1cdbd2cSJim Jagielski INTERFACESAFE_FOR_UNTRUSTED_DATA > 58*b1cdbd2cSJim Jagielski { 59*b1cdbd2cSJim Jagielski protected: 60*b1cdbd2cSJim Jagielski CComPtr<IWebBrowser2> mWebBrowser2; 61*b1cdbd2cSJim Jagielski DWORD mCookie; 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski CComPtr<IDispatch> mpDispFactory; 64*b1cdbd2cSJim Jagielski CComPtr<IDispatch> mpDispFrame; 65*b1cdbd2cSJim Jagielski CComPtr<IDispatch> mpDispWin; 66*b1cdbd2cSJim Jagielski OLECHAR* mCurFileUrl; 67*b1cdbd2cSJim Jagielski BOOL mbLoad; 68*b1cdbd2cSJim Jagielski BOOL mbViewOnly; 69*b1cdbd2cSJim Jagielski WNDCLASS mPWinClass; 70*b1cdbd2cSJim Jagielski HWND mParentWin; 71*b1cdbd2cSJim Jagielski HWND mOffWin; 72*b1cdbd2cSJim Jagielski public: 73*b1cdbd2cSJim Jagielski CSOActiveX(); 74*b1cdbd2cSJim Jagielski ~CSOActiveX(); 75*b1cdbd2cSJim Jagielski 76*b1cdbd2cSJim Jagielski DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX) 77*b1cdbd2cSJim Jagielski 78*b1cdbd2cSJim Jagielski DECLARE_PROTECT_FINAL_CONSTRUCT() 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski BEGIN_COM_MAP(CSOActiveX) 81*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(ISOActiveX) 82*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IDispatch) 83*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IViewObjectEx) 84*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IViewObject2) 85*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IViewObject) 86*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) 87*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IOleInPlaceObject) 88*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) 89*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) 90*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IOleControl) 91*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IOleObject) 92*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IPersistStreamInit) 93*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) 94*b1cdbd2cSJim Jagielski // COM_INTERFACE_ENTRY(IConnectionPointContainer) 95*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IProvideClassInfo) 96*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IProvideClassInfo2) 97*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IPersistPropertyBag) 98*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IObjectSafety) 99*b1cdbd2cSJim Jagielski END_COM_MAP() 100*b1cdbd2cSJim Jagielski 101*b1cdbd2cSJim Jagielski BEGIN_PROP_MAP(CSOActiveX) 102*b1cdbd2cSJim Jagielski PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) 103*b1cdbd2cSJim Jagielski PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) 104*b1cdbd2cSJim Jagielski // Example entries 105*b1cdbd2cSJim Jagielski // PROP_ENTRY("Property Description", dispid, clsid) 106*b1cdbd2cSJim Jagielski // PROP_PAGE(CLSID_StockColorPage) 107*b1cdbd2cSJim Jagielski END_PROP_MAP() 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski BEGIN_CONNECTION_POINT_MAP(CSOActiveX) 110*b1cdbd2cSJim Jagielski END_CONNECTION_POINT_MAP() 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski BEGIN_MSG_MAP(CSOActiveX) 113*b1cdbd2cSJim Jagielski CHAIN_MSG_MAP(CComControl<CSOActiveX>) 114*b1cdbd2cSJim Jagielski DEFAULT_REFLECTION_HANDLER() 115*b1cdbd2cSJim Jagielski END_MSG_MAP() 116*b1cdbd2cSJim Jagielski // Handler prototypes: 117*b1cdbd2cSJim Jagielski // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 118*b1cdbd2cSJim Jagielski // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 119*b1cdbd2cSJim Jagielski // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski // IViewObjectEx 124*b1cdbd2cSJim Jagielski DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE) 125*b1cdbd2cSJim Jagielski 126*b1cdbd2cSJim Jagielski // ISOActiveX 127*b1cdbd2cSJim Jagielski public: 128*b1cdbd2cSJim Jagielski 129*b1cdbd2cSJim Jagielski STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ); 130*b1cdbd2cSJim Jagielski STDMETHOD(Invoke)( DISPID dispidMember, 131*b1cdbd2cSJim Jagielski REFIID riid, 132*b1cdbd2cSJim Jagielski LCID lcid, 133*b1cdbd2cSJim Jagielski WORD wFlags, 134*b1cdbd2cSJim Jagielski DISPPARAMS* pDispParams, 135*b1cdbd2cSJim Jagielski VARIANT* pvarResult, 136*b1cdbd2cSJim Jagielski EXCEPINFO* pExcepInfo, 137*b1cdbd2cSJim Jagielski UINT* puArgErr); 138*b1cdbd2cSJim Jagielski STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ); 139*b1cdbd2cSJim Jagielski STDMETHOD(Load) ( LPSTREAM pStm ); 140*b1cdbd2cSJim Jagielski STDMETHOD(InitNew) (); 141*b1cdbd2cSJim Jagielski HRESULT OnDrawAdvanced(ATL_DRAWINFO& di); OnDraw(ATL_DRAWINFO & di)142*b1cdbd2cSJim Jagielski HRESULT OnDraw(ATL_DRAWINFO& di) { return S_OK; } 143*b1cdbd2cSJim Jagielski 144*b1cdbd2cSJim Jagielski HRESULT CreateFrameOldWay( HWND hwnd, int width, int height ); 145*b1cdbd2cSJim Jagielski HRESULT GetUnoStruct( OLECHAR* sStructName, CComPtr<IDispatch>& pdispResult ); 146*b1cdbd2cSJim Jagielski HRESULT LoadURLToFrame(); 147*b1cdbd2cSJim Jagielski HRESULT ShowSomeBars(); 148*b1cdbd2cSJim Jagielski HRESULT HideAllBars(); 149*b1cdbd2cSJim Jagielski HRESULT CallDispatch1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal ); 150*b1cdbd2cSJim Jagielski HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl ); 151*b1cdbd2cSJim Jagielski HRESULT Cleanup(); 152*b1cdbd2cSJim Jagielski }; 153*b1cdbd2cSJim Jagielski 154*b1cdbd2cSJim Jagielski #endif //__SOACTIVEX_H_ 155*b1cdbd2cSJim Jagielski 156