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