Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
21 : #define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
22 :
23 : #include <deque>
24 : #include <com/sun/star/accessibility/XAccessible.hpp>
25 : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
26 : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
27 : #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
28 : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
29 : #include <com/sun/star/accessibility/XAccessibleAction.hpp>
30 : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
31 : #include <com/sun/star/lang/DisposedException.hpp>
32 : #include <com/sun/star/lang/XEventListener.hpp>
33 : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : #include <com/sun/star/accessibility/XAccessibleValue.hpp>
35 : #include <cppuhelper/compbase9.hxx>
36 : #include <comphelper/broadcasthelper.hxx>
37 : #include <comphelper/accessibletexthelper.hxx>
38 : #include <svtools/treelistentry.hxx>
39 : #include <tools/gen.hxx>
40 : #include "accessibility/extended/listboxaccessible.hxx"
41 :
42 : // forward ---------------------------------------------------------------
43 :
44 : namespace com { namespace sun { namespace star { namespace awt {
45 : struct Point;
46 : struct Rectangle;
47 : struct Size;
48 : class XFocusListener;
49 : } } } }
50 :
51 : class SvTreeListBox;
52 : class SvTreeListEntry;
53 :
54 :
55 : namespace accessibility
56 : {
57 :
58 :
59 : // class AccessibleListBoxEntry ------------------------------------------
60 : /*
61 : typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
62 : , ::com::sun::star::accessibility::XAccessibleContext
63 : , ::com::sun::star::accessibility::XAccessibleComponent
64 : , ::com::sun::star::accessibility::XAccessibleEventBroadcaster
65 : , ::com::sun::star::accessibility::XAccessibleAction
66 : , ::com::sun::star::accessibility::XAccessibleSelection
67 : , ::com::sun::star::accessibility::XAccessibleText
68 : , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
69 : */
70 : typedef ::cppu::WeakAggComponentImplHelper9< ::com::sun::star::accessibility::XAccessible
71 : , ::com::sun::star::accessibility::XAccessibleContext
72 : , ::com::sun::star::accessibility::XAccessibleComponent
73 : , ::com::sun::star::accessibility::XAccessibleEventBroadcaster
74 : , ::com::sun::star::accessibility::XAccessibleAction
75 : , ::com::sun::star::accessibility::XAccessibleSelection
76 : , ::com::sun::star::accessibility::XAccessibleText
77 : , ::com::sun::star::accessibility::XAccessibleValue
78 : , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
79 :
80 : /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */
81 : class AccessibleListBoxEntry:public ::comphelper::OBaseMutex
82 : ,public AccessibleListBoxEntry_BASE
83 : ,public ::comphelper::OCommonAccessibleText
84 : ,public ListBoxAccessibleBase
85 : {
86 : friend class AccessibleListBox;
87 :
88 : private:
89 : /** The treelistbox control */
90 : ::std::deque< sal_Int32 > m_aEntryPath;
91 : SvTreeListEntry* m_pSvLBoxEntry; // Needed for a11y focused item...
92 :
93 :
94 : protected:
95 : /// client id in the AccessibleEventNotifier queue
96 : sal_uInt32 m_nClientId;
97 :
98 : ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible >
99 : m_aParent;
100 :
101 : private:
102 : Rectangle GetBoundingBox_Impl() const;
103 : Rectangle GetBoundingBoxOnScreen_Impl() const;
104 : sal_Bool IsAlive_Impl() const;
105 : sal_Bool IsShowing_Impl() const;
106 :
107 : Rectangle GetBoundingBox()
108 : throw (css::lang::DisposedException,
109 : css::uno::RuntimeException);
110 : Rectangle GetBoundingBoxOnScreen()
111 : throw (css::lang::DisposedException,
112 : css::uno::RuntimeException);
113 : void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
114 :
115 : void NotifyAccessibleEvent( sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _aOldValue, const ::com::sun::star::uno::Any& _aNewValue );
116 :
117 : protected:
118 : virtual ~AccessibleListBoxEntry();
119 :
120 : /** this function is called upon disposing the component
121 : */
122 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
123 :
124 : // ListBoxAccessible/XComponent
125 : virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
126 :
127 : // OCommonAccessibleText
128 : virtual OUString implGetText() SAL_OVERRIDE;
129 : virtual ::com::sun::star::lang::Locale implGetLocale() SAL_OVERRIDE;
130 : virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) SAL_OVERRIDE;
131 :
132 : public:
133 : /** Ctor()
134 : @param _rListBox
135 : the view control
136 : @param _pEntry
137 : the entry
138 : @param _xParent
139 : is our parent accessible object
140 : */
141 : AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvTreeListEntry* _pEntry,
142 : const ::com::sun::star::uno::Reference<
143 : ::com::sun::star::accessibility::XAccessible >& _xParent );
144 :
145 0 : SvTreeListEntry* GetSvLBoxEntry() const { return m_pSvLBoxEntry; }
146 :
147 :
148 : protected:
149 : // XTypeProvider
150 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 :
152 : // XServiceInfo
153 : virtual OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 :
157 : // XServiceInfo - static methods
158 : static com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
159 : static OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
160 :
161 : // XAccessible
162 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 :
164 : // XAccessibleContext
165 : virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
167 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
168 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 : virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 : virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 : virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 : virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 : virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 :
177 : // XAccessibleComponent
178 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 : 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, std::exception) SAL_OVERRIDE;
180 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
181 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
184 : virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 : virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
186 : virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 :
188 : // XAccessibleText
189 : virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
190 : virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
191 : virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
192 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
193 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
194 : virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
195 : virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
196 : virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
197 : virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
198 : virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
199 : virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 : virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
201 : virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
202 : 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, std::exception) SAL_OVERRIDE;
203 : 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, std::exception) SAL_OVERRIDE;
204 : 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, std::exception) SAL_OVERRIDE;
205 : virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
206 :
207 : // XAccessibleEventBroadcaster
208 : virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
209 : virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
210 :
211 : // XAccessibleAction
212 : virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
213 : virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
214 : virtual OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 : 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, std::exception) SAL_OVERRIDE;
216 :
217 : // XAccessibleSelection
218 : void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
219 : sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
220 : void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
221 : void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
222 : sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
223 : ::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, std::exception) SAL_OVERRIDE;
224 : void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
225 : virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
226 : virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
227 : virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
228 : virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
229 : private:
230 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const;
231 : SvTreeListEntry* GetRealChild(sal_Int32 nIndex);
232 : sal_Int32 GetRoleType();
233 : };
234 :
235 :
236 : }// namespace accessibility
237 :
238 :
239 : #endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
240 :
241 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|