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_OBJECT_HXX
25cdf0e10cSrcweir #define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_SORTER_OBJECT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "MutexOwner.hxx"
28cdf0e10cSrcweir #include <cppuhelper/compbase5.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/awt/XFocusListener.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class SdPage;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace sd { namespace slidesorter {
41cdf0e10cSrcweir class SlideSorter;
42cdf0e10cSrcweir } }
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace accessibility {
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper5<
48cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessible,
49cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
50cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleContext,
51cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessibleComponent,
52cdf0e10cSrcweir     ::com::sun::star::lang::XServiceInfo > AccessibleSlideSorterObjectBase;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
55cdf0e10cSrcweir /** This class makes page objects of the slide sorter accessible.
56cdf0e10cSrcweir */
57cdf0e10cSrcweir class AccessibleSlideSorterObject
58cdf0e10cSrcweir     : public ::sd::MutexOwner,
59cdf0e10cSrcweir       public AccessibleSlideSorterObjectBase
60cdf0e10cSrcweir {
61cdf0e10cSrcweir public:
62cdf0e10cSrcweir     /** Create a new object that represents a page object in the slide
63cdf0e10cSrcweir         sorter.
64cdf0e10cSrcweir         @param rxParent
65cdf0e10cSrcweir             The accessible parent.
66cdf0e10cSrcweir         @param rSlideSorter
67cdf0e10cSrcweir             The slide sorter whose model manages the page.
68cdf0e10cSrcweir         @param nPageNumber
69cdf0e10cSrcweir             The number of the page in the range [0,nPageCount).
70cdf0e10cSrcweir     */
71cdf0e10cSrcweir     AccessibleSlideSorterObject(
72cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
73cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessible >& rxParent,
74cdf0e10cSrcweir         ::sd::slidesorter::SlideSorter& rSlideSorter,
75cdf0e10cSrcweir         sal_uInt16 nPageNumber);
76cdf0e10cSrcweir     ~AccessibleSlideSorterObject (void);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     /** Return the page that is made accessible by the called object.
79cdf0e10cSrcweir     */
80cdf0e10cSrcweir     SdPage* GetPage (void) const;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     /** The page number as given to the constructor.
83cdf0e10cSrcweir     */
84cdf0e10cSrcweir     sal_uInt16 GetPageNumber (void) const;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     void FireAccessibleEvent (
87cdf0e10cSrcweir         short nEventId,
88cdf0e10cSrcweir         const ::com::sun::star::uno::Any& rOldValue,
89cdf0e10cSrcweir         const ::com::sun::star::uno::Any& rNewValue);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     //===== XAccessible =======================================================
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
98cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
99cdf0e10cSrcweir         getAccessibleContext (void)
100cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     //===== XAccessibleEventBroadcaster =======================================
104cdf0e10cSrcweir     virtual void SAL_CALL
105cdf0e10cSrcweir         addEventListener(
106cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
107cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
108cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     virtual void SAL_CALL
111cdf0e10cSrcweir         removeEventListener(
112cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
113cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener )
114cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	using cppu::WeakComponentImplHelperBase::addEventListener;
117cdf0e10cSrcweir 	using cppu::WeakComponentImplHelperBase::removeEventListener;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	//=====  XAccessibleContext  ==============================================
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
122cdf0e10cSrcweir     	getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
125cdf0e10cSrcweir     	getAccessibleChild (sal_Int32 nIndex)
126cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
129cdf0e10cSrcweir     	getAccessibleParent (void)
130cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	virtual	sal_Int32 SAL_CALL
133cdf0e10cSrcweir     	getAccessibleIndexInParent (void)
134cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL
137cdf0e10cSrcweir     	getAccessibleRole (void)
138cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
141cdf0e10cSrcweir     	getAccessibleDescription (void)
142cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
145cdf0e10cSrcweir     	getAccessibleName (void)
146cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
149cdf0e10cSrcweir     	getAccessibleRelationSet (void)
150cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
153cdf0e10cSrcweir         getAccessibleStateSet (void)
154cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     virtual ::com::sun::star::lang::Locale SAL_CALL
157cdf0e10cSrcweir     	getLocale (void)
158cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException,
159cdf0e10cSrcweir 			::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     //=====  XAccessibleComponent  ================================================
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint (
165cdf0e10cSrcweir         const ::com::sun::star::awt::Point& aPoint)
166cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
169cdf0e10cSrcweir         getAccessibleAtPoint (
170cdf0e10cSrcweir             const ::com::sun::star::awt::Point& aPoint)
171cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
174cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
177cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
180cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
183cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     virtual void SAL_CALL grabFocus (void)
186cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground (void)
189cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground (void)
192cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 	//=====  XServiceInfo  ====================================================
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     /**	Returns an identifier for the implementation of this object.
199cdf0e10cSrcweir     */
200cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
201cdf0e10cSrcweir     	getImplementationName (void)
202cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
203cdf0e10cSrcweir 
204cdf0e10cSrcweir     /**	Return whether the specified service is supported by this class.
205cdf0e10cSrcweir     */
206cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
207cdf0e10cSrcweir     	supportsService (const ::rtl::OUString& sServiceName)
208cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     /** Returns a list of all supported services.
211cdf0e10cSrcweir     */
212cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
213cdf0e10cSrcweir     	getSupportedServiceNames (void)
214cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 
217cdf0e10cSrcweir private:
218cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
219cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible> mxParent;
220cdf0e10cSrcweir     sal_uInt16 mnPageNumber;
221cdf0e10cSrcweir     ::sd::slidesorter::SlideSorter& mrSlideSorter;
222cdf0e10cSrcweir     sal_uInt32 mnClientId;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir     /** Check whether or not the object has been disposed (or is in the
225*30acf5e8Spfg         state of being disposed).  If that is the case then
226cdf0e10cSrcweir         DisposedException is thrown to inform the (indirect) caller of the
227cdf0e10cSrcweir         foul deed.
228cdf0e10cSrcweir     */
229cdf0e10cSrcweir     void ThrowIfDisposed (void)
230cdf0e10cSrcweir         throw (::com::sun::star::lang::DisposedException);
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     /** Check whether or not the object has been disposed (or is in the
233*30acf5e8Spfg         state of being disposed).
234cdf0e10cSrcweir 
235cdf0e10cSrcweir         @return sal_True, if the object is disposed or in the course
236cdf0e10cSrcweir         of being disposed. Otherwise, sal_False is returned.
237cdf0e10cSrcweir     */
238cdf0e10cSrcweir     sal_Bool IsDisposed (void);
239cdf0e10cSrcweir };
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 
243cdf0e10cSrcweir } // end of namespace ::accessibility
244cdf0e10cSrcweir 
245cdf0e10cSrcweir #endif
246