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 <com/sun/star/accessibility/AccessibleRole.hpp>
30 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
31 : : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
32 : : #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
33 : : #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
34 : : #include <toolkit/awt/vclxaccessiblecomponent.hxx>
35 : : #include <toolkit/helper/externallock.hxx>
36 : : #include <toolkit/awt/vclxwindow.hxx>
37 : : #include <toolkit/helper/convert.hxx>
38 : : #include <toolkit/awt/vclxfont.hxx>
39 : : #include <vcl/dialog.hxx>
40 : : #include <vcl/window.hxx>
41 : : #include <tools/debug.hxx>
42 : : #include <unotools/accessiblestatesethelper.hxx>
43 : : #include <unotools/accessiblerelationsethelper.hxx>
44 : : #include <vcl/svapp.hxx>
45 : : #include <vcl/menu.hxx>
46 : :
47 : : #ifndef VCLEVENT_WINDOW_FRAMETITLECHANGED
48 : : #define VCLEVENT_WINDOW_FRAMETITLECHANGED 1018 // pData = XubString* = oldTitle
49 : : #endif
50 : :
51 : : using namespace ::com::sun::star;
52 : : using namespace ::comphelper;
53 : :
54 : :
55 : : DBG_NAME(VCLXAccessibleComponent)
56 : :
57 : :
58 : : // ----------------------------------------------------
59 : : // class VCLXAccessibleComponent
60 : : // ----------------------------------------------------
61 : 475 : VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow )
62 : 0 : : AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
63 [ + - ][ + - ]: 475 : , OAccessibleImplementationAccess( )
64 : : {
65 : : DBG_CTOR( VCLXAccessibleComponent, 0 );
66 : 475 : mpVCLXindow = pVCLXindow;
67 [ + - ][ + - ]: 475 : mxWindow = pVCLXindow;
68 : :
69 [ + - ]: 475 : m_pSolarLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) );
70 : :
71 : : DBG_ASSERT( pVCLXindow->GetWindow(), "VCLXAccessibleComponent - no window!" );
72 [ + - ]: 475 : if ( pVCLXindow->GetWindow() )
73 : : {
74 [ + - ][ + - ]: 475 : pVCLXindow->GetWindow()->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
75 [ + - ][ + - ]: 475 : pVCLXindow->GetWindow()->AddChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
76 : : }
77 : :
78 : : // announce the XAccessible of our creator to the base class
79 [ + - ][ + - ]: 475 : lateInit( pVCLXindow );
[ + - ]
80 : 475 : }
81 : :
82 [ + - ]: 437 : VCLXAccessibleComponent::~VCLXAccessibleComponent()
83 : : {
84 : : DBG_DTOR( VCLXAccessibleComponent, 0 );
85 : :
86 [ + - ]: 437 : ensureDisposed();
87 : :
88 [ - + ][ # # ]: 437 : if ( mpVCLXindow && mpVCLXindow->GetWindow() )
[ - + ]
89 : : {
90 [ # # ][ # # ]: 0 : mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
91 [ # # ][ # # ]: 0 : mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
92 : : }
93 : :
94 [ + - ][ + - ]: 437 : delete m_pSolarLock;
95 : 437 : m_pSolarLock = NULL;
96 : : // This is not completely safe. If we assume that the base class dtor calls some method which
97 : : // uses this lock, the we crash. However, as the base class' dtor does not have a chance to call _out_
98 : : // virtual methods, this is no problem as long as the base class is safe, i.e. does not use the external
99 : : // lock from within it's dtor. At the moment, we _know_ the base class is safe in this respect, so
100 : : // let's assume it keeps this way.
101 : : // @see OAccessibleContextHelper::OAccessibleContextHelper( IMutex* )
102 [ - + ]: 758 : }
103 : :
104 [ + + ][ + - ]: 104333 : IMPLEMENT_FORWARD_XINTERFACE3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE )
[ + - ][ + - ]
105 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE )
[ # # ][ # # ]
[ # # ]
106 : :
107 : 22 : ::rtl::OUString VCLXAccessibleComponent::getImplementationName() throw (uno::RuntimeException)
108 : : {
109 : 22 : return ::rtl::OUString("com.sun.star.comp.toolkit.AccessibleWindow");
110 : : }
111 : :
112 : 0 : sal_Bool VCLXAccessibleComponent::supportsService( const ::rtl::OUString& rServiceName ) throw (uno::RuntimeException)
113 : : {
114 [ # # ]: 0 : uno::Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
115 : 0 : const ::rtl::OUString* pNames = aNames.getConstArray();
116 : 0 : const ::rtl::OUString* pEnd = pNames + aNames.getLength();
117 [ # # ][ # # ]: 0 : for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
[ # # ]
118 : : ;
119 : :
120 [ # # ]: 0 : return pNames != pEnd;
121 : : }
122 : :
123 : 0 : uno::Sequence< ::rtl::OUString > VCLXAccessibleComponent::getSupportedServiceNames() throw (uno::RuntimeException)
124 : : {
125 : 0 : uno::Sequence< ::rtl::OUString > aNames(1);
126 [ # # ]: 0 : aNames[0] = ::rtl::OUString("com.sun.star.awt.AccessibleWindow");
127 : 0 : return aNames;
128 : : }
129 : :
130 : 3334 : IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent )
131 : : {
132 : : DBG_CHKTHIS(VCLXAccessibleComponent,0);
133 : :
134 : : DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
135 : :
136 : : /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper
137 : : * might have been destroyed by the previous VCLEventListener (if no AT tool
138 : : * is running), e.g. sub-toolbars in impress.
139 : : */
140 [ + - ][ + - ]: 3334 : if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #122218# */ && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
[ + - ][ + - ]
[ + - ]
141 : : {
142 : : DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
143 [ + + ][ + + ]: 3334 : if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
[ + + ]
144 : : {
145 : 3169 : ProcessWindowEvent( *(VclWindowEvent*)pEvent );
146 : : }
147 : : }
148 : 3334 : return 0;
149 : : }
150 : :
151 : 40553 : IMPL_LINK( VCLXAccessibleComponent, WindowChildEventListener, VclSimpleEvent*, pEvent )
152 : : {
153 : : DBG_CHKTHIS(VCLXAccessibleComponent,0);
154 : :
155 : : DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
156 [ + - ][ + - ]: 40553 : if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #i68079# */ )
[ + - ][ + - ]
157 : : {
158 : : DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
159 [ + + ]: 40553 : if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() )
160 : : {
161 : : // #103087# to prevent an early release of the component
162 [ + - ]: 38417 : uno::Reference< accessibility::XAccessibleContext > xTmp = this;
163 : :
164 [ + - ]: 38417 : ProcessWindowChildEvent( *(VclWindowEvent*)pEvent );
165 : : }
166 : : }
167 : 40553 : return 0;
168 : : }
169 : :
170 : 6043 : uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::GetChildAccessible( const VclWindowEvent& rVclWindowEvent )
171 : : {
172 : : // checks if the data in the window event is our direct child
173 : : // and returns its accessible
174 : :
175 : : // MT: Change this later, normaly a show/hide event shouldn't have the Window* in pData.
176 : 6043 : Window* pChildWindow = (Window *) rVclWindowEvent.GetData();
177 [ + + ][ + + ]: 6043 : if( pChildWindow && GetWindow() == pChildWindow->GetAccessibleParentWindow() )
[ + + ]
178 : 777 : return pChildWindow->GetAccessible( rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW );
179 : : else
180 : 6043 : return uno::Reference< accessibility::XAccessible > ();
181 : : }
182 : :
183 : 38323 : void VCLXAccessibleComponent::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
184 : : {
185 : 38323 : uno::Any aOldValue, aNewValue;
186 : 38323 : uno::Reference< accessibility::XAccessible > xAcc;
187 : :
188 [ + + + ]: 38323 : switch ( rVclWindowEvent.GetId() )
189 : : {
190 : : case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children
191 : : {
192 [ + - ][ + - ]: 241 : xAcc = GetChildAccessible( rVclWindowEvent );
193 [ + + ]: 241 : if( xAcc.is() )
194 : : {
195 [ + - ]: 49 : aNewValue <<= xAcc;
196 [ + - ]: 49 : NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
197 : : }
198 : : }
199 : 241 : break;
200 : : case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children
201 : : {
202 [ + - ][ + - ]: 5812 : xAcc = GetChildAccessible( rVclWindowEvent );
203 [ + + ]: 5812 : if( xAcc.is() )
204 : : {
205 [ + - ]: 429 : aOldValue <<= xAcc;
206 [ + - ]: 429 : NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
207 : : }
208 : : }
209 : 5812 : break;
210 : 38323 : }
211 : 38323 : }
212 : :
213 : 2589 : void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
214 : : {
215 : 2589 : uno::Any aOldValue, aNewValue;
216 : :
217 : 2589 : Window* pAccWindow = rVclWindowEvent.GetWindow();
218 : : DBG_ASSERT( pAccWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" );
219 : :
220 [ + + + + : 2589 : switch ( rVclWindowEvent.GetId() )
+ + + + +
+ - + - -
+ ]
221 : : {
222 : : case VCLEVENT_OBJECT_DYING:
223 : : {
224 [ + - ][ + - ]: 475 : pAccWindow->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
225 [ + - ][ + - ]: 475 : pAccWindow->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
226 : 475 : mxWindow.clear();
227 : 475 : mpVCLXindow = NULL;
228 : : }
229 : 475 : break;
230 : : //
231 : : // dont handle CHILDCREATED events here
232 : : // they are handled separately as child events, see ProcessWindowChildEvent above
233 : : //
234 : : /*
235 : : case VCLEVENT_WINDOW_CHILDCREATED:
236 : : {
237 : : Window* pWindow = (Window*) rVclWindowEvent.GetData();
238 : : DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDCREATED - Window=?" );
239 : : aNewValue <<= pWindow->GetAccessible();
240 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
241 : : }
242 : : break;
243 : : */
244 : : case VCLEVENT_WINDOW_CHILDDESTROYED:
245 : : {
246 : 622 : Window* pWindow = (Window*) rVclWindowEvent.GetData();
247 : : DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDDESTROYED - Window=?" );
248 [ + + ][ + - ]: 622 : if ( pWindow->GetAccessible( sal_False ).is() )
249 : : {
250 [ + - ][ + - ]: 305 : aOldValue <<= pWindow->GetAccessible( sal_False );
251 [ + - ]: 305 : NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
252 : : }
253 : : }
254 : 622 : break;
255 : :
256 : : //
257 : : // show and hide will be handled as child events only and are
258 : : // responsible for sending create/destroy events, see ProcessWindowChildEvent above
259 : : //
260 : : /*
261 : : case VCLEVENT_WINDOW_SHOW:
262 : : {
263 : : aNewValue <<= accessibility::AccessibleStateType::VISIBLE;
264 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
265 : :
266 : : aNewValue <<= accessibility::AccessibleStateType::SHOWING;
267 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
268 : :
269 : : aNewValue.clear();
270 : : aOldValue <<= accessibility::AccessibleStateType::INVALID;
271 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
272 : : }
273 : : break;
274 : : case VCLEVENT_WINDOW_HIDE:
275 : : {
276 : : aOldValue <<= accessibility::AccessibleStateType::VISIBLE;
277 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
278 : :
279 : : aOldValue <<= accessibility::AccessibleStateType::SHOWING;
280 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
281 : :
282 : : aOldValue.clear();
283 : : aNewValue <<= accessibility::AccessibleStateType::INVALID;
284 : : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
285 : : }
286 : : break;
287 : : */
288 : : case VCLEVENT_WINDOW_ACTIVATE:
289 : : {
290 : : // avoid notification if a child frame is already active
291 : : // only one frame may be active at a given time
292 [ + - ][ + - ]: 160 : if ( !pAccWindow->HasActiveChildFrame() &&
[ + - ][ + - ]
[ - + ][ - + ]
293 [ + - ]: 40 : ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||
294 [ + - ]: 40 : getAccessibleRole() == accessibility::AccessibleRole::ALERT ||
295 [ + - ]: 40 : getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891#
296 : : {
297 [ # # ]: 0 : aNewValue <<= accessibility::AccessibleStateType::ACTIVE;
298 [ # # ]: 0 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
299 : : }
300 : : }
301 : 40 : break;
302 : : case VCLEVENT_WINDOW_DEACTIVATE:
303 : : {
304 [ + - ][ + - ]: 603 : if ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||
[ + - ][ - + ]
[ - + ]
305 [ + - ]: 201 : getAccessibleRole() == accessibility::AccessibleRole::ALERT ||
306 [ + - ]: 201 : getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) // #i18891#
307 : : {
308 [ # # ]: 0 : aOldValue <<= accessibility::AccessibleStateType::ACTIVE;
309 [ # # ]: 0 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
310 : : }
311 : : }
312 : 201 : break;
313 : : case VCLEVENT_WINDOW_GETFOCUS:
314 : : case VCLEVENT_CONTROL_GETFOCUS:
315 : : {
316 [ + - ][ + + ]: 548 : if( (pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS) ||
[ + + ]
[ + + + + ]
[ + + ]
317 [ + - ]: 360 : (!pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS) )
318 : : {
319 : : // if multiple listeners were registered it is possible that the
320 : : // focus was changed during event processing (eg SfxTopWindow )
321 : : // #106082# allow ChildPathFocus only for CompoundControls, for windows the focus must be in the window itself
322 [ + - ][ + + ]: 526 : if( (pAccWindow->IsCompoundControl() && pAccWindow->HasChildPathFocus()) ||
[ + - ][ - + ]
[ + - ][ + + ]
[ + + ]
323 [ + - ][ + - ]: 348 : (!pAccWindow->IsCompoundControl() && pAccWindow->HasFocus()) )
324 : : {
325 [ + - ]: 174 : aNewValue <<= accessibility::AccessibleStateType::FOCUSED;
326 [ + - ]: 174 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
327 : : }
328 : : }
329 : : }
330 : 188 : break;
331 : : case VCLEVENT_WINDOW_LOSEFOCUS:
332 : : case VCLEVENT_CONTROL_LOSEFOCUS:
333 : : {
334 [ + - ][ - + ]: 39 : if( (pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS) ||
[ # # ]
[ + - + - ]
[ + - ]
335 [ + - ]: 26 : (!pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS) )
336 : : {
337 [ + - ]: 13 : aOldValue <<= accessibility::AccessibleStateType::FOCUSED;
338 [ + - ]: 13 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
339 : : }
340 : : }
341 : 13 : break;
342 : : case VCLEVENT_WINDOW_FRAMETITLECHANGED:
343 : : {
344 : 188 : ::rtl::OUString aOldName( *((::rtl::OUString*) rVclWindowEvent.GetData()) );
345 [ + - ]: 188 : ::rtl::OUString aNewName( getAccessibleName() );
346 [ + - ]: 188 : aOldValue <<= aOldName;
347 [ + - ]: 188 : aNewValue <<= aNewName;
348 [ + - ]: 188 : NotifyAccessibleEvent( accessibility::AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
349 : : }
350 : 188 : break;
351 : : case VCLEVENT_WINDOW_ENABLED:
352 : : {
353 [ + - ]: 4 : aNewValue <<= accessibility::AccessibleStateType::ENABLED;
354 [ + - ]: 4 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
355 [ + - ]: 4 : aNewValue <<= accessibility::AccessibleStateType::SENSITIVE;
356 [ + - ]: 4 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
357 : : }
358 : 4 : break;
359 : : case VCLEVENT_WINDOW_DISABLED:
360 : : {
361 [ + - ]: 4 : aOldValue <<= accessibility::AccessibleStateType::SENSITIVE;
362 [ + - ]: 4 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
363 : :
364 [ + - ]: 4 : aOldValue <<= accessibility::AccessibleStateType::ENABLED;
365 [ + - ]: 4 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
366 : : }
367 : 4 : break;
368 : : case VCLEVENT_WINDOW_MOVE:
369 : : case VCLEVENT_WINDOW_RESIZE:
370 : : {
371 [ + - ]: 148 : NotifyAccessibleEvent( accessibility::AccessibleEventId::BOUNDRECT_CHANGED, aOldValue, aNewValue );
372 : : }
373 : 148 : break;
374 : : case VCLEVENT_WINDOW_MENUBARADDED:
375 : : {
376 : 0 : MenuBar* pMenuBar = (MenuBar*) rVclWindowEvent.GetData();
377 [ # # ]: 0 : if ( pMenuBar )
378 : : {
379 [ # # ]: 0 : uno::Reference< accessibility::XAccessible > xChild( pMenuBar->GetAccessible() );
380 [ # # ]: 0 : if ( xChild.is() )
381 : : {
382 [ # # ]: 0 : aNewValue <<= xChild;
383 [ # # ]: 0 : NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
384 : 0 : }
385 : : }
386 : : }
387 : 0 : break;
388 : : case VCLEVENT_WINDOW_MENUBARREMOVED:
389 : : {
390 : 49 : MenuBar* pMenuBar = (MenuBar*) rVclWindowEvent.GetData();
391 [ + - ]: 49 : if ( pMenuBar )
392 : : {
393 [ + - ]: 49 : uno::Reference< accessibility::XAccessible > xChild( pMenuBar->GetAccessible() );
394 [ + - ]: 49 : if ( xChild.is() )
395 : : {
396 [ + - ]: 49 : aOldValue <<= xChild;
397 [ + - ]: 49 : NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
398 : 49 : }
399 : : }
400 : : }
401 : 49 : break;
402 : : case VCLEVENT_WINDOW_MINIMIZE:
403 : : {
404 [ # # ]: 0 : aNewValue <<= accessibility::AccessibleStateType::ICONIFIED;
405 [ # # ]: 0 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
406 : : }
407 : 0 : break;
408 : : case VCLEVENT_WINDOW_NORMALIZE:
409 : : {
410 [ # # ]: 0 : aOldValue <<= accessibility::AccessibleStateType::ICONIFIED;
411 [ # # ]: 0 : NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
412 : : }
413 : 0 : break;
414 : : default:
415 : : {
416 : : }
417 : 657 : break;
418 : 2589 : }
419 : 2589 : }
420 : :
421 : 469 : void VCLXAccessibleComponent::disposing()
422 : : {
423 [ + + ][ + - ]: 469 : if ( mpVCLXindow && mpVCLXindow->GetWindow() )
[ + + ]
424 : : {
425 [ + - ]: 16 : mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
426 [ + - ]: 16 : mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
427 : : }
428 : :
429 : 469 : AccessibleExtendedComponentHelper_BASE::disposing();
430 : :
431 : 469 : mxWindow.clear();
432 : 469 : mpVCLXindow = NULL;
433 : 469 : }
434 : :
435 : 39708 : Window* VCLXAccessibleComponent::GetWindow() const
436 : : {
437 [ + - ]: 39708 : return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() : NULL;
438 : : }
439 : :
440 : 10 : void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
441 : : {
442 : 10 : Window* pWindow = GetWindow();
443 [ + - ]: 10 : if ( pWindow )
444 : : {
445 : 10 : Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
446 [ # # ][ - + ]: 10 : if ( pLabeledBy && pLabeledBy != pWindow )
447 : : {
448 [ # # ]: 0 : uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
449 [ # # ][ # # ]: 0 : aSequence[0] = pLabeledBy->GetAccessible();
[ # # ]
450 [ # # ][ # # ]: 0 : rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
[ # # ][ # # ]
451 : : }
452 : :
453 : 10 : Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor();
454 [ # # ][ - + ]: 10 : if ( pLabelFor && pLabelFor != pWindow )
455 : : {
456 [ # # ]: 0 : uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
457 [ # # ][ # # ]: 0 : aSequence[0] = pLabelFor->GetAccessible();
[ # # ]
458 [ # # ][ # # ]: 0 : rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
[ # # ][ # # ]
459 : : }
460 : : }
461 : 10 : }
462 : :
463 : 538 : void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
464 : : {
465 : 538 : Window* pWindow = GetWindow();
466 [ + - ]: 538 : if ( pWindow )
467 : : {
468 [ + - ]: 538 : if ( pWindow->IsVisible() )
469 : : {
470 : 538 : rStateSet.AddState( accessibility::AccessibleStateType::VISIBLE );
471 : 538 : rStateSet.AddState( accessibility::AccessibleStateType::SHOWING );
472 : : }
473 : : else
474 : : {
475 : 0 : rStateSet.AddState( accessibility::AccessibleStateType::INVALID );
476 : : }
477 : :
478 [ + - ]: 538 : if ( pWindow->IsEnabled() )
479 : : {
480 : 538 : rStateSet.AddState( accessibility::AccessibleStateType::ENABLED );
481 : 538 : rStateSet.AddState( accessibility::AccessibleStateType::SENSITIVE );
482 : : }
483 : :
484 [ + + + - : 1387 : if ( pWindow->HasChildPathFocus() &&
+ - + + ]
[ + + ]
485 : 283 : ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||
486 : 283 : getAccessibleRole() == accessibility::AccessibleRole::ALERT ||
487 : 283 : getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891#
488 : 2 : rStateSet.AddState( accessibility::AccessibleStateType::ACTIVE );
489 : :
490 : : // #104290# MT: This way, a ComboBox doesn't get state FOCUSED.
491 : : // I also don't understand
492 : : // a) why WINDOW_FIRSTCHILD is used here (which btw is a border window in the case of a combo box)
493 : : // b) why HasFocus() is nout "enough" for a compound control
494 : : /*
495 : : Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
496 : : if ( ( !pWindow->IsCompoundControl() && pWindow->HasFocus() ) ||
497 : : ( pWindow->IsCompoundControl() && pChild && pChild->HasFocus() ) )
498 : : rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED );
499 : : */
500 [ + + ][ + + ]: 538 : if ( pWindow->HasFocus() || ( pWindow->IsCompoundControl() && pWindow->HasChildPathFocus() ) )
[ + + ][ + + ]
501 : 24 : rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED );
502 : :
503 [ - + ]: 538 : if ( pWindow->IsWait() )
504 : 0 : rStateSet.AddState( accessibility::AccessibleStateType::BUSY );
505 : :
506 [ + + ]: 538 : if ( pWindow->GetStyle() & WB_SIZEABLE )
507 : 24 : rStateSet.AddState( accessibility::AccessibleStateType::RESIZABLE );
508 : :
509 [ + + ]: 538 : if( pWindow->IsDialog() )
510 : : {
511 : 2 : Dialog *pDlg = static_cast< Dialog* >( pWindow );
512 [ - + ]: 2 : if( pDlg->IsInExecute() )
513 : 0 : rStateSet.AddState( accessibility::AccessibleStateType::MODAL );
514 : : }
515 : : }
516 : : else
517 : : {
518 : 0 : rStateSet.AddState( accessibility::AccessibleStateType::DEFUNC );
519 : : }
520 : :
521 : : /*
522 : :
523 : : MUST BE SET FROM DERIVED CLASSES:
524 : :
525 : : CHECKED
526 : : COLLAPSED
527 : : EXPANDED
528 : : EXPANDABLE
529 : : EDITABLE
530 : : FOCUSABLE
531 : : HORIZONTAL
532 : : VERTICAL
533 : : ICONIFIED
534 : : MULTILINE
535 : : MULTI_SELECTABLE
536 : : PRESSED
537 : : SELECTABLE
538 : : SELECTED
539 : : SINGLE_LINE
540 : : TRANSIENT
541 : :
542 : : */
543 : 538 : }
544 : :
545 : :
546 : : // accessibility::XAccessibleContext
547 : 2180 : sal_Int32 VCLXAccessibleComponent::getAccessibleChildCount() throw (uno::RuntimeException)
548 : : {
549 [ + - ]: 2180 : OExternalLockGuard aGuard( this );
550 : :
551 : 2180 : sal_Int32 nChildren = 0;
552 [ + - ][ + - ]: 2180 : if ( GetWindow() )
553 [ + - ][ + - ]: 2180 : nChildren = GetWindow()->GetAccessibleChildWindowCount();
554 : :
555 [ + - ]: 2180 : return nChildren;
556 : : }
557 : :
558 : 448 : uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
559 : : {
560 [ + - ]: 448 : OExternalLockGuard aGuard( this );
561 : :
562 [ + - ][ - + ]: 448 : if ( i >= getAccessibleChildCount() )
563 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
564 : :
565 : 448 : uno::Reference< accessibility::XAccessible > xAcc;
566 [ + - ][ + - ]: 448 : if ( GetWindow() )
567 : : {
568 [ + - ][ + - ]: 448 : Window* pChild = GetWindow()->GetAccessibleChildWindow( (sal_uInt16)i );
569 [ + - ]: 448 : if ( pChild )
570 [ + - ][ + - ]: 448 : xAcc = pChild->GetAccessible();
571 : : }
572 : :
573 [ + - ]: 448 : return xAcc;
574 : : }
575 : :
576 : 1128 : uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getVclParent() const
577 : : {
578 : 1128 : uno::Reference< accessibility::XAccessible > xAcc;
579 [ + - ][ + - ]: 1128 : if ( GetWindow() )
580 : : {
581 [ + - ][ + - ]: 1128 : Window* pParent = GetWindow()->GetAccessibleParentWindow();
582 [ + + ]: 1128 : if ( pParent )
583 [ + - ][ + - ]: 752 : xAcc = pParent->GetAccessible();
584 : : }
585 : 1128 : return xAcc;
586 : : }
587 : :
588 : 1128 : uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleParent( ) throw (uno::RuntimeException)
589 : : {
590 [ + - ]: 1128 : OExternalLockGuard aGuard( this );
591 : :
592 [ + - ]: 1128 : uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() );
593 [ + - ]: 1128 : if ( !xAcc.is() )
594 : : // we do _not_ have a foreign-controlled parent -> default to our VCL parent
595 [ + - ][ + - ]: 1128 : xAcc = getVclParent();
596 : :
597 [ + - ]: 1128 : return xAcc;
598 : : }
599 : :
600 : 24 : sal_Int32 VCLXAccessibleComponent::getAccessibleIndexInParent( ) throw (uno::RuntimeException)
601 : : {
602 [ + - ]: 24 : OExternalLockGuard aGuard( this );
603 : :
604 : 24 : sal_Int32 nIndex = -1;
605 : :
606 [ + - ]: 24 : uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() );
607 [ - + ]: 24 : if ( xAcc.is() )
608 : : { // we _do_ have a foreign-controlled parent -> use the base class' implementation,
609 : : // which goes the UNO way
610 [ # # ]: 0 : nIndex = AccessibleExtendedComponentHelper_BASE::getAccessibleIndexInParent( );
611 : : }
612 : : else
613 : : {
614 [ + - ][ + - ]: 24 : if ( GetWindow() )
615 : : {
616 [ + - ][ + - ]: 24 : Window* pParent = GetWindow()->GetAccessibleParentWindow();
617 [ + - ]: 24 : if ( pParent )
618 : : {
619 : : /*
620 : : for ( sal_uInt16 n = pParent->GetAccessibleChildWindowCount(); n; )
621 : : {
622 : : Window* pChild = pParent->GetAccessibleChildWindow( --n );
623 : : if ( pChild == GetWindow() )
624 : : {
625 : : nIndex = n;
626 : : break;
627 : : }
628 : : }
629 : : */
630 : : // Iterate over all the parent's children and search for this object.
631 : : // this should be compatible with the code in SVX
632 [ + - ]: 24 : uno::Reference< accessibility::XAccessible > xParentAcc( pParent->GetAccessible() );
633 [ + - ]: 24 : if ( xParentAcc.is() )
634 : : {
635 [ + - ][ + - ]: 24 : uno::Reference< accessibility::XAccessibleContext > xParentContext ( xParentAcc->getAccessibleContext() );
636 [ + - ]: 24 : if ( xParentContext.is() )
637 : : {
638 [ + - ][ + - ]: 24 : sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
639 [ + + ]: 74 : for ( sal_Int32 i=0; i<nChildCount; i++ )
640 : : {
641 [ + - ][ + - ]: 50 : uno::Reference< accessibility::XAccessible > xChild( xParentContext->getAccessibleChild(i) );
642 [ + - ]: 50 : if ( xChild.is() )
643 : : {
644 [ + - ][ + - ]: 50 : uno::Reference< accessibility::XAccessibleContext > xChildContext = xChild->getAccessibleContext();
645 [ + - ][ + + ]: 50 : if ( xChildContext == (accessibility::XAccessibleContext*) this )
646 : : {
647 : 50 : nIndex = i;
648 : : break;
649 [ + + ]: 50 : }
650 : : }
651 [ + + ]: 50 : }
652 : 24 : }
653 : 24 : }
654 : : }
655 : : }
656 : : }
657 [ + - ]: 24 : return nIndex;
658 : : }
659 : :
660 : 2936 : sal_Int16 VCLXAccessibleComponent::getAccessibleRole( ) throw (uno::RuntimeException)
661 : : {
662 [ + - ]: 2936 : OExternalLockGuard aGuard( this );
663 : :
664 : 2936 : sal_Int16 nRole = 0;
665 : :
666 [ + - ][ + - ]: 2936 : if ( GetWindow() )
667 [ + - ][ + - ]: 2936 : nRole = GetWindow()->GetAccessibleRole();
668 : :
669 [ + - ]: 2936 : return nRole;
670 : : }
671 : :
672 : 1162 : ::rtl::OUString VCLXAccessibleComponent::getAccessibleDescription( ) throw (uno::RuntimeException)
673 : : {
674 [ + - ]: 1162 : OExternalLockGuard aGuard( this );
675 : :
676 : 1162 : ::rtl::OUString aDescription;
677 : :
678 [ + - ][ + - ]: 1162 : if ( GetWindow() )
679 [ + - ][ + - ]: 1162 : aDescription = GetWindow()->GetAccessibleDescription();
[ + - ][ + - ]
680 : :
681 [ + - ]: 1162 : return aDescription;
682 : : }
683 : :
684 : 1380 : ::rtl::OUString VCLXAccessibleComponent::getAccessibleName( ) throw (uno::RuntimeException)
685 : : {
686 [ + - ]: 1380 : OExternalLockGuard aGuard( this );
687 : :
688 : 1380 : ::rtl::OUString aName;
689 [ + - ][ + - ]: 1380 : if ( GetWindow() )
690 : : {
691 [ + - ][ + - ]: 1380 : aName = GetWindow()->GetAccessibleName();
[ + - ][ + - ]
692 : : #if OSL_DEBUG_LEVEL > 1
693 : : aName += rtl::OUString(" (Type = ");
694 : : aName += rtl::OUString::valueOf(static_cast<sal_Int32>(GetWindow()->GetType()));
695 : : aName += rtl::OUString( ")");
696 : : #endif
697 : : }
698 [ + - ]: 1380 : return aName;
699 : : }
700 : :
701 : 10 : uno::Reference< accessibility::XAccessibleRelationSet > VCLXAccessibleComponent::getAccessibleRelationSet( ) throw (uno::RuntimeException)
702 : : {
703 [ + - ]: 10 : OExternalLockGuard aGuard( this );
704 : :
705 [ + - ]: 10 : utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
706 [ + - ][ + - ]: 10 : uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
707 [ + - ]: 10 : FillAccessibleRelationSet( *pRelationSetHelper );
708 [ + - ]: 10 : return xSet;
709 : : }
710 : :
711 : 538 : uno::Reference< accessibility::XAccessibleStateSet > VCLXAccessibleComponent::getAccessibleStateSet( ) throw (uno::RuntimeException)
712 : : {
713 [ + - ]: 538 : OExternalLockGuard aGuard( this );
714 : :
715 [ + - ]: 538 : utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
716 [ + - ][ + - ]: 538 : uno::Reference< accessibility::XAccessibleStateSet > xSet = pStateSetHelper;
717 [ + - ]: 538 : FillAccessibleStateSet( *pStateSetHelper );
718 [ + - ]: 538 : return xSet;
719 : : }
720 : :
721 : 23 : lang::Locale VCLXAccessibleComponent::getLocale() throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
722 : : {
723 [ + - ]: 23 : OExternalLockGuard aGuard( this );
724 : :
725 [ + - ][ + - ]: 23 : return Application::GetSettings().GetLocale();
[ + - ]
726 : : }
727 : :
728 : 8 : uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException)
729 : : {
730 [ + - ]: 8 : OExternalLockGuard aGuard( this );
731 : :
732 : 8 : uno::Reference< accessibility::XAccessible > xChild;
733 [ + + ][ + - ]: 20 : for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
734 : : {
735 [ + - ]: 12 : uno::Reference< accessibility::XAccessible > xAcc = getAccessibleChild( i );
736 [ + - ]: 12 : if ( xAcc.is() )
737 : : {
738 [ + - ][ + - ]: 12 : uno::Reference< accessibility::XAccessibleComponent > xComp( xAcc->getAccessibleContext(), uno::UNO_QUERY );
[ + - ]
739 [ + - ]: 12 : if ( xComp.is() )
740 : : {
741 [ + - ][ + - ]: 12 : Rectangle aRect = VCLRectangle( xComp->getBounds() );
[ + - ]
742 : 12 : Point aPos = VCLPoint( rPoint );
743 [ + + ][ + - ]: 12 : if ( aRect.IsInside( aPos ) )
744 : : {
745 [ + - ]: 12 : xChild = xAcc;
746 : : break;
747 : : }
748 [ + + ]: 12 : }
749 : : }
750 [ + + ]: 12 : }
751 : :
752 [ + - ]: 8 : return xChild;
753 : : }
754 : :
755 : : // accessibility::XAccessibleComponent
756 : 12979 : awt::Rectangle VCLXAccessibleComponent::implGetBounds() throw (uno::RuntimeException)
757 : : {
758 : 12979 : awt::Rectangle aBounds ( 0, 0, 0, 0 );
759 : :
760 [ + - ]: 12979 : Window* pWindow = GetWindow();
761 [ + - ]: 12979 : if ( pWindow )
762 : : {
763 [ + - ]: 12979 : Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
764 [ + - ]: 12979 : aBounds = AWTRectangle( aRect );
765 [ + - ]: 12979 : Window* pParent = pWindow->GetAccessibleParentWindow();
766 [ + - ]: 12979 : if ( pParent )
767 : : {
768 [ + - ]: 12979 : Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL );
769 : 12979 : awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
770 : 12979 : aBounds.X -= aParentScreenLoc.X;
771 : 12979 : aBounds.Y -= aParentScreenLoc.Y;
772 : : }
773 : : }
774 : :
775 [ + - ]: 12979 : uno::Reference< accessibility::XAccessible > xParent( implGetForeignControlledParent() );
776 [ - + ]: 12979 : if ( xParent.is() )
777 : : { // hmm, we can't rely on our VCL coordinates, as in the Accessibility Hierarchy, somebody gave
778 : : // us a parent which is different from our VCL parent
779 : : // (actually, we did not check if it's really different ...)
780 : :
781 : : // the screen location of the foreign parent
782 [ # # ][ # # ]: 0 : uno::Reference< accessibility::XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), uno::UNO_QUERY );
[ # # ]
783 : : DBG_ASSERT( xParentComponent.is(), "VCLXAccessibleComponent::implGetBounds: invalid (foreign) parent component!" );
784 : :
785 : 0 : awt::Point aScreenLocForeign( 0, 0 );
786 [ # # ]: 0 : if ( xParentComponent.is() )
787 [ # # ][ # # ]: 0 : aScreenLocForeign = xParentComponent->getLocationOnScreen();
788 : :
789 : : // the screen location of the VCL parent
790 [ # # ][ # # ]: 0 : xParent = getVclParent();
791 [ # # ]: 0 : if ( xParent.is() )
792 [ # # ][ # # ]: 0 : xParentComponent = xParentComponent.query( xParent->getAccessibleContext() );
[ # # ][ # # ]
793 : :
794 : 0 : awt::Point aScreenLocVCL( 0, 0 );
795 [ # # ]: 0 : if ( xParentComponent.is() )
796 [ # # ][ # # ]: 0 : aScreenLocVCL = xParentComponent->getLocationOnScreen();
797 : :
798 : : // the difference between them
799 : 0 : awt::Size aOffset( aScreenLocVCL.X - aScreenLocForeign.X, aScreenLocVCL.Y - aScreenLocForeign.Y );
800 : : // move the bounds
801 : 0 : aBounds.X += aOffset.Width;
802 : 0 : aBounds.Y += aOffset.Height;
803 : : }
804 : :
805 : 12979 : return aBounds;
806 : : }
807 : :
808 : 18 : awt::Point VCLXAccessibleComponent::getLocationOnScreen( ) throw (uno::RuntimeException)
809 : : {
810 [ + - ]: 18 : OExternalLockGuard aGuard( this );
811 : :
812 : 18 : awt::Point aPos;
813 [ + - ][ + - ]: 18 : if ( GetWindow() )
814 : : {
815 [ + - ][ + - ]: 18 : Rectangle aRect = GetWindow()->GetWindowExtentsRelative( NULL );
816 : 18 : aPos.X = aRect.Left();
817 : 18 : aPos.Y = aRect.Top();
818 : : }
819 : :
820 [ + - ]: 18 : return aPos;
821 : : }
822 : :
823 : 16 : void VCLXAccessibleComponent::grabFocus( ) throw (uno::RuntimeException)
824 : : {
825 [ + - ]: 16 : OExternalLockGuard aGuard( this );
826 : :
827 [ + - ]: 16 : uno::Reference< accessibility::XAccessibleStateSet > xStates = getAccessibleStateSet();
828 [ + - ][ + - ]: 16 : if ( mxWindow.is() && xStates.is() && xStates->contains( accessibility::AccessibleStateType::FOCUSABLE ) )
[ + - ][ + - ]
[ - + ][ - + ]
829 [ # # ][ # # ]: 16 : mxWindow->setFocus();
[ + - ]
830 : 16 : }
831 : :
832 : 12 : sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( ) throw (uno::RuntimeException)
833 : : {
834 [ + - ]: 12 : OExternalLockGuard aGuard( this );
835 : :
836 : 12 : sal_Int32 nColor = 0;
837 [ + - ]: 12 : Window* pWindow = GetWindow();
838 [ + - ]: 12 : if ( pWindow )
839 : : {
840 [ + - ][ - + ]: 12 : if ( pWindow->IsControlForeground() )
841 [ # # ]: 0 : nColor = pWindow->GetControlForeground().GetColor();
842 : : else
843 : : {
844 [ + - ]: 12 : Font aFont;
845 [ + - ][ - + ]: 12 : if ( pWindow->IsControlFont() )
846 [ # # ][ # # ]: 0 : aFont = pWindow->GetControlFont();
[ # # ]
847 : : else
848 [ + - ]: 12 : aFont = pWindow->GetFont();
849 [ + - ][ + - ]: 12 : nColor = aFont.GetColor().GetColor();
850 : : }
851 : : }
852 : :
853 [ + - ]: 12 : return nColor;
854 : : }
855 : :
856 : 12 : sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( ) throw (uno::RuntimeException)
857 : : {
858 [ + - ]: 12 : OExternalLockGuard aGuard( this );
859 : :
860 : 12 : sal_Int32 nColor = 0;
861 [ + - ]: 12 : Window* pWindow = GetWindow();
862 [ + - ]: 12 : if ( pWindow )
863 : : {
864 [ + - ][ - + ]: 12 : if ( pWindow->IsControlBackground() )
865 [ # # ]: 0 : nColor = pWindow->GetControlBackground().GetColor();
866 : : else
867 [ + - ]: 12 : nColor = pWindow->GetBackground().GetColor().GetColor();
868 : : }
869 : :
870 [ + - ]: 12 : return nColor;
871 : : }
872 : :
873 : : // XAccessibleExtendedComponent
874 : :
875 : 14 : uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) throw (uno::RuntimeException)
876 : : {
877 [ + - ]: 14 : OExternalLockGuard aGuard( this );
878 : :
879 : 14 : uno::Reference< awt::XFont > xFont;
880 [ + - ]: 14 : Window* pWindow = GetWindow();
881 [ + - ]: 14 : if ( pWindow )
882 : : {
883 [ + - ][ + - ]: 14 : uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY );
884 [ + - ]: 14 : if ( xDev.is() )
885 : : {
886 [ + - ]: 14 : Font aFont;
887 [ + - ][ - + ]: 14 : if ( pWindow->IsControlFont() )
888 [ # # ][ # # ]: 0 : aFont = pWindow->GetControlFont();
[ # # ]
889 : : else
890 [ + - ]: 14 : aFont = pWindow->GetFont();
891 [ + - ]: 14 : VCLXFont* pVCLXFont = new VCLXFont;
892 [ + - ][ + - ]: 14 : pVCLXFont->Init( *xDev.get(), aFont );
893 [ + - ][ + - ]: 14 : xFont = pVCLXFont;
894 : 14 : }
895 : : }
896 : :
897 [ + - ]: 14 : return xFont;
898 : : }
899 : :
900 : 12 : ::rtl::OUString SAL_CALL VCLXAccessibleComponent::getTitledBorderText( ) throw (uno::RuntimeException)
901 : : {
902 [ + - ]: 12 : OExternalLockGuard aGuard( this );
903 : :
904 : 12 : ::rtl::OUString sRet;
905 [ + - ][ + - ]: 12 : if ( GetWindow() )
906 [ + - ][ + - ]: 12 : sRet = GetWindow()->GetText();
[ + - ][ + - ]
907 : :
908 [ + - ]: 12 : return sRet;
909 : : }
910 : :
911 : 12 : ::rtl::OUString SAL_CALL VCLXAccessibleComponent::getToolTipText( ) throw (uno::RuntimeException)
912 : : {
913 [ + - ]: 12 : OExternalLockGuard aGuard( this );
914 : :
915 : 12 : ::rtl::OUString sRet;
916 [ + - ][ + - ]: 12 : if ( GetWindow() )
917 [ + - ][ + - ]: 12 : sRet = GetWindow()->GetQuickHelpText();
[ + - ]
918 : :
919 [ + - ]: 12 : return sRet;
920 : : }
921 : :
922 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|