1*a462bbb7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a462bbb7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a462bbb7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a462bbb7SAndrew Rist  * distributed with this work for additional information
6*a462bbb7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a462bbb7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a462bbb7SAndrew Rist  * "License"); you may not use this file except in compliance
9*a462bbb7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a462bbb7SAndrew Rist  *
11*a462bbb7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a462bbb7SAndrew Rist  *
13*a462bbb7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a462bbb7SAndrew Rist  * software distributed under the License is distributed on an
15*a462bbb7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a462bbb7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*a462bbb7SAndrew Rist  * specific language governing permissions and limitations
18*a462bbb7SAndrew Rist  * under the License.
19*a462bbb7SAndrew Rist  *
20*a462bbb7SAndrew Rist  *************************************************************/
21*a462bbb7SAndrew Rist 
22*a462bbb7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
25cdf0e10cSrcweir #define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <deque>
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
29cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
30cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp>
31cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
33cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleAction.hpp>
34cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
37cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
38cdf0e10cSrcweir #include <cppuhelper/compbase8.hxx>
39cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
40cdf0e10cSrcweir #include <comphelper/accessibletexthelper.hxx>
41cdf0e10cSrcweir #include <tools/gen.hxx>
42cdf0e10cSrcweir #include "accessibility/extended/listboxaccessible.hxx"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir // forward ---------------------------------------------------------------
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace awt {
47cdf0e10cSrcweir 	struct Point;
48cdf0e10cSrcweir 	struct Rectangle;
49cdf0e10cSrcweir 	struct Size;
50cdf0e10cSrcweir 	class XFocusListener;
51cdf0e10cSrcweir } } } }
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class SvTreeListBox;
54cdf0e10cSrcweir class SvLBoxEntry;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //........................................................................
57cdf0e10cSrcweir namespace accessibility
58cdf0e10cSrcweir {
59cdf0e10cSrcweir //........................................................................
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // class AccessibleListBoxEntry ------------------------------------------
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
64cdf0e10cSrcweir 												, ::com::sun::star::accessibility::XAccessibleContext
65cdf0e10cSrcweir 												, ::com::sun::star::accessibility::XAccessibleComponent
66cdf0e10cSrcweir 												, ::com::sun::star::accessibility::XAccessibleEventBroadcaster
67cdf0e10cSrcweir 												, ::com::sun::star::accessibility::XAccessibleAction
68cdf0e10cSrcweir 												, ::com::sun::star::accessibility::XAccessibleSelection
69cdf0e10cSrcweir 												, ::com::sun::star::accessibility::XAccessibleText
70cdf0e10cSrcweir 										    	, ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	/** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */
73cdf0e10cSrcweir 	class AccessibleListBoxEntry:public ::comphelper::OBaseMutex
74cdf0e10cSrcweir 							   	,public AccessibleListBoxEntry_BASE
75cdf0e10cSrcweir 								,public ::comphelper::OCommonAccessibleText
76cdf0e10cSrcweir 								,public ListBoxAccessibleBase
77cdf0e10cSrcweir 	{
78cdf0e10cSrcweir 	friend class AccessibleListBox;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	private:
81cdf0e10cSrcweir 		/** The treelistbox control */
82cdf0e10cSrcweir 		SvTreeListBox*						m_pListBox;
83cdf0e10cSrcweir 		::std::deque< sal_Int32 >			m_aEntryPath;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	protected:
86cdf0e10cSrcweir         /// client id in the AccessibleEventNotifier queue
87cdf0e10cSrcweir         sal_uInt32                          m_nClientId;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible >
90cdf0e10cSrcweir                                             m_aParent;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	private:
93cdf0e10cSrcweir 		Rectangle				GetBoundingBox_Impl() const;
94cdf0e10cSrcweir 		Rectangle				GetBoundingBoxOnScreen_Impl() const;
95cdf0e10cSrcweir 		sal_Bool				IsAlive_Impl() const;
96cdf0e10cSrcweir 		sal_Bool				IsShowing_Impl() const;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 		Rectangle				GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException );
99cdf0e10cSrcweir 		Rectangle				GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException );
100cdf0e10cSrcweir     	void 					EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	protected:
103cdf0e10cSrcweir 		virtual ~AccessibleListBoxEntry();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		/** this function is called upon disposing the component
106cdf0e10cSrcweir 		*/
107cdf0e10cSrcweir 		virtual void SAL_CALL					disposing();
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 		// ListBoxAccessible/XComponent
110cdf0e10cSrcweir 		virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		// OCommonAccessibleText
113cdf0e10cSrcweir 		virtual ::rtl::OUString					implGetText();
114cdf0e10cSrcweir 		virtual ::com::sun::star::lang::Locale	implGetLocale();
115cdf0e10cSrcweir 		virtual void							implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	public:
118cdf0e10cSrcweir 		/** Ctor()
119cdf0e10cSrcweir 			@param	_rListBox
120cdf0e10cSrcweir 				the view control
121cdf0e10cSrcweir 			@param	_pEntry
122cdf0e10cSrcweir 				the entry
123cdf0e10cSrcweir 			@param	_xParent
124cdf0e10cSrcweir 				is our parent accessible object
125cdf0e10cSrcweir 		*/
126cdf0e10cSrcweir 		AccessibleListBoxEntry(	SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry,
127cdf0e10cSrcweir 								const ::com::sun::star::uno::Reference<
128cdf0e10cSrcweir 									::com::sun::star::accessibility::XAccessible >& _xParent );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 	protected:
131cdf0e10cSrcweir 		// XTypeProvider
132cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 		// XServiceInfo
135cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
137cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 		// XServiceInfo - static methods
140cdf0e10cSrcweir 		static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir 		static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 		// XAccessible
144cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 		// XAccessibleContext
147cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
149cdf0e10cSrcweir                 ::com::sun::star::uno::RuntimeException );
150cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 		virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
155cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
156cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir 		virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 		// XAccessibleComponent
160cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir 		virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir 		virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir 		virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
165cdf0e10cSrcweir 		virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
166cdf0e10cSrcweir 		virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
167cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
168cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 		// XAccessibleText
171cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
173cdf0e10cSrcweir 		virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
174cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
175cdf0e10cSrcweir 		virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
176cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
177cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
178cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
179cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
180cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
181cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
182cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
183cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
184cdf0e10cSrcweir         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
185cdf0e10cSrcweir         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
186cdf0e10cSrcweir         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
187cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     	// XAccessibleEventBroadcaster
190cdf0e10cSrcweir         using cppu::WeakAggComponentImplHelperBase::addEventListener;
191cdf0e10cSrcweir 		virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
192cdf0e10cSrcweir         using cppu::WeakAggComponentImplHelperBase::removeEventListener;
193cdf0e10cSrcweir     	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     	// XAccessibleAction
196cdf0e10cSrcweir     	virtual sal_Int32 SAL_CALL getAccessibleActionCount(  ) throw (::com::sun::star::uno::RuntimeException);
197cdf0e10cSrcweir     	virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
198cdf0e10cSrcweir     	virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
199cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 		// XAccessibleSelection
202cdf0e10cSrcweir 		void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
203cdf0e10cSrcweir 		sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
204cdf0e10cSrcweir 		void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
205cdf0e10cSrcweir 		void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
206cdf0e10cSrcweir 		sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
207cdf0e10cSrcweir 		::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);
208cdf0e10cSrcweir 		void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     private:
211cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const;
212cdf0e10cSrcweir 	};
213cdf0e10cSrcweir 
214cdf0e10cSrcweir //........................................................................
215cdf0e10cSrcweir }// namespace accessibility
216cdf0e10cSrcweir //........................................................................
217cdf0e10cSrcweir 
218cdf0e10cSrcweir #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
219cdf0e10cSrcweir 
220