Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "AccessibleContextBase.hxx"
30 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
31 : : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
32 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
33 : : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
34 : : #include <tools/debug.hxx>
35 : : #include <tools/gen.hxx>
36 : : #include <unotools/accessiblestatesethelper.hxx>
37 : : #include <toolkit/helper/convert.hxx>
38 : : #include <svl/smplhint.hxx>
39 : : #include <comphelper/sequence.hxx>
40 : : #include <comphelper/servicehelper.hxx>
41 : : #include <unotools/accessiblerelationsethelper.hxx>
42 : : #include <vcl/unohelp.hxx>
43 : : #include <comphelper/accessibleeventnotifier.hxx>
44 : : #include <vcl/svapp.hxx>
45 : :
46 : : using namespace ::rtl;
47 : : using namespace ::com::sun::star;
48 : : using namespace ::com::sun::star::accessibility;
49 : :
50 : : //===== internal ============================================================
51 : :
52 : : DBG_NAME(ScAccessibleContextBase)
53 : :
54 : 148 : ScAccessibleContextBase::ScAccessibleContextBase(
55 : : const uno::Reference<XAccessible>& rxParent,
56 : : const sal_Int16 aRole)
57 : : :
58 : : ScAccessibleContextBaseWeakImpl(m_aMutex),
59 : : mxParent(rxParent),
60 : : mnClientId(0),
61 [ + - ]: 148 : maRole(aRole)
62 : : {
63 : : DBG_CTOR(ScAccessibleContextBase, NULL);
64 : 148 : }
65 : :
66 : :
67 [ + - ][ + - ]: 137 : ScAccessibleContextBase::~ScAccessibleContextBase(void)
68 : : {
69 : : DBG_DTOR(ScAccessibleContextBase, NULL);
70 : :
71 [ - + ][ # # ]: 137 : if (!IsDefunc() && !rBHelper.bInDispose)
[ - + ]
72 : : {
73 : : // increment refcount to prevent double call off dtor
74 [ # # ]: 0 : osl_incrementInterlockedCount( &m_refCount );
75 : : // call dispose to inform object wich have a weak reference to this object
76 [ # # ]: 0 : dispose();
77 : : }
78 [ - + ]: 137 : }
79 : :
80 : 113 : void ScAccessibleContextBase::Init()
81 : : {
82 : : // hold reference to make sure that the destructor is not called
83 [ + - ]: 113 : uno::Reference< XAccessibleContext > xOwnContext(this);
84 : :
85 [ + - ]: 113 : if (mxParent.is())
86 : : {
87 [ + - ][ + - ]: 113 : uno::Reference< XAccessibleEventBroadcaster > xBroadcaster (mxParent->getAccessibleContext(), uno::UNO_QUERY);
[ + - ]
88 [ + - ]: 113 : if (xBroadcaster.is())
89 [ + - ][ + - ]: 113 : xBroadcaster->addEventListener(this);
[ + - ]
90 : : }
91 [ + - ]: 113 : msName = createAccessibleName();
92 [ + - ]: 113 : msDescription = createAccessibleDescription();
93 : 113 : }
94 : :
95 : 148 : void SAL_CALL ScAccessibleContextBase::disposing()
96 : : {
97 [ + - ]: 148 : SolarMutexGuard aGuard;
98 : : // CommitDefunc(); not necessary and should not be send, because it cost a lot of time
99 : :
100 : : // hold reference to make sure that the destructor is not called
101 [ + - ]: 148 : uno::Reference< XAccessibleContext > xOwnContext(this);
102 : :
103 [ + + ]: 148 : if ( mnClientId )
104 : : {
105 : 33 : sal_Int32 nTemClientId(mnClientId);
106 : 33 : mnClientId = 0;
107 [ + - ][ + - ]: 33 : comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nTemClientId, *this );
108 : : }
109 : :
110 [ + - ]: 148 : if (mxParent.is())
111 : : {
112 [ + - ][ + - ]: 148 : uno::Reference< XAccessibleEventBroadcaster > xBroadcaster (mxParent->getAccessibleContext(), uno::UNO_QUERY);
[ + - ]
113 [ + - ]: 148 : if (xBroadcaster.is())
114 [ + - ][ + - ]: 148 : xBroadcaster->removeEventListener(this);
[ + - ]
115 [ + - ]: 148 : mxParent = NULL;
116 : : }
117 : :
118 [ + - ][ + - ]: 148 : ScAccessibleContextBaseWeakImpl::disposing();
119 : 148 : }
120 : :
121 : : //===== XInterface =====================================================
122 : :
123 : 1410 : uno::Any SAL_CALL ScAccessibleContextBase::queryInterface( uno::Type const & rType )
124 : : throw (uno::RuntimeException)
125 : : {
126 [ + - ]: 1410 : uno::Any aAny (ScAccessibleContextBaseWeakImpl::queryInterface(rType));
127 [ + + ][ + - ]: 1410 : return aAny.hasValue() ? aAny : ScAccessibleContextBaseImplEvent::queryInterface(rType);
128 : : }
129 : :
130 : 8923 : void SAL_CALL ScAccessibleContextBase::acquire()
131 : : throw ()
132 : : {
133 : 8923 : ScAccessibleContextBaseWeakImpl::acquire();
134 : 8923 : }
135 : :
136 : 8912 : void SAL_CALL ScAccessibleContextBase::release()
137 : : throw ()
138 : : {
139 : 8912 : ScAccessibleContextBaseWeakImpl::release();
140 : 8912 : }
141 : :
142 : : //===== SfxListener =====================================================
143 : :
144 : 400 : void ScAccessibleContextBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
145 : : {
146 [ + + ]: 400 : if (rHint.ISA( SfxSimpleHint ) )
147 : : {
148 : 270 : const SfxSimpleHint& rRef = (const SfxSimpleHint&)rHint;
149 [ + + ]: 270 : if (rRef.GetId() == SFX_HINT_DYING)
150 : : {
151 : : // it seems the Broadcaster is dying, since the view is dying
152 : 41 : dispose();
153 : : }
154 : : }
155 : 400 : }
156 : :
157 : : //===== XAccessible =========================================================
158 : :
159 : : uno::Reference< XAccessibleContext> SAL_CALL
160 : 1586 : ScAccessibleContextBase::getAccessibleContext(void)
161 : : throw (uno::RuntimeException)
162 : : {
163 : 1586 : return this;
164 : : }
165 : :
166 : : //===== XAccessibleComponent ================================================
167 : :
168 : 2400 : sal_Bool SAL_CALL ScAccessibleContextBase::containsPoint(const awt::Point& rPoint )
169 : : throw (uno::RuntimeException)
170 : : {
171 [ + - ]: 2400 : SolarMutexGuard aGuard;
172 [ + - ]: 2400 : IsObjectValid();
173 [ + - ][ + - ]: 2400 : return Rectangle (Point(), GetBoundingBox().GetSize()).IsInside(VCLPoint(rPoint));
[ + - ][ + - ]
[ + - ]
174 : : }
175 : :
176 : 0 : uno::Reference< XAccessible > SAL_CALL ScAccessibleContextBase::getAccessibleAtPoint(
177 : : const awt::Point& /* rPoint */ )
178 : : throw (uno::RuntimeException)
179 : : {
180 : : OSL_FAIL("not implemented");
181 : 0 : return uno::Reference<XAccessible>();
182 : : }
183 : :
184 : 1159 : awt::Rectangle SAL_CALL ScAccessibleContextBase::getBounds( )
185 : : throw (uno::RuntimeException)
186 : : {
187 [ + - ]: 1159 : SolarMutexGuard aGuard;
188 [ + - ]: 1159 : IsObjectValid();
189 [ + - ][ + - ]: 1159 : return AWTRectangle(GetBoundingBox());
[ + - ]
190 : : }
191 : :
192 : 7 : awt::Point SAL_CALL ScAccessibleContextBase::getLocation( )
193 : : throw (uno::RuntimeException)
194 : : {
195 [ + - ]: 7 : SolarMutexGuard aGuard;
196 [ + - ]: 7 : IsObjectValid();
197 [ + - ][ + - ]: 7 : return AWTPoint(GetBoundingBox().TopLeft());
198 : : }
199 : :
200 : 15 : awt::Point SAL_CALL ScAccessibleContextBase::getLocationOnScreen( )
201 : : throw (uno::RuntimeException)
202 : : {
203 [ + - ]: 15 : SolarMutexGuard aGuard;
204 [ + - ]: 15 : IsObjectValid();
205 [ + - ][ + - ]: 15 : return AWTPoint(GetBoundingBoxOnScreen().TopLeft());
206 : : }
207 : :
208 : 7 : awt::Size SAL_CALL ScAccessibleContextBase::getSize( )
209 : : throw (uno::RuntimeException)
210 : : {
211 [ + - ]: 7 : SolarMutexGuard aGuard;
212 [ + - ]: 7 : IsObjectValid();
213 [ + - ][ + - ]: 7 : return AWTSize(GetBoundingBox().GetSize());
[ + - ]
214 : : }
215 : :
216 : 283 : sal_Bool SAL_CALL ScAccessibleContextBase::isShowing( )
217 : : throw (uno::RuntimeException)
218 : : {
219 [ + - ]: 283 : SolarMutexGuard aGuard;
220 [ + - ]: 283 : IsObjectValid();
221 : 283 : sal_Bool bShowing(false);
222 [ + - ]: 283 : if (mxParent.is())
223 : : {
224 [ + - ][ + - ]: 283 : uno::Reference<XAccessibleComponent> xParentComponent (mxParent->getAccessibleContext(), uno::UNO_QUERY);
[ + - ]
225 [ + - ]: 283 : if (xParentComponent.is())
226 : : {
227 [ + - ][ + - ]: 283 : Rectangle aParentBounds(VCLRectangle(xParentComponent->getBounds()));
[ + - ]
228 [ + - ][ + - ]: 283 : Rectangle aBounds(VCLRectangle(getBounds()));
229 [ + - ]: 283 : bShowing = aBounds.IsOver(aParentBounds);
230 : 283 : }
231 : : }
232 [ + - ]: 283 : return bShowing;
233 : : }
234 : :
235 : 254 : sal_Bool SAL_CALL ScAccessibleContextBase::isVisible( )
236 : : throw (uno::RuntimeException)
237 : : {
238 : 254 : return sal_True;
239 : : }
240 : :
241 : 1 : void SAL_CALL ScAccessibleContextBase::grabFocus( )
242 : : throw (uno::RuntimeException)
243 : : {
244 : : OSL_FAIL("not implemented");
245 : 1 : }
246 : :
247 : 5 : sal_Int32 SAL_CALL ScAccessibleContextBase::getForeground( )
248 : : throw (uno::RuntimeException)
249 : : {
250 : 5 : return COL_BLACK;
251 : : }
252 : :
253 : 5 : sal_Int32 SAL_CALL ScAccessibleContextBase::getBackground( )
254 : : throw (uno::RuntimeException)
255 : : {
256 : 5 : return COL_WHITE;
257 : : }
258 : :
259 : : //===== XAccessibleContext ==================================================
260 : :
261 : : sal_Int32 SAL_CALL
262 : 0 : ScAccessibleContextBase::getAccessibleChildCount(void)
263 : : throw (uno::RuntimeException)
264 : : {
265 : : OSL_FAIL("should be implemented in the abrevated class");
266 : 0 : return 0;
267 : : }
268 : :
269 : : uno::Reference<XAccessible> SAL_CALL
270 : 0 : ScAccessibleContextBase::getAccessibleChild(sal_Int32 /* nIndex */)
271 : : throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
272 : : {
273 : : OSL_FAIL("should be implemented in the abrevated class");
274 : 0 : return uno::Reference<XAccessible>();
275 : : }
276 : :
277 : : uno::Reference<XAccessible> SAL_CALL
278 : 1127 : ScAccessibleContextBase::getAccessibleParent(void)
279 : : throw (uno::RuntimeException)
280 : : {
281 : 1127 : return mxParent;
282 : : }
283 : :
284 : : sal_Int32 SAL_CALL
285 : 7 : ScAccessibleContextBase::getAccessibleIndexInParent(void)
286 : : throw (uno::RuntimeException)
287 : : {
288 [ + - ]: 7 : SolarMutexGuard aGuard;
289 [ + - ]: 7 : IsObjectValid();
290 : : // Use a simple but slow solution for now. Optimize later.
291 : : // Return -1 to indicate that this object's parent does not know about the
292 : : // object.
293 : 7 : sal_Int32 nIndex(-1);
294 : :
295 : : // Iterate over all the parent's children and search for this object.
296 [ + - ]: 7 : if (mxParent.is())
297 : : {
298 : : uno::Reference<XAccessibleContext> xParentContext (
299 [ + - ][ + - ]: 7 : mxParent->getAccessibleContext());
300 [ + - ]: 7 : if (xParentContext.is())
301 : : {
302 [ + - ][ + - ]: 7 : sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
303 [ + + ]: 26 : for (sal_Int32 i=0; i<nChildCount; ++i)
304 : : {
305 [ + - ][ + - ]: 19 : uno::Reference<XAccessible> xChild (xParentContext->getAccessibleChild (i));
306 [ + - ]: 19 : if (xChild.is())
307 : : {
308 [ + - ][ + - ]: 19 : if (xChild.get() == this)
309 : 19 : nIndex = i;
310 : : }
311 : 19 : }
312 : 7 : }
313 : : }
314 : :
315 [ + - ]: 7 : return nIndex;
316 : : }
317 : :
318 : : sal_Int16 SAL_CALL
319 : 281 : ScAccessibleContextBase::getAccessibleRole(void)
320 : : throw (uno::RuntimeException)
321 : : {
322 : 281 : return maRole;
323 : : }
324 : :
325 : : ::rtl::OUString SAL_CALL
326 : 147 : ScAccessibleContextBase::getAccessibleDescription(void)
327 : : throw (uno::RuntimeException)
328 : : {
329 [ + - ]: 147 : SolarMutexGuard aGuard;
330 [ + - ]: 147 : IsObjectValid();
331 [ + - ]: 147 : if (msDescription.isEmpty())
332 : : {
333 [ + - ]: 147 : OUString sDescription(createAccessibleDescription());
334 : :
335 [ - + ]: 147 : if (msDescription != sDescription)
336 : : {
337 [ # # ]: 0 : AccessibleEventObject aEvent;
338 : 0 : aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
339 [ # # ][ # # ]: 0 : aEvent.Source = uno::Reference< XAccessibleContext >(this);
340 [ # # ]: 0 : aEvent.OldValue <<= msDescription;
341 [ # # ]: 0 : aEvent.NewValue <<= sDescription;
342 : :
343 : 0 : msDescription = sDescription;
344 : :
345 [ # # ][ # # ]: 0 : CommitChange(aEvent);
346 : 147 : }
347 : : }
348 [ + - ]: 147 : return msDescription;
349 : : }
350 : :
351 : : OUString SAL_CALL
352 : 173 : ScAccessibleContextBase::getAccessibleName(void)
353 : : throw (uno::RuntimeException)
354 : : {
355 [ + - ]: 173 : SolarMutexGuard aGuard;
356 [ + - ]: 173 : IsObjectValid();
357 [ + + ]: 173 : if (msName.isEmpty())
358 : : {
359 [ + - ]: 20 : OUString sName(createAccessibleName());
360 : : OSL_ENSURE(!sName.isEmpty(), "We should give always a name.");
361 : :
362 [ + + ]: 20 : if (msName != sName)
363 : : {
364 [ + - ]: 8 : AccessibleEventObject aEvent;
365 : 8 : aEvent.EventId = AccessibleEventId::NAME_CHANGED;
366 [ + - ][ + - ]: 8 : aEvent.Source = uno::Reference< XAccessibleContext >(this);
367 [ + - ]: 8 : aEvent.OldValue <<= msName;
368 [ + - ]: 8 : aEvent.NewValue <<= sName;
369 : :
370 : 8 : msName = sName;
371 : :
372 [ + - ][ + - ]: 8 : CommitChange(aEvent);
373 : 20 : }
374 : : }
375 [ + - ]: 173 : return msName;
376 : : }
377 : :
378 : : uno::Reference<XAccessibleRelationSet> SAL_CALL
379 : 7 : ScAccessibleContextBase::getAccessibleRelationSet(void)
380 : : throw (uno::RuntimeException)
381 : : {
382 [ + - ][ + - ]: 7 : return new utl::AccessibleRelationSetHelper();
383 : : }
384 : :
385 : : uno::Reference<XAccessibleStateSet> SAL_CALL
386 : 0 : ScAccessibleContextBase::getAccessibleStateSet(void)
387 : : throw (uno::RuntimeException)
388 : : {
389 : 0 : return uno::Reference<XAccessibleStateSet>();
390 : : }
391 : :
392 : : lang::Locale SAL_CALL
393 : 24 : ScAccessibleContextBase::getLocale(void)
394 : : throw (IllegalAccessibleComponentStateException,
395 : : uno::RuntimeException)
396 : : {
397 [ + - ]: 24 : SolarMutexGuard aGuard;
398 [ + - ]: 24 : IsObjectValid();
399 [ + - ]: 24 : if (mxParent.is())
400 : : {
401 : : uno::Reference<XAccessibleContext> xParentContext (
402 [ + - ][ + - ]: 24 : mxParent->getAccessibleContext());
403 [ + - ]: 24 : if (xParentContext.is())
404 [ + - ][ + - ]: 48 : return xParentContext->getLocale ();
[ - + ]
405 : : }
406 : :
407 : : // No locale and no parent. Therefore throw exception to indicate this
408 : : // cluelessness.
409 [ + - ][ # # ]: 24 : throw IllegalAccessibleComponentStateException ();
410 : : }
411 : :
412 : : //===== XAccessibleEventBroadcaster =====================================
413 : :
414 : : void SAL_CALL
415 : 103 : ScAccessibleContextBase::addEventListener(
416 : : const uno::Reference<XAccessibleEventListener>& xListener)
417 : : throw (uno::RuntimeException)
418 : : {
419 [ + - ]: 103 : if (xListener.is())
420 : : {
421 [ + - ]: 103 : SolarMutexGuard aGuard;
422 [ + - ]: 103 : IsObjectValid();
423 [ + - ]: 103 : if (!IsDefunc())
424 : : {
425 [ + + ]: 103 : if (!mnClientId)
426 [ + - ]: 59 : mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
427 [ + - ]: 103 : comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
428 [ + - ]: 103 : }
429 : : }
430 : 103 : }
431 : :
432 : : void SAL_CALL
433 : 136 : ScAccessibleContextBase::removeEventListener(
434 : : const uno::Reference<XAccessibleEventListener>& xListener)
435 : : throw (uno::RuntimeException)
436 : : {
437 [ + - ]: 136 : if (xListener.is())
438 : : {
439 [ + - ]: 136 : SolarMutexGuard aGuard;
440 [ + + ][ + + ]: 136 : if (!IsDefunc() && mnClientId)
[ + + ]
441 : : {
442 [ + - ]: 27 : sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
443 [ + + ]: 27 : if ( !nListenerCount )
444 : : {
445 : : // no listeners anymore
446 : : // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
447 : : // and at least to us not firing any events anymore, in case somebody calls
448 : : // NotifyAccessibleEvent, again
449 [ + - ]: 26 : comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
450 : 26 : mnClientId = 0;
451 : : }
452 [ + - ]: 136 : }
453 : : }
454 : 136 : }
455 : :
456 : : //===== XAccessibleEventListener ========================================
457 : :
458 : 76 : void SAL_CALL ScAccessibleContextBase::disposing(
459 : : const lang::EventObject& rSource )
460 : : throw (uno::RuntimeException)
461 : : {
462 [ + - ]: 76 : SolarMutexGuard aGuard;
463 [ + - ][ + + ]: 76 : if (rSource.Source == mxParent)
464 [ + - ][ + - ]: 76 : dispose();
465 : 76 : }
466 : :
467 : 244 : void SAL_CALL ScAccessibleContextBase::notifyEvent(
468 : : const AccessibleEventObject& /* aEvent */ )
469 : : throw (uno::RuntimeException)
470 : : {
471 : 244 : }
472 : :
473 : : //===== XServiceInfo ========================================================
474 : :
475 : : ::rtl::OUString SAL_CALL
476 : 0 : ScAccessibleContextBase::getImplementationName(void)
477 : : throw (uno::RuntimeException)
478 : : {
479 : 0 : return OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleContextBase"));
480 : : }
481 : :
482 : : sal_Bool SAL_CALL
483 : 0 : ScAccessibleContextBase::supportsService(const OUString& sServiceName)
484 : : throw (uno::RuntimeException)
485 : : {
486 : : // Iterate over all supported service names and return true if on of them
487 : : // matches the given name.
488 : : uno::Sequence< ::rtl::OUString> aSupportedServices (
489 [ # # ]: 0 : getSupportedServiceNames ());
490 : 0 : sal_Int32 nLength(aSupportedServices.getLength());
491 : 0 : const OUString* pServiceNames = aSupportedServices.getConstArray();
492 [ # # ]: 0 : for (int i=0; i<nLength; ++i, ++pServiceNames)
493 [ # # ]: 0 : if (sServiceName == *pServiceNames)
494 : 0 : return sal_True;
495 [ # # ]: 0 : return false;
496 : : }
497 : :
498 : : uno::Sequence< ::rtl::OUString> SAL_CALL
499 : 0 : ScAccessibleContextBase::getSupportedServiceNames(void)
500 : : throw (uno::RuntimeException)
501 : : {
502 : 0 : uno::Sequence<OUString> aServiceNames(2);
503 [ # # ]: 0 : OUString* pServiceNames = aServiceNames.getArray();
504 [ # # ]: 0 : if (pServiceNames)
505 : : {
506 [ # # ]: 0 : pServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.Accessible"));
507 [ # # ]: 0 : pServiceNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext"));
508 : : }
509 : :
510 : 0 : return aServiceNames;
511 : : }
512 : :
513 : : //===== XTypeProvider =======================================================
514 : :
515 : 0 : uno::Sequence< uno::Type > SAL_CALL ScAccessibleContextBase::getTypes()
516 : : throw (uno::RuntimeException)
517 : : {
518 [ # # ][ # # ]: 0 : return comphelper::concatSequences(ScAccessibleContextBaseWeakImpl::getTypes(), ScAccessibleContextBaseImplEvent::getTypes());
[ # # ]
519 : : }
520 : :
521 : : namespace
522 : : {
523 : : class theScAccessibleContextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theScAccessibleContextBaseImplementationId > {};
524 : : }
525 : :
526 : : uno::Sequence<sal_Int8> SAL_CALL
527 : 0 : ScAccessibleContextBase::getImplementationId(void)
528 : : throw (uno::RuntimeException)
529 : : {
530 : 0 : return theScAccessibleContextBaseImplementationId::get().getSeq();
531 : : }
532 : :
533 : : //===== internal ============================================================
534 : :
535 : : ::rtl::OUString SAL_CALL
536 : 0 : ScAccessibleContextBase::createAccessibleDescription(void)
537 : : throw (uno::RuntimeException)
538 : : {
539 : : OSL_FAIL("should be implemented in the abrevated class");
540 : 0 : return rtl::OUString();
541 : : }
542 : :
543 : : ::rtl::OUString SAL_CALL
544 : 0 : ScAccessibleContextBase::createAccessibleName(void)
545 : : throw (uno::RuntimeException)
546 : : {
547 : : OSL_FAIL("should be implemented in the abrevated class");
548 : 0 : return rtl::OUString();
549 : : }
550 : :
551 : 137 : void ScAccessibleContextBase::CommitChange(const AccessibleEventObject& rEvent) const
552 : : {
553 [ + + ]: 137 : if (mnClientId)
554 : 107 : comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
555 : 137 : }
556 : :
557 : 0 : void ScAccessibleContextBase::ChangeName()
558 : : {
559 [ # # ]: 0 : AccessibleEventObject aEvent;
560 : 0 : aEvent.EventId = AccessibleEventId::NAME_CHANGED;
561 [ # # ][ # # ]: 0 : aEvent.Source = uno::Reference< XAccessibleContext >(const_cast<ScAccessibleContextBase*>(this));
562 [ # # ]: 0 : aEvent.OldValue <<= msName;
563 : :
564 : 0 : msName = rtl::OUString(); // reset the name so it will be hold again
565 [ # # ]: 0 : getAccessibleName(); // create the new name
566 : :
567 [ # # ]: 0 : aEvent.NewValue <<= msName;
568 : :
569 [ # # ][ # # ]: 0 : CommitChange(aEvent);
570 : 0 : }
571 : :
572 : 5 : void ScAccessibleContextBase::CommitFocusGained() const
573 : : {
574 [ + - ]: 5 : AccessibleEventObject aEvent;
575 : 5 : aEvent.EventId = AccessibleEventId::STATE_CHANGED;
576 [ + - ][ + - ]: 5 : aEvent.Source = uno::Reference< XAccessibleContext >(const_cast<ScAccessibleContextBase*>(this));
577 [ + - ]: 5 : aEvent.NewValue <<= AccessibleStateType::FOCUSED;
578 : :
579 [ + - ]: 5 : CommitChange(aEvent);
580 : :
581 [ + - ][ + - ]: 5 : ::vcl::unohelper::NotifyAccessibleStateEventGlobally(aEvent);
582 : 5 : }
583 : :
584 : 21 : void ScAccessibleContextBase::CommitFocusLost() const
585 : : {
586 [ + - ]: 21 : AccessibleEventObject aEvent;
587 : 21 : aEvent.EventId = AccessibleEventId::STATE_CHANGED;
588 [ + - ][ + - ]: 21 : aEvent.Source = uno::Reference< XAccessibleContext >(const_cast<ScAccessibleContextBase*>(this));
589 [ + - ]: 21 : aEvent.OldValue <<= AccessibleStateType::FOCUSED;
590 : :
591 [ + - ]: 21 : CommitChange(aEvent);
592 : :
593 [ + - ][ + - ]: 21 : vcl::unohelper::NotifyAccessibleStateEventGlobally(aEvent);
594 : 21 : }
595 : :
596 : 0 : Rectangle ScAccessibleContextBase::GetBoundingBoxOnScreen(void) const
597 : : throw (uno::RuntimeException)
598 : : {
599 : : OSL_FAIL("not implemented");
600 : 0 : return Rectangle();
601 : : }
602 : :
603 : 0 : Rectangle ScAccessibleContextBase::GetBoundingBox(void) const
604 : : throw (uno::RuntimeException)
605 : : {
606 : : OSL_FAIL("not implemented");
607 : 0 : return Rectangle();
608 : : }
609 : :
610 : 5142 : void ScAccessibleContextBase::IsObjectValid() const
611 : : throw (lang::DisposedException)
612 : : {
613 [ + + ][ - + ]: 5142 : if (rBHelper.bDisposed || rBHelper.bInDispose)
614 [ + - ]: 1 : throw lang::DisposedException();
615 : 5141 : }
616 : :
617 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|