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::WeakComponentImplHelper5<
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();
71 :
72 : /** Return the page that is made accessible by the called object.
73 : */
74 : SdPage* GetPage() const;
75 :
76 : /** The page number as given to the constructor.
77 : */
78 0 : sal_uInt16 GetPageNumber() 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() SAL_OVERRIDE;
86 :
87 : //===== XAccessible =======================================================
88 :
89 : virtual ::com::sun::star::uno::Reference<
90 : ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
91 : getAccessibleContext()
92 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 :
94 : //===== XAccessibleEventBroadcaster =======================================
95 : virtual void SAL_CALL
96 : addAccessibleEventListener(
97 : const ::com::sun::star::uno::Reference<
98 : ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
99 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 :
101 : virtual void SAL_CALL
102 : removeAccessibleEventListener(
103 : const ::com::sun::star::uno::Reference<
104 : ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener )
105 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : //===== XAccessibleContext ==============================================
108 :
109 : virtual sal_Int32 SAL_CALL
110 : getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 :
112 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
113 : getAccessibleChild (sal_Int32 nIndex)
114 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 :
116 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
117 : getAccessibleParent()
118 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 :
120 : virtual sal_Int32 SAL_CALL
121 : getAccessibleIndexInParent()
122 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 :
124 : virtual sal_Int16 SAL_CALL
125 : getAccessibleRole()
126 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 :
128 : virtual OUString SAL_CALL
129 : getAccessibleDescription()
130 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 :
132 : virtual OUString SAL_CALL
133 : getAccessibleName()
134 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 :
136 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
137 : getAccessibleRelationSet()
138 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 :
140 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
141 : getAccessibleStateSet()
142 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 :
144 : virtual ::com::sun::star::lang::Locale SAL_CALL
145 : getLocale()
146 : throw (::com::sun::star::uno::RuntimeException,
147 : ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception) SAL_OVERRIDE;
148 :
149 : //===== XAccessibleComponent ================================================
150 :
151 : virtual sal_Bool SAL_CALL containsPoint (
152 : const ::com::sun::star::awt::Point& aPoint)
153 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 :
155 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
156 : getAccessibleAtPoint (
157 : const ::com::sun::star::awt::Point& aPoint)
158 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 :
160 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
161 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 :
163 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
164 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 :
166 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
167 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 :
169 : virtual ::com::sun::star::awt::Size SAL_CALL getSize()
170 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 :
172 : virtual void SAL_CALL grabFocus()
173 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 :
175 : virtual sal_Int32 SAL_CALL getForeground()
176 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 :
178 : virtual sal_Int32 SAL_CALL getBackground()
179 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 :
181 : //===== XServiceInfo ====================================================
182 :
183 : /** Returns an identifier for the implementation of this object.
184 : */
185 : virtual OUString SAL_CALL
186 : getImplementationName()
187 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 :
189 : /** Return whether the specified service is supported by this class.
190 : */
191 : virtual sal_Bool SAL_CALL
192 : supportsService (const OUString& sServiceName)
193 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
194 :
195 : /** Returns a list of all supported services.
196 : */
197 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
198 : getSupportedServiceNames()
199 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 :
201 : private:
202 : ::com::sun::star::uno::Reference<
203 : ::com::sun::star::accessibility::XAccessible> mxParent;
204 : sal_uInt16 mnPageNumber;
205 : ::sd::slidesorter::SlideSorter& mrSlideSorter;
206 : sal_uInt32 mnClientId;
207 :
208 : /** Check whether or not the object has been disposed (or is in the
209 : state of being disposed). If that is the case then
210 : DisposedException is thrown to inform the (indirect) caller of the
211 : foul deed.
212 : */
213 : void ThrowIfDisposed()
214 : throw (::com::sun::star::lang::DisposedException);
215 :
216 : /** Check whether or not the object has been disposed (or is in the
217 : state of being disposed).
218 :
219 : @return sal_True, if the object is disposed or in the course
220 : of being disposed. Otherwise, sal_False is returned.
221 : */
222 : bool IsDisposed();
223 : };
224 :
225 : } // end of namespace ::accessibility
226 :
227 : #endif
228 :
229 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|