Author: steve_y
Date: Wed Dec 12 04:28:59 2012
New Revision: 1420518

URL: http://svn.apache.org/viewvc?rev=1420518&view=rev
Log:
IAccessible2 bridge integration

Modified:
    
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
    
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
    
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
    
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
    
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
    openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/makefile.mk
    openoffice/branches/ia2/main/postprocess/packcomponents/makefile.mk
    openoffice/branches/ia2/main/postprocess/prj/build.lst
    openoffice/branches/ia2/main/vcl/inc/svdata.hxx
    openoffice/branches/ia2/main/vcl/inc/vcl/svapp.hxx
    openoffice/branches/ia2/main/vcl/source/app/svapp.cxx
    openoffice/branches/ia2/main/vcl/source/app/svdata.cxx
    openoffice/branches/ia2/main/vcl/source/app/svmain.cxx
    openoffice/branches/ia2/main/vcl/win/source/window/salframe.cxx

Modified: 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
 (original)
+++ 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
 Wed Dec 12 04:28:59 2012
@@ -376,6 +376,17 @@ published constants AccessibleEventId
         @since OOo 3.2
     */
     const short LISTBOX_ENTRY_COLLAPSED = 33;
+
+    //IAccessibility2 Implementation 2009-----
+    const short ACTIVE_DESCENDANT_CHANGED_NOFOCUS = 34;
+    const short SELECTION_CHANGED_ADD =35;
+    const short SELECTION_CHANGED_REMOVE =36;
+    const short SELECTION_CHANGED_WITHIN =37;
+    const short PAGE_CHANGED =38;
+    const short SECTION_CHANGED =39;
+    const short COLUMN_CHANGED =40;
+    //-----IAccessibility2 Implementation 2009
+
 };
 
 }; }; }; };

Modified: 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
 (original)
+++ 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
 Wed Dec 12 04:28:59 2012
@@ -110,6 +110,14 @@ published constants AccessibleRelationTy
         @since OOo 3.0
     */
     const short NODE_CHILD_OF = 9;
+
+    /** Described-by relation type.
+    
+        <p>Indicates an object is described by the target object.</p>
+
+        @since OOo 3.5
+    */
+    const short DESCRIBED_BY = 10;
 };
 
 }; }; }; };

Modified: 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
 (original)
+++ 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
 Wed Dec 12 04:28:59 2012
@@ -214,6 +214,27 @@ published constants AccessibleStateType
         partly in the visible area of its parent.</p>
     */
     const short VISIBLE = 30;
+    
+    // The following constants have been introduced with the IA2 CWS:
+
+       // MOVEABLE only exists in MSAA/IA2, but not in ATK/JAA/NSAccessibility.
+    /** Indicates the position of the object is not fixed.
+    */
+    const short MOVEABLE = 31;
+
+       // DEFAULT exists in MSAA/IA2, and now also in ATK and NSAccessibility.
+    /** Indicates the object is the default button in a window
+    */
+    const short DEFAULT = 32;
+
+       // OFFSCREEN only exists in MSAA/IA2, but not in 
ATK/JAA/NSAccessibility.
+    // MT: Shouldn't this be the same like !SHOWING in UAA/ATK?
+    const short OFFSCREEN = 33;
+
+       // COLLAPSED exists in MSAA/IA2, and now also in JAA, but not in 
ATK/NSAccessibility. In NSAccessibility, there is a notification for collapse.
+    // In opposite to MSAA, UAA has EXPANDABLE, so EXPANDABLE && !EXPANDED 
should be the same like COLLAPSED.
+    const short COLLAPSE = 34;
+
 };
 
 }; }; }; };

Modified: 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
 (original)
+++ 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
 Wed Dec 12 04:28:59 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef __com_sun_star_accessibility_XAccessibleTable_idl__
 #define __com_sun_star_accessibility_XAccessibleTable_idl__
 

Modified: 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
 (original)
+++ 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
 Wed Dec 12 04:28:59 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef __com_sun_star_accessibility_XAccessibleValue_idl__
 #define __com_sun_star_accessibility_XAccessibleValue_idl__
 

Modified: 
openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/makefile.mk?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/makefile.mk 
(original)
+++ openoffice/branches/ia2/main/offapi/com/sun/star/accessibility/makefile.mk 
Wed Dec 12 04:28:59 2012
@@ -47,15 +47,18 @@ IDLFILES=\
     AccessibleTableModelChangeType.idl              \
     AccessibleTextType.idl                          \
     IllegalAccessibleComponentStateException.idl    \
+    MSAAService.idl                                 \
     TextSegment.idl                                 \
     XAccessible.idl                                 \
     XAccessibleAction.idl                           \
     XAccessibleComponent.idl                        \
     XAccessibleContext.idl                          \
     XAccessibleEditableText.idl                     \
+    XAccessibleExtendedAttributes.idl               \
     XAccessibleEventBroadcaster.idl                 \
     XAccessibleEventListener.idl                    \
     XAccessibleExtendedComponent.idl                \
+    XAccessibleGroupPosition.idl                    \
     XAccessibleHyperlink.idl                        \
     XAccessibleHypertext.idl                        \
     XAccessibleImage.idl                            \
@@ -65,10 +68,14 @@ IDLFILES=\
     XAccessibleSelection.idl                        \
     XAccessibleStateSet.idl                         \
     XAccessibleTable.idl                            \
+    XAccessibleTableSelection.idl                   \
     XAccessibleText.idl                             \
     XAccessibleTextAttributes.idl                   \
     XAccessibleTextMarkup.idl                       \
-    XAccessibleValue.idl
+    XAccessibleTextSelection.idl                    \
+    XAccessibleValue.idl                            \
+    XMSAAService.idl
+
 
 # ------------------------------------------------------------------
 

Modified: openoffice/branches/ia2/main/postprocess/packcomponents/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/postprocess/packcomponents/makefile.mk?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/postprocess/packcomponents/makefile.mk 
(original)
+++ openoffice/branches/ia2/main/postprocess/packcomponents/makefile.mk Wed Dec 
12 04:28:59 2012
@@ -313,6 +313,7 @@ my_components += \
     java_uno_accessbridge \
     smplmail \
     sysdtrans \
+    winaccessibility \
     wininetbe1
 .END
 

Modified: openoffice/branches/ia2/main/postprocess/prj/build.lst
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/postprocess/prj/build.lst?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/postprocess/prj/build.lst (original)
+++ openoffice/branches/ia2/main/postprocess/prj/build.lst Wed Dec 12 04:28:59 
2012
@@ -1,4 +1,4 @@
-po      postprocess     ::      svgio accessibility automation basctl bean 
BINFILTER:binfilter chart2 configmgr CRASHREP:crashrep COINMP:coinmp cui 
dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions 
extras fileaccess filter forms fpicker helpcontent2 hwpfilter io 
JAVAINSTALLER2:javainstaller2 lingucomponent MATHMLDTD:MathMLDTD ODK:odk 
officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 
scripting sd setup_native slideshow starmath sw sysui testtools ucb UnoControls 
unoxml ure wizards xmerge xmlsecurity MORE_FONTS:more_fonts OOo:pyuno 
OOo:readlicense_oo SO:top unodevtools JFREEREPORT:jfreereport 
REPORTBUILDER:reportbuilder reportdesign SDEXT:sdext SWEXT:swext smoketestdoc 
uui writerfilter oox MYSQLC:mysqlc LIBXSLT:libxslt NULL
+po      postprocess     ::      svgio accessibility automation basctl bean 
BINFILTER:binfilter chart2 configmgr CRASHREP:crashrep COINMP:coinmp cui 
dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions 
extras fileaccess filter forms fpicker helpcontent2 hwpfilter io 
JAVAINSTALLER2:javainstaller2 lingucomponent MATHMLDTD:MathMLDTD ODK:odk 
officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 
scripting sd setup_native slideshow starmath sw sysui testtools ucb UnoControls 
unoxml ure wizards xmerge xmlsecurity MORE_FONTS:more_fonts OOo:pyuno 
OOo:readlicense_oo SO:top unodevtools JFREEREPORT:jfreereport 
REPORTBUILDER:reportbuilder reportdesign SDEXT:sdext SWEXT:swext smoketestdoc 
uui writerfilter winaccessibility oox MYSQLC:mysqlc LIBXSLT:libxslt NULL
 po     postprocess                             usr1    -       all     
po_mkout NULL
 po     postprocess\checkxml            nmake   -       all     po_checkxml NULL
 po     postprocess\checkdeliver        nmake   -       all     po_checkdlv NULL

Modified: openoffice/branches/ia2/main/vcl/inc/svdata.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/inc/svdata.hxx?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/inc/svdata.hxx (original)
+++ openoffice/branches/ia2/main/vcl/inc/svdata.hxx Wed Dec 12 04:28:59 2012
@@ -182,6 +182,10 @@ struct ImplSVAppData
      */
     ImeStatusWindowMode meShowImeStatusWindow;
 
+//IAccessibility2 Implementation 2009-----
+       long m_bEnableAccessInterface;
+       long m_mbIsBridgeRegistered;
+//-----IAccessibility2 Implementation 2009
                             DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, 
void* );
                            
 };

Modified: openoffice/branches/ia2/main/vcl/inc/vcl/svapp.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/inc/vcl/svapp.hxx?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/inc/vcl/svapp.hxx (original)
+++ openoffice/branches/ia2/main/vcl/inc/vcl/svapp.hxx Wed Dec 12 04:28:59 2012
@@ -448,6 +448,10 @@ public:
     
     static void                 ShowNativeErrorBox(const String& sTitle  ,
                                                    const String& sMessage);
+//IAccessibility2 Implementation 2009-----
+       static bool                                     
EnableAccessInterface(bool bEnable);
+       static bool                                     
IsEnableAccessInterface();
+//-----IAccessibility2 Implementation 2009
 
     // IME Status Window Control:
 
@@ -514,4 +518,13 @@ inline void Application::EndYield()
     PostUserEvent( Link() );
 }
 
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+// VCL_DLLPUBLIC sal_Bool HasAtHook();
+VCL_DLLPUBLIC bool IsWNTInitAccessBridge();
+bool WNTEnableAccessInterface(bool bEnable);
+VCL_DLLPUBLIC bool TestBridgeRegistered();
+VCL_DLLPUBLIC bool IsBridgeRegistered();
+#endif
+//-----IAccessibility2 Implementation 2009
 #endif // _APP_HXX

Modified: openoffice/branches/ia2/main/vcl/source/app/svapp.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/source/app/svapp.cxx?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/source/app/svapp.cxx (original)
+++ openoffice/branches/ia2/main/vcl/source/app/svapp.cxx Wed Dec 12 04:28:59 
2012
@@ -24,7 +24,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
-//#include "svsys.h"
+#include "svsys.h"
 
 #include "comphelper/processfactory.hxx"
 
@@ -2045,34 +2045,72 @@ void Application::AddToRecentDocumentLis
 
 sal_Bool Application::IsAccessibilityEnabled()
 {
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+       return IsWNTInitAccessBridge();
+#else 
     return sal_False;
+#endif 
+//-----IAccessibility2 Implementation 2009
 }
 
 sal_Bool InitAccessBridge( sal_Bool bShowCancel, sal_Bool &rCancelled )
 {
-    sal_Bool bRet = true;
+    sal_Bool bRet = sal_True;
+    rCancelled = sal_False;
 
 // Disable Java bridge on UNIX
 #if defined UNX
     (void) bShowCancel; // unsued
-    (void) rCancelled; // unused
 #else
-    bRet = ImplInitAccessBridge( bShowCancel, rCancelled );
-    
-    if( !bRet && bShowCancel && !rCancelled )
-    {
-        // disable accessibility if the user chooses to continue
-        AllSettings aSettings = Application::GetSettings();
-        MiscSettings aMisc = aSettings.GetMiscSettings();
-        aMisc.SetEnableATToolSupport( sal_False );
-        aSettings.SetMiscSettings( aMisc );
-        Application::SetSettings( aSettings );
-    }
-#endif // !UNX
+
+       // Checking TestBridgeRegistered() && HasAtHook() was introduced with 
IBM's IA2 CWS.
+       if(TestBridgeRegistered() /* && HasAtHook() */ )
+       {
+           bRet = ImplInitAccessBridge( bShowCancel, rCancelled );
+           
+           if( !bRet && bShowCancel && !rCancelled )
+           {
+               // disable accessibility if the user chooses to continue
+               AllSettings aSettings = Application::GetSettings();
+               MiscSettings aMisc = aSettings.GetMiscSettings();
+               aMisc.SetEnableATToolSupport( sal_False );
+               aSettings.SetMiscSettings( aMisc );
+               Application::SetSettings( aSettings );
+           }
+       }
+       else
+       {
+               bRet = sal_False;
+       }
+#endif
 
     return bRet;
 }
 
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+sal_Bool HasAtHook()
+{
+       // Added by Steve Yin
+       sal_Int32 bIsRuning=0;
+       // BOOL WINAPI SystemParametersInfo(
+       //        __in     UINT uiAction,
+       //        __in     UINT uiParam,
+       //        __inout  PVOID pvParam,
+       //        __in     UINT fWinIni
+       //      );
+       // pvParam must be BOOL (defined in MFC as int)
+       // End
+       if(SystemParametersInfo(SPI_GETSCREENREADER,0,&bIsRuning,0))
+       {
+               if( bIsRuning )
+                       return sal_True;
+       }
+       return sal_False;
+}
+#endif
+//-----IAccessibility2 Implementation 2009
 // MT: AppProperty, AppEvent was in oldsv.cxx, but is still needed...
 // ------------------------------------------------------------------------
 
@@ -2094,9 +2132,53 @@ void Application::SetPropertyHandler( Pr
         delete pHandler;
     pHandler = p;
 }
+//IAccessibility2 Implementation 2009-----
+bool Application::EnableAccessInterface(bool bEnable)
+{
+#ifdef WNT
+       return WNTEnableAccessInterface(bEnable);
+#else 
+    bEnable = TRUE; // avoid compiler warning
+    return TRUE;
+#endif 
+}
+bool Application::IsEnableAccessInterface()
+{
+       return ImplGetSVData()->maAppData.m_bEnableAccessInterface;
+}
+//-----IAccessibility2 Implementation 2009
 
 
 
 void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
 {
 }
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+bool TestBridgeRegistered()
+{
+       const CLSID CLSID_MAccessible = 
{0xCF8DF8BA,0x44FE,0x4B10,{0xBD,0x2E,0x8C,0x8C,0xB3,0x22,0x48,0x5F}};
+
+       LPCOLESTR lpMAcc=L"UAccCOM.MAccessible";
+
+       CLSID mid;      
+       bool bReg = false;
+       if(S_OK  == CLSIDFromProgID(lpMAcc,&mid))
+       {
+               if( IsEqualCLSID(mid,CLSID_MAccessible))
+                       bReg = true;
+               else
+                       bReg = false;
+       }
+
+       ImplGetSVData()->maAppData.m_mbIsBridgeRegistered =bReg;
+       return bReg;
+}
+
+bool IsBridgeRegistered()
+{
+       return ImplGetSVData()->maAppData.m_mbIsBridgeRegistered;;
+}
+
+#endif
+//-----IAccessibility2 Implementation 2009

Modified: openoffice/branches/ia2/main/vcl/source/app/svdata.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/source/app/svdata.cxx?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/source/app/svdata.cxx (original)
+++ openoffice/branches/ia2/main/vcl/source/app/svdata.cxx Wed Dec 12 04:28:59 
2012
@@ -36,6 +36,16 @@
 
 #include "unotools/fontcfg.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#endif
+//-----IAccessibility2 Implementation 2009
 #include "vos/mutex.hxx"
 
 #include "cppuhelper/implbase1.hxx"
@@ -67,6 +77,13 @@
 #include "com/sun/star/java/JavaDisabledException.hpp"
 
 #include <stdio.h>
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+#include <unotools/processfactory.hxx>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#include <win/g_msaasvc.h>
+#endif
+//-----IAccessibility2 Implementation 2009
 
 namespace {
 
@@ -132,6 +149,10 @@ void ImplInitSVData()
             break;
         }
     }
+//IAccessibility2 Implementation 2009-----
+       //Default enable the acc bridge interface
+       pImplSVData->maAppData.m_bEnableAccessInterface =true;
+//-----IAccessibility2 Implementation 2009
     
     // mark default layout border as unitialized
     pImplSVData->maAppData.mnDefaultLayoutBorder = -1;
@@ -339,7 +360,89 @@ com::sun::star::uno::Any AccessBridgeCur
     }
     return ret;
 }
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+void AccessBridgehandleExistingWindow(Window * pWindow, bool bShow)
+{
+    if ( pWindow )
+    {
+        css::uno::Reference< css::accessibility::XAccessible > xAccessible;
+    
+        // Test for combo box - drop down floating windows first
+        Window * pParentWindow = pWindow->GetParent();
+
+        if ( pParentWindow )
+        {
+            try 
+            {
+                // The parent window of a combo box floating window should 
have the role COMBO_BOX
+                css::uno::Reference< css::accessibility::XAccessible > 
xParentAccessible(pParentWindow->GetAccessible());
+                if ( xParentAccessible.is() )
+                {
+                    css::uno::Reference< 
css::accessibility::XAccessibleContext > xParentAC( 
xParentAccessible->getAccessibleContext() );
+                    if ( xParentAC.is() && 
(css::accessibility::AccessibleRole::COMBO_BOX == 
xParentAC->getAccessibleRole()) )
+                    {
+                        // O.k. - this is a combo box floating window 
corresponding to the child of role LIST of the parent.
+                        // Let's not rely on a specific child order, just 
search for the child with the role LIST
+                        sal_Int32 nCount = 
xParentAC->getAccessibleChildCount();
+                        for ( sal_Int32 n = 0; (n < nCount) && 
!xAccessible.is(); n++)
+                        {
+                            css::uno::Reference< 
css::accessibility::XAccessible > xChild = xParentAC->getAccessibleChild(n);
+                            if ( xChild.is() )
+                            {
+                                css::uno::Reference< 
css::accessibility::XAccessibleContext > xChildAC = 
xChild->getAccessibleContext();
+                                if ( xChildAC.is() && 
(css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole()) )
+                                {
+                                    xAccessible = xChild;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            catch (::com::sun::star::uno::RuntimeException e)
+            {
+                // Ignore show events that throw DisposedExceptions in 
getAccessibleContext(),
+                // but keep revoking these windows in hide(s).
+                if (bShow)
+                    return;
+            }
+        }
 
+        // We have to rely on the fact that 
Window::GetAccessible()->getAccessibleContext() returns a valid 
XAccessibleContext
+        // also for other menus than menubar or toplevel popup window. 
Otherwise we had to traverse the hierarchy to find the 
+        // context object to this menu floater. This makes the call to 
Window->IsMenuFloatingWindow() obsolete.
+        if ( ! xAccessible.is() )
+            xAccessible = pWindow->GetAccessible();
+
+               if ( xAccessible.is() && g_acc_manager1 )
+        {
+                       g_acc_manager1->handleWindowOpened( 
(long)(xAccessible.get()));
+        }
+    }
+}
+
+void AccessBridgeupdateOldTopWindows()
+{
+       sal_uInt16 nTopWindowCount = 
(sal_uInt16)Application::GetTopWindowCount();
+       for (sal_uInt16 i = 0; i < nTopWindowCount; i++)
+       {
+               Window* pTopWindow = Application::GetTopWindow( i );
+        css::uno::Reference< css::accessibility::XAccessible > xAccessible = 
pTopWindow->GetAccessible();
+        if ( xAccessible.is() )
+        {
+                       css::uno::Reference< 
css::accessibility::XAccessibleContext > 
xAC(xAccessible->getAccessibleContext());
+            if ( xAC.is())
+            {
+               short role = xAC->getAccessibleRole();
+               if(xAC->getAccessibleName().getLength() > 0)
+                                       
AccessBridgehandleExistingWindow(pTopWindow, true);
+            }
+        }
+       }
+}
+#endif
+//-----IAccessibility2 Implementation 2009
 
 bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled)
 {
@@ -371,6 +474,22 @@ bool ImplInitAccessBridge(sal_Bool bAllo
 
             if( xFactory.is() )
             {
+//IAccessibility2 Implementation 2009-----
+                #ifdef WNT
+                pSVData->mxAccessBridge = xFactory->createInstance(
+                                      OUString::createFromAscii( 
"com.sun.star.accessibility.MSAAService" ) ); 
+                           if( pSVData->mxAccessBridge.is() )
+                           {
+                               css::uno::Reference< css::uno::XInterface > 
pRManager= pSVData->mxAccessBridge;
+                               g_acc_manager1 = 
(css::accessibility::XMSAAService*)(pRManager.get());
+                                       AccessBridgeupdateOldTopWindows();
+                           }
+                           
+                           if( !pSVData->mxAccessBridge.is() )
+                    bSuccess = false;
+                return bSuccess;
+                           #endif
+//-----IAccessibility2 Implementation 2009
                 css::uno::Reference< XExtendedToolkit > xToolkit = 
                     css::uno::Reference< XExtendedToolkit 
>(Application::GetVCLToolkit(), UNO_QUERY);
 

Modified: openoffice/branches/ia2/main/vcl/source/app/svmain.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/source/app/svmain.cxx?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/source/app/svmain.cxx (original)
+++ openoffice/branches/ia2/main/vcl/source/app/svmain.cxx Wed Dec 12 04:28:59 
2012
@@ -55,6 +55,11 @@
 #include <process.h>    // for _beginthreadex
 #include <ole2.h>   // for _beginthreadex
 #include <tools/postwin.h>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#include <win/g_msaasvc.h>
+using namespace com::sun::star::accessibility;
+//-----IAccessibility2 Implementation 2009
 #endif
 
 // [ed 5/14/02 Add in explicit check for quartz graphics.  OS X will define
@@ -215,6 +220,12 @@ sal_Bool ImplSVMain()
        }
 
     DeInitVCL();
+//IAccessibility2 Implementation 2009-----
+       #ifdef WNT
+               if( g_acc_manager1 )
+                       g_acc_manager1->release();
+       #endif 
+//-----IAccessibility2 Implementation 2009
     return bInit;
 }
 

Modified: openoffice/branches/ia2/main/vcl/win/source/window/salframe.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/win/source/window/salframe.cxx?rev=1420518&r1=1420517&r2=1420518&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/win/source/window/salframe.cxx (original)
+++ openoffice/branches/ia2/main/vcl/win/source/window/salframe.cxx Wed Dec 12 
04:28:59 2012
@@ -92,6 +92,30 @@
 using ::std::max;
 #endif
 
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+#include <oleacc.h>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#ifndef _WIN32_WCE
+#define WM_GETOBJECT                    0x003D
+#endif
+#define     OBJID_WINDOW        ((LONG)0x00000000)
+#define     OBJID_SYSMENU       ((LONG)0xFFFFFFFF)
+#define     OBJID_TITLEBAR      ((LONG)0xFFFFFFFE)
+#define     OBJID_MENU          ((LONG)0xFFFFFFFD)
+#define     OBJID_CLIENT        ((LONG)0xFFFFFFFC)
+#define     OBJID_VSCROLL       ((LONG)0xFFFFFFFB)
+#define     OBJID_HSCROLL       ((LONG)0xFFFFFFFA)
+#define     OBJID_SIZEGRIP      ((LONG)0xFFFFFFF9)
+#define     OBJID_CARET         ((LONG)0xFFFFFFF8)
+#define     OBJID_CURSOR        ((LONG)0xFFFFFFF7)
+#define     OBJID_ALERT         ((LONG)0xFFFFFFF6)
+#define     OBJID_SOUND         ((LONG)0xFFFFFFF5)
+#define     OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4)
+#define     OBJID_NATIVEOM      ((LONG)0xFFFFFFF0)
+#include <win/g_msaasvc.h>
+#endif
+//-----IAccessibility2 Implementation 2009
 #include <com/sun/star/uno/Exception.hdl>
 
 #include <time.h>
@@ -153,7 +177,12 @@ sal_Bool WinSalFrame::mbInReparent = FAL
 #define Uni_SupplementaryPlanesStart    0x10000
 
 // =======================================================================
-
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+using namespace ::com::sun::star::accessibility;
+XMSAAService* g_acc_manager1 = NULL;
+#endif
+//-----IAccessibility2 Implementation 2009
 static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
 static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* 
pParentRect = NULL );
 
@@ -6178,6 +6207,54 @@ LRESULT CALLBACK SalFrameWndProc( HWND h
         case WM_IME_NOTIFY:
             ImplHandleIMENotify( hWnd, wParam );
             break;
+
+//IAccessibility2 implementation 2009-----
+#ifdef WNT
+               case WM_GETOBJECT:
+                       {
+                               if (!Application::IsEnableAccessInterface())
+                               {
+                                       break;
+                               }
+                               else
+                               {
+                                       // Make sure to launch Accessibiliity 
only the following criterias are satisfied to avoid RFT interrupts regular acc 
processing
+                                       if (g_acc_manager1 == NULL && 
+                                               
Application::GetSettings().GetMiscSettings().GetEnableATToolSupport() &&
+                                               IsBridgeRegistered() /* && 
HasAtHook() */ )
+                                       {
+                                               sal_Bool bCancelled;
+                                               
InitAccessBridge(sal_False,bCancelled);
+                                               if( bCancelled )
+                                                       break;
+                                       }
+                                       if (g_acc_manager1 != NULL)
+                                       {
+                                               // MT: mhOnSetTitleWnd not set 
to reasonable value anywhere...
+                                               /*
+                                               sal_Bool bSkipSetTitleClient = 
sal_False;
+                                               SalFrame* pFrame = 
GetWindowPtr( hWnd );
+                                               if(pFrame)
+                                               {
+                                                       bSkipSetTitleClient = 
(lParam == OBJID_CLIENT && hWnd == ((WinSalFrame*)pFrame)->mhOnSetTitleWnd);
+                                               }
+                                               */
+                                               if ( (lParam == OBJID_CLIENT ) 
/* && !bSkipSetTitleClient */ )
+                                               {
+                                                       long RetResult = 
g_acc_manager1->getAccObjectPtr((long)hWnd, lParam, wParam);
+                                                       if(RetResult != 0)
+                                                       {
+                                                               rDef = FALSE;   
                                
+                                                               return 
(HRESULT)RetResult;
+                                                       }
+                                               }
+                                       }
+                               }
+                               break;
+                       }
+#endif                 
+//-----IAccessibility2 implementation 2009
+
         case WM_APPCOMMAND:
             if( ImplHandleAppCommand( hWnd, lParam ) )
             {                
@@ -6398,3 +6475,25 @@ sal_Bool ImplWriteLastError( DWORD lastE
 
 // -----------------------------------------------------------------------
 
+//IAccessibility2 implementation 2009-----
+#ifdef WNT
+bool IsWNTInitAccessBridge()
+{
+       return NULL != g_acc_manager1;
+}
+#endif
+#ifdef WNT
+bool WNTEnableAccessInterface(bool bEnable)
+{
+    ImplSVData* pSVData = ImplGetSVData();
+
+       BOOL bPreVal = pSVData->maAppData.m_bEnableAccessInterface; 
+       long nEnable= bEnable;
+       ::InterlockedExchange(
+               (LPLONG)&(pSVData->maAppData.m_bEnableAccessInterface),
+               nEnable);
+       
+       return bPreVal;
+}
+#endif
+//-----IAccessibility2 implementation 2009


Reply via email to