bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / activex / SOActiveX.h
blob515b0ee5d2e5f8c532d52732ef9c1fdafb09f5b0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 // SOActiveX.h : Declaration of the CSOActiveX
22 #ifndef __SOACTIVEX_H_
23 #define __SOACTIVEX_H_
25 #include "resource.h"
27 #pragma warning (push,1)
28 #pragma warning (disable:4265)
30 #include <ExDispID.h>
31 #include <ExDisp.h>
32 #include <shlguid.h>
34 #include <atlctl.h>
36 #include "so_activex.h"
38 #pragma warning (pop)
40 class SODispatchInterceptor;
42 enum SOVersion {
43 SO_NOT_DETECTED = 0,
44 SO_52,
45 SO_60,
46 SO_61,
47 SO_UNKNOWN,
48 OO_10,
49 OO_11,
50 OO_UNKNOWN
54 // CSOActiveX
55 class ATL_NO_VTABLE CSOActiveX :
56 public CComObjectRootEx<CComSingleThreadModel>,
57 public IDispatchImpl<ISOActiveX, &IID_ISOActiveX, &LIBID_SO_ACTIVEXLib>,
58 public CComControl<CSOActiveX>,
59 public IPersistStreamInitImpl<CSOActiveX>,
60 public IOleControlImpl<CSOActiveX>,
61 public IOleObjectImpl<CSOActiveX>,
62 public IOleInPlaceActiveObjectImpl<CSOActiveX>,
63 public IViewObjectExImpl<CSOActiveX>,
64 public IOleInPlaceObjectWindowlessImpl<CSOActiveX>,
65 // public IConnectionPointContainerImpl<CSOActiveX>,
66 public CComCoClass<CSOActiveX, &CLSID_SOActiveX>,
67 // public CProxy_ItryPluginEvents< CSOActiveX >,
68 public IPersistPropertyBagImpl< CSOActiveX >,
69 public IProvideClassInfo2Impl< &CLSID_SOActiveX,
70 &DIID__ISOActiveXEvents,
71 &LIBID_SO_ACTIVEXLib >,
72 public IObjectSafetyImpl< CSOActiveX,
73 INTERFACESAFE_FOR_UNTRUSTED_DATA >
75 protected:
76 CComPtr<IWebBrowser2> mWebBrowser2;
77 DWORD mCookie;
79 CComPtr<IDispatch> mpDispFactory;
80 CComPtr<IDispatch> mpDispFrame;
81 CComPtr<IDispatch> mpInstanceLocker;
82 CComPtr<IDispatch> mpDispWin;
83 OLECHAR* mCurFileUrl;
84 BOOL mbLoad;
85 BOOL mbViewOnly;
86 WNDCLASS mPWinClass;
87 HWND mParentWin;
88 HWND mOffWin;
90 SODispatchInterceptor* mpDispatchInterceptor;
91 SOVersion mnVersion;
93 BOOL mbReadyForActivation;
94 CComPtr<IDispatch> mpDispTempFile;
96 BOOL mbDrawLocked;
98 public:
99 CSOActiveX();
100 ~CSOActiveX();
102 DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX)
104 DECLARE_PROTECT_FINAL_CONSTRUCT()
106 BEGIN_COM_MAP(CSOActiveX)
107 COM_INTERFACE_ENTRY(ISOActiveX)
108 COM_INTERFACE_ENTRY(IDispatch)
109 COM_INTERFACE_ENTRY(IViewObjectEx)
110 COM_INTERFACE_ENTRY(IViewObject2)
111 COM_INTERFACE_ENTRY(IViewObject)
112 COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
113 COM_INTERFACE_ENTRY(IOleInPlaceObject)
114 COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
115 COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
116 COM_INTERFACE_ENTRY(IOleControl)
117 COM_INTERFACE_ENTRY(IOleObject)
118 COM_INTERFACE_ENTRY(IPersistStreamInit)
119 COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
120 // COM_INTERFACE_ENTRY(IConnectionPointContainer)
121 COM_INTERFACE_ENTRY(IProvideClassInfo)
122 COM_INTERFACE_ENTRY(IProvideClassInfo2)
123 COM_INTERFACE_ENTRY(IPersistPropertyBag)
124 COM_INTERFACE_ENTRY(IObjectSafety)
125 END_COM_MAP()
127 BEGIN_PROP_MAP(CSOActiveX)
128 PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
129 PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
130 // Example entries
131 // PROP_ENTRY("Property Description", dispid, clsid)
132 // PROP_PAGE(CLSID_StockColorPage)
133 END_PROP_MAP()
135 BEGIN_CONNECTION_POINT_MAP(CSOActiveX)
136 END_CONNECTION_POINT_MAP()
138 BEGIN_MSG_MAP(CSOActiveX)
139 CHAIN_MSG_MAP(CComControl<CSOActiveX>)
140 DEFAULT_REFLECTION_HANDLER()
141 END_MSG_MAP()
142 // Handler prototypes:
143 // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
144 // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
145 // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
149 // IViewObjectEx
150 DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
152 // ISOActiveX
153 public:
155 STDMETHOD(SetClientSite)( IOleClientSite* aClientSite );
156 STDMETHOD(Invoke)( DISPID dispidMember,
157 REFIID riid,
158 LCID lcid,
159 WORD wFlags,
160 DISPPARAMS* pDispParams,
161 VARIANT* pvarResult,
162 EXCEPINFO* pExcepInfo,
163 UINT* puArgErr);
164 STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog );
165 STDMETHOD(Load) ( LPSTREAM pStm );
166 STDMETHOD(InitNew) ();
167 HRESULT OnDrawAdvanced(ATL_DRAWINFO& di);
168 HRESULT OnDraw(ATL_DRAWINFO& di);
170 HRESULT SetLayoutManagerProps();
171 HRESULT CreateFrameOldWay( HWND hwnd, int width, int height );
172 HRESULT GetUnoStruct( OLECHAR* sStructName, CComPtr<IDispatch>& pdispResult );
173 HRESULT LoadURLToFrame();
174 HRESULT CallDispatchMethod( OLECHAR* sUrl, CComVariant* sArgNames, CComVariant* sArgVal, unsigned int count );
175 HRESULT CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal );
176 HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl );
177 HRESULT Cleanup();
178 HRESULT TerminateOffice();
179 HRESULT GetURL( const OLECHAR* url,
180 const OLECHAR* target );
182 void CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* pbsc, BYTE* pBytes, DWORD dwSize );
185 SOVersion GetVersionConnected();
188 #endif //__SOACTIVEX_H_
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */