1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
29 #define ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
30 
31 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
32 #include <com/sun/star/lang/DisposedException.hpp>
33 #include <cppuhelper/implbase2.hxx>
34 #include <vcl/vclevent.hxx>
35 #include <toolkit/awt/vclxaccessiblecomponent.hxx>
36 
37 
38 // class AccessibleListBox -----------------------------------------------
39 
40 class SvTreeListBox;
41 
42 //........................................................................
43 namespace accessibility
44 {
45 //........................................................................
46 
47 	typedef ::cppu::ImplHelper2<  ::com::sun::star::accessibility::XAccessible
48 								, ::com::sun::star::accessibility::XAccessibleSelection> AccessibleListBox_BASE;
49 
50 	/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
51 	*/
52 	class AccessibleListBox	:public AccessibleListBox_BASE
53 							,public VCLXAccessibleComponent
54 	{
55 	protected:
56 
57 		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
58 
59 	protected:
60 		virtual ~AccessibleListBox();
61 
62 		// OComponentHelper overridables
63 		/** this function is called upon disposing the component */
64 		virtual void SAL_CALL	disposing();
65 
66 		// VCLXAccessibleComponent
67 		virtual void	ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
68         virtual void    ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
69 		virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
70 
71 		SvTreeListBox*	getListBox() const;
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 
120 //........................................................................
121 }// namespace accessibility
122 //........................................................................
123 
124 #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
125 
126