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