1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * The Contents of this file are made available subject to the terms of 4*cdf0e10cSrcweir * the BSD license. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 7*cdf0e10cSrcweir * All rights reserved. 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * Redistribution and use in source and binary forms, with or without 10*cdf0e10cSrcweir * modification, are permitted provided that the following conditions 11*cdf0e10cSrcweir * are met: 12*cdf0e10cSrcweir * 1. Redistributions of source code must retain the above copyright 13*cdf0e10cSrcweir * notice, this list of conditions and the following disclaimer. 14*cdf0e10cSrcweir * 2. Redistributions in binary form must reproduce the above copyright 15*cdf0e10cSrcweir * notice, this list of conditions and the following disclaimer in the 16*cdf0e10cSrcweir * documentation and/or other materials provided with the distribution. 17*cdf0e10cSrcweir * 3. Neither the name of Sun Microsystems, Inc. nor the names of its 18*cdf0e10cSrcweir * contributors may be used to endorse or promote products derived 19*cdf0e10cSrcweir * from this software without specific prior written permission. 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22*cdf0e10cSrcweir * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23*cdf0e10cSrcweir * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24*cdf0e10cSrcweir * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25*cdf0e10cSrcweir * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26*cdf0e10cSrcweir * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27*cdf0e10cSrcweir * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 28*cdf0e10cSrcweir * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29*cdf0e10cSrcweir * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 30*cdf0e10cSrcweir * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 31*cdf0e10cSrcweir * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32*cdf0e10cSrcweir * 33*cdf0e10cSrcweir *************************************************************************/ 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir // SOActiveX.h : Declaration of the CSOActiveX 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #ifndef __SOACTIVEX_H_ 38*cdf0e10cSrcweir #define __SOACTIVEX_H_ 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "resource.h" // main symbols 41*cdf0e10cSrcweir #include <ExDispID.h> 42*cdf0e10cSrcweir #include <ExDisp.h> 43*cdf0e10cSrcweir #include <shlguid.h> 44*cdf0e10cSrcweir #include <atlctl.h> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #include "so_activex.h" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////// 49*cdf0e10cSrcweir // CSOActiveX 50*cdf0e10cSrcweir class ATL_NO_VTABLE CSOActiveX : 51*cdf0e10cSrcweir public CComObjectRootEx<CComSingleThreadModel>, 52*cdf0e10cSrcweir public IDispatchImpl<ISOActiveX, &IID_ISOActiveX, &LIBID_SO_ACTIVEXLib>, 53*cdf0e10cSrcweir public CComControl<CSOActiveX>, 54*cdf0e10cSrcweir public IPersistStreamInitImpl<CSOActiveX>, 55*cdf0e10cSrcweir public IOleControlImpl<CSOActiveX>, 56*cdf0e10cSrcweir public IOleObjectImpl<CSOActiveX>, 57*cdf0e10cSrcweir public IOleInPlaceActiveObjectImpl<CSOActiveX>, 58*cdf0e10cSrcweir public IViewObjectExImpl<CSOActiveX>, 59*cdf0e10cSrcweir public IOleInPlaceObjectWindowlessImpl<CSOActiveX>, 60*cdf0e10cSrcweir // public IConnectionPointContainerImpl<CSOActiveX>, 61*cdf0e10cSrcweir public CComCoClass<CSOActiveX, &CLSID_SOActiveX>, 62*cdf0e10cSrcweir // public CProxy_ItryPluginEvents< CSOActiveX >, 63*cdf0e10cSrcweir public IPersistPropertyBagImpl< CSOActiveX >, 64*cdf0e10cSrcweir public IProvideClassInfo2Impl< &CLSID_SOActiveX, 65*cdf0e10cSrcweir &DIID__ISOActiveXEvents, 66*cdf0e10cSrcweir &LIBID_SO_ACTIVEXLib >, 67*cdf0e10cSrcweir public IObjectSafetyImpl< CSOActiveX, 68*cdf0e10cSrcweir INTERFACESAFE_FOR_UNTRUSTED_DATA > 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir protected: 71*cdf0e10cSrcweir CComPtr<IWebBrowser2> mWebBrowser2; 72*cdf0e10cSrcweir DWORD mCookie; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir CComPtr<IDispatch> mpDispFactory; 75*cdf0e10cSrcweir CComPtr<IDispatch> mpDispFrame; 76*cdf0e10cSrcweir CComPtr<IDispatch> mpDispWin; 77*cdf0e10cSrcweir OLECHAR* mCurFileUrl; 78*cdf0e10cSrcweir BOOL mbLoad; 79*cdf0e10cSrcweir BOOL mbViewOnly; 80*cdf0e10cSrcweir WNDCLASS mPWinClass; 81*cdf0e10cSrcweir HWND mParentWin; 82*cdf0e10cSrcweir HWND mOffWin; 83*cdf0e10cSrcweir public: 84*cdf0e10cSrcweir CSOActiveX(); 85*cdf0e10cSrcweir ~CSOActiveX(); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX) 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir DECLARE_PROTECT_FINAL_CONSTRUCT() 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir BEGIN_COM_MAP(CSOActiveX) 92*cdf0e10cSrcweir COM_INTERFACE_ENTRY(ISOActiveX) 93*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IDispatch) 94*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IViewObjectEx) 95*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IViewObject2) 96*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IViewObject) 97*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) 98*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleInPlaceObject) 99*cdf0e10cSrcweir COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) 100*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) 101*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleControl) 102*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IOleObject) 103*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IPersistStreamInit) 104*cdf0e10cSrcweir COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) 105*cdf0e10cSrcweir // COM_INTERFACE_ENTRY(IConnectionPointContainer) 106*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IProvideClassInfo) 107*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IProvideClassInfo2) 108*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IPersistPropertyBag) 109*cdf0e10cSrcweir COM_INTERFACE_ENTRY(IObjectSafety) 110*cdf0e10cSrcweir END_COM_MAP() 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir BEGIN_PROP_MAP(CSOActiveX) 113*cdf0e10cSrcweir PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) 114*cdf0e10cSrcweir PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) 115*cdf0e10cSrcweir // Example entries 116*cdf0e10cSrcweir // PROP_ENTRY("Property Description", dispid, clsid) 117*cdf0e10cSrcweir // PROP_PAGE(CLSID_StockColorPage) 118*cdf0e10cSrcweir END_PROP_MAP() 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir BEGIN_CONNECTION_POINT_MAP(CSOActiveX) 121*cdf0e10cSrcweir END_CONNECTION_POINT_MAP() 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir BEGIN_MSG_MAP(CSOActiveX) 124*cdf0e10cSrcweir CHAIN_MSG_MAP(CComControl<CSOActiveX>) 125*cdf0e10cSrcweir DEFAULT_REFLECTION_HANDLER() 126*cdf0e10cSrcweir END_MSG_MAP() 127*cdf0e10cSrcweir // Handler prototypes: 128*cdf0e10cSrcweir // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 129*cdf0e10cSrcweir // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); 130*cdf0e10cSrcweir // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // IViewObjectEx 135*cdf0e10cSrcweir DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE) 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir // ISOActiveX 138*cdf0e10cSrcweir public: 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ); 141*cdf0e10cSrcweir STDMETHOD(Invoke)( DISPID dispidMember, 142*cdf0e10cSrcweir REFIID riid, 143*cdf0e10cSrcweir LCID lcid, 144*cdf0e10cSrcweir WORD wFlags, 145*cdf0e10cSrcweir DISPPARAMS* pDispParams, 146*cdf0e10cSrcweir VARIANT* pvarResult, 147*cdf0e10cSrcweir EXCEPINFO* pExcepInfo, 148*cdf0e10cSrcweir UINT* puArgErr); 149*cdf0e10cSrcweir STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ); 150*cdf0e10cSrcweir STDMETHOD(Load) ( LPSTREAM pStm ); 151*cdf0e10cSrcweir STDMETHOD(InitNew) (); 152*cdf0e10cSrcweir HRESULT OnDrawAdvanced(ATL_DRAWINFO& di); 153*cdf0e10cSrcweir HRESULT OnDraw(ATL_DRAWINFO& di) { return S_OK; } 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir HRESULT CreateFrameOldWay( HWND hwnd, int width, int height ); 156*cdf0e10cSrcweir HRESULT GetUnoStruct( OLECHAR* sStructName, CComPtr<IDispatch>& pdispResult ); 157*cdf0e10cSrcweir HRESULT LoadURLToFrame(); 158*cdf0e10cSrcweir HRESULT ShowSomeBars(); 159*cdf0e10cSrcweir HRESULT HideAllBars(); 160*cdf0e10cSrcweir HRESULT CallDispatch1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal ); 161*cdf0e10cSrcweir HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl ); 162*cdf0e10cSrcweir HRESULT Cleanup(); 163*cdf0e10cSrcweir }; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir #endif //__SOACTIVEX_H_ 166*cdf0e10cSrcweir 167