43 #ifndef QT_NO_WIN_ACTIVEQT 45 #include <ActiveQt/qaxaggregated.h> 49 #include <private/qapplication_p.h> 71 #define AX_DEBUG(x) qDebug(#x); 80 #if defined(Q_CC_GNU) && !defined(__MINGW64_VERSION_MAJOR) 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;
97 #include "../shared/qaxtypes.h" 153 public IOleClientSite,
154 public IOleControlSite,
155 #ifdef QAX_SUPPORT_WINDOWLESS 156 public IOleInPlaceSiteWindowless,
158 public IOleInPlaceSite,
160 public IOleInPlaceFrame,
161 public IOleDocumentSite,
183 return m_spInPlaceActiveObject;
191 return OLE_E_NOT_INPLACEACTIVE;
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);
198 unsigned long WINAPI AddRef();
199 unsigned long WINAPI
Release();
200 STDMETHOD(QueryInterface)(REFIID iid,
void **iface);
206 HRESULT __stdcall Invoke(DISPID dispIdMember,
210 DISPPARAMS *pDispParams,
212 EXCEPINFO *pExcepInfo,
214 void emitAmbientPropertyChange(DISPID dispid);
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)();
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)();
234 STDMETHOD(GetWindow)(HWND *phwnd);
235 STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
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);
249 #ifdef QAX_SUPPORT_WINDOWLESS 251 STDMETHOD(OnInPlaceActivateEx)(BOOL* , DWORD )
255 STDMETHOD(OnInPlaceDeactivateEx)(BOOL )
259 STDMETHOD(RequestUIActivate)()
265 STDMETHOD(CanWindowlessActivate)()
269 STDMETHOD(GetCapture)()
273 STDMETHOD(SetCapture)(BOOL )
277 STDMETHOD(GetFocus)()
281 STDMETHOD(SetFocus)(BOOL )
285 STDMETHOD(GetDC)(LPCRECT , DWORD , HDC *phDC)
290 STDMETHOD(ReleaseDC)(HDC hDC)
295 STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase)
297 ::InvalidateRect(host->winId(), pRect, fErase);
300 STDMETHOD(InvalidateRgn)(HRGN hRGN, BOOL fErase)
302 ::InvalidateRgn(host->winId(), hRGN, fErase);
305 STDMETHOD(ScrollRect)(
int ,
int , LPCRECT , LPCRECT )
309 STDMETHOD(AdjustRect)(LPRECT )
313 #ifdef Q_CC_GNU // signature incorrect in win32api 314 STDMETHOD(AdjustRect)(LPCRECT )
317 return AdjustRect(&rect);
321 STDMETHOD(OnDefWindowMessage)(UINT , WPARAM , LPARAM , LRESULT* )
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));
336 STDMETHOD(GetBorder(LPRECT lprectBorder));
337 STDMETHOD(RequestBorderSpace(LPCBORDERWIDTHS pborderwidths));
338 STDMETHOD(SetBorderSpace(LPCBORDERWIDTHS pborderwidths));
339 STDMETHOD(SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName));
342 STDMETHOD(ActivateMe(IOleDocumentView *pViewToActivate));
347 AX_DEBUG(QAxClientSite::OnDataChange);
349 STDMETHOD_(
void, OnViewChange)(DWORD , LONG )
351 AX_DEBUG(QAxClientSite::OnViewChange);
371 return widget->translateKeyEvent(message, keycode);
380 #if !defined(Q_WS_WINCE) 382 OleMenuItem(HMENU hm = 0,
int ID = 0,
QMenu *menu = 0)
383 : hMenu(hm), id(ID), subMenu(menu)
405 #if !defined(Q_WS_WINCE) 414 #if !defined(Q_WS_WINCE) 436 Qt::MouseButtons bst = 0;
449 Qt::KeyboardModifiers bst = 0;
454 if (GetKeyState(VK_MENU) < 0)
461 #if QT_VERSION >= 0x050000 462 #error "Fix QAbstractEventDispatcher::setEventFilter" 464 #if defined(Q_WS_WINCE) 467 static const wchar_t *qaxatom = L
"QAxContainer4_Atom";
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;
479 while (!host && hwnd) {
481 if (widget && widget->
inherits(
"QAxHostWidget"))
482 host = qobject_cast<QAxHostWidget*>(widget);
483 hwnd = ::GetParent(hwnd);
487 if (ax && msg->hwnd != host->
winId()) {
488 if (message >= WM_KEYFIRST && message <= WM_KEYLAST) {
510 DWORD ol_pos = GetMessagePos();
531 : eventTranslated(true), ref(1),
widget(c), host(0)
550 #if !defined(Q_WS_WINCE) 562 bool showHost =
false;
566 DWORD dwMiscStatus = 0;
567 m_spOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);
569 #if !defined(Q_OS_WINCE) 570 IOleDocument *document = 0;
571 m_spOleObject->QueryInterface(IID_IOleDocument, (
void**)&document);
573 IPersistStorage *persistStorage = 0;
574 document->QueryInterface(IID_IPersistStorage, (
void**)&persistStorage);
575 if (persistStorage) {
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);
582 persistStorage->InitNew(storage);
583 persistStorage->Release();
588 m_spOleObject->SetClientSite(
this);
589 OleRun(m_spOleObject);
597 if(dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
598 m_spOleObject->SetClientSite(
this);
601 IPersistStreamInit *spPSI = 0;
602 m_spOleObject->QueryInterface(IID_IPersistStreamInit, (
void**)&spPSI);
605 IStream *pStream = 0;
608 BYTE *pStByte = (
BYTE *)GlobalLock(hGlobal);
611 GlobalUnlock(hGlobal);
612 if (SUCCEEDED(CreateStreamOnHGlobal(hGlobal,
TRUE, &pStream))) {
613 spPSI->Load(pStream);
622 }
else if (data.
length()) {
623 IPersistStorage *spPS = 0;
624 m_spOleObject->QueryInterface( IID_IPersistStorage, (
void**)&spPS );
628 #if !defined(Q_OS_WINCE) 629 BYTE* pbData = (
BYTE*)GlobalLock(hGlobal);
632 GlobalUnlock(hGlobal);
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);
642 pLockBytes->Release();
652 if(!(dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST))
653 m_spOleObject->SetClientSite(
this);
656 IViewObject *spViewObject = 0;
657 m_spOleObject->QueryInterface(IID_IViewObject, (
void**) &spViewObject);
660 IAdviseSink *spAdviseSink = 0;
662 if (spAdviseSink && spViewObject) {
664 spViewObject->SetAdvise(DVASPECT_CONTENT, 0, spAdviseSink);
667 spAdviseSink->Release();
669 spViewObject->Release();
671 m_spOleObject->SetHostNames(OLESTR(
"AXWIN"), 0);
673 if (!(dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME)) {
678 m_spOleObject->SetExtent(DVASPECT_CONTENT, &hmSize);
679 m_spOleObject->GetExtent(DVASPECT_CONTENT, &hmSize);
688 if (!(dwMiscStatus & OLEMISC_NOUIACTIVATE)) {
696 m_spOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, 0, (IOleClientSite*)
this, 0,
host->
winId(), &rcPos);
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);
711 HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType);
712 if (result == S_OK) {
714 CoTaskMemFree(userType);
717 IObjectWithSite *spSite = 0;
720 spSite->SetSite((IUnknown*)(IDispatch*)
this);
777 return InterlockedIncrement(&
ref);
782 LONG refCount = InterlockedDecrement(&
ref);
793 if (iid == IID_IUnknown) {
794 *iface = (IUnknown*)(IDispatch*)
this;
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;
820 else if (iid == IID_IOleInPlaceFrame)
821 *iface = (IOleInPlaceFrame*)
this;
822 else if (iid == IID_IOleInPlaceUIWindow)
823 *iface = (IOleInPlaceUIWindow*)
this;
825 *iface = (IOleDocumentSite*)
this;
826 else if (iid == IID_IAdviseSink)
827 *iface = (IAdviseSink*)
this;
830 return E_NOINTERFACE;
853 switch(dispIdMember) {
854 case DISPID_AMBIENT_USERMODE:
855 pVarResult->vt = VT_BOOL;
859 case DISPID_AMBIENT_AUTOCLIP:
860 case DISPID_AMBIENT_SUPPORTSMNEMONICS:
861 pVarResult->vt = VT_BOOL;
862 pVarResult->boolVal =
true;
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;
873 case DISPID_AMBIENT_DISPLAYNAME:
874 pVarResult->vt = VT_BSTR;
878 case DISPID_AMBIENT_FONT:
882 case DISPID_AMBIENT_BACKCOLOR:
883 pVarResult->vt = VT_UI4;
887 case DISPID_AMBIENT_FORECOLOR:
888 pVarResult->vt = VT_UI4;
892 case DISPID_AMBIENT_UIDEAD:
893 pVarResult->vt = VT_BOOL;
901 return DISP_E_MEMBERNOTFOUND;
931 return E_NOINTERFACE;
980 if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam)
983 bool ActiveQtDetected =
false;
984 bool fromInProcServer =
false;
986 LONG_PTR serverType = GetWindowLongPtr(lpMsg->hwnd, GWLP_USERDATA);
988 LONG serverType = GetWindowLong(lpMsg->hwnd, GWL_USERDATA);
991 ActiveQtDetected =
true;
992 fromInProcServer =
true;
994 ActiveQtDetected =
true;
995 fromInProcServer =
false;
999 if (!ActiveQtDetected || !fromInProcServer) {
1003 SendMessage(
host->
winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam);
1004 if (ActiveQtDetected && !fromInProcServer) {
1062 #if !defined(Q_OS_WINCE) 1088 if (!ppFrame || !ppDoc || !lprcPosRect || !lprcClipRect || !lpFrameInfo)
1094 ::GetClientRect(
host->
winId(), lprcPosRect);
1095 ::GetClientRect(
host->
winId(), lprcClipRect);
1097 lpFrameInfo->cb =
sizeof(OLEINPLACEFRAMEINFO);
1098 lpFrameInfo->fMDIApp =
false;
1099 lpFrameInfo->haccel = 0;
1100 lpFrameInfo->cAccelEntries = 0;
1128 #if !defined(Q_OS_WINCE) 1156 #if defined(Q_WS_WINCE) 1157 HRESULT WINAPI QAxClientSite::InsertMenus(HMENU , LPOLEMENUGROUPWIDTHS )
1161 HRESULT WINAPI QAxClientSite::InsertMenus(HMENU , LPOLEMENUGROUPWIDTHS lpMenuWidths)
1163 AX_DEBUG(QAxClientSite::InsertMenus);
1171 QMenu *fileMenu = 0;
1172 QMenu *viewMenu = 0;
1173 QMenu *windowMenu = 0;
1175 for (
int i = 0; i < actions.
count(); ++i) {
1179 fileMenu = action->
menu();
1181 viewMenu = action->
menu();
1183 windowMenu = action->
menu();
1191 lpMenuWidths->width[4] = windowMenu->
actions().
count();
1199 if (item.fType == MFT_STRING && item.cch) {
1200 wchar_t *titlebuf =
new wchar_t[item.cch + 1];
1201 item.dwTypeData = titlebuf;
1203 ::GetMenuItemInfo(menu, index,
true, &item);
1209 else if (item.fType == MFT_BITMAP) {
1210 HBITMAP hbm = (HBITMAP)LOWORD(item.hbmpItem);
1212 GetBitmapDimensionEx(hbm, &bmsize);
1217 pixmap.resize(bmsize.cx, bmsize.cy);
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);
1231 #if !defined(Q_OS_WINCE) 1232 QMenu *QAxClientSite::generatePopup(HMENU subMenu,
QWidget *parent)
1235 int count = GetMenuItemCount(subMenu);
1237 popup =
new QMenu(parent);
1238 for (
int i = 0; i < count; ++i) {
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);
1246 QMenu *popupMenu = 0;
1247 if (item.fType == MFT_SEPARATOR) {
1253 popupMenu = item.hSubMenu ? generatePopup(item.hSubMenu, popup) : 0;
1257 if (lastSep != -1) {
1261 text = text.
left(lastSep);
1270 action = popup->
addMenu(popupMenu);
1276 action = popup->
addMenu(popupMenu);
1291 OleMenuItem oleItem(subMenu, item.wID, popupMenu);
1292 menuItemMap.insert(action, oleItem);
1299 #if defined(Q_OS_WINCE) 1300 HRESULT WINAPI QAxClientSite::SetMenu(HMENU , HOLEMENU , HWND )
1304 HRESULT WINAPI QAxClientSite::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
1309 m_menuOwner = hwndActiveObject;
1317 int count = GetMenuItemCount(hmenuShared);
1318 for (
int i = 0; i < count; ++i) {
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);
1326 QMenu *popupMenu = 0;
1327 if (item.fType == MFT_SEPARATOR) {
1328 action = menuBar->addSeparator();
1332 popupMenu = item.hSubMenu ? generatePopup(item.hSubMenu, menuBar) : 0;
1341 action = menuBar->addMenu(popupMenu);
1343 action = menuBar->addAction(text);
1347 action = menuBar->addMenu(popupMenu);
1349 action = menuBar->addAction(text);
1354 if (action && !icon.
isNull())
1359 OleMenuItem oleItem(hmenuShared, item.wID, popupMenu);
1360 menuItemMap.insert(action, oleItem);
1370 }
else if (menuBar) {
1373 for (it = menuItemMap.begin(); it != menuItemMap.end(); ++
it) {
1377 menuItemMap.clear();
1385 #if defined(Q_OS_WINCE) 1395 if (isignal != menuBar->metaObject()->indexOfSignal(
"triggered(QAction*)"))
1401 OleMenuItem oleItem = menuItemMap.value(action);
1403 ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0);
1409 HRESULT WINAPI QAxClientSite::RemoveMenus(HMENU )
1411 #if defined(Q_OS_WINCE) 1414 AX_DEBUG(QAxClientSite::RemoveMenus);
1416 for (it = menuItemMap.begin(); it != menuItemMap.end(); ++
it) {
1421 menuItemMap.clear();
1426 HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText)
1435 HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
1446 qt_win_ignoreNextMouseReleaseEvent =
false;
1456 HRESULT WINAPI QAxClientSite::GetBorder(LPRECT lprectBorder)
1458 #ifndef QAX_SUPPORT_BORDERSPACE 1460 return INPLACE_E_NOTOOLSPACE;
1462 AX_DEBUG(QAxClientSite::GetBorder);
1466 return INPLACE_E_NOTOOLSPACE;
1468 RECT border = { 0,0, 300, 200 };
1469 *lprectBorder = border;
1474 HRESULT WINAPI QAxClientSite::RequestBorderSpace(LPCBORDERWIDTHS )
1476 #ifndef QAX_SUPPORT_BORDERSPACE 1477 return INPLACE_E_NOTOOLSPACE;
1479 AX_DEBUG(QAxClientSite::RequestBorderSpace);
1483 return INPLACE_E_NOTOOLSPACE;
1489 HRESULT WINAPI QAxClientSite::SetBorderSpace(LPCBORDERWIDTHS pborderwidths)
1491 #ifndef QAX_SUPPORT_BORDERSPACE 1493 return OLE_E_INVALIDRECT;
1495 AX_DEBUG(QAxClientSite::SetBorderSpace);
1503 return OLE_E_INVALIDRECT;
1505 bool removeToolBars = !(pborderwidths->left || pborderwidths->top || pborderwidths->right || pborderwidths->bottom);
1508 if (removeToolBars) {
1514 if (pborderwidths->left) {
1520 if (pborderwidths->top) {
1531 HRESULT WINAPI QAxClientSite::SetActiveObject(IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1533 AX_DEBUG(QAxClientSite::SetActiveObject);
1554 HRESULT WINAPI QAxClientSite::ActivateMe(IOleDocumentView *pViewToActivate)
1556 AX_DEBUG(QAxClientSite::ActivateMe);
1562 if (!pViewToActivate) {
1563 IOleDocument *document = 0;
1564 m_spOleObject->QueryInterface(IID_IOleDocument, (
void**)&document);
1568 document->CreateView(
this, 0, 0, &pViewToActivate);
1570 document->Release();
1571 if (!pViewToActivate)
1572 return E_OUTOFMEMORY;
1574 pViewToActivate->SetInPlaceSite(
this);
1598 if (SUCCEEDED(res)) {
1626 :
QWidget(parent), setFocusTimer(0), hasFocus(false), axhost(ax)
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);
1680 GetClientRect(
winId(), &rect);
1715 HRESULT hres = windowless->OnWindowMessage(msg->message, msg->wParam, msg->lParam, &lres);
1724 switch (e->
type()) {
1731 if (axhost->m_spActiveView)
1732 axhost->m_spActiveView->UIActivate(
TRUE);
1736 if (IsWindowEnabled(
winId())) {
1737 EnableWindow(
winId(),
false);
1745 if (!IsWindowEnabled(
winId())) {
1746 EnableWindow(
winId(),
true);
1768 qApp->removeEventFilter(
this);
1800 AX_DEBUG(Deactivating in-place
object);
1810 IViewObject *view = 0;
1822 HGDIOBJ old_hBmp = SelectObject(hBmp_hdc, hBmp);
1826 bounds.right = pm.
width();
1828 bounds.bottom = pm.
height();
1830 view->Draw(DVASPECT_CONTENT, -1, 0, 0, 0, hBmp_hdc, &bounds, 0, 0 , 0);
1836 SelectObject(hBmp_hdc, old_hBmp);
1892 :
QWidget(parent, f), container(0)
1992 #if !defined(Q_OS_WINCE) 1997 #if !defined(Q_OS_WINCE) 2035 #if !defined(Q_OS_WINCE) 2038 DeleteAtom(filter_ref);
2039 filter_ref = FindAtom(qaxatom);
2042 if (!filter_ref && !--filter_ref) {
2075 if (!
verbs().contains(verb))
2080 return hres == S_OK;
2109 if (!
qstrcmp(cname,
"QAxWidget"))
return (
void*)
this;
2111 return QWidget::qt_metacast(cname);
2127 id = QWidget::qt_metacall(call,
id, v);
2169 switch (e->
type()) {
2240 bool translate =
false;
2247 translate = keycode == VK_TAB
2248 || keycode == VK_DELETE;
2251 if (GetKeyState(VK_SHIFT) < 0)
2253 if (GetKeyState(VK_CONTROL) < 0)
2255 if (GetKeyState(VK_MENU) < 0)
2258 state = keycode < VK_LEFT || keycode > VK_DOWN;
2264 translate = keycode == VK_MENU;
2272 #endif // QT_NO_WIN_ACTIVEQT
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...
HRESULT __stdcall GetIDsOfNames(const _GUID &, wchar_t **, unsigned int, unsigned long, long *)
T qobject_cast(QObject *object)
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
The QPainter class performs low-level painting on widgets and other paint devices.
QStringList verbs() const
Returns the list of verbs that the COM object can execute.
IOleInPlaceObjectWindowless * m_spInPlaceObject
void emitAmbientPropertyChange(DISPID dispid)
const Key & key() const
Returns the current item's key as a const reference.
bool isNull() const
Returns true if there is no COM object loaded by this wrapper; otherwise return false.
void setShortcut(const QKeySequence &shortcut)
#define QAX_OUTPROC_SERVER
#define QT_END_NAMESPACE
This macro expands to.
virtual const QMetaObject * metaObject() const
The metaobject is generated on the fly from the information provided by the IDispatch and ITypeInfo i...
STDMETHOD() RequestNewObjectLayout()
int width() const
Returns the width of the pixmap.
QPointer< QWidget > widget
char * data()
Returns a pointer to the data stored in the byte array.
The QRegExp class provides pattern matching using regular expressions.
QString control() const
the name of the COM object wrapped by this QAxBase object.
#define it(className, varName)
bool activateObject(bool initialized, const QByteArray &data)
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...
static QAbstractEventDispatcher * instance(QThread *thread=0)
Returns a pointer to the event dispatcher object for the specified thread.
friend class QAxHostWidget
The QByteArray class provides an array of bytes.
#define MAP_LOGHIM_TO_PIX(x, ppli)
int length() const
Returns the number of characters in this string.
QString text
the action's descriptive text
static QPixmap fromWinHBITMAP(HBITMAP hbitmap, HBitmapFormat format=NoAlpha)
Win32 only: Returns a QPixmap that is equivalent to the given bitmap.
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Qt::HANDLE handle() const
Returns the pixmap's handle to the device context.
int count(const T &t) const
Returns the number of occurrences of value in the list.
unsigned long WINAPI Release()
STDMETHOD() GetContainer(LPOLECONTAINER FAR *ppContainer)
struct tagFORMATETC FORMATETC
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
STDMETHOD() OnShowWindow(BOOL fShow)
STDMETHOD() GetWindowContext(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
The QObject class is the base class of all Qt objects.
STDMETHOD() LockInPlaceActive(BOOL fLock)
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
#define SIZE(large, small, mini)
STDMETHOD() OnFocus(BOOL fGotFocus)
void setObjectName(const QString &name)
unsigned long WINAPI AddRef()
void setWidth(int w)
Sets the width to the given width.
The QAxAggregated class is an abstract base class for implementations of additional COM interfaces...
IOleInPlaceActiveObject * inPlaceObject() const
IOleControl * m_spOleControl
STDMETHOD() OnPosRectChange(LPCRECT lprcPosRect)
int width() const
Returns the width.
static QWidget * activeModalWidget()
Returns the active modal widget.
IOleDocumentView * m_spActiveView
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool isEmpty(const char *str)
HRESULT __stdcall GetTypeInfo(UINT, LCID, ITypeInfo **)
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
STDMETHOD() Scroll(SIZE scrollExtant)
const T & at(int i) const
Returns the item at index position i in the list.
STDMETHOD() OnControlInfoChanged()
HRESULT doVerb(LONG index)
virtual int qt_metacall(QMetaObject::Call, int, void **)
The QResizeEvent class contains event parameters for resize events.
bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out)
bool inPlaceObjectWindowless
static const char * data(const QByteArray &arr)
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.
void connectNotify()
Connects to all event interfaces of the object.
bool setControl(const QString &)
static uint QColorToOLEColor(const QColor &col)
struct tagSTGMEDIUM STGMEDIUM
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)
QString right(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n rightmost characters of the string.
const T * ptr(const T &t)
DECLARE_INTERFACE_(IShellItem, IUnknown)
The QShowEvent class provides an event that is sent when a widget is shown.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
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...
Q_GUI_EXPORT HDC qt_win_display_dc()
STDMETHOD() ContextSensitiveHelp(BOOL fEnterMode)
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
The QMouseEvent class contains parameters that describe a mouse event.
bool(* EventFilter)(void *message)
Typedef for a function with the signature.
STDMETHOD_(void, OnSave)()
#define TRUE
Synonym for true.
int length() const
Same as size().
STDMETHOD() GetWindow(HWND *phwnd)
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
QSize minimumSizeHint() const
QAxClientSite(QAxWidget *c)
STDMETHOD() GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
QMenu * menu() const
Returns the menu contained by this action.
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
Adds the given dockwidget to the specified area.
IOleObject * m_spOleObject
STDMETHOD() TransformCoords(POINTL *pPtlHimetric, POINTF *pPtfContainer, DWORD dwFlags)
QAxAggregated * aggregatedObject
The QKeySequence class encapsulates a key sequence as used by shortcuts.
HBITMAP toWinHBITMAP(HBitmapFormat format=NoAlpha) const
It is the caller's responsibility to free the HBITMAP data after use.
The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap.
long indexOfVerb(const QString &verb) const
Type
This enum type defines the valid event types in Qt.
The QTimerEvent class contains parameters that describe a timer event.
static bool isBlockedByModal(QWidget *widget)
Returns true if widget is blocked by a modal window.
STDMETHOD() TranslateAccelerator(LPMSG lpMsg, DWORD grfModifiers)
IUnknown * controlling_unknown
The QStatusTipEvent class provides an event that is used to show messages in a status bar...
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
HRESULT __stdcall GetTypeInfoCount(unsigned int *)
EventFilter setEventFilter(EventFilter filter)
Replaces the event filter function for this QAbstractEventDispatcher with filter and returns the repl...
STDMETHOD_(void, OnRename)(IMoniker *)
STDMETHOD() OnInPlaceActivate()
QObject * parent() const
Returns a pointer to the parent object.
STDMETHOD() OnInPlaceDeactivate()
int qt_metacall(QMetaObject::Call, int isignal, void **argv)
The QPoint class defines a point in the plane using integer precision.
static BSTR QStringToBSTR(const QString &str)
The QMainWindow class provides a main application window.
HRESULT __stdcall Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
STDMETHOD() DeactivateAndUndo()
QString objectName() const
int height() const
Returns the height.
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
void setIcon(const QIcon &icon)
STDMETHOD() QueryInterface(REFIID iid, void **iface)
bool translateKeyEvent(int message, int keycode) const
virtual long queryInterface(const QUuid &iid, void **iface)=0
Reimplement this pure virtual function to support additional COM interfaces.
STDMETHOD() OnUIDeactivate(BOOL fUndoable)
The QPixmap class is an off-screen image representation that can be used as a paint device...
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...
int height() const
Returns the height of the pixmap.
STDMETHOD() ShowPropertyFrame()
STDMETHOD() GetExtendedControl(IDispatch **ppDisp)
The QSize class defines the size of a two-dimensional object using integer point precision.
int qstrcmp(const QByteArray &str1, const char *str2)
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
The QPaintEvent class contains event parameters for paint events.
bool inPlaceModelessEnabled
long queryInterface(const QUuid &, void **) const
Requests the interface uuid from the COM object and sets the value of iface to the provided interface...
virtual void clear()
Disconnects and destroys the COM object.
virtual bool initialize(IUnknown **ptr)
This virtual function is called by setControl() and creates the requested COM object.
STDMETHOD() CanInPlaceActivate()
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
static void leaveModal(QWidget *)
#define QAX_INPROC_SERVER
STDMETHOD_(void, OnClose)()
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
IOleInPlaceActiveObject * m_spInPlaceActiveObject
The QAxBase class is an abstract class that provides an API to initialize and access a COM object...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void windowActivationChange()
static QPaintDevice * redirected(const QPaintDevice *device, QPoint *offset=0)
Using QWidget::render() obsoletes the use of this function.
The QFocusEvent class contains event parameters for widget focus events.
static void enterModal(QWidget *)
The QAction class provides an abstract user interface action that can be inserted into widgets...
static void enterWhatsThisMode()
This function switches the user interface into "What's This?" mode.
STDMETHOD() DiscardUndoState()
static void leaveWhatsThisMode()
If the user interface is in "What's This?" mode, this function switches back to normal mode; otherwis...
The QMap class is a template class that provides a skip-list-based dictionary.
The QList class is a template class that provides lists.
STDMETHOD() OnUIActivate()
void killTimer(int id)
Kills the timer with timer identifier, id.