Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / extensions / source / activex / SOActiveX.h
blob04055eaf74df356c9ef89f5b865cd7ef4ed773f7
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 INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIVEX_H
23 #define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_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 #if defined __clang__
37 #pragma clang diagnostic push
38 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
39 #endif
40 #include "so_activex.h"
41 #if defined __clang__
42 #pragma clang diagnostic pop
43 #endif
45 #pragma warning (pop)
47 class SODispatchInterceptor;
49 enum SOVersion {
50 SO_NOT_DETECTED = 0,
51 SO_52,
52 SO_60,
53 SO_61,
54 SO_UNKNOWN,
55 OO_10,
56 OO_11,
57 OO_UNKNOWN
61 // CSOActiveX
62 class ATL_NO_VTABLE CSOActiveX :
63 public CComObjectRootEx<CComSingleThreadModel>,
64 public IDispatchImpl<ISOActiveX, &IID_ISOActiveX, &LIBID_SO_ACTIVEXLib>,
65 public CComControl<CSOActiveX>,
66 public IPersistStreamInitImpl<CSOActiveX>,
67 public IOleControlImpl<CSOActiveX>,
68 public IOleObjectImpl<CSOActiveX>,
69 public IOleInPlaceActiveObjectImpl<CSOActiveX>,
70 public IViewObjectExImpl<CSOActiveX>,
71 public IOleInPlaceObjectWindowlessImpl<CSOActiveX>,
72 // public IConnectionPointContainerImpl<CSOActiveX>,
73 public CComCoClass<CSOActiveX, &CLSID_SOActiveX>,
74 // public CProxy_ItryPluginEvents< CSOActiveX >,
75 public IPersistPropertyBagImpl< CSOActiveX >,
76 public IProvideClassInfo2Impl< &CLSID_SOActiveX,
77 &DIID__ISOActiveXEvents,
78 &LIBID_SO_ACTIVEXLib >,
79 public IObjectSafetyImpl< CSOActiveX,
80 INTERFACESAFE_FOR_UNTRUSTED_DATA >
82 protected:
83 CComPtr<IWebBrowser2> mWebBrowser2;
84 DWORD mCookie;
86 CComPtr<IDispatch> mpDispFactory;
87 CComPtr<IDispatch> mpDispFrame;
88 CComPtr<IDispatch> mpInstanceLocker;
89 CComPtr<IDispatch> mpDispWin;
90 OLECHAR const * mCurFileUrl;
91 BOOL mbLoad;
92 BOOL mbViewOnly;
93 WNDCLASS mPWinClass;
94 HWND mParentWin;
95 HWND mOffWin;
97 SODispatchInterceptor* mpDispatchInterceptor;
98 SOVersion mnVersion;
100 BOOL mbReadyForActivation;
101 CComPtr<IDispatch> mpDispTempFile;
103 BOOL mbDrawLocked;
105 public:
106 CSOActiveX();
107 ~CSOActiveX() override;
109 DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX)
111 DECLARE_PROTECT_FINAL_CONSTRUCT()
113 BEGIN_COM_MAP(CSOActiveX)
114 COM_INTERFACE_ENTRY(ISOActiveX)
115 COM_INTERFACE_ENTRY(IDispatch)
116 COM_INTERFACE_ENTRY(IViewObjectEx)
117 COM_INTERFACE_ENTRY(IViewObject2)
118 COM_INTERFACE_ENTRY(IViewObject)
119 COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
120 COM_INTERFACE_ENTRY(IOleInPlaceObject)
121 COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
122 COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
123 COM_INTERFACE_ENTRY(IOleControl)
124 COM_INTERFACE_ENTRY(IOleObject)
125 COM_INTERFACE_ENTRY(IPersistStreamInit)
126 COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
127 // COM_INTERFACE_ENTRY(IConnectionPointContainer)
128 COM_INTERFACE_ENTRY(IProvideClassInfo)
129 COM_INTERFACE_ENTRY(IProvideClassInfo2)
130 COM_INTERFACE_ENTRY(IPersistPropertyBag)
131 COM_INTERFACE_ENTRY(IObjectSafety)
132 #if defined __clang__
133 #pragma clang diagnostic push
134 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
135 #endif
136 END_COM_MAP()
137 #if defined __clang__
138 #pragma clang diagnostic pop
139 #endif
141 #if defined __clang__
142 #pragma clang diagnostic push
143 #pragma clang diagnostic ignored "-Winvalid-offsetof"
144 // offset of on non-standard-layout type '_PropMapClass' (aka 'CSOActiveX'),
145 // expanded from macro 'PROP_DATA_ENTRY'
146 #endif
147 BEGIN_PROP_MAP(CSOActiveX)
148 PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
149 PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
150 // Example entries
151 // PROP_ENTRY("Property Description", dispid, clsid)
152 // PROP_PAGE(CLSID_StockColorPage)
153 END_PROP_MAP()
154 #if defined __clang__
155 #pragma clang diagnostic pop
156 #endif
158 BEGIN_CONNECTION_POINT_MAP(CSOActiveX)
159 END_CONNECTION_POINT_MAP()
161 #if defined __clang__
162 #pragma clang diagnostic push
163 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
164 #endif
165 BEGIN_MSG_MAP(CSOActiveX)
166 #if defined __clang__
167 #pragma clang diagnostic pop
168 #endif
169 CHAIN_MSG_MAP(CComControl<CSOActiveX>)
170 DEFAULT_REFLECTION_HANDLER()
171 END_MSG_MAP()
172 // Handler prototypes:
173 // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
174 // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
175 // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
179 // IViewObjectEx
180 static DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
182 // ISOActiveX
183 public:
185 STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ) override;
186 STDMETHOD(Invoke)( DISPID dispidMember,
187 REFIID riid,
188 LCID lcid,
189 WORD wFlags,
190 DISPPARAMS* pDispParams,
191 VARIANT* pvarResult,
192 EXCEPINFO* pExcepInfo,
193 UINT* puArgErr) override;
194 STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ) override;
195 STDMETHOD(Load) ( LPSTREAM pStm ) override;
196 STDMETHOD(InitNew) () override;
197 HRESULT OnDrawAdvanced(ATL_DRAWINFO& di) override;
198 HRESULT OnDraw(ATL_DRAWINFO& di) override;
200 HRESULT SetLayoutManagerProps();
201 HRESULT CreateFrameOldWay( HWND hwnd, int width, int height );
202 HRESULT GetUnoStruct( OLECHAR const * sStructName, CComPtr<IDispatch>& pdispResult );
203 HRESULT LoadURLToFrame();
204 HRESULT CallDispatchMethod( OLECHAR const * sUrl, CComVariant* sArgNames, CComVariant* sArgVal, unsigned int count );
205 HRESULT CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal );
206 HRESULT GetUrlStruct( OLECHAR const * sUrl, CComPtr<IDispatch>& pdispUrl );
207 HRESULT Cleanup();
208 HRESULT TerminateOffice();
209 HRESULT GetURL( const OLECHAR* url,
210 const OLECHAR* target );
212 void CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* pbsc, BYTE* pBytes, DWORD dwSize );
215 SOVersion GetVersionConnected();
218 #endif
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */