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 
34 // class AccessibleListBox -----------------------------------------------
35 
36 class SvTreeListBox;
37 
38 //........................................................................
39 namespace accessibility
40 {
41 //........................................................................
42 
43 	typedef ::cppu::ImplHelper2<  ::com::sun::star::accessibility::XAccessible
44 								, ::com::sun::star::accessibility::XAccessibleSelection> AccessibleListBox_BASE;
45 
46 	/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
47 	*/
48 	class AccessibleListBox	:public AccessibleListBox_BASE
49 							,public VCLXAccessibleComponent
50 	{
51 	protected:
52 
53 		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
54 
55 	protected:
56 		virtual ~AccessibleListBox();
57 
58 		// OComponentHelper overridables
59 		/** this function is called upon disposing the component */
60 		virtual void SAL_CALL	disposing();
61 
62 		// VCLXAccessibleComponent
63 		virtual void	ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
64         virtual void    ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
65 		virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
66 
67 		SvTreeListBox*	getListBox() const;
68 
69 	public:
70 		/** OAccessibleBase needs a valid view
71 			@param	_rListBox
72 				is the box for which we implement an accessible object
73 			@param	_xParent
74 				is our parent accessible object
75 		*/
76 		AccessibleListBox( SvTreeListBox& _rListBox,
77 						   const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
78 
79 		// XTypeProvider
80 		DECLARE_XTYPEPROVIDER()
81 
82 		// XInterface
83 		DECLARE_XINTERFACE()
84 
85 		// XServiceInfo
86 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
87 		virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
88 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
89 
90 		// XServiceInfo - static methods
91 		static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
92 		static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
93 
94 		// XAccessible
95 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
96 
97 		// XAccessibleContext
98 		virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
99 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
100                 ::com::sun::star::uno::RuntimeException );
101 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
102 		virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
103 		virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
104 		virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
105 
106 		// XAccessibleSelection
107 		void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
108 		sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
109 		void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
110 		void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
111 		sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
112 		::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);
113 		void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
114 	};
115 
116 //........................................................................
117 }// namespace accessibility
118 //........................................................................
119 
120 #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
121 
122