bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / AccessibleSlideSorterView.hxx
blobf1ac5a189f331f7b02c26cfbfbec10f34437f95a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLESLIDESORTERVIEW_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_ACCESSIBLESLIDESORTERVIEW_HXX
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 #include <vcl/vclptr.hxx>
36 #include <memory>
38 namespace vcl { class Window; }
40 namespace sd { namespace slidesorter {
41 class SlideSorter;
42 } }
44 namespace accessibility {
46 class AccessibleSlideSorterObject;
48 typedef ::cppu::WeakComponentImplHelper6<
49 ::com::sun::star::accessibility::XAccessible,
50 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
51 ::com::sun::star::accessibility::XAccessibleContext,
52 ::com::sun::star::accessibility::XAccessibleComponent,
53 ::com::sun::star::accessibility::XAccessibleSelection,
54 ::com::sun::star::lang::XServiceInfo
55 > AccessibleSlideSorterViewBase;
57 /** This class makes the SlideSorterViewShell accessible. It uses objects
58 of the AccessibleSlideSorterObject class to the make the page objects
59 accessible.
61 class AccessibleSlideSorterView
62 : public ::sd::MutexOwner,
63 public AccessibleSlideSorterViewBase
65 public:
66 AccessibleSlideSorterView(
67 ::sd::slidesorter::SlideSorter& rSlideSorter,
68 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> & rxParent,
69 vcl::Window* pParentWindow);
71 void Init();
73 virtual ~AccessibleSlideSorterView();
75 /** This method acts like a dispose call. It sends a disposing to all
76 of its listeners. It may be called twice.
78 void Destroyed();
80 void FireAccessibleEvent (
81 short nEventId,
82 const ::com::sun::star::uno::Any& rOldValue,
83 const ::com::sun::star::uno::Any& rNewValue);
85 virtual void SAL_CALL disposing() SAL_OVERRIDE;
87 /** Return the implementation object of the specified child.
88 @param nIndex
89 Index of the child for which to return the implementation object.
91 AccessibleSlideSorterObject* GetAccessibleChildImplementation (sal_Int32 nIndex);
93 //===== XAccessible =======================================================
95 virtual ::com::sun::star::uno::Reference<
96 ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
97 getAccessibleContext()
98 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 //===== XAccessibleEventBroadcaster =======================================
101 virtual void SAL_CALL
102 addAccessibleEventListener(
103 const ::com::sun::star::uno::Reference<
104 ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
105 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 virtual void SAL_CALL
108 removeAccessibleEventListener(
109 const ::com::sun::star::uno::Reference<
110 ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener )
111 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 //===== XAccessibleContext ==============================================
115 /// Return the number of currently visible children.
116 virtual sal_Int32 SAL_CALL
117 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 /// Return the specified child or throw exception.
120 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
121 getAccessibleChild (sal_Int32 nIndex)
122 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 /// Return a reference to the parent.
125 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
126 getAccessibleParent()
127 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 /// Return this objects index among the parents children.
130 virtual sal_Int32 SAL_CALL
131 getAccessibleIndexInParent()
132 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 /// Return this object's role.
135 virtual sal_Int16 SAL_CALL
136 getAccessibleRole()
137 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 /// Return this object's description.
140 virtual OUString SAL_CALL
141 getAccessibleDescription()
142 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 /// Return the object's current name.
145 virtual OUString SAL_CALL
146 getAccessibleName()
147 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 /// Return NULL to indicate that an empty relation set.
150 virtual ::com::sun::star::uno::Reference<
151 ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
152 getAccessibleRelationSet()
153 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 /// Return the set of current states.
156 virtual ::com::sun::star::uno::Reference<
157 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
158 getAccessibleStateSet()
159 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 /** Return the parents locale or throw exception if this object has no
162 parent yet/anymore.
164 virtual ::com::sun::star::lang::Locale SAL_CALL
165 getLocale()
166 throw (::com::sun::star::uno::RuntimeException,
167 ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception) SAL_OVERRIDE;
169 //===== XAccessibleComponent ================================================
171 /** The default implementation uses the result of
172 <member>getBounds</member> to determine whether the given point lies
173 inside this object.
175 virtual sal_Bool SAL_CALL containsPoint (
176 const ::com::sun::star::awt::Point& aPoint)
177 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 /** The default implementation returns an empty reference.
181 virtual ::com::sun::star::uno::Reference<
182 ::com::sun::star::accessibility::XAccessible > SAL_CALL
183 getAccessibleAtPoint (
184 const ::com::sun::star::awt::Point& aPoint)
185 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 /** The default implementation returns an empty rectangle.
189 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
190 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
192 /** The default implementation uses the result of
193 <member>getBounds</member> to determine the location.
195 virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
196 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
198 /** The default implementation returns an empty position, i.e. the
199 * result of the default constructor of <type>com::sun::star::awt::Point</type>.
201 virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
202 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
204 /** The default implementation uses the result of
205 <member>getBounds</member> to determine the size.
207 virtual ::com::sun::star::awt::Size SAL_CALL getSize()
208 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
210 /** The default implementation does nothing.
212 virtual void SAL_CALL grabFocus()
213 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 /** Returns black as the default foreground color.
217 virtual sal_Int32 SAL_CALL getForeground()
218 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
220 /** Returns white as the default background color.
222 virtual sal_Int32 SAL_CALL getBackground()
223 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
225 //===== XAccessibleSelection ==============================================
227 virtual void SAL_CALL
228 selectAccessibleChild (sal_Int32 nChildIndex)
229 throw (::com::sun::star::lang::IndexOutOfBoundsException,
230 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
232 virtual sal_Bool SAL_CALL
233 isAccessibleChildSelected( sal_Int32 nChildIndex )
234 throw (::com::sun::star::lang::IndexOutOfBoundsException,
235 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
237 virtual void SAL_CALL
238 clearAccessibleSelection( )
239 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
241 virtual void SAL_CALL
242 selectAllAccessibleChildren( )
243 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
245 virtual sal_Int32 SAL_CALL
246 getSelectedAccessibleChildCount( )
247 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
249 virtual ::com::sun::star::uno::Reference<
250 ::com::sun::star::accessibility::XAccessible > SAL_CALL
251 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
252 throw (::com::sun::star::lang::IndexOutOfBoundsException,
253 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 virtual void SAL_CALL
256 deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
257 throw (::com::sun::star::lang::IndexOutOfBoundsException,
258 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
260 //===== XServiceInfo ====================================================
262 /** Returns an identifier for the implementation of this object.
264 virtual OUString SAL_CALL
265 getImplementationName()
266 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
268 /** Return whether the specified service is supported by this class.
270 virtual sal_Bool SAL_CALL
271 supportsService (const OUString& sServiceName)
272 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
274 /** Returns a list of all supported services.
276 virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
277 getSupportedServiceNames()
278 throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
280 void SwitchViewActivated();
281 private:
282 class Implementation;
283 ::std::unique_ptr<Implementation> mpImpl;
285 ::sd::slidesorter::SlideSorter& mrSlideSorter;
287 ::com::sun::star::uno::Reference<
288 ::com::sun::star::accessibility::XAccessible> mxParent;
290 sal_uInt32 mnClientId;
292 VclPtr<vcl::Window> mpContentWindow;
294 /** Check whether or not the object has been disposed (or is in the
295 state of being disposed). If that is the case then
296 DisposedException is thrown to inform the (indirect) caller of the
297 foul deed.
299 void ThrowIfDisposed()
300 throw (::com::sun::star::lang::DisposedException);
302 /** Check whether or not the object has been disposed (or is in the
303 state of being disposed).
305 @return sal_True, if the object is disposed or in the course
306 of being disposed. Otherwise, sal_False is returned.
308 bool IsDisposed();
311 } // end of namespace ::accessibility
313 #endif
315 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */