summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-03-23 11:11:53 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-24 13:11:09 +0100
commit5e9089135bfe7db7d7a43c9ee4d4c24ab8f6458d (patch)
tree2d3708863f179b81237981ca646862af024fb240 /src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
parent015bc43da010456460dd594d35118ce35d006469 (diff)
Enable IAccessible for MinGW32, keep IAccessible2 disabled for MinGW
No surprise, the files generated by midl contains code that only the MS compiler will understand. However, since the generated files are only needed for IA2, we can still compile the old IAccessible/MSAA implementation for mingw (like it was before the introduction of IA2) I used mingw 4.6.1 to test this. Change-Id: Iad581f2fee087bd7b796ac5a01548f2fcacbd595 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp')
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 8791bbdcfb..6c4d217cb4 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -224,6 +224,53 @@ void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleIn
}
#endif
+/**************************************************************\
+ * *
+ * IUnknown *
+ * *
+ **************************************************************/
+HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::QueryInterface(REFIID id, LPVOID *iface)
+{
+ *iface = 0;
+
+ QByteArray strIID = IIDToString(id);
+ if (!strIID.isEmpty()) {
+ QString ss; QDebug dbg(&ss); dbg << accessible;
+ accessibleDebug("QWindowsIA2Accessible::QI() - IID:%s, iface:%s ", strIID.constData(), qPrintable(ss));
+ }
+ if (id == IID_IUnknown) {
+ *iface = (IUnknown*)(IDispatch*)this;
+ } else if (id == IID_IDispatch) {
+ *iface = (IDispatch*)this;
+ } else if (id == IID_IAccessible) {
+ *iface = (IAccessible*)this;
+ } else if (id == IID_IOleWindow) {
+ *iface = (IOleWindow*)this;
+ }
+
+ if (*iface) {
+ AddRef();
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
+
+ULONG STDMETHODCALLTYPE QWindowsMsaaAccessible::AddRef()
+{
+ return ++ref;
+}
+
+ULONG STDMETHODCALLTYPE QWindowsMsaaAccessible::Release()
+{
+ if (!--ref) {
+ delete this;
+ return 0;
+ }
+ return ref;
+}
+
+
/*
IDispatch
*/
@@ -1208,6 +1255,17 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::ContextSensitiveHelp(BOOL)
return S_OK;
}
+#define IF_EQUAL_RETURN_IIDSTRING(id, iid) if (id == iid) return QByteArray(#iid)
+QByteArray QWindowsMsaaAccessible::IIDToString(REFIID id)
+{
+ IF_EQUAL_RETURN_IIDSTRING(id, IID_IUnknown);
+ IF_EQUAL_RETURN_IIDSTRING(id, IID_IDispatch);
+ IF_EQUAL_RETURN_IIDSTRING(id, IID_IAccessible);
+ IF_EQUAL_RETURN_IIDSTRING(id, IID_IOleWindow);
+
+ return QByteArray();
+}
+
QT_END_NAMESPACE
#endif //QT_NO_ACCESSIBILITY