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 INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLESLIDESORTERVIEW_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLESLIDESORTERVIEW_HXX
22 :
23 : #include "MutexOwner.hxx"
24 : #include <cppuhelper/compbase6.hxx>
25 : #include <com/sun/star/accessibility/XAccessible.hpp>
26 : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
27 : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
28 : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
29 : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
30 : #include <com/sun/star/lang/XServiceInfo.hpp>
31 : #include <com/sun/star/lang/DisposedException.hpp>
32 : #include <com/sun/star/awt/XFocusListener.hpp>
33 : #include <com/sun/star/document/XEventListener.hpp>
34 :
35 :
36 : #include <memory>
37 :
38 : class Window;
39 :
40 : namespace sd { namespace slidesorter {
41 : class SlideSorter;
42 : } }
43 :
44 : namespace accessibility {
45 :
46 :
47 : class AccessibleSlideSorterObject;
48 :
49 : typedef ::cppu::PartialWeakComponentImplHelper6<
50 : ::com::sun::star::accessibility::XAccessible,
51 : ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
52 : ::com::sun::star::accessibility::XAccessibleContext,
53 : ::com::sun::star::accessibility::XAccessibleComponent,
54 : ::com::sun::star::accessibility::XAccessibleSelection,
55 : ::com::sun::star::lang::XServiceInfo
56 : > AccessibleSlideSorterViewBase;
57 :
58 : /** This class makes the SlideSorterViewShell accessible. It uses objects
59 : of the AccessibleSlideSorterObject class to the make the page objects
60 : accessible.
61 : */
62 : class AccessibleSlideSorterView
63 : : public ::sd::MutexOwner,
64 : public AccessibleSlideSorterViewBase
65 : {
66 : public:
67 : AccessibleSlideSorterView(
68 : ::sd::slidesorter::SlideSorter& rSlideSorter,
69 : const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> & rxParent,
70 : ::Window* pParentWindow);
71 :
72 : void Init();
73 :
74 : virtual ~AccessibleSlideSorterView (void);
75 :
76 : /** This method acts like a dispose call. It sends a disposing to all
77 : of its listeners. It may be called twice.
78 : */
79 : void Destroyed (void);
80 :
81 : void FireAccessibleEvent (
82 : short nEventId,
83 : const ::com::sun::star::uno::Any& rOldValue,
84 : const ::com::sun::star::uno::Any& rNewValue);
85 :
86 : virtual void SAL_CALL disposing (void) SAL_OVERRIDE;
87 :
88 : /** Return the implementation object of the specified child.
89 : @param nIndex
90 : Index of the child for which to return the implementation object.
91 : */
92 : AccessibleSlideSorterObject* GetAccessibleChildImplementation (sal_Int32 nIndex);
93 :
94 : //===== XComponent ==============================================
95 :
96 0 : virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
97 0 : { WeakComponentImplHelperBase::dispose(); }
98 0 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
99 0 : { WeakComponentImplHelperBase::addEventListener(xListener); }
100 0 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
101 0 : { WeakComponentImplHelperBase::removeEventListener(xListener); }
102 :
103 : //===== XAccessible =======================================================
104 :
105 : virtual ::com::sun::star::uno::Reference<
106 : ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
107 : getAccessibleContext (void)
108 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 :
110 :
111 : //===== XAccessibleEventBroadcaster =======================================
112 : virtual void SAL_CALL
113 : addAccessibleEventListener(
114 : const ::com::sun::star::uno::Reference<
115 : ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
116 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 :
118 : virtual void SAL_CALL
119 : removeAccessibleEventListener(
120 : const ::com::sun::star::uno::Reference<
121 : ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener )
122 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 :
124 : //===== XAccessibleContext ==============================================
125 :
126 : /// Return the number of currently visible children.
127 : virtual sal_Int32 SAL_CALL
128 : getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 :
130 : /// Return the specified child or throw exception.
131 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
132 : getAccessibleChild (sal_Int32 nIndex)
133 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : /// Return a reference to the parent.
136 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
137 : getAccessibleParent (void)
138 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 :
140 : /// Return this objects index among the parents children.
141 : virtual sal_Int32 SAL_CALL
142 : getAccessibleIndexInParent (void)
143 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 :
145 : /// Return this object's role.
146 : virtual sal_Int16 SAL_CALL
147 : getAccessibleRole (void)
148 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 :
150 : /// Return this object's description.
151 : virtual OUString SAL_CALL
152 : getAccessibleDescription (void)
153 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 :
155 : /// Return the object's current name.
156 : virtual OUString SAL_CALL
157 : getAccessibleName (void)
158 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 :
160 : /// Return NULL to indicate that an empty relation set.
161 : virtual ::com::sun::star::uno::Reference<
162 : ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
163 : getAccessibleRelationSet (void)
164 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 :
166 : /// Return the set of current states.
167 : virtual ::com::sun::star::uno::Reference<
168 : ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
169 : getAccessibleStateSet (void)
170 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 :
172 : /** Return the parents locale or throw exception if this object has no
173 : parent yet/anymore.
174 : */
175 : virtual ::com::sun::star::lang::Locale SAL_CALL
176 : getLocale (void)
177 : throw (::com::sun::star::uno::RuntimeException,
178 : ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception) SAL_OVERRIDE;
179 :
180 : //===== XAccessibleComponent ================================================
181 :
182 : /** The default implementation uses the result of
183 : <member>getBounds</member> to determine whether the given point lies
184 : inside this object.
185 : */
186 : virtual sal_Bool SAL_CALL containsPoint (
187 : const ::com::sun::star::awt::Point& aPoint)
188 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
189 :
190 : /** The default implementation returns an empty reference.
191 : */
192 : virtual ::com::sun::star::uno::Reference<
193 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
194 : getAccessibleAtPoint (
195 : const ::com::sun::star::awt::Point& aPoint)
196 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
197 :
198 : /** The default implementation returns an empty rectangle.
199 : */
200 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
201 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
202 :
203 : /** The default implementation uses the result of
204 : <member>getBounds</member> to determine the location.
205 : */
206 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
207 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
208 :
209 : /** The default implementation returns an empty position, i.e. the
210 : * result of the default constructor of <type>com::sun::star::awt::Point</type>.
211 : */
212 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
213 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
214 :
215 : /** The default implementation uses the result of
216 : <member>getBounds</member> to determine the size.
217 : */
218 : virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
219 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
220 :
221 : /** The default implementation does nothing.
222 : */
223 : virtual void SAL_CALL grabFocus (void)
224 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
225 :
226 : /** Returns black as the default foreground color.
227 : */
228 : virtual sal_Int32 SAL_CALL getForeground (void)
229 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
230 :
231 : /** Returns white as the default background color.
232 : */
233 : virtual sal_Int32 SAL_CALL getBackground (void)
234 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
235 :
236 :
237 : //===== XAccessibleSelection ==============================================
238 :
239 : virtual void SAL_CALL
240 : selectAccessibleChild (sal_Int32 nChildIndex)
241 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
242 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
243 :
244 : virtual sal_Bool SAL_CALL
245 : isAccessibleChildSelected( sal_Int32 nChildIndex )
246 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
247 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
248 :
249 : virtual void SAL_CALL
250 : clearAccessibleSelection( )
251 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
252 :
253 : virtual void SAL_CALL
254 : selectAllAccessibleChildren( )
255 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
256 :
257 : virtual sal_Int32 SAL_CALL
258 : getSelectedAccessibleChildCount( )
259 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 :
261 : virtual ::com::sun::star::uno::Reference<
262 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
263 : getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
264 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
265 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
266 :
267 : virtual void SAL_CALL
268 : deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
269 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
270 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
271 :
272 :
273 : //===== XServiceInfo ====================================================
274 :
275 : /** Returns an identifier for the implementation of this object.
276 : */
277 : virtual OUString SAL_CALL
278 : getImplementationName (void)
279 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
280 :
281 : /** Return whether the specified service is supported by this class.
282 : */
283 : virtual sal_Bool SAL_CALL
284 : supportsService (const OUString& sServiceName)
285 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
286 :
287 : /** Returns a list of all supported services.
288 : */
289 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
290 : getSupportedServiceNames (void)
291 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
292 :
293 : virtual void SwitchViewActivated (void);
294 : private:
295 : class Implementation;
296 : ::std::auto_ptr<Implementation> mpImpl;
297 :
298 : ::sd::slidesorter::SlideSorter& mrSlideSorter;
299 :
300 : ::com::sun::star::uno::Reference<
301 : ::com::sun::star::accessibility::XAccessible> mxParent;
302 :
303 : sal_uInt32 mnClientId;
304 :
305 : ::Window* mpContentWindow;
306 :
307 : /** Check whether or not the object has been disposed (or is in the
308 : state of beeing disposed). If that is the case then
309 : DisposedException is thrown to inform the (indirect) caller of the
310 : foul deed.
311 : */
312 : void ThrowIfDisposed (void)
313 : throw (::com::sun::star::lang::DisposedException);
314 :
315 : /** Check whether or not the object has been disposed (or is in the
316 : state of beeing disposed).
317 :
318 : @return sal_True, if the object is disposed or in the course
319 : of being disposed. Otherwise, sal_False is returned.
320 : */
321 : sal_Bool IsDisposed (void);
322 : };
323 :
324 : } // end of namespace ::accessibility
325 :
326 : #endif
327 :
328 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|