xref: /AOO41X/main/accessibility/inc/accessibility/extended/accessiblelistbox.hxx (revision 4d7c9de063a797b8b4f3d45e3561e82ad1f8ef1f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
25 #define ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
26 
27 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
28 #include <com/sun/star/lang/DisposedException.hpp>
29 #include <cppuhelper/implbase2.hxx>
30 #include <vcl/vclevent.hxx>
31 #include <toolkit/awt/vclxaccessiblecomponent.hxx>
32 
33 #include <map>
34 
35 // class AccessibleListBox -----------------------------------------------
36 
37 class SvTreeListBox;
38 class SvLBoxEntry;
39 //........................................................................
40 namespace accessibility
41 {
42     class AccessibleListBoxEntry;
43 //........................................................................
44 
45     typedef ::cppu::ImplHelper2<  ::com::sun::star::accessibility::XAccessible
46                                 , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleListBox_BASE;
47 
48     /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
49     */
50     class AccessibleListBox :public AccessibleListBox_BASE
51                             ,public VCLXAccessibleComponent
52     {
53     protected:
54 
55         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
56 
57     protected:
58         virtual ~AccessibleListBox();
59 
60         // OComponentHelper overridables
61         /** this function is called upon disposing the component */
62         virtual void SAL_CALL   disposing();
63 
64         // VCLXAccessibleComponent
65         virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
66         virtual void    ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
67         virtual void    FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
68 
69         SvTreeListBox*  getListBox() const;
70 
71         void            RemoveChildEntries(SvLBoxEntry*);
72 
73     public:
74         /** OAccessibleBase needs a valid view
75             @param  _rListBox
76                 is the box for which we implement an accessible object
77             @param  _xParent
78                 is our parent accessible object
79         */
80         AccessibleListBox( SvTreeListBox& _rListBox,
81                            const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
82 
83         // XTypeProvider
84         DECLARE_XTYPEPROVIDER()
85 
86         // XInterface
87         DECLARE_XINTERFACE()
88 
89         // XServiceInfo
90         virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
91         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
92         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
93 
94         // XServiceInfo - static methods
95         static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
96         static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
97 
98         // XAccessible
99         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
100 
101         // XAccessibleContext
102         virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
103         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
104                 ::com::sun::star::uno::RuntimeException );
105         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
106         virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
107         virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
108         virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
109 
110         // XAccessibleSelection
111         void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
112         sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
113         void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
114         void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
115         sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
116         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
117         void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
118 
119         sal_Int32 SAL_CALL getRoleType();
120 
121 private:
122 
123     typedef std::map< SvLBoxEntry*, ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > MAP_ENTRY;
124     MAP_ENTRY m_mapEntry;
125 
126     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xFocusedChild;
127 
128     accessibility::AccessibleListBoxEntry* GetCurEventEntry( const VclWindowEvent& rVclWindowEvent );
129 
130     };
131 
132 //........................................................................
133 }// namespace accessibility
134 //........................................................................
135 
136 #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
137 
138