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