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