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