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