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