Changeset 561 for trunk/src/activeqt/container/qaxwidget.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/activeqt/container/qaxwidget.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the ActiveQt framework of the Qt Toolkit. … … 38 39 ****************************************************************************/ 39 40 40 #ifndef UNICODE41 #define UNICODE42 #endif43 44 45 41 #include "qaxwidget.h" 46 42 … … 124 120 125 121 int qt_metacall(QMetaObject::Call, int isignal, void **argv); 122 void* qt_metacast(const char *clname); 123 126 124 inline QAxClientSite *clientSite() const 127 125 { … … 384 382 385 383 private: 386 #if !defined(Q_ OS_WINCE)384 #if !defined(Q_WS_WINCE) 387 385 struct OleMenuItem { 388 386 OleMenuItem(HMENU hm = 0, int ID = 0, QMenu *menu = 0) … … 409 407 410 408 DWORD m_dwOleObject; 411 #if !defined(Q_ OS_WINCE)409 #if !defined(Q_WS_WINCE) 412 410 HWND m_menuOwner; 413 411 #endif … … 418 416 QAxWidget *widget; 419 417 QAxHostWidget *host; 420 #if !defined(Q_ OS_WINCE)418 #if !defined(Q_WS_WINCE) 421 419 QPointer<QMenuBar> menuBar; 422 420 QMap<QAction*,OleMenuItem> menuItemMap; … … 468 466 #error "Fix QAbstractEventDispatcher::setEventFilter" 469 467 #endif 470 #if defined(Q_ OS_WINCE)468 #if defined(Q_WS_WINCE) 471 469 static int filter_ref = 0; 472 470 #else 473 static const char *qaxatom ="QAxContainer4_Atom";471 static const wchar_t *qaxatom = L"QAxContainer4_Atom"; 474 472 #endif 475 473 … … 484 482 QAxHostWidget *host = 0; 485 483 while (!host && hwnd) { 486 host = qobject_cast<QAxHostWidget*>(QWidget::find(hwnd)); 484 QWidget *widget = QWidget::find(hwnd); 485 if (widget && widget->inherits("QAxHostWidget")) 486 host = qobject_cast<QAxHostWidget*>(widget); 487 487 hwnd = ::GetParent(hwnd); 488 488 } … … 533 533 534 534 QAxClientSite::QAxClientSite(QAxWidget *c) 535 : ref(1), widget(c), host(0), eventTranslated(true)535 : eventTranslated(true), ref(1), widget(c), host(0) 536 536 { 537 537 aggregatedObject = widget->createAggregate(); … … 552 552 553 553 m_dwOleObject = 0; 554 #if !defined(Q_ OS_WINCE)554 #if !defined(Q_WS_WINCE) 555 555 m_menuOwner = 0; 556 556 menuBar = 0; … … 715 715 HRESULT result = m_spOleObject->GetUserType(USERCLASSTYPE_SHORT, &userType); 716 716 if (result == S_OK) { 717 widget->setWindowTitle(QString::from Utf16((const ushort *)userType));717 widget->setWindowTitle(QString::fromWCharArray(userType)); 718 718 CoTaskMemFree(userType); 719 719 } … … 982 982 HRESULT WINAPI QAxClientSite::TranslateAccelerator(LPMSG lpMsg, DWORD /*grfModifiers*/) 983 983 { 984 eventTranslated = false;985 984 if (lpMsg->message == WM_KEYDOWN && !lpMsg->wParam) 986 985 return S_OK; 987 QT_WA_INLINE( 988 SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam), 989 SendMessageA(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam) 990 ); 986 987 bool ActiveQtDetected = false; 988 bool fromInProcServer = false; 989 #ifdef GWLP_USERDATA 990 LONG_PTR serverType = GetWindowLongPtr(lpMsg->hwnd, GWLP_USERDATA); 991 #else 992 LONG serverType = GetWindowLong(lpMsg->hwnd, GWL_USERDATA); 993 #endif 994 if (serverType == QAX_INPROC_SERVER) { 995 ActiveQtDetected = true; 996 fromInProcServer = true; 997 } else if (serverType == QAX_OUTPROC_SERVER) { 998 ActiveQtDetected = true; 999 fromInProcServer = false; 1000 } 1001 1002 eventTranslated = false; 1003 if (!ActiveQtDetected || !fromInProcServer) { 1004 // if the request is coming from an out-of-proc server or a non ActiveQt server, 1005 // we send the message to the host window. This will make sure this key event 1006 // comes to Qt for processing. 1007 SendMessage(host->winId(), lpMsg->message, lpMsg->wParam, lpMsg->lParam); 1008 if (ActiveQtDetected && !fromInProcServer) { 1009 // ActiveQt based servers will need further processing of the event 1010 // (eg. <SPACE> key for a checkbox), so we return false. 1011 return S_FALSE; 1012 } 1013 } 1014 // ActiveQt based in-processes-servers will handle the event properly, so 1015 // we dont need to send this key event to the host. 991 1016 return S_OK; 992 1017 } … … 1133 1158 1134 1159 //**** IOleInPlaceFrame 1135 #if defined(Q_ OS_WINCE)1160 #if defined(Q_WS_WINCE) 1136 1161 HRESULT WINAPI QAxClientSite::InsertMenus(HMENU /*hmenuShared*/, LPOLEMENUGROUPWIDTHS /*lpMenuWidths*/) 1137 1162 { … … 1174 1199 } 1175 1200 1176 static int menuItemEntry(HMENU menu, int index, MENUITEMINFO Aitem, QString &text, QPixmap &/*icon*/)1201 static int menuItemEntry(HMENU menu, int index, MENUITEMINFO item, QString &text, QPixmap &/*icon*/) 1177 1202 { 1178 1203 if (item.fType == MFT_STRING && item.cch) { 1179 char *titlebuf = new char[item.cch+1];1204 wchar_t *titlebuf = new wchar_t[item.cch + 1]; 1180 1205 item.dwTypeData = titlebuf; 1181 1206 item.cch++; 1182 ::GetMenuItemInfo A(menu, index, true, &item);1183 text = QString::from Local8Bit(titlebuf);1184 delete [] titlebuf;1207 ::GetMenuItemInfo(menu, index, true, &item); 1208 text = QString::fromWCharArray(titlebuf); 1209 delete [] titlebuf; 1185 1210 return MFT_STRING; 1186 1211 } … … 1192 1217 QPixmap pixmap(1,1); 1193 1218 QSize sz(MAP_LOGHIM_TO_PIX(bmsize.cx, pixmap.logicalDpiX()), 1194 MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY()));1219 MAP_LOGHIM_TO_PIX(bmsize.cy, pixmap.logicalDpiY())); 1195 1220 1196 1221 pixmap.resize(bmsize.cx, bmsize.cy); … … 1216 1241 popup = new QMenu(parent); 1217 1242 for (int i = 0; i < count; ++i) { 1218 MENUITEMINFO Aitem;1219 memset(&item, 0, sizeof(MENUITEMINFO A));1220 item.cbSize = sizeof(MENUITEMINFO A);1243 MENUITEMINFO item; 1244 memset(&item, 0, sizeof(MENUITEMINFO)); 1245 item.cbSize = sizeof(MENUITEMINFO); 1221 1246 item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; 1222 ::GetMenuItemInfo A(subMenu, i, true, &item);1247 ::GetMenuItemInfo(subMenu, i, true, &item); 1223 1248 1224 1249 QAction *action = 0; … … 1296 1321 int count = GetMenuItemCount(hmenuShared); 1297 1322 for (int i = 0; i < count; ++i) { 1298 MENUITEMINFO Aitem;1299 memset(&item, 0, sizeof(MENUITEMINFO A));1300 item.cbSize = sizeof(MENUITEMINFO A);1323 MENUITEMINFO item; 1324 memset(&item, 0, sizeof(MENUITEMINFO)); 1325 item.cbSize = sizeof(MENUITEMINFO); 1301 1326 item.fMask = MIIM_ID | MIIM_TYPE | MIIM_SUBMENU; 1302 ::GetMenuItemInfo A(hmenuShared, i, true, &item);1327 ::GetMenuItemInfo(hmenuShared, i, true, &item); 1303 1328 1304 1329 QAction *action = 0; … … 1380 1405 OleMenuItem oleItem = menuItemMap.value(action); 1381 1406 if (oleItem.hMenu) 1382 ::PostMessage A(m_menuOwner, WM_COMMAND, oleItem.id, 0);1407 ::PostMessage(m_menuOwner, WM_COMMAND, oleItem.id, 0); 1383 1408 return -1; 1384 1409 #endif … … 1405 1430 HRESULT WINAPI QAxClientSite::SetStatusText(LPCOLESTR pszStatusText) 1406 1431 { 1407 QStatusTipEvent tip(QString::from Utf16((const ushort *)(BSTR)pszStatusText));1432 QStatusTipEvent tip(QString::fromWCharArray(pszStatusText)); 1408 1433 QApplication::sendEvent(widget, &tip); 1409 1434 return S_OK; … … 1414 1439 HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable) 1415 1440 { 1441 #if !defined(Q_OS_WINCE) 1442 LockWindowUpdate(host->window()->winId()); 1443 #endif 1416 1444 EnableWindow(host->window()->winId(), fEnable); 1417 1445 … … 1424 1452 } 1425 1453 qt_win_ignoreNextMouseReleaseEvent = false; 1426 1454 #if !defined(Q_OS_WINCE) 1455 LockWindowUpdate(0); 1456 #endif 1427 1457 return S_OK; 1428 1458 } … … 1512 1542 { 1513 1543 AX_DEBUG(QAxClientSite::SetActiveObject); 1514 1515 if (pszObjName && widget) 1516 widget->setWindowTitle(QString::fromUtf16((const ushort *)(BSTR)pszObjName)); 1544 1545 Q_UNUSED(pszObjName); 1546 // we are ignoring the name of the object, as suggested by MSDN documentation 1547 // for IOleInPlaceUIWindow::SetActiveObject(). 1517 1548 1518 1549 if (m_spInPlaceActiveObject) { … … 1624 1655 return axhost->qt_metacall(call, isignal, argv); 1625 1656 return -1; 1657 } 1658 1659 void* QAxHostWidget::qt_metacast(const char *clname) 1660 { 1661 if (!clname) return 0; 1662 if (!qstrcmp(clname,"QAxHostWidget")) 1663 return static_cast<void*>(const_cast< QAxHostWidget*>(this)); 1664 return QWidget::qt_metacast(clname); 1626 1665 } 1627 1666 … … 1953 1992 1954 1993 #if !defined(Q_OS_WINCE) 1955 ATOM filter_ref = FindAtom A(qaxatom);1994 ATOM filter_ref = FindAtom(qaxatom); 1956 1995 #endif 1957 1996 if (!filter_ref) 1958 1997 previous_filter = QAbstractEventDispatcher::instance()->setEventFilter(axc_FilterProc); 1959 1998 #if !defined(Q_OS_WINCE) 1960 AddAtom A(qaxatom);1999 AddAtom(qaxatom); 1961 2000 #else 1962 2001 ++filter_ref; … … 1993 2032 if (!control().isEmpty()) { 1994 2033 #if !defined(Q_OS_WINCE) 1995 ATOM filter_ref = FindAtom A(qaxatom);2034 ATOM filter_ref = FindAtom(qaxatom); 1996 2035 if (filter_ref) 1997 2036 DeleteAtom(filter_ref); 1998 filter_ref = FindAtom A(qaxatom);2037 filter_ref = FindAtom(qaxatom); 1999 2038 if (!filter_ref) { 2000 2039 #else … … 2043 2082 2044 2083 /*! 2045 \ reimp2084 \internal 2046 2085 */ 2047 2086 const QMetaObject *QAxWidget::metaObject() const … … 2051 2090 2052 2091 /*! 2053 \ reimp2092 \internal 2054 2093 */ 2055 2094 const QMetaObject *QAxWidget::parentMetaObject() const … … 2069 2108 2070 2109 /*! 2071 \ reimp2110 \internal 2072 2111 */ 2073 2112 const char *QAxWidget::className() const … … 2077 2116 2078 2117 /*! 2079 \ reimp2118 \internal 2080 2119 */ 2081 2120 int QAxWidget::qt_metacall(QMetaObject::Call call, int id, void **v)
Note:
See TracChangeset
for help on using the changeset viewer.