1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_VIEW_HXX
21 #define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_VIEW_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>
40 namespace sd
{ namespace slidesorter
{
44 namespace accessibility
{
47 class AccessibleSlideSorterObject
;
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
;
58 /** This class makes the SlideSorterViewShell accessible. It uses objects
59 of the AccessibleSlideSorterObject class to the make the page objects
62 class AccessibleSlideSorterView
63 : public ::sd::MutexOwner
,
64 public AccessibleSlideSorterViewBase
67 AccessibleSlideSorterView(
68 ::sd::slidesorter::SlideSorter
& rSlideSorter
,
69 const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> & rxParent
,
70 ::Window
* pParentWindow
);
74 virtual ~AccessibleSlideSorterView (void);
76 /** This method acts like a dispose call. It sends a disposing to all
77 of its listeners. It may be called twice.
79 void Destroyed (void);
81 void FireAccessibleEvent (
83 const ::com::sun::star::uno::Any
& rOldValue
,
84 const ::com::sun::star::uno::Any
& rNewValue
);
86 virtual void SAL_CALL
disposing (void);
88 /** Return the implementation object of the specified child.
90 Index of the child for which to return the implementation object.
92 AccessibleSlideSorterObject
* GetAccessibleChildImplementation (sal_Int32 nIndex
);
94 //===== XComponent ==============================================
96 virtual void SAL_CALL
dispose()throw (::com::sun::star::uno::RuntimeException
)
97 { WeakComponentImplHelperBase::dispose(); }
98 virtual void SAL_CALL
addEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
)throw (::com::sun::star::uno::RuntimeException
)
99 { WeakComponentImplHelperBase::addEventListener(xListener
); }
100 virtual void SAL_CALL
removeEventListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
> & xListener
)throw (::com::sun::star::uno::RuntimeException
)
101 { WeakComponentImplHelperBase::removeEventListener(xListener
); }
103 //===== XAccessible =======================================================
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
);
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
);
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
);
124 //===== XAccessibleContext ==============================================
126 /// Return the number of currently visible children.
127 virtual sal_Int32 SAL_CALL
128 getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
145 /// Return this object's role.
146 virtual sal_Int16 SAL_CALL
147 getAccessibleRole (void)
148 throw (::com::sun::star::uno::RuntimeException
);
150 /// Return this object's description.
151 virtual OUString SAL_CALL
152 getAccessibleDescription (void)
153 throw (::com::sun::star::uno::RuntimeException
);
155 /// Return the object's current name.
156 virtual OUString SAL_CALL
157 getAccessibleName (void)
158 throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
172 /** Return the parents locale or throw exception if this object has no
175 virtual ::com::sun::star::lang::Locale SAL_CALL
177 throw (::com::sun::star::uno::RuntimeException
,
178 ::com::sun::star::accessibility::IllegalAccessibleComponentStateException
);
180 //===== XAccessibleComponent ================================================
182 /** The default implementation uses the result of
183 <member>getBounds</member> to determine whether the given point lies
186 virtual sal_Bool SAL_CALL
containsPoint (
187 const ::com::sun::star::awt::Point
& aPoint
)
188 throw (::com::sun::star::uno::RuntimeException
);
190 /** The default implementation returns an empty reference.
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
);
198 /** The default implementation returns an empty rectangle.
200 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds (void)
201 throw (::com::sun::star::uno::RuntimeException
);
203 /** The default implementation uses the result of
204 <member>getBounds</member> to determine the location.
206 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation (void)
207 throw (::com::sun::star::uno::RuntimeException
);
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>.
212 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen (void)
213 throw (::com::sun::star::uno::RuntimeException
);
215 /** The default implementation uses the result of
216 <member>getBounds</member> to determine the size.
218 virtual ::com::sun::star::awt::Size SAL_CALL
getSize (void)
219 throw (::com::sun::star::uno::RuntimeException
);
221 /** The default implementation does nothing.
223 virtual void SAL_CALL
grabFocus (void)
224 throw (::com::sun::star::uno::RuntimeException
);
226 /** Returns black as the default foreground color.
228 virtual sal_Int32 SAL_CALL
getForeground (void)
229 throw (::com::sun::star::uno::RuntimeException
);
231 /** Returns white as the default background color.
233 virtual sal_Int32 SAL_CALL
getBackground (void)
234 throw (::com::sun::star::uno::RuntimeException
);
237 //===== XAccessibleSelection ==============================================
239 virtual void SAL_CALL
240 selectAccessibleChild (sal_Int32 nChildIndex
)
241 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
242 ::com::sun::star::uno::RuntimeException
);
244 virtual sal_Bool SAL_CALL
245 isAccessibleChildSelected( sal_Int32 nChildIndex
)
246 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
247 ::com::sun::star::uno::RuntimeException
);
249 virtual void SAL_CALL
250 clearAccessibleSelection( )
251 throw (::com::sun::star::uno::RuntimeException
);
253 virtual void SAL_CALL
254 selectAllAccessibleChildren( )
255 throw (::com::sun::star::uno::RuntimeException
);
257 virtual sal_Int32 SAL_CALL
258 getSelectedAccessibleChildCount( )
259 throw (::com::sun::star::uno::RuntimeException
);
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
);
267 virtual void SAL_CALL
268 deselectAccessibleChild( sal_Int32 nSelectedChildIndex
)
269 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
270 ::com::sun::star::uno::RuntimeException
);
273 //===== XServiceInfo ====================================================
275 /** Returns an identifier for the implementation of this object.
277 virtual OUString SAL_CALL
278 getImplementationName (void)
279 throw (::com::sun::star::uno::RuntimeException
);
281 /** Return whether the specified service is supported by this class.
283 virtual sal_Bool SAL_CALL
284 supportsService (const OUString
& sServiceName
)
285 throw (::com::sun::star::uno::RuntimeException
);
287 /** Returns a list of all supported services.
289 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
290 getSupportedServiceNames (void)
291 throw (::com::sun::star::uno::RuntimeException
);
295 class Implementation
;
296 ::std::auto_ptr
<Implementation
> mpImpl
;
298 ::sd::slidesorter::SlideSorter
& mrSlideSorter
;
300 ::com::sun::star::uno::Reference
<
301 ::com::sun::star::accessibility::XAccessible
> mxParent
;
303 sal_uInt32 mnClientId
;
305 ::Window
* mpContentWindow
;
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
312 void ThrowIfDisposed (void)
313 throw (::com::sun::star::lang::DisposedException
);
315 /** Check whether or not the object has been disposed (or is in the
316 state of beeing disposed).
318 @return sal_True, if the object is disposed or in the course
319 of being disposed. Otherwise, sal_False is returned.
321 sal_Bool
IsDisposed (void);
324 } // end of namespace ::accessibility
328 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */