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