1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #ifndef _SVTRULERACCESSIBLE_HXX
23 #define _SVTRULERACCESSIBLE_HXX
24
25 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
26 #include <com/sun/star/accessibility/XAccessible.hpp>
27 #endif
28 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
29 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
30 #endif
31 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
32 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
33 #endif
34 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_
35 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
36 #endif
37 #ifndef _COM_SUN_STAR_ACCESSIBILITY_ILLEGALACCESSIBLECOMPONENTSTATEEXCEPTION_HPP_
38 #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
39 #endif
40
41 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
42 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
43 #endif
44 #ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
45 #include <com/sun/star/uno/Reference.hxx>
46 #endif
47 #ifndef _CPPUHELPER_WEAK_HXX_
48 #include <cppuhelper/weak.hxx>
49 #endif
50 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
51 #include <com/sun/star/lang/XServiceInfo.hpp>
52 #endif
53 #ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
54 #include <com/sun/star/lang/XTypeProvider.hpp>
55 #endif
56 #ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
57 #include <com/sun/star/lang/XServiceName.hpp>
58 #endif
59 #ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_
60 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
61 #endif
62 #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
63 #include <com/sun/star/lang/DisposedException.hpp>
64 #endif
65 #ifndef _VOS_MUTEX_HXX_
66 #include <vos/mutex.hxx>
67 #endif
68 #ifndef _CPPUHELPER_INTERFACECONTAINER_H_
69 #include <cppuhelper/interfacecontainer.h>
70 #endif
71 #ifndef _CPPUHELPER_COMPBASE5_HXX_
72 #include <cppuhelper/compbase5.hxx>
73 #endif
74 #ifndef _COMPHELPER_BROADCASTHELPER_HXX_
75 #include <comphelper/broadcasthelper.hxx>
76 #endif
77 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
78 #include <cppuhelper/implbase5.hxx>
79 #endif
80 #ifndef _UTL_SERVICEHELPER_HXX_
81 #include <comphelper/servicehelper.hxx>
82 #endif
83
84 namespace com { namespace sun { namespace star { namespace awt {
85 struct Point;
86 struct Rectangle;
87 struct Size;
88 class XFocusListener;
89 } } } }
90
91 class Rectangle;
92 class Ruler;
93 class Window;
94
95
96 typedef ::cppu::WeakAggComponentImplHelper5<
97 ::com::sun::star::accessibility::XAccessible,
98 ::com::sun::star::accessibility::XAccessibleComponent,
99 ::com::sun::star::accessibility::XAccessibleContext,
100 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
101 ::com::sun::star::lang::XServiceInfo >
102 SvtRulerAccessible_Base;
103
104 class SvtRulerAccessible : public ::comphelper::OBaseMutex, public SvtRulerAccessible_Base
105 {
106 public:
107 //===== internal ========================================================
108 SvtRulerAccessible(
109 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, Ruler& rRepresentation, const ::rtl::OUString& rName );
110 protected:
111 virtual ~SvtRulerAccessible();
112 public:
113 //===== XAccessible =====================================================
114
115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
116 getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException );
117
118 //===== XAccessibleComponent ============================================
119
120 virtual sal_Bool SAL_CALL
121 containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
122
123 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
124 getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
125
126 virtual ::com::sun::star::awt::Rectangle SAL_CALL
127 getBounds() throw( ::com::sun::star::uno::RuntimeException );
128
129 virtual ::com::sun::star::awt::Point SAL_CALL
130 getLocation() throw( ::com::sun::star::uno::RuntimeException );
131
132 virtual ::com::sun::star::awt::Point SAL_CALL
133 getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException );
134
135 virtual ::com::sun::star::awt::Size SAL_CALL
136 getSize() throw( ::com::sun::star::uno::RuntimeException );
137
138 virtual sal_Bool SAL_CALL
139 isShowing() throw( ::com::sun::star::uno::RuntimeException );
140
141 virtual sal_Bool SAL_CALL
142 isVisible() throw( ::com::sun::star::uno::RuntimeException );
143
144 virtual sal_Bool SAL_CALL
145 isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException );
146
147 virtual void SAL_CALL
148 addFocusListener(
149 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
150 throw( ::com::sun::star::uno::RuntimeException );
151
152 virtual void SAL_CALL
153 removeFocusListener(
154 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
155 throw( ::com::sun::star::uno::RuntimeException );
156
157 virtual void SAL_CALL
158 grabFocus() throw( ::com::sun::star::uno::RuntimeException );
159
160 virtual ::com::sun::star::uno::Any SAL_CALL
161 getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException );
162 virtual sal_Int32 SAL_CALL
163 getForeground( ) throw (::com::sun::star::uno::RuntimeException);
164 virtual sal_Int32 SAL_CALL
165 getBackground( ) throw (::com::sun::star::uno::RuntimeException);
166
167 //===== XAccessibleContext ==============================================
168
169 virtual sal_Int32 SAL_CALL
170 getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException );
171
172 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
173 getAccessibleChild( sal_Int32 nIndex )
174 throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
175
176 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
177 getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException );
178
179 virtual sal_Int32 SAL_CALL
180 getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException );
181
182 virtual sal_Int16 SAL_CALL
183 getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException );
184
185 virtual ::rtl::OUString SAL_CALL
186 getAccessibleDescription( void ) throw (::com::sun::star::uno::RuntimeException);
187
188 virtual ::rtl::OUString SAL_CALL
189 getAccessibleName( void ) throw (::com::sun::star::uno::RuntimeException);
190
191 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
192 getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException );
193
194 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
195 getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException );
196
197 virtual ::com::sun::star::lang::Locale SAL_CALL
198 getLocale( void )
199 throw( ::com::sun::star::uno::RuntimeException,
200 ::com::sun::star::accessibility::IllegalAccessibleComponentStateException );
201 //===== XAccessibleEventBroadcaster =====================================
202
203 virtual void SAL_CALL
204 addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )throw( com::sun::star::uno::RuntimeException );
205
206 virtual void SAL_CALL
207 removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
208
209 // Needed, because some compilers would complain about virtual functions above would hide cppu::WeakAggComponentImplHelperBase::add/removeEventListener(const Reference<lang::XEventListener>&)...
210 virtual void SAL_CALL
211 addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )throw( com::sun::star::uno::RuntimeException );
212
213 virtual void SAL_CALL
214 removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
215
216
217 //===== XServiceInfo ====================================================
218
219 virtual ::rtl::OUString SAL_CALL
220 getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException );
221
222 virtual sal_Bool SAL_CALL
223 supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException );
224
225 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
226 getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException );
227
228 //===== XTypeProvider ===================================================
229
230 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
231 getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException );
232
233
234
235
236 public:
237
238 /// Sets the name
239 void setName( const ::rtl::OUString& rName );
240
241 /// Sets the description
242 void setDescription( const ::rtl::OUString& rDescr );
243 private:
244 static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
245 protected:
246
247 /// @Return the object's current bounding box relative to the desktop.
248 virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
249
250 /// @Return the object's current bounding box relative to the parent object.
251 virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
252
253
254 virtual void SAL_CALL disposing();
255
256 /// @returns true if it's disposed or in disposing
257 inline sal_Bool IsAlive( void ) const;
258
259 /// @returns true if it's not disposed and no in disposing
260 inline sal_Bool IsNotAlive( void ) const;
261
262 /// throws the exception DisposedException if it's not alive
263 void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
264
265 private:
266 /** Description of this object. This is not a constant because it can
267 be set from the outside.
268 */
269 ::rtl::OUString msDescription;
270
271 /** Name of this object.
272 */
273 ::rtl::OUString msName;
274
275 /// Reference to the parent object.
276 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
277 mxParent;
278
279 /// pointer to internal representation
280 Ruler* mpRepr;
281
282 /// client id in the AccessibleEventNotifier queue
283 sal_uInt32 mnClientId;
284
285
286 };
287
IsAlive(void) const288 inline sal_Bool SvtRulerAccessible::IsAlive( void ) const
289 {
290 return !rBHelper.bDisposed && !rBHelper.bInDispose;
291 }
292
IsNotAlive(void) const293 inline sal_Bool SvtRulerAccessible::IsNotAlive( void ) const
294 {
295 return rBHelper.bDisposed || rBHelper.bInDispose;
296 }
297
298
299
300 #endif
301
302