LibreOffice Module extensions (master) 1
SOActiveX.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20// SOActiveX.h : Declaration of the CSOActiveX
21
22#pragma once
23
24#include "resource.h"
25
26#include <ExDispID.h>
27#include <ExDisp.h>
28#include <shlguid.h>
29
30#include <atlctl.h>
31
32#include <so_activex.h>
33
35
45};
46
47
48// CSOActiveX
49class 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 >
68{
69protected:
70 CComPtr<IWebBrowser2> mWebBrowser2;
71 DWORD mCookie;
72
73 CComPtr<IDispatch> mpDispFactory;
74 CComPtr<IDispatch> mpDispFrame;
75 CComPtr<IDispatch> mpInstanceLocker;
76 CComPtr<IDispatch> mpDispWin;
77 CComBSTR mCurFileUrl;
80 WNDCLASSW mPWinClass;
82 HWND mOffWin;
83
86
88 CComPtr<IDispatch> mpDispTempFile;
89
91
92public:
93 CSOActiveX();
94 ~CSOActiveX() override;
95
96DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX)
97
98DECLARE_PROTECT_FINAL_CONSTRUCT()
99
100BEGIN_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
123END_COM_MAP()
124#if defined __clang__
125#pragma clang diagnostic pop
126#endif
127
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
134BEGIN_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)
140END_PROP_MAP()
141#if defined __clang__
142#pragma clang diagnostic pop
143#endif
144
145BEGIN_CONNECTION_POINT_MAP(CSOActiveX)
146END_CONNECTION_POINT_MAP()
147
148#if defined __clang__
149#pragma clang diagnostic push
150#pragma clang diagnostic ignored "-Winconsistent-missing-override"
151#endif
152BEGIN_MSG_MAP(CSOActiveX)
153#if defined __clang__
154#pragma clang diagnostic pop
155#endif
156 CHAIN_MSG_MAP(CComControl<CSOActiveX>)
157 DEFAULT_REFLECTION_HANDLER()
158END_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);
163
164
165
166// IViewObjectEx
167 static DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
168
169// ISOActiveX
170public:
171
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;
186
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 );
198
199 void CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* pbsc, BYTE* pBytes, DWORD dwSize );
200
201
202 SOVersion GetVersionConnected();
203};
204
205/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SOVersion
Definition: SOActiveX.h:36
@ OO_11
Definition: SOActiveX.h:43
@ SO_UNKNOWN
Definition: SOActiveX.h:41
@ OO_UNKNOWN
Definition: SOActiveX.h:44
@ SO_52
Definition: SOActiveX.h:38
@ OO_10
Definition: SOActiveX.h:42
@ SO_61
Definition: SOActiveX.h:40
@ SO_60
Definition: SOActiveX.h:39
@ SO_NOT_DETECTED
Definition: SOActiveX.h:37
CComPtr< IDispatch > mpInstanceLocker
Definition: SOActiveX.h:75
SODispatchInterceptor * mpDispatchInterceptor
Definition: SOActiveX.h:84
BOOL mbLoad
Definition: SOActiveX.h:78
BOOL mbViewOnly
Definition: SOActiveX.h:79
CComPtr< IDispatch > mpDispFactory
Definition: SOActiveX.h:73
DWORD mCookie
Definition: SOActiveX.h:71
HWND mOffWin
Definition: SOActiveX.h:82
bool mbDrawLocked
Definition: SOActiveX.h:90
CComBSTR mCurFileUrl
Definition: SOActiveX.h:77
CComPtr< IDispatch > mpDispTempFile
Definition: SOActiveX.h:88
HWND mParentWin
Definition: SOActiveX.h:81
SOVersion mnVersion
Definition: SOActiveX.h:85
CComPtr< IWebBrowser2 > mWebBrowser2
Definition: SOActiveX.h:70
CComPtr< IDispatch > mpDispFrame
Definition: SOActiveX.h:74
WNDCLASSW mPWinClass
Definition: SOActiveX.h:80
CComPtr< IDispatch > mpDispWin
Definition: SOActiveX.h:76
BOOL mbReadyForActivation
Definition: SOActiveX.h:87
unsigned short WORD
const wchar_t *typedef BOOL
#define IDR_SOACTIVEX
Definition: resource.h:26
unsigned char BYTE