Qt 4.8
qaxwidget.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the ActiveQt framework of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
10 **
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
13 ** met:
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
19 ** distribution.
20 ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 ** of its contributors may be used to endorse or promote products derived
22 ** from this software without specific prior written permission.
23 **
24 **
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #include "qaxwidget.h"
42 
43 #ifndef QT_NO_WIN_ACTIVEQT
44 
45 #include <ActiveQt/qaxaggregated.h>
46 
48 #include <qapplication.h>
49 #include <private/qapplication_p.h>
50 #include <qdockwidget.h>
51 #include <qevent.h>
52 #include <qlayout.h>
53 #include <qmainwindow.h>
54 #include <qmenu.h>
55 #include <qmenubar.h>
56 #include <qmetaobject.h>
57 #include <qpainter.h>
58 #include <qpointer.h>
59 #include <qregexp.h>
60 #include <quuid.h>
61 #include <qwhatsthis.h>
62 
63 #include <windowsx.h>
64 #include <ocidl.h>
65 #include <olectl.h>
66 #include <docobj.h>
67 
68 // #define QAX_DEBUG
69 
70 #ifdef QAX_DEBUG
71 #define AX_DEBUG(x) qDebug(#x);
72 #else
73 #define AX_DEBUG(x);
74 #endif
75 
76 // #define QAX_SUPPORT_WINDOWLESS
77 // #define QAX_SUPPORT_BORDERSPACE
78 
79 // missing interface from win32api
80 #if defined(Q_CC_GNU) && !defined(__MINGW64_VERSION_MAJOR)
81  DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject)
82  {
83  STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
84  STDMETHOD_(ULONG,AddRef)(THIS) PURE;
85  STDMETHOD_(ULONG,Release)(THIS) PURE;
86  STDMETHOD(GetWindow)(THIS_ HWND*) PURE;
87  STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE;
88  STDMETHOD(InPlaceDeactivate)(THIS) PURE;
89  STDMETHOD(UIDeactivate)(THIS) PURE;
90  STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE;
91  STDMETHOD(ReactivateAndUndo)(THIS) PURE;
92  STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE;
93  STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE;
94  };
95 #endif
96 
97 #include "../shared/qaxtypes.h"
98 
100 
101 /* \class QAxHostWidget
102  \brief The QAxHostWidget class is the actual container widget.
103 
104  \internal
105 */
106 class QAxHostWidget : public QWidget
107 {
108  friend class QAxClientSite;
109 public:
112  ~QAxHostWidget();
113 
114  QSize sizeHint() const;
115  QSize minimumSizeHint() const;
116 
117  int qt_metacall(QMetaObject::Call, int isignal, void **argv);
118  void* qt_metacast(const char *clname);
119 
120  inline QAxClientSite *clientSite() const
121  {
122  return axhost;
123  }
124 
125 protected:
126  bool winEvent(MSG *msg, long *result);
127  bool event(QEvent *e);
128  bool eventFilter(QObject *o, QEvent *e);
129  void resizeEvent(QResizeEvent *e);
130  void focusInEvent(QFocusEvent *e);
131  void focusOutEvent(QFocusEvent *e);
132  void paintEvent(QPaintEvent *e);
133  void showEvent(QShowEvent *e);
135  {
136  return 0;
137  }
138 
139 private:
140  void resizeObject();
141 
143  bool hasFocus;
145 };
146 
147 /* \class QAxClientSite
148  \brief The QAxClientSite class implements the client site interfaces.
149 
150  \internal
151 */
152 class QAxClientSite : public IDispatch,
153  public IOleClientSite,
154  public IOleControlSite,
155 #ifdef QAX_SUPPORT_WINDOWLESS
156  public IOleInPlaceSiteWindowless,
157 #else
158  public IOleInPlaceSite,
159 #endif
160  public IOleInPlaceFrame,
161  public IOleDocumentSite,
162  public IAdviseSink
163 {
164  friend class QAxHostWidget;
165 public:
167  virtual ~QAxClientSite();
168 
169  bool activateObject(bool initialized, const QByteArray &data);
170 
171  void releaseAll();
172  void deactivate();
173  inline void reset(QWidget *p)
174  {
175  if (widget == p)
176  widget = 0;
177  else if (host == p)
178  host = 0;
179  }
180 
181  inline IOleInPlaceActiveObject *inPlaceObject() const
182  {
183  return m_spInPlaceActiveObject;
184  }
185 
186  inline HRESULT doVerb(LONG index)
187  {
188  if (!m_spOleObject)
189  return E_NOTIMPL;
190  if (!host)
191  return OLE_E_NOT_INPLACEACTIVE;
192 
193  RECT rcPos = { host->x(), host->y(), host->x()+host->width(), host->y()+host->height() };
194  return m_spOleObject->DoVerb(index, 0, this, 0, host->winId(), &rcPos);
195  }
196 
197  // IUnknown
198  unsigned long WINAPI AddRef();
199  unsigned long WINAPI Release();
200  STDMETHOD(QueryInterface)(REFIID iid, void **iface);
201 
202  // IDispatch
203  HRESULT __stdcall GetTypeInfoCount(unsigned int *) { return E_NOTIMPL; }
204  HRESULT __stdcall GetTypeInfo(UINT, LCID, ITypeInfo **) { return E_NOTIMPL; }
205  HRESULT __stdcall GetIDsOfNames(const _GUID &, wchar_t **, unsigned int, unsigned long, long *) { return E_NOTIMPL; }
206  HRESULT __stdcall Invoke(DISPID dispIdMember,
207  REFIID riid,
208  LCID lcid,
209  WORD wFlags,
210  DISPPARAMS *pDispParams,
211  VARIANT *pVarResult,
212  EXCEPINFO *pExcepInfo,
213  UINT *puArgErr);
214  void emitAmbientPropertyChange(DISPID dispid);
215 
216  // IOleClientSite
217  STDMETHOD(SaveObject)();
218  STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk);
219  STDMETHOD(GetContainer)(LPOLECONTAINER FAR* ppContainer);
220  STDMETHOD(ShowObject)();
221  STDMETHOD(OnShowWindow)(BOOL fShow);
222  STDMETHOD(RequestNewObjectLayout)();
223 
224  // IOleControlSite
225  STDMETHOD(OnControlInfoChanged)();
226  STDMETHOD(LockInPlaceActive)(BOOL fLock);
227  STDMETHOD(GetExtendedControl)(IDispatch** ppDisp);
228  STDMETHOD(TransformCoords)(POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags);
229  STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, DWORD grfModifiers);
230  STDMETHOD(OnFocus)(BOOL fGotFocus);
231  STDMETHOD(ShowPropertyFrame)();
232 
233  // IOleWindow
234  STDMETHOD(GetWindow)(HWND *phwnd);
235  STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
236 
237  // IOleInPlaceSite
238  STDMETHOD(CanInPlaceActivate)();
239  STDMETHOD(OnInPlaceActivate)();
240  STDMETHOD(OnUIActivate)();
241  STDMETHOD(GetWindowContext)(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
242  STDMETHOD(Scroll)(SIZE scrollExtant);
243  STDMETHOD(OnUIDeactivate)(BOOL fUndoable);
244  STDMETHOD(OnInPlaceDeactivate)();
245  STDMETHOD(DiscardUndoState)();
246  STDMETHOD(DeactivateAndUndo)();
247  STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect);
248 
249 #ifdef QAX_SUPPORT_WINDOWLESS
250 // IOleInPlaceSiteEx ###
251  STDMETHOD(OnInPlaceActivateEx)(BOOL* /*pfNoRedraw*/, DWORD /*dwFlags*/)
252  {
253  return S_OK;
254  }
255  STDMETHOD(OnInPlaceDeactivateEx)(BOOL /*fNoRedraw*/)
256  {
257  return S_OK;
258  }
259  STDMETHOD(RequestUIActivate)()
260  {
261  return S_OK;
262  }
263 
264 // IOleInPlaceSiteWindowless ###
265  STDMETHOD(CanWindowlessActivate)()
266  {
267  return S_OK;
268  }
269  STDMETHOD(GetCapture)()
270  {
271  return S_FALSE;
272  }
273  STDMETHOD(SetCapture)(BOOL /*fCapture*/)
274  {
275  return S_FALSE;
276  }
277  STDMETHOD(GetFocus)()
278  {
279  return S_FALSE;
280  }
281  STDMETHOD(SetFocus)(BOOL /*fCapture*/)
282  {
283  return S_FALSE;
284  }
285  STDMETHOD(GetDC)(LPCRECT /*pRect*/, DWORD /*grfFlags*/, HDC *phDC)
286  {
287  *phDC = 0;
288  return S_OK;
289  }
290  STDMETHOD(ReleaseDC)(HDC hDC)
291  {
292  ::ReleaseDC(widget->winId(), hDC);
293  return S_OK;
294  }
295  STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase)
296  {
297  ::InvalidateRect(host->winId(), pRect, fErase);
298  return S_OK;
299  }
300  STDMETHOD(InvalidateRgn)(HRGN hRGN, BOOL fErase)
301  {
302  ::InvalidateRgn(host->winId(), hRGN, fErase);
303  return S_OK;
304  }
305  STDMETHOD(ScrollRect)(int /*dx*/, int /*dy*/, LPCRECT /*pRectScroll*/, LPCRECT /*pRectClip*/)
306  {
307  return S_OK;
308  }
309  STDMETHOD(AdjustRect)(LPRECT /*prc*/)
310  {
311  return S_OK;
312  }
313 #ifdef Q_CC_GNU // signature incorrect in win32api
314  STDMETHOD(AdjustRect)(LPCRECT /*prc*/)
315  {
316  RECT rect;
317  return AdjustRect(&rect);
318  }
319 #endif
320 
321  STDMETHOD(OnDefWindowMessage)(UINT /*msg*/, WPARAM /*wPara*/, LPARAM /*lParam*/, LRESULT* /*plResult*/)
322  {
323  return S_FALSE;
324  }
325 #endif
326 
327  // IOleInPlaceFrame
328  STDMETHOD(InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths));
329  STDMETHOD(SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject));
330  STDMETHOD(RemoveMenus(HMENU hmenuShared));
331  STDMETHOD(SetStatusText(LPCOLESTR pszStatusText));
332  STDMETHOD(EnableModeless(BOOL fEnable));
333  STDMETHOD(TranslateAccelerator(LPMSG lpMsg, WORD grfModifiers));
334 
335  // IOleInPlaceUIWindow
336  STDMETHOD(GetBorder(LPRECT lprectBorder));
337  STDMETHOD(RequestBorderSpace(LPCBORDERWIDTHS pborderwidths));
338  STDMETHOD(SetBorderSpace(LPCBORDERWIDTHS pborderwidths));
339  STDMETHOD(SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName));
340 
341  // IOleDocumentSite
342  STDMETHOD(ActivateMe(IOleDocumentView *pViewToActivate));
343 
344  // IAdviseSink
345  STDMETHOD_(void, OnDataChange)(FORMATETC* /*pFormatetc*/, STGMEDIUM* /*pStgmed*/)
346  {
347  AX_DEBUG(QAxClientSite::OnDataChange);
348  }
349  STDMETHOD_(void, OnViewChange)(DWORD /*dwAspect*/, LONG /*lindex*/)
350  {
351  AX_DEBUG(QAxClientSite::OnViewChange);
352  }
353  STDMETHOD_(void, OnRename)(IMoniker* /*pmk*/)
354  {
355  }
356  STDMETHOD_(void, OnSave)()
357  {
358  }
359  STDMETHOD_(void, OnClose)()
360  {
361  }
362 
363  QSize sizeHint() const { return sizehint; }
364  QSize minimumSizeHint() const;
365  inline void resize(QSize sz) { if (host) host->resize(sz); }
366 
367  bool translateKeyEvent(int message, int keycode) const
368  {
369  if (!widget)
370  return false;
371  return widget->translateKeyEvent(message, keycode);
372  }
373 
374  int qt_metacall(QMetaObject::Call, int isignal, void **argv);
375  void windowActivationChange();
376 
377  bool eventTranslated : 1;
378 
379 private:
380 #if !defined(Q_WS_WINCE)
381  struct OleMenuItem {
382  OleMenuItem(HMENU hm = 0, int ID = 0, QMenu *menu = 0)
383  : hMenu(hm), id(ID), subMenu(menu)
384  {}
385  HMENU hMenu;
386  int id;
387  QMenu *subMenu;
388  };
389  QMenu *generatePopup(HMENU subMenu, QWidget *parent);
390 #endif
391 
392  IOleObject *m_spOleObject;
393  IOleControl *m_spOleControl;
394  IOleInPlaceObjectWindowless *m_spInPlaceObject;
395  IOleInPlaceActiveObject *m_spInPlaceActiveObject;
396  IOleDocumentView *m_spActiveView;
397 
399 
402  bool canHostDocument : 1;
403 
405 #if !defined(Q_WS_WINCE)
406  HWND m_menuOwner;
407 #endif
408  CONTROLINFO control_info;
409 
411  LONG ref;
414 #if !defined(Q_WS_WINCE)
415  QPointer<QMenuBar> menuBar;
416  QMap<QAction*,OleMenuItem> menuItemMap;
417 #endif
418 };
419 
420 static const ushort mouseTbl[] = {
421  WM_MOUSEMOVE, QEvent::MouseMove, 0,
422  WM_LBUTTONDOWN, QEvent::MouseButtonPress, Qt::LeftButton,
424  WM_LBUTTONDBLCLK, QEvent::MouseButtonDblClick, Qt::LeftButton,
425  WM_RBUTTONDOWN, QEvent::MouseButtonPress, Qt::RightButton,
427  WM_RBUTTONDBLCLK, QEvent::MouseButtonDblClick, Qt::RightButton,
428  WM_MBUTTONDOWN, QEvent::MouseButtonPress, Qt::MidButton,
430  WM_MBUTTONDBLCLK, QEvent::MouseButtonDblClick, Qt::MidButton,
431  0, 0, 0
432 };
433 
434 static Qt::MouseButtons translateMouseButtonState(int s)
435 {
436  Qt::MouseButtons bst = 0;
437  if (s & MK_LBUTTON)
438  bst |= Qt::LeftButton;
439  if (s & MK_MBUTTON)
440  bst |= Qt::MidButton;
441  if (s & MK_RBUTTON)
442  bst |= Qt::RightButton;
443 
444  return bst;
445 }
446 
447 static Qt::KeyboardModifiers translateModifierState(int s)
448 {
449  Qt::KeyboardModifiers bst = 0;
450  if (s & MK_SHIFT)
451  bst |= Qt::ShiftModifier;
452  if (s & MK_CONTROL)
453  bst |= Qt::ControlModifier;
454  if (GetKeyState(VK_MENU) < 0)
455  bst |= Qt::AltModifier;
456 
457  return bst;
458 }
459 
461 #if QT_VERSION >= 0x050000
462 #error "Fix QAbstractEventDispatcher::setEventFilter"
463 #endif
464 #if defined(Q_WS_WINCE)
465 static int filter_ref = 0;
466 #else
467 static const wchar_t *qaxatom = L"QAxContainer4_Atom";
468 #endif
469 
470 // The filter procedure listening to user interaction on the control
471 bool axc_FilterProc(void *m)
472 {
473  MSG *msg = (MSG*)m;
474  const uint message = msg->message;
475  if ((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) || (message >= WM_KEYFIRST && message <= WM_KEYLAST)) {
476  HWND hwnd = msg->hwnd;
477  QAxWidget *ax = 0;
478  QAxHostWidget *host = 0;
479  while (!host && hwnd) {
480  QWidget *widget = QWidget::find(hwnd);
481  if (widget && widget->inherits("QAxHostWidget"))
482  host = qobject_cast<QAxHostWidget*>(widget);
483  hwnd = ::GetParent(hwnd);
484  }
485  if (host)
486  ax = qobject_cast<QAxWidget*>(host->parentWidget());
487  if (ax && msg->hwnd != host->winId()) {
488  if (message >= WM_KEYFIRST && message <= WM_KEYLAST) {
489  QAxClientSite *site = host->clientSite();
490  site->eventTranslated = true; // reset in QAxClientSite::TranslateAccelerator
491  HRESULT hres = S_FALSE;
492  if (site && site->inPlaceObject() && site->translateKeyEvent(msg->message, msg->wParam))
493  hres = site->inPlaceObject()->TranslateAccelerator(msg);
494  // if the object calls our TranslateAccelerator implementation, then continue with normal event processing
495  // otherwise the object has translated the accelerator, and the event should be stopped
496  if (site->eventTranslated && hres == S_OK)
497  return true;
498  } else {
499  int i;
500  for (i = 0; (UINT)mouseTbl[i] != message && mouseTbl[i]; i += 3)
501  ;
502 
503  if (mouseTbl[i]) {
505  int button = mouseTbl[++i];
506  if (type != QEvent::MouseMove || ax->hasMouseTracking() || button) {
507  if (type == QEvent::MouseMove)
508  button = 0;
509 
510  DWORD ol_pos = GetMessagePos();
511  QPoint gpos(GET_X_LPARAM(ol_pos), GET_Y_LPARAM(ol_pos));
512  QPoint pos = ax->mapFromGlobal(gpos);
513 
514  QMouseEvent e(type, pos, gpos, (Qt::MouseButton)button,
515  translateMouseButtonState(msg->wParam),
516  translateModifierState(msg->wParam));
517  QApplication::sendEvent(ax, &e);
518  }
519  }
520  }
521  }
522  }
523 
524  if (previous_filter)
525  return previous_filter(m);
526 
527  return false;
528 }
529 
531 : eventTranslated(true), ref(1), widget(c), host(0)
532 {
534  if (aggregatedObject) {
535  aggregatedObject->controlling_unknown = (IUnknown*)(IDispatch*)this;
537  }
538 
539  m_spOleObject = 0;
540  m_spOleControl = 0;
541  m_spInPlaceObject = 0;
543  m_spActiveView = 0;
544 
545  inPlaceObjectWindowless = false;
546  inPlaceModelessEnabled = true;
547  canHostDocument = false;
548 
549  m_dwOleObject = 0;
550 #if !defined(Q_WS_WINCE)
551  m_menuOwner = 0;
552  menuBar = 0;
553 #endif
554  memset(&control_info, 0, sizeof(control_info));
555 }
556 
557 bool QAxClientSite::activateObject(bool initialized, const QByteArray &data)
558 {
559  if (!host)
560  host = new QAxHostWidget(widget, this);
561 
562  bool showHost = false;
563  if (!m_spOleObject)
564  widget->queryInterface(IID_IOleObject, (void**)&m_spOleObject);
565  if (m_spOleObject) {
566  DWORD dwMiscStatus = 0;
567  m_spOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
568 
569 #if !defined(Q_OS_WINCE)
570  IOleDocument *document = 0;
571  m_spOleObject->QueryInterface(IID_IOleDocument, (void**)&document);
572  if (document) {
573  IPersistStorage *persistStorage = 0;
574  document->QueryInterface(IID_IPersistStorage, (void**)&persistStorage);
575  if (persistStorage) {
576  // try to activate as document server
577  IStorage *storage = 0;
578  ILockBytes * bytes = 0;
579  ::CreateILockBytesOnHGlobal(0, TRUE, &bytes);
580  ::StgCreateDocfileOnILockBytes(bytes, STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &storage);
581 
582  persistStorage->InitNew(storage);
583  persistStorage->Release();
584  canHostDocument = true;
585  storage->Release();
586  bytes->Release();
587 
588  m_spOleObject->SetClientSite(this);
589  OleRun(m_spOleObject);
590  }
591  document->Release();
592  }
593 #endif
594 
595  if (!canHostDocument) {
596  // activate as control
597  if(dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
598  m_spOleObject->SetClientSite(this);
599 
600  if (!initialized) {
601  IPersistStreamInit *spPSI = 0;
602  m_spOleObject->QueryInterface(IID_IPersistStreamInit, (void**)&spPSI);
603  if (spPSI) {
604  if (data.length()) {
605  IStream *pStream = 0;
606  HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, data.length());
607  if (hGlobal) {
608  BYTE *pStByte = (BYTE *)GlobalLock(hGlobal);
609  if (pStByte)
610  memcpy(pStByte, data.data(), data.length());
611  GlobalUnlock(hGlobal);
612  if (SUCCEEDED(CreateStreamOnHGlobal(hGlobal, TRUE, &pStream))) {
613  spPSI->Load(pStream);
614  pStream->Release();
615  }
616  GlobalFree(hGlobal);
617  }
618  } else {
619  spPSI->InitNew();
620  }
621  spPSI->Release();
622  } else if (data.length()) { //try initializing using a IPersistStorage
623  IPersistStorage *spPS = 0;
624  m_spOleObject->QueryInterface( IID_IPersistStorage, (void**)&spPS );
625  if (spPS) {
626  HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, data.length());
627  if (hGlobal) {
628 #if !defined(Q_OS_WINCE)
629  BYTE* pbData = (BYTE*)GlobalLock(hGlobal);
630  if (pbData)
631  memcpy(pbData, data.data(), data.length());
632  GlobalUnlock(hGlobal);
633  // open an IStorage on the data and pass it to Load
634  LPLOCKBYTES pLockBytes = 0;
635  if (SUCCEEDED(CreateILockBytesOnHGlobal(hGlobal, TRUE, &pLockBytes))) {
636  LPSTORAGE pStorage = 0;
637  if (SUCCEEDED(StgOpenStorageOnILockBytes(pLockBytes, 0,
638  STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStorage))) {
639  spPS->Load(pStorage);
640  pStorage->Release();
641  }
642  pLockBytes->Release();
643  }
644  GlobalFree(hGlobal);
645 #endif
646  }
647  spPS->Release();
648  }
649  }
650  }
651 
652  if(!(dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST))
653  m_spOleObject->SetClientSite(this);
654  }
655 
656  IViewObject *spViewObject = 0;
657  m_spOleObject->QueryInterface(IID_IViewObject, (void**) &spViewObject);
658 
659  m_spOleObject->Advise(this, &m_dwOleObject);
660  IAdviseSink *spAdviseSink = 0;
661  QueryInterface(IID_IAdviseSink, (void**)&spAdviseSink);
662  if (spAdviseSink && spViewObject) {
663  if (spViewObject)
664  spViewObject->SetAdvise(DVASPECT_CONTENT, 0, spAdviseSink);
665  }
666  if (spAdviseSink)
667  spAdviseSink->Release();
668  if (spViewObject)
669  spViewObject->Release();
670 
671  m_spOleObject->SetHostNames(OLESTR("AXWIN"), 0);
672 
673  if (!(dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME)) {
674  SIZEL hmSize;
675  hmSize.cx = MAP_PIX_TO_LOGHIM(250, widget->logicalDpiX());
676  hmSize.cy = MAP_PIX_TO_LOGHIM(250, widget->logicalDpiY());
677 
678  m_spOleObject->SetExtent(DVASPECT_CONTENT, &hmSize);
679  m_spOleObject->GetExtent(DVASPECT_CONTENT, &hmSize);
680 
683  showHost = true;
684  } else {
685  sizehint = QSize(0, 0);
686  host->hide();
687  }
688  if (!(dwMiscStatus & OLEMISC_NOUIACTIVATE)) {
690  } else {
692  }
693 
694  RECT rcPos = { host->x(), host->y(), host->x()+sizehint.width(), host->y()+sizehint.height() };
695 
696  m_spOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, 0, (IOleClientSite*)this, 0, host->winId(), &rcPos);
697 
698  if (!m_spOleControl)
699  m_spOleObject->QueryInterface(IID_IOleControl, (void**)&m_spOleControl);
700  if (m_spOleControl) {
701  m_spOleControl->OnAmbientPropertyChange(DISPID_AMBIENT_BACKCOLOR);
702  m_spOleControl->OnAmbientPropertyChange(DISPID_AMBIENT_FORECOLOR);
703  m_spOleControl->OnAmbientPropertyChange(DISPID_AMBIENT_FONT);
704  m_spOleControl->OnAmbientPropertyChange(DISPID_AMBIENT_USERMODE);
705 
706  control_info.cb = sizeof(control_info);
707  m_spOleControl->GetControlInfo(&control_info);
708  }
709 
710  BSTR userType;
711  HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType);
712  if (result == S_OK) {
714  CoTaskMemFree(userType);
715  }
716  } else {
717  IObjectWithSite *spSite = 0;
718  widget->queryInterface(IID_IObjectWithSite, (void**)&spSite);
719  if (spSite) {
720  spSite->SetSite((IUnknown*)(IDispatch*)this);
721  spSite->Release();
722  }
723  }
724 
725  host->resize(widget->size());
726  if (showHost)
727  host->show();
728 
729  if (host->focusPolicy() != Qt::NoFocus) {
732  }
733 
734  return true;
735 }
736 
738 {
739  if (host) {
740  host->axhost = 0;
741  }
742 
743  if (aggregatedObject)
745  delete aggregatedObject;
746  delete host;
747 }
748 
750 {
751  if (m_spOleObject) {
752  m_spOleObject->SetClientSite(0);
753  m_spOleObject->Unadvise(m_dwOleObject);
754  m_spOleObject->Release();
755  }
756  m_spOleObject = 0;
757  if (m_spOleControl) m_spOleControl->Release();
758  m_spOleControl = 0;
759  if (m_spInPlaceObject) m_spInPlaceObject->Release();
760  m_spInPlaceObject = 0;
763 
764  inPlaceObjectWindowless = false;
765 }
766 
768 {
769  if (m_spInPlaceObject) m_spInPlaceObject->InPlaceDeactivate();
770  // if this assertion fails the control didn't call OnInPlaceDeactivate
772 }
773 
774 //**** IUnknown
775 unsigned long WINAPI QAxClientSite::AddRef()
776 {
777  return InterlockedIncrement(&ref);
778 }
779 
780 unsigned long WINAPI QAxClientSite::Release()
781 {
782  LONG refCount = InterlockedDecrement(&ref);
783  if (!refCount)
784  delete this;
785 
786  return refCount;
787 }
788 
789 HRESULT WINAPI QAxClientSite::QueryInterface(REFIID iid, void **iface)
790 {
791  *iface = 0;
792 
793  if (iid == IID_IUnknown) {
794  *iface = (IUnknown*)(IDispatch*)this;
795  } else {
796  HRESULT res = S_OK;
797  if (aggregatedObject)
798  res = aggregatedObject->queryInterface(iid, iface);
799  if (*iface)
800  return res;
801  }
802 
803  if (!(*iface)) {
804  if (iid == IID_IDispatch)
805  *iface = (IDispatch*)this;
806  else if (iid == IID_IOleClientSite)
807  *iface = (IOleClientSite*)this;
808  else if (iid == IID_IOleControlSite)
809  *iface = (IOleControlSite*)this;
810  else if (iid == IID_IOleWindow)
811  *iface = (IOleWindow*)(IOleInPlaceSite*)this;
812  else if (iid == IID_IOleInPlaceSite)
813  *iface = (IOleInPlaceSite*)this;
814 #ifdef QAX_SUPPORT_WINDOWLESS
815  else if (iid == IID_IOleInPlaceSiteEx)
816  *iface = (IOleInPlaceSiteEx*)this;
817  else if (iid == IID_IOleInPlaceSiteWindowless)
818  *iface = (IOleInPlaceSiteWindowless*)this;
819 #endif
820  else if (iid == IID_IOleInPlaceFrame)
821  *iface = (IOleInPlaceFrame*)this;
822  else if (iid == IID_IOleInPlaceUIWindow)
823  *iface = (IOleInPlaceUIWindow*)this;
824  else if (iid == IID_IOleDocumentSite && canHostDocument)
825  *iface = (IOleDocumentSite*)this;
826  else if (iid == IID_IAdviseSink)
827  *iface = (IAdviseSink*)this;
828  }
829  if (!*iface)
830  return E_NOINTERFACE;
831 
832  AddRef();
833  return S_OK;
834 }
835 
836 bool qax_runsInDesignMode = false;
837 
838 //**** IDispatch
839 HRESULT WINAPI QAxClientSite::Invoke(DISPID dispIdMember,
840  REFIID /*riid*/,
841  LCID /*lcid*/,
842  WORD /*wFlags*/,
843  DISPPARAMS * /*pDispParams*/,
844  VARIANT *pVarResult,
845  EXCEPINFO * /*pExcepInfo*/,
846  UINT * /*puArgErr*/)
847 {
848  if (!pVarResult)
849  return E_POINTER;
850  if (!widget || !host)
851  return E_UNEXPECTED;
852 
853  switch(dispIdMember) {
854  case DISPID_AMBIENT_USERMODE:
855  pVarResult->vt = VT_BOOL;
856  pVarResult->boolVal = !qax_runsInDesignMode;
857  return S_OK;
858 
859  case DISPID_AMBIENT_AUTOCLIP:
860  case DISPID_AMBIENT_SUPPORTSMNEMONICS:
861  pVarResult->vt = VT_BOOL;
862  pVarResult->boolVal = true;
863  return S_OK;
864 
865  case DISPID_AMBIENT_SHOWHATCHING:
866  case DISPID_AMBIENT_SHOWGRABHANDLES:
867  case DISPID_AMBIENT_DISPLAYASDEFAULT:
868  case DISPID_AMBIENT_MESSAGEREFLECT:
869  pVarResult->vt = VT_BOOL;
870  pVarResult->boolVal = false;
871  return S_OK;
872 
873  case DISPID_AMBIENT_DISPLAYNAME:
874  pVarResult->vt = VT_BSTR;
875  pVarResult->bstrVal = QStringToBSTR(widget->windowTitle());
876  return S_OK;
877 
878  case DISPID_AMBIENT_FONT:
879  QVariantToVARIANT(widget->font(), *pVarResult);
880  return S_OK;
881 
882  case DISPID_AMBIENT_BACKCOLOR:
883  pVarResult->vt = VT_UI4;
884  pVarResult->lVal = QColorToOLEColor(widget->palette().color(widget->backgroundRole()));
885  return S_OK;
886 
887  case DISPID_AMBIENT_FORECOLOR:
888  pVarResult->vt = VT_UI4;
889  pVarResult->lVal = QColorToOLEColor(widget->palette().color(widget->foregroundRole()));
890  return S_OK;
891 
892  case DISPID_AMBIENT_UIDEAD:
893  pVarResult->vt = VT_BOOL;
894  pVarResult->boolVal = !widget->isEnabled();
895  return S_OK;
896 
897  default:
898  break;
899  }
900 
901  return DISP_E_MEMBERNOTFOUND;
902 }
903 
905 {
906  if (m_spOleControl)
907  m_spOleControl->OnAmbientPropertyChange(dispid);
908 }
909 
910 //**** IOleClientSite
912 {
913  return E_NOTIMPL;
914 }
915 
916 HRESULT WINAPI QAxClientSite::GetMoniker(DWORD, DWORD, IMoniker **ppmk)
917 {
918  if (!ppmk)
919  return E_POINTER;
920 
921  *ppmk = 0;
922  return E_NOTIMPL;
923 }
924 
925 HRESULT WINAPI QAxClientSite::GetContainer(LPOLECONTAINER *ppContainer)
926 {
927  if (!ppContainer)
928  return E_POINTER;
929 
930  *ppContainer = 0;
931  return E_NOINTERFACE;
932 }
933 
935 {
936  return S_OK;
937 }
938 
939 HRESULT WINAPI QAxClientSite::OnShowWindow(BOOL /*fShow*/)
940 {
941  return S_OK;
942 }
943 
945 {
946  return E_NOTIMPL;
947 }
948 
949 //**** IOleControlSite
951 {
952  if (m_spOleControl)
953  m_spOleControl->GetControlInfo(&control_info);
954 
955  return S_OK;
956 }
957 
959 {
961  return S_OK;
962 }
963 
964 HRESULT WINAPI QAxClientSite::GetExtendedControl(IDispatch** ppDisp)
965 {
966  if (!ppDisp)
967  return E_POINTER;
968 
969  *ppDisp = 0;
970  return E_NOTIMPL;
971 }
972 
973 HRESULT WINAPI QAxClientSite::TransformCoords(POINTL* /*pPtlHimetric*/, POINTF* /*pPtfContainer*/, DWORD /*dwFlags*/)
974 {
975  return S_OK;
976 }
977 
978 HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModifiers*/)
979 {
980  if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam)
981  return S_OK;
982 
983  bool ActiveQtDetected = false;
984  bool fromInProcServer = false;
985 #ifdef GWLP_USERDATA
986  LONG_PTR serverType = GetWindowLongPtr(lpMsg->hwnd, GWLP_USERDATA);
987 #else
988  LONG serverType = GetWindowLong(lpMsg->hwnd, GWL_USERDATA);
989 #endif
990  if (serverType == QAX_INPROC_SERVER) {
991  ActiveQtDetected = true;
992  fromInProcServer = true;
993  } else if (serverType == QAX_OUTPROC_SERVER) {
994  ActiveQtDetected = true;
995  fromInProcServer = false;
996  }
997 
998  eventTranslated = false;
999  if (!ActiveQtDetected || !fromInProcServer) {
1000  // if the request is coming from an out-of-proc server or a non ActiveQt server,
1001  // we send the message to the host window. This will make sure this key event
1002  // comes to Qt for processing.
1003  SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam);
1004  if (ActiveQtDetected && !fromInProcServer) {
1005  // ActiveQt based servers will need further processing of the event
1006  // (eg. <SPACE> key for a checkbox), so we return false.
1007  return S_FALSE;
1008  }
1009  }
1010  // ActiveQt based in-processes-servers will handle the event properly, so
1011  // we don't need to send this key event to the host.
1012  return S_OK;
1013 }
1014 
1015 HRESULT WINAPI QAxClientSite::OnFocus(BOOL bGotFocus)
1016 {
1018  if (host) {
1019  host->hasFocus = bGotFocus;
1020  qApp->removeEventFilter(host);
1021  if (bGotFocus)
1022  qApp->installEventFilter(host);
1023  }
1024  return S_OK;
1025 }
1026 
1028 {
1029  return E_NOTIMPL;
1030 }
1031 
1032 //**** IOleWindow
1034 {
1035  if (!phwnd)
1036  return E_POINTER;
1037 
1038  *phwnd = host->winId();
1039  return S_OK;
1040 }
1041 
1043 {
1044  if (fEnterMode)
1046  else
1048 
1049  return S_OK;
1050 }
1051 
1052 //**** IOleInPlaceSite
1054 {
1056  return S_OK;
1057 }
1058 
1060 {
1062 #if !defined(Q_OS_WINCE)
1063  OleLockRunning(m_spOleObject, true, false);
1064 #endif
1065  if (!m_spInPlaceObject) {
1066 /* ### disabled for now
1067  m_spOleObject->QueryInterface(IID_IOleInPlaceObjectWindowless, (void**) &m_spInPlaceObject);
1068 */
1069  if (m_spInPlaceObject) {
1070  inPlaceObjectWindowless = true;
1071  } else {
1072  inPlaceObjectWindowless = false;
1073  m_spOleObject->QueryInterface(IID_IOleInPlaceObject, (void**) &m_spInPlaceObject);
1074  }
1075  }
1076 
1077  return S_OK;
1078 }
1079 
1081 {
1083  return S_OK;
1084 }
1085 
1086 HRESULT WINAPI QAxClientSite::GetWindowContext(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1087 {
1088  if (!ppFrame || !ppDoc || !lprcPosRect || !lprcClipRect || !lpFrameInfo)
1089  return E_POINTER;
1090 
1091  QueryInterface(IID_IOleInPlaceFrame, (void**)ppFrame);
1092  QueryInterface(IID_IOleInPlaceUIWindow, (void**)ppDoc);
1093 
1094  ::GetClientRect(host->winId(), lprcPosRect);
1095  ::GetClientRect(host->winId(), lprcClipRect);
1096 
1097  lpFrameInfo->cb = sizeof(OLEINPLACEFRAMEINFO);
1098  lpFrameInfo->fMDIApp = false;
1099  lpFrameInfo->haccel = 0;
1100  lpFrameInfo->cAccelEntries = 0;
1101  lpFrameInfo->hwndFrame = widget ? widget->window()->winId() : 0;
1102 
1103  return S_OK;
1104 }
1105 
1106 HRESULT WINAPI QAxClientSite::Scroll(SIZE /*scrollExtant*/)
1107 {
1108  return S_FALSE;
1109 }
1110 
1112 {
1114  if (host && host->hasFocus) {
1115  qApp->removeEventFilter(host);
1116  host->hasFocus = false;
1117  }
1118  return S_OK;
1119 }
1120 
1122 {
1124  if (m_spInPlaceObject)
1125  m_spInPlaceObject->Release();
1126  m_spInPlaceObject = 0;
1127  inPlaceObjectWindowless = false;
1128 #if !defined(Q_OS_WINCE)
1129  OleLockRunning(m_spOleObject, false, false);
1130 #endif
1131 
1132  return S_OK;
1133 }
1134 
1136 {
1137  return S_OK;
1138 }
1139 
1141 {
1142  if (m_spInPlaceObject)
1143  m_spInPlaceObject->UIDeactivate();
1144 
1145  return S_OK;
1146 }
1147 
1148 HRESULT WINAPI QAxClientSite::OnPosRectChange(LPCRECT /*lprcPosRect*/)
1149 {
1151  // ###
1152  return S_OK;
1153 }
1154 
1155 //**** IOleInPlaceFrame
1156 #if defined(Q_WS_WINCE)
1157 HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPWIDTHS /*lpMenuWidths*/)
1158 {
1159  return E_NOTIMPL;
1160 #else
1161 HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPWIDTHS lpMenuWidths)
1162 {
1163  AX_DEBUG(QAxClientSite::InsertMenus);
1164  QMenuBar *mb = menuBar;
1165  if (!mb)
1166  mb = widget->window()->findChild<QMenuBar*>();
1167  if (!mb)
1168  return E_NOTIMPL;
1169  menuBar = mb;
1170 
1171  QMenu *fileMenu = 0;
1172  QMenu *viewMenu = 0;
1173  QMenu *windowMenu = 0;
1174  QList<QAction*> actions = menuBar->actions();
1175  for (int i = 0; i < actions.count(); ++i) {
1176  QAction *action = actions.at(i);
1177  QString text = action->text().remove(QLatin1Char('&'));
1178  if (text == QLatin1String("File")) {
1179  fileMenu = action->menu();
1180  } else if (text == QLatin1String("View")) {
1181  viewMenu = action->menu();
1182  } else if (text == QLatin1String("Window")) {
1183  windowMenu = action->menu();
1184  }
1185  }
1186  if (fileMenu)
1187  lpMenuWidths->width[0] = fileMenu->actions().count();
1188  if (viewMenu)
1189  lpMenuWidths->width[2] = viewMenu->actions().count();
1190  if (windowMenu)
1191  lpMenuWidths->width[4] = windowMenu->actions().count();
1192 
1193  return S_OK;
1194 #endif
1195 }
1196 
1197 static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &/*icon*/)
1198 {
1199  if (item.fType == MFT_STRING && item.cch) {
1200  wchar_t *titlebuf = new wchar_t[item.cch + 1];
1201  item.dwTypeData = titlebuf;
1202  item.cch++;
1203  ::GetMenuItemInfo(menu, index, true, &item);
1204  text = QString::fromWCharArray(titlebuf);
1205  delete [] titlebuf;
1206  return MFT_STRING;
1207  }
1208 #if 0
1209  else if (item.fType == MFT_BITMAP) {
1210  HBITMAP hbm = (HBITMAP)LOWORD(item.hbmpItem);
1211  SIZE bmsize;
1212  GetBitmapDimensionEx(hbm, &bmsize);
1213  QPixmap pixmap(1,1);
1214  QSize sz(MAP_LOGHIM_TO_PIX(bmsize.cx, pixmap.logicalDpiX()),
1215  MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY()));
1216 
1217  pixmap.resize(bmsize.cx, bmsize.cy);
1218  if (!pixmap.isNull()) {
1219  HDC hdc = ::CreateCompatibleDC(pixmap.handle());
1220  ::SelectObject(hdc, hbm);
1221  BOOL res = ::BitBlt(pixmap.handle(), 0, 0, pixmap.width(), pixmap.height(), hdc, 0, 0, SRCCOPY);
1222  ::DeleteObject(hdc);
1223  }
1224 
1225  icon = pixmap;
1226  }
1227 #endif
1228  return -1;
1229 }
1230 
1231 #if !defined(Q_OS_WINCE)
1232 QMenu *QAxClientSite::generatePopup(HMENU subMenu, QWidget *parent)
1233 {
1234  QMenu *popup = 0;
1235  int count = GetMenuItemCount(subMenu);
1236  if (count)
1237  popup = new QMenu(parent);
1238  for (int i = 0; i < count; ++i) {
1239  MENUITEMINFO item;
1240  memset(&item, 0, sizeof(MENUITEMINFO));
1241  item.cbSize = sizeof(MENUITEMINFO);
1242  item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU;
1243  ::GetMenuItemInfo(subMenu, i, true, &item);
1244 
1245  QAction *action = 0;
1246  QMenu *popupMenu = 0;
1247  if (item.fType == MFT_SEPARATOR) {
1248  action = popup->addSeparator();
1249  } else {
1250  QString text;
1251  QPixmap icon;
1252  QKeySequence accel;
1253  popupMenu = item.hSubMenu ? generatePopup(item.hSubMenu, popup) : 0;
1254  int res = menuItemEntry(subMenu, i, item, text, icon);
1255 
1256  int lastSep = text.lastIndexOf(QRegExp(QLatin1String("[\\s]")));
1257  if (lastSep != -1) {
1258  QString keyString = text.right(text.length() - lastSep);
1259  accel = keyString;
1260  if ((int)accel)
1261  text = text.left(lastSep);
1262  }
1263 
1264  if (popupMenu)
1265  popupMenu->setTitle(text);
1266 
1267  switch (res) {
1268  case MFT_STRING:
1269  if (popupMenu)
1270  action = popup->addMenu(popupMenu);
1271  else
1272  action = popup->addAction(text);
1273  break;
1274  case MFT_BITMAP:
1275  if (popupMenu)
1276  action = popup->addMenu(popupMenu);
1277  else
1278  action = popup->addAction(icon, text);
1279  break;
1280  }
1281 
1282  if (action) {
1283  if (int(accel))
1284  action->setShortcut(accel);
1285  if (!icon.isNull())
1286  action->setIcon(icon);
1287  }
1288  }
1289 
1290  if (action) {
1291  OleMenuItem oleItem(subMenu, item.wID, popupMenu);
1292  menuItemMap.insert(action, oleItem);
1293  }
1294  }
1295  return popup;
1296 }
1297 #endif
1298 
1299 #if defined(Q_OS_WINCE)
1300 HRESULT WINAPI QAxClientSite::SetMenu(HMENU /*hmenuShared*/, HOLEMENU /*holemenu*/, HWND /*hwndActiveObject*/)
1301 {
1302  return E_NOTIMPL;
1303 #else
1304 HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
1305 {
1306  AX_DEBUG(QAxClientSite::SetMenu);
1307 
1308  if (hmenuShared) {
1309  m_menuOwner = hwndActiveObject;
1310  QMenuBar *mb = menuBar;
1311  if (!mb)
1312  mb = widget->window()->findChild<QMenuBar*>();
1313  if (!mb)
1314  return E_NOTIMPL;
1315  menuBar = mb;
1316 
1317  int count = GetMenuItemCount(hmenuShared);
1318  for (int i = 0; i < count; ++i) {
1319  MENUITEMINFO item;
1320  memset(&item, 0, sizeof(MENUITEMINFO));
1321  item.cbSize = sizeof(MENUITEMINFO);
1322  item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU;
1323  ::GetMenuItemInfo(hmenuShared, i, true, &item);
1324 
1325  QAction *action = 0;
1326  QMenu *popupMenu = 0;
1327  if (item.fType == MFT_SEPARATOR) {
1328  action = menuBar->addSeparator();
1329  } else {
1330  QString text;
1331  QPixmap icon;
1332  popupMenu = item.hSubMenu ? generatePopup(item.hSubMenu, menuBar) : 0;
1333  int res = menuItemEntry(hmenuShared, i, item, text, icon);
1334 
1335  if (popupMenu)
1336  popupMenu->setTitle(text);
1337 
1338  switch(res) {
1339  case MFT_STRING:
1340  if (popupMenu)
1341  action = menuBar->addMenu(popupMenu);
1342  else
1343  action = menuBar->addAction(text);
1344  break;
1345  case MFT_BITMAP:
1346  if (popupMenu)
1347  action = menuBar->addMenu(popupMenu);
1348  else
1349  action = menuBar->addAction(text);
1350  break;
1351  default:
1352  break;
1353  }
1354  if (action && !icon.isNull())
1355  action->setIcon(icon);
1356  }
1357 
1358  if (action) {
1359  OleMenuItem oleItem(hmenuShared, item.wID, popupMenu);
1360  menuItemMap.insert(action, oleItem);
1361  }
1362  }
1363  if (count) {
1364  const QMetaObject *mbmo = menuBar->metaObject();
1365  int index = mbmo->indexOfSignal("triggered(QAction*)");
1366  Q_ASSERT(index != -1);
1367  menuBar->disconnect(SIGNAL(triggered(QAction*)), host);
1368  QMetaObject::connect(menuBar, index, host, index);
1369  }
1370  } else if (menuBar) {
1371  m_menuOwner = 0;
1373  for (it = menuItemMap.begin(); it != menuItemMap.end(); ++it) {
1374  QAction *action = it.key();
1375  delete action;
1376  }
1377  menuItemMap.clear();
1378  }
1379 
1380  OleSetMenuDescriptor(holemenu, widget ? widget->window()->winId() : 0, m_menuOwner, this, m_spInPlaceActiveObject);
1381  return S_OK;
1382 #endif
1383 }
1384 
1385 #if defined(Q_OS_WINCE)
1386 int QAxClientSite::qt_metacall(QMetaObject::Call /*call*/, int isignal, void ** /*argv*/)
1387 {
1388  return isignal;
1389 #else
1390 int QAxClientSite::qt_metacall(QMetaObject::Call call, int isignal, void **argv)
1391 {
1392  if (!m_spOleObject || call != QMetaObject::InvokeMetaMethod || !menuBar)
1393  return isignal;
1394 
1395  if (isignal != menuBar->metaObject()->indexOfSignal("triggered(QAction*)"))
1396  return isignal;
1397 
1398  QAction *action = *(QAction**)argv[1];
1399  // ###
1400 
1401  OleMenuItem oleItem = menuItemMap.value(action);
1402  if (oleItem.hMenu)
1403  ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0);
1404  return -1;
1405 #endif
1406 }
1407 
1408 
1409 HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU /*hmenuShared*/)
1410 {
1411 #if defined(Q_OS_WINCE)
1412  return E_NOTIMPL;
1413 #else
1414  AX_DEBUG(QAxClientSite::RemoveMenus);
1416  for (it = menuItemMap.begin(); it != menuItemMap.end(); ++it) {
1417  QAction *action = it.key();
1418  action->setVisible(false);
1419  delete action;
1420  }
1421  menuItemMap.clear();
1422  return S_OK;
1423 #endif
1424 }
1425 
1426 HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText)
1427 {
1428  QStatusTipEvent tip(QString::fromWCharArray(pszStatusText));
1430  return S_OK;
1431 }
1432 
1434 
1435 HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
1436 {
1437  EnableWindow(host->window()->winId(), fEnable);
1438 
1439  if (!fEnable) {
1442  } else {
1445  }
1446  qt_win_ignoreNextMouseReleaseEvent = false;
1447  return S_OK;
1448 }
1449 
1450 HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, WORD grfModifiers)
1451 {
1452  return TranslateAccelerator(lpMsg, (DWORD)grfModifiers);
1453 }
1454 
1455 //**** IOleInPlaceUIWindow
1456 HRESULT WINAPI QAxClientSite::GetBorder(LPRECT lprectBorder)
1457 {
1458 #ifndef QAX_SUPPORT_BORDERSPACE
1459  Q_UNUSED(lprectBorder);
1460  return INPLACE_E_NOTOOLSPACE;
1461 #else
1462  AX_DEBUG(QAxClientSite::GetBorder);
1463 
1465  if (!mw)
1466  return INPLACE_E_NOTOOLSPACE;
1467 
1468  RECT border = { 0,0, 300, 200 };
1469  *lprectBorder = border;
1470  return S_OK;
1471 #endif
1472 }
1473 
1474 HRESULT WINAPI QAxClientSite::RequestBorderSpace(LPCBORDERWIDTHS /*pborderwidths*/)
1475 {
1476 #ifndef QAX_SUPPORT_BORDERSPACE
1477  return INPLACE_E_NOTOOLSPACE;
1478 #else
1479  AX_DEBUG(QAxClientSite::RequestBorderSpace);
1480 
1482  if (!mw)
1483  return INPLACE_E_NOTOOLSPACE;
1484 
1485  return S_OK;
1486 #endif
1487 }
1488 
1489 HRESULT WINAPI QAxClientSite::SetBorderSpace(LPCBORDERWIDTHS pborderwidths)
1490 {
1491 #ifndef QAX_SUPPORT_BORDERSPACE
1492  Q_UNUSED(pborderwidths);
1493  return OLE_E_INVALIDRECT;
1494 #else
1495  AX_DEBUG(QAxClientSite::SetBorderSpace);
1496 
1497  // object has no toolbars and wants container toolbars to remain
1498  if (!pborderwidths)
1499  return S_OK;
1500 
1502  if (!mw)
1503  return OLE_E_INVALIDRECT;
1504 
1505  bool removeToolBars = !(pborderwidths->left || pborderwidths->top || pborderwidths->right || pborderwidths->bottom);
1506 
1507  // object has toolbars, and wants container to remove toolbars
1508  if (removeToolBars) {
1509  if (mw) {
1510  //### remove our toolbars
1511  }
1512  }
1513 
1514  if (pborderwidths->left) {
1515  QDockWidget *left = new QDockWidget(mw);
1516  left->setFixedWidth(pborderwidths->left);
1518  left->show();
1519  }
1520  if (pborderwidths->top) {
1521  QDockWidget *top = new QDockWidget(mw);
1522  top->setFixedHeight(pborderwidths->top);
1524  top->show();
1525  }
1526 
1527  return S_OK;
1528 #endif
1529 }
1530 
1531 HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1532 {
1533  AX_DEBUG(QAxClientSite::SetActiveObject);
1534 
1535  Q_UNUSED(pszObjName);
1536  // we are ignoring the name of the object, as suggested by MSDN documentation
1537  // for IOleInPlaceUIWindow::SetActiveObject().
1538 
1541  m_spInPlaceActiveObject->EnableModeless(true);
1542  inPlaceModelessEnabled = true;
1543  m_spInPlaceActiveObject->Release();
1544  }
1545 
1546  m_spInPlaceActiveObject = pActiveObject;
1548  m_spInPlaceActiveObject->AddRef();
1549 
1550  return S_OK;
1551 }
1552 
1553 //**** IOleDocumentSite
1554 HRESULT WINAPI QAxClientSite::ActivateMe(IOleDocumentView *pViewToActivate)
1555 {
1556  AX_DEBUG(QAxClientSite::ActivateMe);
1557 
1558  if (m_spActiveView)
1559  m_spActiveView->Release();
1560  m_spActiveView = 0;
1561 
1562  if (!pViewToActivate) {
1563  IOleDocument *document = 0;
1564  m_spOleObject->QueryInterface(IID_IOleDocument, (void**)&document);
1565  if (!document)
1566  return E_FAIL;
1567 
1568  document->CreateView(this, 0, 0, &pViewToActivate);
1569 
1570  document->Release();
1571  if (!pViewToActivate)
1572  return E_OUTOFMEMORY;
1573  } else {
1574  pViewToActivate->SetInPlaceSite(this);
1575  }
1576 
1577  m_spActiveView = pViewToActivate;
1578  m_spActiveView->AddRef();
1579 
1580  m_spActiveView->UIActivate(TRUE);
1581 
1582  RECT rect;
1583  GetClientRect(widget->winId(), &rect);
1584  m_spActiveView->SetRect(&rect);
1585  m_spActiveView->Show(TRUE);
1586 
1587  return S_OK;
1588 }
1589 
1591 {
1592  if (!m_spOleObject)
1593  return QSize();
1594 
1595  SIZE sz = { 0, 0 };
1596  m_spOleObject->SetExtent(DVASPECT_CONTENT, &sz);
1597  HRESULT res = m_spOleObject->GetExtent(DVASPECT_CONTENT, &sz);
1598  if (SUCCEEDED(res)) {
1599  return QSize(MAP_LOGHIM_TO_PIX(sz.cx, widget->logicalDpiX()),
1600  MAP_LOGHIM_TO_PIX(sz.cy, widget->logicalDpiY()));
1601  }
1602  return QSize();
1603 }
1604 
1606 {
1608 
1611  if (modal && inPlaceModelessEnabled) {
1612  m_spInPlaceActiveObject->EnableModeless(false);
1613  inPlaceModelessEnabled = false;
1614  } else if (!inPlaceModelessEnabled) {
1615  m_spInPlaceActiveObject->EnableModeless(true);
1616  inPlaceModelessEnabled = true;
1617  }
1618  m_spInPlaceActiveObject->OnFrameWindowActivate(widget->isActiveWindow());
1619  }
1620 }
1621 
1622 
1623 //**** QWidget
1624 
1626 : QWidget(parent), setFocusTimer(0), hasFocus(false), axhost(ax)
1627 {
1632 
1633  setObjectName(parent->objectName() + QLatin1String(" - QAxHostWidget"));
1634 }
1635 
1637 {
1638  if (axhost)
1639  axhost->reset(this);
1640 }
1641 
1642 int QAxHostWidget::qt_metacall(QMetaObject::Call call, int isignal, void **argv)
1643 {
1644  if (axhost)
1645  return axhost->qt_metacall(call, isignal, argv);
1646  return -1;
1647 }
1648 
1649 void* QAxHostWidget::qt_metacast(const char *clname)
1650 {
1651  if (!clname) return 0;
1652  if (!qstrcmp(clname,"QAxHostWidget"))
1653  return static_cast<void*>(const_cast< QAxHostWidget*>(this));
1654  return QWidget::qt_metacast(clname);
1655 }
1656 
1658 {
1659  return axhost ? axhost->sizeHint() : QWidget::sizeHint();
1660 }
1661 
1663 {
1664  QSize size;
1665  if (axhost)
1666  size = axhost->minimumSizeHint();
1667  if (size.isValid())
1668  return size;
1669  return QWidget::minimumSizeHint();
1670 }
1671 
1673 {
1674  if (!axhost)
1675  return;
1676 
1677  // document server - talk to view?
1678  if (axhost->m_spActiveView) {
1679  RECT rect;
1680  GetClientRect(winId(), &rect);
1681  axhost->m_spActiveView->SetRect(&rect);
1682 
1683  return;
1684  }
1685 
1686  SIZEL hmSize;
1687  hmSize.cx = MAP_PIX_TO_LOGHIM(width(), logicalDpiX());
1688  hmSize.cy = MAP_PIX_TO_LOGHIM(height(), logicalDpiY());
1689 
1690  if (axhost->m_spOleObject)
1691  axhost->m_spOleObject->SetExtent(DVASPECT_CONTENT, &hmSize);
1692  if (axhost->m_spInPlaceObject) {
1693  RECT rcPos = { x(), y(), x()+width(), y()+height() };
1694  axhost->m_spInPlaceObject->SetObjectRects(&rcPos, &rcPos);
1695  }
1696 }
1697 
1699 {
1700  resizeObject();
1701 }
1702 
1704 {
1705  resizeObject();
1706 }
1707 
1708 bool QAxHostWidget::winEvent(MSG *msg, long *result)
1709 {
1712  IOleInPlaceObjectWindowless *windowless = (IOleInPlaceObjectWindowless*)axhost->m_spInPlaceObject;
1713  Q_ASSERT(windowless);
1714  LRESULT lres;
1715  HRESULT hres = windowless->OnWindowMessage(msg->message, msg->wParam, msg->lParam, &lres);
1716  if (hres == S_OK)
1717  return true;
1718  }
1719  return QWidget::winEvent(msg, result);
1720 }
1721 
1723 {
1724  switch (e->type()) {
1725  case QEvent::Timer:
1726  if (axhost && ((QTimerEvent*)e)->timerId() == setFocusTimer) {
1728  setFocusTimer = 0;
1729  RECT rcPos = { x(), y(), x()+size().width(), y()+size().height() };
1730  axhost->m_spOleObject->DoVerb(OLEIVERB_UIACTIVATE, 0, (IOleClientSite*)axhost, 0, winId(), &rcPos);
1731  if (axhost->m_spActiveView)
1732  axhost->m_spActiveView->UIActivate(TRUE);
1733  }
1734  break;
1735  case QEvent::WindowBlocked:
1736  if (IsWindowEnabled(winId())) {
1737  EnableWindow(winId(), false);
1739  axhost->inPlaceModelessEnabled = false;
1740  axhost->m_spInPlaceActiveObject->EnableModeless(false);
1741  }
1742  }
1743  break;
1745  if (!IsWindowEnabled(winId())) {
1746  EnableWindow(winId(), true);
1749  axhost->m_spInPlaceActiveObject->EnableModeless(true);
1750  }
1751  }
1752  break;
1753  default:
1754  break;
1755  }
1756 
1757  return QWidget::event(e);
1758 }
1759 
1761 {
1762  // focus goes to Qt while ActiveX still has it - deactivate
1763  QWidget *newFocus = qobject_cast<QWidget*>(o);
1764  if (e->type() == QEvent::FocusIn && hasFocus
1765  && newFocus && newFocus->window() == window()) {
1767  axhost->m_spInPlaceObject->UIDeactivate();
1768  qApp->removeEventFilter(this);
1769  }
1770 
1771  return QWidget::eventFilter(o, e);
1772 }
1773 
1775 {
1777 
1778  if (!axhost || !axhost->m_spOleObject)
1779  return;
1780 
1781  // this is called by QWidget::setFocus which calls ::SetFocus on "this",
1782  // so we have to UIActivate the control after all that had happend.
1783  AX_DEBUG(Setting focus on in-place object);
1785 }
1786 
1788 {
1790  if (setFocusTimer) {
1792  setFocusTimer = 0;
1793  }
1795  return;
1796 
1798  return;
1799 
1800  AX_DEBUG(Deactivating in-place object);
1801  axhost->m_spInPlaceObject->UIDeactivate();
1802 }
1803 
1804 
1806 {
1807  if (!QPainter::redirected(this))
1808  return;
1809 
1810  IViewObject *view = 0;
1811  if (axhost)
1812  axhost->widget->queryInterface(IID_IViewObject, (void**)&view);
1813  if (!view)
1814  return;
1815 
1816  // somebody tries to grab us!
1817  QPixmap pm(size());
1818  pm.fill();
1819 
1820  HBITMAP hBmp = pm.toWinHBITMAP();
1821  HDC hBmp_hdc = CreateCompatibleDC(qt_win_display_dc());
1822  HGDIOBJ old_hBmp = SelectObject(hBmp_hdc, hBmp);
1823 
1824  RECTL bounds;
1825  bounds.left = 0;
1826  bounds.right = pm.width();
1827  bounds.top = 0;
1828  bounds.bottom = pm.height();
1829 
1830  view->Draw(DVASPECT_CONTENT, -1, 0, 0, 0, hBmp_hdc, &bounds, 0, 0 /*fptr*/, 0);
1831  view->Release();
1832 
1833  QPainter painter(this);
1834  painter.drawPixmap(0, 0, QPixmap::fromWinHBITMAP(hBmp));
1835 
1836  SelectObject(hBmp_hdc, old_hBmp);
1837  DeleteObject(hBmp);
1838  DeleteDC(hBmp_hdc);
1839 }
1840 
1891 QAxWidget::QAxWidget(QWidget *parent, Qt::WindowFlags f)
1892 : QWidget(parent, f), container(0)
1893 {
1894 }
1895 
1902 QAxWidget::QAxWidget(const QString &c, QWidget *parent, Qt::WindowFlags f)
1903 : QWidget(parent, f), container(0)
1904 {
1905  setControl(c);
1906 }
1907 
1912 QAxWidget::QAxWidget(IUnknown *iface, QWidget *parent, Qt::WindowFlags f)
1913 : QWidget(parent, f), QAxBase(iface), container(0)
1914 {
1915 }
1916 
1924 {
1925  if (container)
1926  container->reset(this);
1927  clear();
1928 }
1929 
1943 bool QAxWidget::initialize(IUnknown **ptr)
1944 {
1945  if (!QAxBase::initialize(ptr))
1946  return false;
1947 
1948  return createHostWindow(false); // assume that control is not initialized
1949 }
1950 
1962 bool QAxWidget::createHostWindow(bool initialized)
1963 {
1964  return createHostWindow(initialized, QByteArray());
1965 }
1966 
1983 bool QAxWidget::createHostWindow(bool initialized, const QByteArray &data)
1984 {
1985 #ifdef QT3_SUPPORT
1986  QApplication::sendPostedEvents(0, QEvent::ChildInserted);
1987 #endif
1988 
1989  container = new QAxClientSite(this);
1990  container->activateObject(initialized, data);
1991 
1992 #if !defined(Q_OS_WINCE)
1993  ATOM filter_ref = FindAtom(qaxatom);
1994 #endif
1995  if (!filter_ref)
1997 #if !defined(Q_OS_WINCE)
1998  AddAtom(qaxatom);
1999 #else
2000  ++filter_ref;
2001 #endif
2002 
2003  if (parentWidget())
2005 
2006  return true;
2007 }
2008 
2018 {
2019  return 0;
2020 }
2021 
2031 {
2032  if (isNull())
2033  return;
2034  if (!control().isEmpty()) {
2035 #if !defined(Q_OS_WINCE)
2036  ATOM filter_ref = FindAtom(qaxatom);
2037  if (filter_ref)
2038  DeleteAtom(filter_ref);
2039  filter_ref = FindAtom(qaxatom);
2040  if (!filter_ref) {
2041 #else
2042  if (!filter_ref && !--filter_ref) {
2043 #endif
2045  previous_filter = 0;
2046  }
2047  }
2048 
2049  if (container)
2050  container->deactivate();
2051 
2052  QAxBase::clear();
2054 
2055  if (container) {
2056  container->releaseAll();
2057  container->Release();
2058  }
2059  container = 0;
2060 }
2061 
2073 bool QAxWidget::doVerb(const QString &verb)
2074 {
2075  if (!verbs().contains(verb))
2076  return false;
2077 
2078  HRESULT hres = container->doVerb(indexOfVerb(verb));
2079 
2080  return hres == S_OK;
2081 }
2082 
2092 {
2093  return QAxBase::metaObject();
2094 }
2095 
2100 {
2101  return &QWidget::staticMetaObject;
2102 }
2103 
2107 void *QAxWidget::qt_metacast(const char *cname)
2108 {
2109  if (!qstrcmp(cname, "QAxWidget")) return (void*)this;
2110  if (!qstrcmp(cname, "QAxBase")) return (QAxBase*)this;
2111  return QWidget::qt_metacast(cname);
2112 }
2113 
2117 const char *QAxWidget::className() const
2118 {
2119  return "QAxWidget";
2120 }
2121 
2125 int QAxWidget::qt_metacall(QMetaObject::Call call, int id, void **v)
2126 {
2127  id = QWidget::qt_metacall(call, id, v);
2128  if (id < 0)
2129  return id;
2130  return QAxBase::qt_metacall(call, id, v);
2131 }
2132 
2137 {
2138  if (container) {
2139  QSize sh = container->sizeHint();
2140  if (sh.isValid())
2141  return sh;
2142  }
2143 
2144  return QWidget::sizeHint();
2145 }
2146 
2151 {
2152  if (container) {
2154  if (sh.isValid())
2155  return sh;
2156  }
2157 
2158  return QWidget::minimumSizeHint();
2159 }
2160 
2165 {
2166  if (isNull() || !container)
2167  return;
2168 
2169  switch (e->type()) {
2170  case QEvent::EnabledChange:
2171  container->emitAmbientPropertyChange(DISPID_AMBIENT_UIDEAD);
2172  break;
2173  case QEvent::FontChange:
2174  container->emitAmbientPropertyChange(DISPID_AMBIENT_FONT);
2175  break;
2176  case QEvent::PaletteChange:
2177  container->emitAmbientPropertyChange(DISPID_AMBIENT_BACKCOLOR);
2178  container->emitAmbientPropertyChange(DISPID_AMBIENT_FORECOLOR);
2179  break;
2182  break;
2183  default:
2184  break;
2185  }
2186 }
2187 
2192 {
2193  if (container)
2194  container->resize(size());
2195 }
2196 
2200 void QAxWidget::connectNotify(const char *)
2201 {
2203 }
2204 
2205 
2238 bool QAxWidget::translateKeyEvent(int message, int keycode) const
2239 {
2240  bool translate = false;
2241 
2242  switch (message) {
2243  case WM_SYSKEYDOWN:
2244  translate = true;
2245  break;
2246  case WM_KEYDOWN:
2247  translate = keycode == VK_TAB
2248  || keycode == VK_DELETE;
2249  if (!translate) {
2250  int state = 0;
2251  if (GetKeyState(VK_SHIFT) < 0)
2252  state |= 0x01;
2253  if (GetKeyState(VK_CONTROL) < 0)
2254  state |= 0x02;
2255  if (GetKeyState(VK_MENU) < 0)
2256  state |= 0x04;
2257  if (state) {
2258  state = keycode < VK_LEFT || keycode > VK_DOWN;
2259  }
2260  translate = state;
2261  }
2262  break;
2263  case WM_SYSKEYUP:
2264  translate = keycode == VK_MENU;
2265  break;
2266  }
2267 
2268  return translate;
2269 }
2270 
2272 #endif // QT_NO_WIN_ACTIVEQT
friend class QAxClientSite
Definition: qaxwidget.h:94
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
Definition: qstring.cpp:1019
HRESULT __stdcall GetIDsOfNames(const _GUID &, wchar_t **, unsigned int, unsigned long, long *)
Definition: qaxwidget.cpp:205
QSize sizeHint() const
Definition: qaxwidget.cpp:363
QPoint pos() const
T qobject_cast(QObject *object)
Definition: qobject.h:375
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
QStringList verbs() const
Returns the list of verbs that the COM object can execute.
Definition: qaxbase.cpp:1137
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
IOleInPlaceObjectWindowless * m_spInPlaceObject
Definition: qaxwidget.cpp:394
DWORD m_dwOleObject
Definition: qaxwidget.cpp:404
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void emitAmbientPropertyChange(DISPID dispid)
Definition: qaxwidget.cpp:904
const Key & key() const
Returns the current item&#39;s key as a const reference.
Definition: qmap.h:250
STGMEDIUM LONG
Definition: qaxwidget.cpp:350
bool isNull() const
Returns true if there is no COM object loaded by this wrapper; otherwise return false.
Definition: qaxbase.cpp:4412
void setShortcut(const QKeySequence &shortcut)
Definition: qaction.cpp:450
int type
Definition: qmetatype.cpp:239
int y() const
Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent
#define QAX_OUTPROC_SERVER
Definition: qaxtypes.h:94
unsigned char c[8]
Definition: qnumeric_p.h:62
static bool connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, int type=0, int *types=0)
Definition: qobject.cpp:3194
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual const QMetaObject * metaObject() const
The metaobject is generated on the fly from the information provided by the IDispatch and ITypeInfo i...
Definition: qaxbase.cpp:3245
STDMETHOD() RequestNewObjectLayout()
Definition: qaxwidget.cpp:944
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QSize size() const
QPointer< QWidget > widget
void paintEvent(QPaintEvent *e)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qaxwidget.cpp:1805
#define BYTE
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
Definition: quuid.h:52
int keycode
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition: qdockwidget.h:60
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
virtual QSize minimumSizeHint() const
QString control() const
the name of the COM object wrapped by this QAxBase object.
Definition: qaxbase.cpp:1029
#define it(className, varName)
bool activateObject(bool initialized, const QByteArray &data)
Definition: qaxwidget.cpp:557
int logicalDpiY() const
Definition: qpaintdevice.h:96
bool qax_runsInDesignMode
Definition: qaxwidget.cpp:836
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
void reset(QWidget *p)
Definition: qaxwidget.cpp:173
static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &)
Definition: qaxwidget.cpp:1197
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
Q_OBJECT_CHECK QAxHostWidget(QWidget *parent, QAxClientSite *ax)
Definition: qaxwidget.cpp:1625
friend class QAxHostWidget
Definition: qaxwidget.cpp:164
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
#define MAP_LOGHIM_TO_PIX(x, ppli)
Definition: qaxtypes.h:73
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QString text
the action&#39;s descriptive text
Definition: qaction.h:76
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
CONTROLINFO control_info
Definition: qaxwidget.cpp:408
static QPixmap fromWinHBITMAP(HBITMAP hbitmap, HBitmapFormat format=NoAlpha)
Win32 only: Returns a QPixmap that is equivalent to the given bitmap.
QSize sizeHint() const
Reimplemented Function
Definition: qaxwidget.cpp:2136
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
Definition: qobject.h:128
QPalette::ColorRole backgroundRole() const
Returns the background role of the widget.
Definition: qwidget.cpp:4677
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Qt::HANDLE handle() const
Returns the pixmap&#39;s handle to the device context.
Definition: qpixmap.cpp:1299
static Qt::KeyboardModifiers translateModifierState(int s)
Definition: qaxwidget.cpp:447
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
unsigned long WINAPI Release()
Definition: qaxwidget.cpp:780
QAxHostWidget * host
Definition: qaxwidget.cpp:413
void * qt_metacast(const char *clname)
Definition: qaxwidget.cpp:1649
#define AX_DEBUG(x)
Definition: qaxwidget.cpp:73
STDMETHOD() GetContainer(LPOLECONTAINER FAR *ppContainer)
Definition: qaxwidget.cpp:925
struct tagFORMATETC FORMATETC
Definition: qmime.h:66
bool isActiveWindow() const
const QMetaObject * parentMetaObject() const
Definition: qaxwidget.cpp:2099
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool hasFocus() const
Definition: qwidget.cpp:6583
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
T * qobject_cast(QObject *object)
Definition: qobject.h:375
STDMETHOD() OnShowWindow(BOOL fShow)
Definition: qaxwidget.cpp:939
STDMETHOD() GetWindowContext(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
Definition: qaxwidget.cpp:1086
QAction * addAction(const QString &text)
This convenience function creates a new action with text.
Definition: qmenu.cpp:1453
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void clear()
Shuts down the ActiveX control.
Definition: qaxwidget.cpp:2030
STDMETHOD() LockInPlaceActive(BOOL fLock)
Definition: qaxwidget.cpp:958
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
int height() const
int qt_metacall(QMetaObject::Call, int, void **)
Definition: qaxwidget.cpp:2125
#define SIZE(large, small, mini)
Qt::FocusPolicy focusPolicy() const
STDMETHOD() OnFocus(BOOL fGotFocus)
Definition: qaxwidget.cpp:1015
virtual void focusOutEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) f...
Definition: qwidget.cpp:9457
void setFixedWidth(int w)
Sets both the minimum and maximum width of the widget to w without changing the heights.
Definition: qwidget.cpp:4368
virtual QSize sizeHint() const
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
unsigned long WINAPI AddRef()
Definition: qaxwidget.cpp:775
QObject * the_object
Definition: qaxaggregated.h:79
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
#define ATOM(x)
Definition: qt_x11_p.h:723
The QAxAggregated class is an abstract base class for implementations of additional COM interfaces...
Definition: qaxaggregated.h:58
void focusOutEvent(QFocusEvent *e)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) f...
Definition: qaxwidget.cpp:1787
bool focus
whether this widget (or its focus proxy) has the keyboard input focus
Definition: qwidget.h:188
IOleInPlaceActiveObject * inPlaceObject() const
Definition: qaxwidget.cpp:181
IOleControl * m_spOleControl
Definition: qaxwidget.cpp:393
int logicalDpiX() const
Definition: qpaintdevice.h:95
#define SIGNAL(a)
Definition: qobjectdefs.h:227
STDMETHOD() OnPosRectChange(LPCRECT lprcPosRect)
Definition: qaxwidget.cpp:1148
void setWindowTitle(const QString &)
Definition: qwidget.cpp:6312
int width() const
Returns the width.
Definition: qsize.h:126
static QWidget * activeModalWidget()
Returns the active modal widget.
IOleDocumentView * m_spActiveView
Definition: qaxwidget.cpp:396
QSize minimumSizeHint() const
Reimplemented Function
Definition: qaxwidget.cpp:2150
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QSize sizeHint() const
Definition: qaxwidget.cpp:1657
static bool isEmpty(const char *str)
HRESULT __stdcall GetTypeInfo(UINT, LCID, ITypeInfo **)
Definition: qaxwidget.cpp:204
bool initialize(IUnknown **)
Calls QAxBase::initialize(ptr), and embeds the control in this widget by calling createHostWindow(fal...
Definition: qaxwidget.cpp:1943
void resizeObject()
Definition: qaxwidget.cpp:1672
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
void setTitle(const QString &title)
Definition: qmenu.cpp:732
QPalette::ColorRole foregroundRole() const
Returns the foreground role.
Definition: qwidget.cpp:4728
#define qApp
STDMETHOD() Scroll(SIZE scrollExtant)
Definition: qaxwidget.cpp:1106
int width() const
virtual bool translateKeyEvent(int message, int keycode) const
Reimplement this function to pass certain key events to the ActiveX control.
Definition: qaxwidget.cpp:2238
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
const QMetaObject * metaObject() const
Definition: qaxwidget.cpp:2091
STDMETHOD() OnControlInfoChanged()
Definition: qaxwidget.cpp:950
HRESULT doVerb(LONG index)
Definition: qaxwidget.cpp:186
static QWidget * find(WId)
Returns a pointer to the widget with window identifer/handle id.
Definition: qwidget.cpp:2517
const QPalette & palette() const
static QAbstractEventDispatcher::EventFilter previous_filter
Definition: qaxwidget.cpp:460
QWidgetData * data
Definition: qwidget.h:815
virtual int qt_metacall(QMetaObject::Call, int, void **)
Definition: qaxbase.cpp:3705
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
QAxClientSite * axhost
Definition: qaxwidget.cpp:144
bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out)
Definition: qaxtypes.cpp:246
bool inPlaceObjectWindowless
Definition: qaxwidget.cpp:400
QAction * addSeparator()
This convenience function creates a new separator action, i.e.
Definition: qmenu.cpp:1583
#define GET_X_LPARAM(lp)
void focusInEvent(QFocusEvent *e)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
Definition: qaxwidget.cpp:1774
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
T findChild(const QString &aName=QString()) const
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object.
Definition: qobject.h:158
void connectNotify()
Connects to all event interfaces of the object.
Definition: qaxbase.cpp:3282
bool setControl(const QString &)
Definition: qaxbase.cpp:975
The QAxWidget class is a QWidget that wraps an ActiveX control.
Definition: qaxwidget.h:60
QString windowTitle() const
static uint QColorToOLEColor(const QColor &col)
Definition: qaxtypes.h:81
struct tagSTGMEDIUM STGMEDIUM
Definition: qmime.h:67
void resizeEvent(QResizeEvent *e)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
Definition: qaxwidget.cpp:1698
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static void sendPostedEvents()
#define MAP_PIX_TO_LOGHIM(x, ppli)
Definition: qaxtypes.h:72
QString right(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n rightmost characters of the string.
Definition: qstring.cpp:3682
int indexOfSignal(const char *signal) const
Finds signal and returns its index; otherwise returns -1.
const T * ptr(const T &t)
bool eventTranslated
Definition: qaxwidget.cpp:377
DECLARE_INTERFACE_(IShellItem, IUnknown)
void resizeEvent(QResizeEvent *)
Reimplemented Function
Definition: qaxwidget.cpp:2191
bool doVerb(const QString &verb)
Requests the ActiveX control to perform the action verb.
Definition: qaxwidget.cpp:2073
void show()
Shows the widget and its child widgets.
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition: qobject.h:275
Q_GUI_EXPORT HDC qt_win_display_dc()
STDMETHOD() ContextSensitiveHelp(BOOL fEnterMode)
Definition: qaxwidget.cpp:1042
QRect rect() const
bool isEnabled() const
Definition: qwidget.h:948
void hide()
Hides the widget.
Definition: qwidget.h:501
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
const char * className() const
Definition: qaxwidget.cpp:2117
bool axc_FilterProc(void *m)
Definition: qaxwidget.cpp:471
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
bool eventFilter(QObject *o, QEvent *e)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qaxwidget.cpp:1760
bool(* EventFilter)(void *message)
Typedef for a function with the signature.
STDMETHOD_(void, OnSave)()
Definition: qaxwidget.cpp:356
#define TRUE
Synonym for true.
Definition: qglobal.h:1018
int length() const
Same as size().
Definition: qbytearray.h:356
QAxClientSite * clientSite() const
Definition: qaxwidget.cpp:120
STDMETHOD() GetWindow(HWND *phwnd)
Definition: qaxwidget.cpp:1033
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
QSize minimumSizeHint() const
Definition: qaxwidget.cpp:1590
QAxClientSite(QAxWidget *c)
Definition: qaxwidget.cpp:530
QAxWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Creates an empty QAxWidget widget and propagates parent and f to the QWidget constructor.
Definition: qaxwidget.cpp:1891
STDMETHOD() GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
Definition: qaxwidget.cpp:916
void setFocusProxy(QWidget *)
Sets the widget&#39;s focus proxy to widget w.
Definition: qwidget.cpp:6537
struct tagMSG MSG
long HRESULT
QMenu * menu() const
Returns the menu contained by this action.
Definition: qaction.cpp:793
void setVisible(bool)
Definition: qaction.cpp:1230
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
Adds the given dockwidget to the specified area.
#define Q_OBJECT_CHECK
Definition: qobjectdefs.h:139
IOleObject * m_spOleObject
Definition: qaxwidget.cpp:392
The QMenuBar class provides a horizontal menu bar.
Definition: qmenubar.h:62
STDMETHOD() TransformCoords(POINTL *pPtlHimetric, POINTF *pPtfContainer, DWORD dwFlags)
Definition: qaxwidget.cpp:973
QAxAggregated * aggregatedObject
Definition: qaxwidget.cpp:398
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
int x() const
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
HBITMAP toWinHBITMAP(HBitmapFormat format=NoAlpha) const
It is the caller&#39;s responsibility to free the HBITMAP data after use.
The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap.
Definition: qmap.h:233
long indexOfVerb(const QString &verb) const
Definition: qaxbase.cpp:1172
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
static bool isBlockedByModal(QWidget *widget)
Returns true if widget is blocked by a modal window.
QPaintEngine * paintEngine() const
Definition: qaxwidget.cpp:134
STDMETHOD() TranslateAccelerator(LPMSG lpMsg, DWORD grfModifiers)
Definition: qaxwidget.cpp:978
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941
bool hasMouseTracking() const
Definition: qwidget.h:993
static int filter_ref
Definition: qaxwidget.cpp:465
virtual ~QAxClientSite()
Definition: qaxwidget.cpp:737
IUnknown * controlling_unknown
Definition: qaxaggregated.h:78
unsigned short ushort
Definition: qglobal.h:995
The QStatusTipEvent class provides an event that is used to show messages in a status bar...
Definition: qevent.h:606
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
HRESULT __stdcall GetTypeInfoCount(unsigned int *)
Definition: qaxwidget.cpp:203
QAxWidget * widget
Definition: qaxwidget.cpp:412
EventFilter setEventFilter(EventFilter filter)
Replaces the event filter function for this QAbstractEventDispatcher with filter and returns the repl...
STDMETHOD_(void, OnRename)(IMoniker *)
Definition: qaxwidget.cpp:353
STDMETHOD() OnInPlaceActivate()
Definition: qaxwidget.cpp:1059
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
STDMETHOD() OnInPlaceDeactivate()
Definition: qaxwidget.cpp:1121
void * qt_metacast(const char *)
Definition: qaxwidget.cpp:2107
int qt_metacall(QMetaObject::Call, int isignal, void **argv)
Definition: qaxwidget.cpp:1386
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static BSTR QStringToBSTR(const QString &str)
Definition: qaxtypes.h:76
bool event(QEvent *e)
This virtual function receives events to an object and should return true if the event e was recogniz...
Definition: qaxwidget.cpp:1722
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
QList< QAction * > actions() const
Returns the (possibly empty) list of this widget&#39;s actions.
Definition: qwidget.cpp:3407
STDMETHOD() SaveObject()
Definition: qaxwidget.cpp:911
HRESULT __stdcall Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: qaxwidget.cpp:839
STDMETHOD() DeactivateAndUndo()
Definition: qaxwidget.cpp:1140
QString objectName() const
int height() const
Returns the height.
Definition: qsize.h:129
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
QAction * addMenu(QMenu *menu)
This convenience function adds menu as a submenu to this menu.
Definition: qmenu.cpp:1541
void setIcon(const QIcon &icon)
Definition: qaction.cpp:772
void showEvent(QShowEvent *e)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
Definition: qaxwidget.cpp:1703
STDMETHOD() QueryInterface(REFIID iid, void **iface)
Definition: qaxwidget.cpp:789
virtual void windowActivationChange(bool)
Definition: qwidget.cpp:12004
Qt::FocusReason reason()
Definition: qevent.cpp:1197
bool translateKeyEvent(int message, int keycode) const
Definition: qaxwidget.cpp:367
friend class QAxClientSite
Definition: qaxwidget.cpp:108
virtual long queryInterface(const QUuid &iid, void **iface)=0
Reimplement this pure virtual function to support additional COM interfaces.
STDMETHOD() OnUIDeactivate(BOOL fUndoable)
Definition: qaxwidget.cpp:1111
static Qt::MouseButtons translateMouseButtonState(int s)
Definition: qaxwidget.cpp:434
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
quint16 index
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
bool modal
Definition: qmenu_mac.mm:99
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
QSize minimumSizeHint() const
Definition: qaxwidget.cpp:1662
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
STDMETHOD() ShowPropertyFrame()
Definition: qaxwidget.cpp:1027
STDMETHOD() GetExtendedControl(IDispatch **ppDisp)
Definition: qaxwidget.cpp:964
~QAxWidget()
Shuts down the ActiveX control and destroys the QAxWidget widget, cleaning up all allocated resources...
Definition: qaxwidget.cpp:1923
const QFont & font() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
int qstrcmp(const QByteArray &str1, const char *str2)
Definition: qbytearray.cpp:336
#define GET_Y_LPARAM(lp)
QAxClientSite * container
Definition: qaxwidget.h:95
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
static const ushort mouseTbl[]
Definition: qaxwidget.cpp:420
bool canHostDocument
Definition: qaxwidget.cpp:402
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
bool inPlaceModelessEnabled
Definition: qaxwidget.cpp:401
virtual QAxAggregated * createAggregate()
Reimplement this function when you want to implement additional COM interfaces for the client site of...
Definition: qaxwidget.cpp:2017
long queryInterface(const QUuid &, void **) const
Requests the interface uuid from the COM object and sets the value of iface to the provided interface...
Definition: qaxbase.cpp:1479
virtual void clear()
Disconnects and destroys the COM object.
Definition: qaxbase.cpp:1095
STDMETHOD() ShowObject()
Definition: qaxwidget.cpp:934
void releaseAll()
Definition: qaxwidget.cpp:749
int qt_metacall(QMetaObject::Call, int isignal, void **argv)
Definition: qaxwidget.cpp:1642
virtual bool initialize(IUnknown **ptr)
This virtual function is called by setControl() and creates the requested COM object.
Definition: qaxbase.cpp:1199
STDMETHOD() CanInPlaceActivate()
Definition: qaxwidget.cpp:1053
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
void deactivate()
Definition: qaxwidget.cpp:767
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
static void leaveModal(QWidget *)
#define QAX_INPROC_SERVER
Definition: qaxtypes.h:93
STDMETHOD_(void, OnClose)()
Definition: qaxwidget.cpp:359
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
IOleInPlaceActiveObject * m_spInPlaceActiveObject
Definition: qaxwidget.cpp:395
The QAxBase class is an abstract class that provides an API to initialize and access a COM object...
Definition: qaxbase.h:66
void changeEvent(QEvent *e)
Reimplemented Function
Definition: qaxwidget.cpp:2164
virtual void focusInEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
Definition: qwidget.cpp:9431
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
void windowActivationChange()
Definition: qaxwidget.cpp:1605
static QPaintDevice * redirected(const QPaintDevice *device, QPoint *offset=0)
Using QWidget::render() obsoletes the use of this function.
Definition: qpainter.cpp:8391
The QFocusEvent class contains event parameters for widget focus events.
Definition: qevent.h:275
static void enterModal(QWidget *)
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
static void enterWhatsThisMode()
This function switches the user interface into "What&#39;s This?" mode.
Definition: qwhatsthis.cpp:633
STDMETHOD() DiscardUndoState()
Definition: qaxwidget.cpp:1135
static void leaveWhatsThisMode()
If the user interface is in "What&#39;s This?" mode, this function switches back to normal mode; otherwis...
Definition: qwhatsthis.cpp:662
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
#define GMEM_MOVEABLE
#define text
Definition: qobjectdefs.h:80
void resize(QSize sz)
Definition: qaxwidget.cpp:365
void setFocusPolicy(Qt::FocusPolicy policy)
Definition: qwidget.cpp:7631
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
STDMETHOD() OnUIActivate()
Definition: qaxwidget.cpp:1080
void killTimer(int id)
Kills the timer with timer identifier, id.
Definition: qobject.cpp:1650
virtual bool createHostWindow(bool)
Creates the client site for the ActiveX control, and returns true if the control could be embedded su...
Definition: qaxwidget.cpp:1962
MouseButton
Definition: qnamespace.h:150
void setFixedHeight(int h)
Sets both the minimum and maximum heights of the widget to h without changing the widths...
Definition: qwidget.cpp:4388
bool winEvent(MSG *msg, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qaxwidget.cpp:1708