Anonymous avatar Anonymous committed 4a7a9be

CWS-TOOLING: integrate CWS impressaccessibility4
2009-09-16 19:30:19 +0200 af r276217 : #i80994# Fixed the triggering of accessibility initialization.
2009-09-16 18:43:57 +0200 af r276214 : #i93083# ValueSet now handles the FOCUSED and FOCUSABLE states correctly.

Comments (0)

Files changed (5)

sd/source/ui/slidesorter/shell/SlideSorter.cxx

         // Set view pointer of base class.
         SetupControls(pParentWindow);
 
-        // For accessibility we have to shortly hide the content window.
-        // This triggers the construction of a new accessibility object for
-        // the new view shell.  (One is created earlier while the construtor
-        // of the base class is executed.  At that time the correct
-        // accessibility object can not be constructed.)
-        pWindow->Hide();
-        pWindow->Show();
-
         mbIsValid = true;
     }
 }

sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx

         mpVerticalScrollBar,
         mpScrollBarBox);
     mpView = &mpSlideSorter->GetView();
+
+    // For accessibility we have to shortly hide the content window.
+    // This triggers the construction of a new accessibility object for
+    // the new view shell.  (One is created earlier while the construtor
+    // of the base class is executed.  At that time the correct
+    // accessibility object can not be constructed.)
+    ::Window* pWindow = mpSlideSorter->GetActiveWindow();
+    if (pWindow != NULL)
+    {
+        pWindow->Hide();
+        pWindow->Show();
+    }
 }
 
 

svtools/source/control/valueacc.cxx

 #include <vcl/svapp.hxx>
 #include <svtools/valueset.hxx>
 #include "valueimp.hxx"
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 
 ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) :
     ValueSetAccComponentBase (m_aMutex),
     mpParent( pParent ),
-    mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled )
+    mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ),
+    mbIsFocused(false)
 {
 }
 
 	}
 }
 
+
+// -----------------------------------------------------------------------------
+
+void ValueSetAcc::GetFocus (void)
+{
+    mbIsFocused = true;
+
+    // Boradcast the state change.
+    ::com::sun::star::uno::Any aOldState, aNewState;
+    aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
+    FireAccessibleEvent(
+        ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
+        aOldState, aNewState);
+}
+
+// -----------------------------------------------------------------------------
+
+void ValueSetAcc::LoseFocus (void)
+{
+    mbIsFocused = false;
+
+    // Boradcast the state change.
+    ::com::sun::star::uno::Any aOldState, aNewState;
+    aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
+    FireAccessibleEvent(
+        ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
+        aOldState, aNewState);
+}
+
 // -----------------------------------------------------------------------------
 
 uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext()
     pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
     if ( !mbIsTransientChildrenDisabled )
         pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS);
+    pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE);
+    if (mbIsFocused)
+        pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED);
 
     return pStateSet;
 }

svtools/source/control/valueimp.hxx

 
 public:
 
+    /** Called by the corresponding ValueSet when it gets the focus.
+        Stores the new focus state and broadcasts a state change event.
+    */
+    void GetFocus (void);
+
+    /** Called by the corresponding ValueSet when it loses the focus.
+        Stores the new focus state and broadcasts a state change event.
+    */
+    void LoseFocus (void);
+
+
     // XAccessible
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
 
         ::com::sun::star::accessibility::XAccessibleEventListener > >   mxEventListeners;
     ValueSet*                                                           mpParent;
     bool                                                                mbIsTransientChildrenDisabled;
+    /// The current FOCUSED state.
+    bool mbIsFocused;
 
 	static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
 

svtools/source/control/valueset.cxx

 	ImplDrawSelect();
 	Control::GetFocus();
 
-    // Send accessibility event.
-    ::com::sun::star::uno::Any aOldState, aNewState;
-    aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
-    ImplFireAccessibleEvent (
-        ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
-        aOldState, aNewState);
-
+    // Tell the accessible object that we got the focus.
+    ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) );
+    if( pAcc )
+        pAcc->GetFocus();
 }
 
 // -----------------------------------------------------------------------
 		HideFocus();
 	Control::LoseFocus();
 
-    // Send accessibility event.
-    ::com::sun::star::uno::Any aOldState, aNewState;
-    aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
-    ImplFireAccessibleEvent (
-        ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
-        aOldState, aNewState);
+    // Tell the accessible object that we lost the focus.
+    ValueSetAcc* pAcc = ValueSetAcc::getImplementation( GetAccessible( FALSE ) );
+    if( pAcc )
+        pAcc->LoseFocus();
 }
 
 // -----------------------------------------------------------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.