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