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