[Libreoffice-commits] core.git: Branch 'feature/ia2.4' - winaccessibility/inc winaccessibility/source

Michael Meeks michael.meeks at collabora.com
Mon Nov 18 13:45:11 PST 2013


 winaccessibility/inc/g_msacc.hxx                          |    4 +
 winaccessibility/source/UAccCOM/stdafx.h                  |    5 -
 winaccessibility/source/service/AccFrameEventListener.cxx |   13 ----
 winaccessibility/source/service/AccTopWindowListener.cxx  |   42 ++++----------
 winaccessibility/source/service/msaaservice_impl.cxx      |   41 +++++++------
 5 files changed, 39 insertions(+), 66 deletions(-)

New commits:
commit 9633cdf1b07bf2f56805b4b030ba78bfb845956c
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Nov 18 21:44:36 2013 +0000

    uia: more cleanups and debugging output.
    
    Change-Id: Ifaaebbc7826ad8421de432cb91030584b807b893

diff --git a/winaccessibility/inc/g_msacc.hxx b/winaccessibility/inc/g_msacc.hxx
index df6e4bd..d700249 100644
--- a/winaccessibility/inc/g_msacc.hxx
+++ b/winaccessibility/inc/g_msacc.hxx
@@ -20,6 +20,10 @@
 #ifndef __G_MSACC_HXX
 #define __G_MSACC_HXX
 
+extern void FreeTopWindowListener();
+extern void handleWindowOpened_impl( long pAcc );
+extern long GetMSComPtr( long hWnd, long lParam, long wParam );
+
 extern AccTopWindowListener* g_pTop;
 
 #endif
diff --git a/winaccessibility/source/UAccCOM/stdafx.h b/winaccessibility/source/UAccCOM/stdafx.h
index b933b12..6b2ccdd 100644
--- a/winaccessibility/source/UAccCOM/stdafx.h
+++ b/winaccessibility/source/UAccCOM/stdafx.h
@@ -28,10 +28,6 @@
 #pragma once
 #endif // _MSC_VER > 1000
 
-//#define STRICT
-//#ifndef _WIN32_WINNT
-//#define _WIN32_WINNT 0x0400
-//#endif
 //#define _ATL_APARTMENT_THREADED
 
 #include <atlbase.h>
@@ -56,6 +52,7 @@ extern CComModule _Module;
 #include <windows.h>
 #undef OPAQUE
 #include "CheckEnableAccessible.h"
+
 //{{AFX_INSERT_LOCATION}}
 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
 
diff --git a/winaccessibility/source/service/AccFrameEventListener.cxx b/winaccessibility/source/service/AccFrameEventListener.cxx
index a57fc3c..81b81ff 100755
--- a/winaccessibility/source/service/AccFrameEventListener.cxx
+++ b/winaccessibility/source/service/AccFrameEventListener.cxx
@@ -32,20 +32,7 @@ using namespace com::sun::star::accessibility;
 
 #include <vcl/window.hxx>
 #include <toolkit/awt/Vclxwindow.hxx>
-
-//#ifndef _SV_SYSDATA_HXX
-#if 0
-#if defined( WIN ) || defined( WNT ) || defined( OS2 )
-typedef sal_Int32 HWND;
-typedef sal_Int32 HMENU;
-typedef sal_Int32 HDC;
-typedef void *PVOID;
-typedef PVOID HANDLE;
-typedef HANDLE HFONT;
-#endif
-#endif
 #include <vcl/sysdata.hxx>
-//#endif
 
 AccFrameEventListener::AccFrameEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
         :AccEventListener(pAcc, Agent)
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx
index 28d2b79..24cf2a0 100755
--- a/winaccessibility/source/service/AccTopWindowListener.cxx
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -23,17 +23,6 @@
 #include <vcl/window.hxx>
 #include <toolkit/awt/Vclxwindow.hxx>
 
-//#ifndef _SV_SYSDATA_HXX
-#if 0
-#if defined( WIN ) || defined( WNT ) || defined( OS2 )
-typedef sal_Int32 HWND;
-typedef sal_Int32 HMENU;
-typedef sal_Int32 HDC;
-typedef void *PVOID;
-typedef PVOID HANDLE;
-typedef HANDLE HFONT;
-#endif
-#endif
 #include <vcl/sysdata.hxx>
 
 #include "AccTopWindowListener.hxx"
@@ -53,11 +42,9 @@ using namespace com::sun::star::bridge;
 using namespace com::sun::star::awt;
 using namespace rtl;
 using namespace cppu;
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
 
 AccTopWindowListener* g_pTop = NULL;
+
 //when proccess exit, call FreeTopWindowListener() in svmain
 void FreeTopWindowListener()
 {
@@ -73,7 +60,7 @@ void FreeTopWindowListener()
  */
 void handleWindowOpened_impl(long pAcc)
 {
-    if( g_pTop && pAcc != NULL )
+    if( g_pTop && pAcc != 0 )
         g_pTop->handleWindowOpened( (com::sun::star::accessibility::XAccessible*)((void*)pAcc) );
 }
 
@@ -106,7 +93,7 @@ void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XA
     //Only AccessibleContext exist, add all listeners
     if(pAccessibleContext != NULL && systemdata != NULL)
     {
-      accManagerAgent.SaveTopWindowHandle((long)(HWND)systemdata->hWnd,  pAccessible);
+        accManagerAgent.SaveTopWindowHandle((long)(HWND)systemdata->hWnd, pAccessible);
 
         AddAllListeners(pAccessible,NULL,(HWND)systemdata->hWnd);
 
@@ -115,7 +102,6 @@ void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XA
 
         short role = pAccessibleContext->getAccessibleRole();
 
-
         if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU ||
                 role == com::sun::star::accessibility::AccessibleRole::MENU )
         {
@@ -147,20 +133,17 @@ AccTopWindowListener::~AccTopWindowListener()
  */
 void AccTopWindowListener::windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)
 {
+    SAL_INFO( "iacc2", "windowOpened triggered" );
+
     if ( !e.Source.is())
-    {
         return;
-    }
 
     Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY );
     com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get();
-    if ( pAccessible == NULL)
-    {
+    if ( !pAccessible )
         return;
-    }
-
-    handleWindowOpened(pAccessible);
 
+    handleWindowOpened( pAccessible );
 }
 
 /**
@@ -214,7 +197,7 @@ void AccTopWindowListener::AddAllListeners(com::sun::star::accessibility::XAcces
             com::sun::star::accessibility::XAccessibleContext* mpContext = mxAccessibleContext.get();
             if(mpContext != NULL)
             {
-                //fprintf(output, "go on add child's children event listener\n");
+                SAL_INFO( "iacc2", "add child's children event listener" );
                 AddAllListeners(mpAccessible,pAccessible,pWND);
             }
         }
@@ -223,6 +206,7 @@ void AccTopWindowListener::AddAllListeners(com::sun::star::accessibility::XAcces
 
 void AccTopWindowListener::windowClosing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
 {
+    SAL_INFO( "iacc2", "windowClosing triggered" );
 }
 
 /**
@@ -232,17 +216,15 @@ void AccTopWindowListener::windowClosing( const ::com::sun::star::lang::EventObj
  */
 void AccTopWindowListener::windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)
 {
+    SAL_INFO( "iacc2", "windowClosed triggered" );
+
     if ( !e.Source.is())
-    {
         return;
-    }
+
     Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY );
     com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get();
     if ( pAccessible == NULL)
-    {
         return;
-    }
-
 
     VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;
     Window* window = pvclwindow->GetWindow();
diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
index b96a86d..c52ba0a 100755
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -43,11 +43,6 @@ using namespace ::com::sun::star::awt;
 #include "AccTopWindowListener.hxx"
 #include "g_msacc.hxx"
 
-extern void FreeTopWindowListener();
-extern long GetMSComPtr(long hWnd, long lParam, long wParam);
-extern void handleWindowOpened_impl( long pAcc);
-
-
 namespace my_sc_impl
 {
 
@@ -126,9 +121,10 @@ sal_Int32 MSAAServiceImpl::getAccObjectPtr ( long hWnd, long lParam, long wParam
    * @param
    * @return
    */
-void MSAAServiceImpl::handleWindowOpened( sal_Int32 pAcc)
+void MSAAServiceImpl::handleWindowOpened( sal_Int32 nAcc)
 {
-    handleWindowOpened_impl( pAcc );
+    SAL_INFO( "iacc2", "Window opened " << nAcc );
+    handleWindowOpened_impl( nAcc );
 }
 
 OUString MSAAServiceImpl::getImplementationName() throw (RuntimeException)
@@ -157,13 +153,15 @@ Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() throw (RuntimeE
     return getSupportedServiceNames_MSAAServiceImpl();
 }
 
-void AccessBridgehandleExistingWindow(const Reference< XMSAAService > &xAccMgr,
-                                      Window * pWindow, bool bShow)
+static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > &xAccMgr,
+                                             Window *pWindow, bool bShow)
 {
     if ( pWindow )
     {
         css::uno::Reference< css::accessibility::XAccessible > xAccessible;
 
+        SAL_INFO( "iacc2", "Decide whether to register existing window with IAccessible2" );
+
         // Test for combo box - drop down floating windows first
         Window * pParentWindow = pWindow->GetParent();
 
@@ -211,15 +209,19 @@ void AccessBridgehandleExistingWindow(const Reference< XMSAAService > &xAccMgr,
         if ( ! xAccessible.is() )
             xAccessible = pWindow->GetAccessible();
 
-        if ( xAccessible.is() && xAccMgr.is() )
+        assert( xAccMgr.is() );
+        if ( xAccessible.is() )
+        {
             xAccMgr->handleWindowOpened( (long)xAccessible.get() );
+            SAL_INFO( "iacc2", "Decide whether to register existing window with IAccessible2" );
+        }
     }
 }
 
 /*
  * Setup and notify the OS of Accessible peers for all existing windows.
  */
-void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xAccMgr )
+static void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xAccMgr )
 {
     sal_uInt16 nTopWindowCount = (sal_uInt16)Application::GetTopWindowCount();
 
@@ -233,8 +235,8 @@ void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xAccMgr )
             if ( xAC.is())
             {
                 short role = xAC->getAccessibleRole();
-                if ( xAC->getAccessibleName().getLength() > 0 )
-                    AccessBridgehandleExistingWindow( xAccMgr, pTopWindow, true );
+                if ( !xAC->getAccessibleName().isEmpty() )
+                    AccessBridgeHandleExistingWindow( xAccMgr, pTopWindow, true );
             }
         }
     }
@@ -287,14 +289,15 @@ MSAAServiceImpl::MSAAServiceImpl()
     Reference< XExtendedToolkit > xToolkit =
         Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
 
-    if(xToolkit.is())
+    if( xToolkit.is() )
     {
-        AccTopWindowListener *accListener;
-        accListener = new AccTopWindowListener();
-        g_pTop = accListener;
-        Reference< XTopWindowListener> x(accListener);
-        xToolkit->addTopWindowListener(x);
+        g_pTop = new AccTopWindowListener();
+        Reference< XTopWindowListener> xRef( g_pTop );
+        xToolkit->addTopWindowListener( xRef );
+        SAL_INFO( "iacc2", "successfully connected to the toolkit event hose" );
     }
+    else
+        SAL_WARN( "iacc2", "No VCL toolkit interface to listen to for events");
 }
 
 MSAAServiceImpl::~MSAAServiceImpl()


More information about the Libreoffice-commits mailing list