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 <vcl/window.hxx>
30 : : #include <swtypes.hxx>
31 : :
32 : : #include <com/sun/star/accessibility/XAccessible.hpp>
33 : : #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
34 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
35 : : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36 : : #include <osl/mutex.hxx>
37 : : #include <vcl/svapp.hxx>
38 : : #include <unotools/accessiblestatesethelper.hxx>
39 : : #include <unotools/accessiblerelationsethelper.hxx>
40 : : #include <viewsh.hxx>
41 : : #include <crsrsh.hxx>
42 : : #include <fesh.hxx>
43 : : #include <wrtsh.hxx>
44 : : #include <txtfrm.hxx>
45 : : #include <ndtxt.hxx>
46 : : #include <pagefrm.hxx>
47 : : #include <flyfrm.hxx>
48 : : #include <dflyobj.hxx>
49 : : #include <pam.hxx>
50 : : #include <viewimp.hxx>
51 : : #include <accmap.hxx>
52 : : #include <accfrmobjslist.hxx>
53 : : #include <acccontext.hxx>
54 : : #include <svx/AccessibleShape.hxx>
55 : : #include <comphelper/accessibleeventnotifier.hxx>
56 : : #include <PostItMgr.hxx>
57 : :
58 : : using namespace sw::access;
59 : : using namespace ::com::sun::star;
60 : : using namespace ::com::sun::star::accessibility;
61 : : using ::rtl::OUString;
62 : :
63 : 79 : void SwAccessibleContext::InitStates()
64 : : {
65 [ + - ]: 79 : bIsShowingState = GetMap() ? IsShowing( *(GetMap()) ) : sal_False;
66 : :
67 : 79 : ViewShell *pVSh = GetMap()->GetShell();
68 [ + - ][ + - ]: 79 : bIsEditableState = pVSh && IsEditable( pVSh );
69 [ + - ][ + + ]: 79 : bIsOpaqueState = pVSh && IsOpaque( pVSh );
70 : 79 : bIsDefuncState = sal_False;
71 : 79 : }
72 : :
73 : 61 : void SwAccessibleContext::SetParent( SwAccessibleContext *pParent )
74 : : {
75 [ + - ]: 61 : osl::MutexGuard aGuard( aMutex );
76 : :
77 [ + - ][ + - ]: 61 : uno::Reference < XAccessible > xParent( pParent );
78 [ + - ][ + - ]: 61 : xWeakParent = xParent;
79 : 61 : }
80 : :
81 : 68 : uno::Reference< XAccessible > SwAccessibleContext::GetWeakParent() const
82 : : {
83 [ + - ]: 68 : osl::MutexGuard aGuard( aMutex );
84 : :
85 [ + - ]: 68 : uno::Reference< XAccessible > xParent( xWeakParent );
86 [ + - ]: 68 : return xParent;
87 : : }
88 : :
89 : 4837 : Window *SwAccessibleContext::GetWindow()
90 : : {
91 : 4837 : Window *pWin = 0;
92 : :
93 [ + - ]: 4837 : if( GetMap() )
94 : : {
95 : 4837 : const ViewShell *pVSh = GetMap()->GetShell();
96 : : OSL_ENSURE( pVSh, "no view shell" );
97 [ + - ]: 4837 : if( pVSh )
98 : 4837 : pWin = pVSh->GetWin();
99 : :
100 : : OSL_ENSURE( pWin, "no window" );
101 : : }
102 : :
103 : 4837 : return pWin;
104 : : }
105 : :
106 : : // get ViewShell from accessibility map, and cast to cursor shell
107 : 217 : SwCrsrShell* SwAccessibleContext::GetCrsrShell()
108 : : {
109 : : SwCrsrShell* pCrsrShell;
110 [ + - ]: 217 : ViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0;
111 : : OSL_ENSURE( pViewShell, "no view shell" );
112 [ + - ][ + - ]: 217 : if( pViewShell && pViewShell->ISA( SwCrsrShell ) )
[ + - ]
113 : 217 : pCrsrShell = static_cast<SwCrsrShell*>( pViewShell );
114 : : else
115 : 0 : pCrsrShell = NULL;
116 : :
117 : 217 : return pCrsrShell;
118 : : }
119 : :
120 : 8 : const SwCrsrShell* SwAccessibleContext::GetCrsrShell() const
121 : : {
122 : : // just like non-const GetCrsrShell
123 : : const SwCrsrShell* pCrsrShell;
124 [ + - ]: 8 : const ViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : 0;
125 : : OSL_ENSURE( pViewShell, "no view shell" );
126 [ + - ][ + - ]: 8 : if( pViewShell && pViewShell->ISA( SwCrsrShell ) )
[ + - ]
127 : 8 : pCrsrShell = static_cast<const SwCrsrShell*>( pViewShell );
128 : : else
129 : 0 : pCrsrShell = NULL;
130 : :
131 : 8 : return pCrsrShell;
132 : : }
133 : :
134 : :
135 : : enum Action { NONE, SCROLLED, SCROLLED_WITHIN,
136 : : SCROLLED_IN, SCROLLED_OUT };
137 : :
138 : 294 : void SwAccessibleContext::ChildrenScrolled( const SwFrm *pFrm,
139 : : const SwRect& rOldVisArea )
140 : : {
141 : 294 : const SwRect& rNewVisArea = GetVisArea();
142 [ + - ][ + - ]: 294 : const bool bVisibleChildrenOnly = SwAccessibleChild( pFrm ).IsVisibleChildrenOnly();
143 : :
144 : 294 : const SwAccessibleChildSList aList( *pFrm, *(GetMap()) );
145 [ + - ]: 294 : SwAccessibleChildSList::const_iterator aIter( aList.begin() );
146 [ + - ][ + - ]: 550 : while( aIter != aList.end() )
[ + + ]
147 : : {
148 : 256 : const SwAccessibleChild& rLower = *aIter;
149 [ + - ]: 256 : const SwRect aBox( rLower.GetBox( *(GetMap()) ) );
150 [ + - ][ + + ]: 256 : if( rLower.IsAccessible( GetShell()->IsPreView() ) )
151 : : {
152 : 108 : Action eAction = NONE;
153 [ + - ][ + - ]: 108 : if( aBox.IsOver( rNewVisArea ) )
154 : : {
155 [ + - ][ + - ]: 108 : if( aBox.IsOver( rOldVisArea ) )
156 : : {
157 : 108 : eAction = SCROLLED_WITHIN;
158 : : }
159 : : else
160 : : {
161 [ # # ][ # # ]: 0 : if ( bVisibleChildrenOnly &&
[ # # ]
162 [ # # ]: 0 : !rLower.AlwaysIncludeAsChild() )
163 : : {
164 : 0 : eAction = SCROLLED_IN;
165 : : }
166 : : else
167 : : {
168 : 0 : eAction = SCROLLED;
169 : : }
170 : : }
171 : : }
172 [ # # ][ # # ]: 0 : else if( aBox.IsOver( rOldVisArea ) )
173 : : {
174 [ # # ][ # # ]: 0 : if ( bVisibleChildrenOnly &&
[ # # ]
175 [ # # ]: 0 : !rLower.AlwaysIncludeAsChild() )
176 : : {
177 : 0 : eAction = SCROLLED_OUT;
178 : : }
179 : : else
180 : : {
181 : 0 : eAction = SCROLLED;
182 : : }
183 : : }
184 [ # # ][ # # ]: 0 : else if( !bVisibleChildrenOnly ||
[ # # ]
185 [ # # ]: 0 : rLower.AlwaysIncludeAsChild() )
186 : : {
187 : : // This wouldn't be required if the SwAccessibleFrame,
188 : : // wouldn't know about the vis area.
189 : 0 : eAction = SCROLLED;
190 : : }
191 [ + - ]: 108 : if( NONE != eAction )
192 : : {
193 [ + - ][ + - ]: 108 : if ( rLower.GetSwFrm() )
194 : : {
195 : : OSL_ENSURE( !rLower.AlwaysIncludeAsChild(),
196 : : "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
197 [ + - ]: 108 : const SwFrm* pLower( rLower.GetSwFrm() );
198 : : ::rtl::Reference< SwAccessibleContext > xAccImpl =
199 : : GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
200 [ + - ][ - + ]: 108 : SCROLLED_IN == eAction );
[ + - ]
201 [ + + ]: 108 : if( xAccImpl.is() )
202 : : {
203 [ - + - - : 76 : switch( eAction )
- - ]
204 : : {
205 : : case SCROLLED:
206 [ # # ]: 0 : xAccImpl->Scrolled( rOldVisArea );
207 : 0 : break;
208 : : case SCROLLED_WITHIN:
209 [ + - ]: 76 : xAccImpl->ScrolledWithin( rOldVisArea );
210 : 76 : break;
211 : : case SCROLLED_IN:
212 [ # # ]: 0 : xAccImpl->ScrolledIn();
213 : 0 : break;
214 : : case SCROLLED_OUT:
215 [ # # ]: 0 : xAccImpl->ScrolledOut( rOldVisArea );
216 : 0 : break;
217 : : case NONE:
218 : 76 : break;
219 : : }
220 : : }
221 : : else
222 : : {
223 [ + - ]: 32 : ChildrenScrolled( pLower, rOldVisArea );
224 : 108 : }
225 : : }
226 [ # # ][ # # ]: 0 : else if ( rLower.GetDrawObject() )
227 : : {
228 : : OSL_ENSURE( !rLower.AlwaysIncludeAsChild(),
229 : : "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
230 : : ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl =
231 : : GetMap()->GetContextImpl( rLower.GetDrawObject(),
232 : : this,
233 : : SCROLLED_OUT == eAction ||
234 [ # # ][ # # ]: 0 : SCROLLED_IN == eAction );
[ # # ][ # # ]
235 [ # # ]: 0 : if( xAccImpl.is() )
236 : : {
237 [ # # # # : 0 : switch( eAction )
# ]
238 : : {
239 : : case SCROLLED:
240 : : case SCROLLED_WITHIN:
241 : 0 : xAccImpl->ViewForwarderChanged(
242 : : ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
243 [ # # ]: 0 : GetMap() );
244 : 0 : break;
245 : : case SCROLLED_IN:
246 : : ScrolledInShape( rLower.GetDrawObject(),
247 [ # # ][ # # ]: 0 : xAccImpl.get() );
248 : 0 : break;
249 : : case SCROLLED_OUT:
250 : : {
251 : 0 : xAccImpl->ViewForwarderChanged(
252 : : ::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
253 [ # # ]: 0 : GetMap() );
254 : : DisposeShape( rLower.GetDrawObject(),
255 [ # # ][ # # ]: 0 : xAccImpl.get() );
256 : : }
257 : 0 : break;
258 : : case NONE:
259 : 0 : break;
260 : : }
261 : 0 : }
262 : : }
263 [ # # ]: 0 : else if ( rLower.GetWindow() )
264 : : {
265 : : // nothing to do - as such children are always included as children.
266 : : OSL_ENSURE( rLower.AlwaysIncludeAsChild(),
267 : : "<SwAccessibleContext::ChildrenScrolled(..)> - not always included child not considered!" );
268 : : }
269 : : }
270 : : }
271 [ + - ][ + - ]: 292 : else if ( rLower.GetSwFrm() &&
[ + + ][ - + ]
[ # # ][ + - ]
272 : 148 : ( !bVisibleChildrenOnly ||
273 [ + - ]: 144 : aBox.IsOver( rOldVisArea ) ||
274 [ # # ]: 0 : aBox.IsOver( rNewVisArea ) ) )
275 : : {
276 : : // There are no unaccessible SdrObjects that need to be notified
277 [ + - ][ + - ]: 148 : ChildrenScrolled( rLower.GetSwFrm(), rOldVisArea );
278 : : }
279 [ + - ]: 256 : ++aIter;
280 : : }
281 : 294 : }
282 : :
283 : 38 : void SwAccessibleContext::Scrolled( const SwRect& rOldVisArea )
284 : : {
285 : 38 : SetVisArea( GetMap()->GetVisArea() );
286 : :
287 : 38 : ChildrenScrolled( GetFrm(), rOldVisArea );
288 : :
289 : : sal_Bool bIsOldShowingState;
290 : 38 : sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
291 : : {
292 [ + - ]: 38 : osl::MutexGuard aGuard( aMutex );
293 : 38 : bIsOldShowingState = bIsShowingState;
294 [ + - ]: 38 : bIsShowingState = bIsNewShowingState;
295 : : }
296 : :
297 [ - + ]: 38 : if( bIsOldShowingState != bIsNewShowingState )
298 : : FireStateChangedEvent( AccessibleStateType::SHOWING,
299 : 0 : bIsNewShowingState );
300 : 38 : }
301 : :
302 : 76 : void SwAccessibleContext::ScrolledWithin( const SwRect& rOldVisArea )
303 : : {
304 : 76 : SetVisArea( GetMap()->GetVisArea() );
305 : :
306 : 76 : ChildrenScrolled( GetFrm(), rOldVisArea );
307 : :
308 : 76 : FireVisibleDataEvent();
309 : 76 : }
310 : :
311 : 1 : void SwAccessibleContext::ScrolledIn()
312 : : {
313 : : // This accessible should be freshly created, because it
314 : : // was not visisble before. Therefor, its vis area must already
315 : : // reflect the scrolling.
316 : : OSL_ENSURE( GetVisArea() == GetMap()->GetVisArea(),
317 : : "Vis area of child is wrong. Did it exist already?" );
318 : :
319 : : // Send child event at parent. That's all we have to do here.
320 [ + - ]: 1 : const SwFrm* pParent = GetParent();
321 : : ::rtl::Reference< SwAccessibleContext > xParentImpl(
322 [ + - ]: 1 : GetMap()->GetContextImpl( pParent, sal_False ) );
323 [ + - ]: 1 : uno::Reference < XAccessibleContext > xThis( this );
324 [ + - ]: 1 : if( xParentImpl.is() )
325 : : {
326 [ + - ]: 1 : SetParent( xParentImpl.get() );
327 : :
328 [ + - ]: 1 : AccessibleEventObject aEvent;
329 : 1 : aEvent.EventId = AccessibleEventId::CHILD;
330 [ + - ]: 1 : aEvent.NewValue <<= xThis;
331 : :
332 [ + - ]: 1 : xParentImpl->FireAccessibleEvent( aEvent );
333 : :
334 [ + - ][ + - ]: 1 : if( HasCursor() )
335 : : {
336 : 1 : Window *pWin = GetWindow();
337 [ + - ][ + - ]: 1 : if( pWin && pWin->HasFocus() )
[ + - ][ + - ]
338 : : {
339 [ + - ]: 1 : FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_True );
340 : : }
341 [ + - ]: 1 : }
342 : :
343 : 1 : }
344 : 1 : }
345 : :
346 : 0 : void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
347 : : {
348 : 0 : SetVisArea( GetMap()->GetVisArea() );
349 : :
350 : : // First of all, update the children. That's required to dispose
351 : : // all children that are existing only if they are visible. They
352 : : // are not disposed by the recusive Dispose call that follows later on,
353 : : // because this call will only dispose children that are in the
354 : : // new vis area. The children we want to dispode however are in the
355 : : // old vis area all.
356 : 0 : ChildrenScrolled( GetFrm(), rOldVisArea );
357 : :
358 : : // Broadcast a state changed event for the showing state.
359 : : // It might be that the child is freshly created just to send
360 : : // the child event. In this case no listener will exist.
361 : 0 : FireStateChangedEvent( AccessibleStateType::SHOWING, sal_False );
362 : :
363 : : // We now dispose the frame
364 : 0 : Dispose( sal_True );
365 : 0 : }
366 : :
367 : : // #i27301# - use new type definition for <_nStates>
368 : 0 : void SwAccessibleContext::InvalidateChildrenStates( const SwFrm* _pFrm,
369 : : tAccessibleStates _nStates )
370 : : {
371 [ # # ]: 0 : const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrm, *(GetMap()) );
372 : :
373 [ # # ]: 0 : SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
374 [ # # ][ # # ]: 0 : while( aIter != aVisList.end() )
[ # # ]
375 : : {
376 : 0 : const SwAccessibleChild& rLower = *aIter;
377 [ # # ]: 0 : const SwFrm* pLower = rLower.GetSwFrm();
378 [ # # ]: 0 : if( pLower )
379 : : {
380 : 0 : ::rtl::Reference< SwAccessibleContext > xAccImpl;
381 [ # # ][ # # ]: 0 : if( rLower.IsAccessible( GetShell()->IsPreView() ) )
382 [ # # ][ # # ]: 0 : xAccImpl = GetMap()->GetContextImpl( pLower, sal_False );
383 [ # # ]: 0 : if( xAccImpl.is() )
384 [ # # ]: 0 : xAccImpl->InvalidateStates( _nStates );
385 : : else
386 [ # # ]: 0 : InvalidateChildrenStates( pLower, _nStates );
387 : : }
388 [ # # ][ # # ]: 0 : else if ( rLower.GetDrawObject() )
389 : : {
390 : : // TODO: SdrObjects
391 : : }
392 [ # # ]: 0 : else if ( rLower.GetWindow() )
393 : : {
394 : : // nothing to do ?
395 : : }
396 : :
397 [ # # ]: 0 : ++aIter;
398 : : }
399 : 0 : }
400 : :
401 : 174 : void SwAccessibleContext::DisposeChildren( const SwFrm *pFrm,
402 : : sal_Bool bRecursive )
403 : : {
404 [ + - ]: 174 : const SwAccessibleChildSList aVisList( GetVisArea(), *pFrm, *(GetMap()) );
405 [ + - ]: 174 : SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
406 [ + - ][ + - ]: 324 : while( aIter != aVisList.end() )
[ + + ]
407 : : {
408 : 150 : const SwAccessibleChild& rLower = *aIter;
409 [ + - ]: 150 : const SwFrm* pLower = rLower.GetSwFrm();
410 [ + - ]: 150 : if( pLower )
411 : : {
412 : 150 : ::rtl::Reference< SwAccessibleContext > xAccImpl;
413 [ + + ][ + - ]: 150 : if( rLower.IsAccessible( GetShell()->IsPreView() ) )
414 [ + - ][ + - ]: 86 : xAccImpl = GetMap()->GetContextImpl( pLower, sal_False );
415 [ + + ]: 150 : if( xAccImpl.is() )
416 [ + - ]: 44 : xAccImpl->Dispose( bRecursive );
417 [ + - ]: 106 : else if( bRecursive )
418 [ + - ]: 150 : DisposeChildren( pLower, bRecursive );
419 : : }
420 [ # # ][ # # ]: 0 : else if ( rLower.GetDrawObject() )
421 : : {
422 : : ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl(
423 : : GetMap()->GetContextImpl( rLower.GetDrawObject(),
424 [ # # ][ # # ]: 0 : this, sal_False ) );
425 [ # # ]: 0 : if( xAccImpl.is() )
426 [ # # ][ # # ]: 0 : DisposeShape( rLower.GetDrawObject(), xAccImpl.get() );
427 : : }
428 [ # # ][ # # ]: 0 : else if ( rLower.GetWindow() )
429 : : {
430 [ # # ]: 0 : DisposeChild( rLower, sal_False );
431 : : }
432 [ + - ]: 150 : ++aIter;
433 : : }
434 : 174 : }
435 : :
436 : 28 : void SwAccessibleContext::_InvalidateContent( sal_Bool )
437 : : {
438 : 28 : }
439 : :
440 : 0 : void SwAccessibleContext::_InvalidateCursorPos()
441 : : {
442 : 0 : }
443 : :
444 : 0 : void SwAccessibleContext::_InvalidateFocus()
445 : : {
446 : 0 : }
447 : :
448 : 238 : void SwAccessibleContext::FireAccessibleEvent( AccessibleEventObject& rEvent )
449 : : {
450 : : OSL_ENSURE( GetFrm(), "fire event for diposed frame?" );
451 [ - + ]: 238 : if( !GetFrm() )
452 : 238 : return;
453 : :
454 [ + - ]: 238 : if( !rEvent.Source.is() )
455 : : {
456 [ + - ]: 238 : uno::Reference < XAccessibleContext > xThis( this );
457 [ + - ]: 238 : rEvent.Source = xThis;
458 : : }
459 : :
460 [ + + ]: 238 : if (nClientId)
461 : 40 : comphelper::AccessibleEventNotifier::addEvent( nClientId, rEvent );
462 : : }
463 : :
464 : 132 : void SwAccessibleContext::FireVisibleDataEvent()
465 : : {
466 [ + - ]: 132 : AccessibleEventObject aEvent;
467 : 132 : aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
468 : :
469 [ + - ][ + - ]: 132 : FireAccessibleEvent( aEvent );
470 : 132 : }
471 : :
472 : 35 : void SwAccessibleContext::FireStateChangedEvent( sal_Int16 nState,
473 : : sal_Bool bNewState )
474 : : {
475 [ + - ]: 35 : AccessibleEventObject aEvent;
476 : :
477 : 35 : aEvent.EventId = AccessibleEventId::STATE_CHANGED;
478 [ + + ]: 35 : if( bNewState )
479 [ + - ]: 11 : aEvent.NewValue <<= nState;
480 : : else
481 [ + - ]: 24 : aEvent.OldValue <<= nState;
482 : :
483 [ + - ][ + - ]: 35 : FireAccessibleEvent( aEvent );
484 : 35 : }
485 : :
486 : 68 : void SwAccessibleContext::GetStates(
487 : : ::utl::AccessibleStateSetHelper& rStateSet )
488 : : {
489 [ + - ]: 68 : SolarMutexGuard aGuard;
490 : :
491 : : // SHOWING
492 [ + - ]: 68 : if( bIsShowingState )
493 [ + - ]: 68 : rStateSet.AddState( AccessibleStateType::SHOWING );
494 : :
495 : : // EDITABLE
496 [ + - ]: 68 : if( bIsEditableState )
497 [ + - ]: 68 : rStateSet.AddState( AccessibleStateType::EDITABLE );
498 : :
499 : : // ENABLED
500 [ + - ]: 68 : rStateSet.AddState( AccessibleStateType::ENABLED );
501 : :
502 : : // OPAQUE
503 [ + + ]: 68 : if( bIsOpaqueState )
504 [ + - ]: 24 : rStateSet.AddState( AccessibleStateType::OPAQUE );
505 : :
506 : : // VISIBLE
507 [ + - ]: 68 : rStateSet.AddState( AccessibleStateType::VISIBLE );
508 : :
509 [ - + ]: 68 : if( bIsDefuncState )
510 [ # # ][ + - ]: 68 : rStateSet.AddState( AccessibleStateType::DEFUNC );
511 : 68 : }
512 : :
513 : 0 : sal_Bool SwAccessibleContext::IsEditableState()
514 : : {
515 : : sal_Bool bRet;
516 : : {
517 [ # # ]: 0 : osl::MutexGuard aGuard( aMutex );
518 [ # # ]: 0 : bRet = bIsEditableState;
519 : : }
520 : :
521 : 0 : return bRet;
522 : : }
523 : :
524 : 79 : SwAccessibleContext::SwAccessibleContext( SwAccessibleMap *pM,
525 : : sal_Int16 nR,
526 : : const SwFrm *pF )
527 [ + - ]: 79 : : SwAccessibleFrame( pM->GetVisArea().SVRect(), pF,
528 : 79 : pM->GetShell()->IsPreView() )
529 : : , pMap( pM )
530 : : , nClientId(0)
531 : : , nRole( nR )
532 : : , bDisposing( sal_False )
533 [ + - ][ + - ]: 158 : , bRegisteredAtAccessibleMap( true )
[ + - ][ + - ]
[ + - ][ + - ]
534 : : {
535 [ + - ]: 79 : InitStates();
536 : 79 : }
537 : :
538 [ + - ][ + - ]: 79 : SwAccessibleContext::~SwAccessibleContext()
[ + - ][ + - ]
539 : : {
540 [ + - ]: 79 : SolarMutexGuard aGuard;
541 [ + - ][ + - ]: 79 : RemoveFrmFromAccessibleMap();
542 [ - + ]: 79 : }
543 : :
544 : : uno::Reference< XAccessibleContext > SAL_CALL
545 : 170 : SwAccessibleContext::getAccessibleContext( void )
546 : : throw (uno::RuntimeException)
547 : : {
548 : 170 : uno::Reference < XAccessibleContext > xRet( this );
549 : 170 : return xRet;
550 : : }
551 : :
552 : 186 : sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleChildCount( void )
553 : : throw (uno::RuntimeException)
554 : : {
555 [ + - ]: 186 : SolarMutexGuard aGuard;
556 : :
557 [ + - ][ - + ]: 186 : CHECK_FOR_DEFUNC( XAccessibleContext )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
558 : :
559 [ + - ][ + - ]: 186 : return bDisposing ? 0 : GetChildCount( *(GetMap()) );
[ + - ]
560 : : }
561 : :
562 : : uno::Reference< XAccessible> SAL_CALL
563 : 60 : SwAccessibleContext::getAccessibleChild( sal_Int32 nIndex )
564 : : throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
565 : : {
566 [ + - ]: 60 : SolarMutexGuard aGuard;
567 : :
568 [ + - ][ - + ]: 60 : CHECK_FOR_DEFUNC( XAccessibleContext )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
569 : :
570 [ + - ]: 60 : const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
571 [ + - ][ - + ]: 60 : if( !aChild.IsValid() )
572 : : {
573 [ # # ]: 0 : uno::Reference < XAccessibleContext > xThis( this );
574 : : lang::IndexOutOfBoundsException aExcept(
575 : : OUString( RTL_CONSTASCII_USTRINGPARAM("index out of bounds") ),
576 [ # # ][ # # ]: 0 : xThis );
577 [ # # ]: 0 : throw aExcept;
578 : : }
579 : :
580 : 60 : uno::Reference< XAccessible > xChild;
581 [ + - ][ + - ]: 60 : if( aChild.GetSwFrm() )
582 : : {
583 : : ::rtl::Reference < SwAccessibleContext > xChildImpl(
584 [ + - ][ + - ]: 60 : GetMap()->GetContextImpl( aChild.GetSwFrm(), !bDisposing ) );
585 [ + - ]: 60 : if( xChildImpl.is() )
586 : : {
587 [ + - ]: 60 : xChildImpl->SetParent( this );
588 [ + - ][ + - ]: 60 : xChild = xChildImpl.get();
589 : 60 : }
590 : : }
591 [ # # ][ # # ]: 0 : else if ( aChild.GetDrawObject() )
592 : : {
593 : : ::rtl::Reference < ::accessibility::AccessibleShape > xChildImpl(
594 : : GetMap()->GetContextImpl( aChild.GetDrawObject(),
595 [ # # ][ # # ]: 0 : this, !bDisposing ) );
596 [ # # ]: 0 : if( xChildImpl.is() )
597 [ # # ][ # # ]: 0 : xChild = xChildImpl.get();
598 : : }
599 [ # # ][ # # ]: 0 : else if ( aChild.GetWindow() )
600 : : {
601 [ # # ][ # # ]: 0 : xChild = aChild.GetWindow()->GetAccessible();
[ # # ]
602 : : }
603 : :
604 [ + - ]: 60 : return xChild;
605 : : }
606 : :
607 : 68 : uno::Reference< XAccessible> SAL_CALL SwAccessibleContext::getAccessibleParent (void)
608 : : throw (uno::RuntimeException)
609 : : {
610 [ + - ]: 68 : SolarMutexGuard aGuard;
611 : :
612 [ + - ][ - + ]: 68 : CHECK_FOR_DEFUNC( XAccessibleContext )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
613 : :
614 [ + - ]: 68 : const SwFrm *pUpper = GetParent();
615 : : OSL_ENSURE( pUpper != 0 || bDisposing, "no upper found" );
616 : :
617 : 68 : uno::Reference< XAccessible > xAcc;
618 [ + - ]: 68 : if( pUpper )
619 [ + - ][ + - ]: 68 : xAcc = GetMap()->GetContext( pUpper, !bDisposing );
620 : :
621 : : OSL_ENSURE( xAcc.is() || bDisposing, "no parent found" );
622 : :
623 : : // Remember the parent as weak ref.
624 : : {
625 [ + - ]: 68 : osl::MutexGuard aWeakParentGuard( aMutex );
626 [ + - ][ + - ]: 68 : xWeakParent = xAcc;
627 : : }
628 : :
629 [ + - ]: 68 : return xAcc;
630 : : }
631 : :
632 : 14 : sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleIndexInParent (void)
633 : : throw (uno::RuntimeException)
634 : : {
635 [ + - ]: 14 : SolarMutexGuard aGuard;
636 : :
637 [ + - ][ - + ]: 14 : CHECK_FOR_DEFUNC( XAccessibleContext )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
638 : :
639 [ + - ]: 14 : const SwFrm *pUpper = GetParent();
640 : : OSL_ENSURE( pUpper != 0 || bDisposing, "no upper found" );
641 : :
642 : 14 : sal_Int32 nIndex = -1;
643 [ + - ]: 14 : if( pUpper )
644 : : {
645 : : ::rtl::Reference < SwAccessibleContext > xAccImpl(
646 [ + - ]: 14 : GetMap()->GetContextImpl( pUpper, !bDisposing ) );
647 : : OSL_ENSURE( xAccImpl.is() || bDisposing, "no parent found" );
648 [ + - ]: 14 : if( xAccImpl.is() )
649 [ + - ][ + - ]: 14 : nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrm()) );
650 : : }
651 : :
652 [ + - ]: 14 : return nIndex;
653 : : }
654 : :
655 : 142 : sal_Int16 SAL_CALL SwAccessibleContext::getAccessibleRole (void)
656 : : throw (uno::RuntimeException)
657 : : {
658 : 142 : return nRole;
659 : : }
660 : :
661 : 0 : OUString SAL_CALL SwAccessibleContext::getAccessibleDescription (void)
662 : : throw (uno::RuntimeException)
663 : : {
664 : : OSL_ENSURE( !this, "description needs to be overloaded" );
665 [ # # ][ # # ]: 0 : THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (method must be overloaded)" );
[ # # ][ # # ]
666 : : }
667 : :
668 : 94 : OUString SAL_CALL SwAccessibleContext::getAccessibleName (void)
669 : : throw (uno::RuntimeException)
670 : : {
671 : 94 : return sName;
672 : : }
673 : :
674 : : uno::Reference< XAccessibleRelationSet> SAL_CALL
675 : 4 : SwAccessibleContext::getAccessibleRelationSet (void)
676 : : throw (uno::RuntimeException)
677 : : {
678 : : // by default there are no relations
679 [ + - ][ + - ]: 4 : uno::Reference< XAccessibleRelationSet> xRet( new utl::AccessibleRelationSetHelper() );
[ + - ]
680 : 4 : return xRet;
681 : : }
682 : :
683 : : uno::Reference<XAccessibleStateSet> SAL_CALL
684 : 68 : SwAccessibleContext::getAccessibleStateSet (void)
685 : : throw (uno::RuntimeException)
686 : : {
687 [ + - ]: 68 : SolarMutexGuard aGuard;
688 : :
689 [ + - ][ - + ]: 68 : CHECK_FOR_DEFUNC( XAccessibleContext )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
690 : :
691 : : ::utl::AccessibleStateSetHelper *pStateSet =
692 [ + - ]: 68 : new ::utl::AccessibleStateSetHelper;
693 : :
694 [ + - ][ + - ]: 68 : uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
695 [ + - ]: 68 : GetStates( *pStateSet );
696 : :
697 [ + - ]: 68 : return xStateSet;
698 : : }
699 : :
700 : 4 : lang::Locale SAL_CALL SwAccessibleContext::getLocale (void)
701 : : throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
702 : : {
703 [ + - ]: 4 : SolarMutexGuard aGuard;
704 : :
705 [ + - ][ + - ]: 4 : lang::Locale aLoc( Application::GetSettings().GetLocale() );
706 [ + - ]: 4 : return aLoc;
707 : : }
708 : :
709 : 6 : void SAL_CALL SwAccessibleContext::addEventListener(
710 : : const uno::Reference< XAccessibleEventListener >& xListener )
711 : : throw (uno::RuntimeException)
712 : : {
713 [ + - ]: 6 : if (xListener.is())
714 : : {
715 [ + - ]: 6 : SolarMutexGuard aGuard;
716 [ + - ]: 6 : if (!nClientId)
717 [ + - ]: 6 : nClientId = comphelper::AccessibleEventNotifier::registerClient( );
718 [ + - ][ + - ]: 6 : comphelper::AccessibleEventNotifier::addEventListener( nClientId, xListener );
719 : : }
720 : 6 : }
721 : :
722 : 6 : void SAL_CALL SwAccessibleContext::removeEventListener(
723 : : const uno::Reference< XAccessibleEventListener >& xListener )
724 : : throw (uno::RuntimeException)
725 : : {
726 [ + - ]: 6 : if (xListener.is())
727 : : {
728 [ + - ]: 6 : SolarMutexGuard aGuard;
729 [ + - ]: 6 : sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( nClientId, xListener );
730 [ + - ]: 6 : if ( !nListenerCount )
731 : : {
732 : : // no listeners anymore
733 : : // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
734 : : // and at least to us not firing any events anymore, in case somebody calls
735 : : // NotifyAccessibleEvent, again
736 [ + - ]: 6 : comphelper::AccessibleEventNotifier::revokeClient( nClientId );
737 : 6 : nClientId = 0;
738 [ + - ]: 6 : }
739 : : }
740 : 6 : }
741 : :
742 : 4644 : static sal_Bool lcl_PointInRectangle(const awt::Point & aPoint,
743 : : const awt::Rectangle & aRect)
744 : : {
745 : 4644 : long nDiffX = aPoint.X - aRect.X;
746 : 4644 : long nDiffY = aPoint.Y - aRect.Y;
747 : :
748 : : return
749 : : nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
750 [ + + ][ + + ]: 4644 : nDiffY < aRect.Height;
[ + + ][ + + ]
751 : :
752 : : }
753 : :
754 : 4644 : sal_Bool SAL_CALL SwAccessibleContext::containsPoint(
755 : : const awt::Point& aPoint )
756 : : throw (uno::RuntimeException)
757 : : {
758 [ + - ]: 4644 : awt::Rectangle aPixBounds = getBoundsImpl(sal_True);
759 : 4644 : aPixBounds.X = 0;
760 : 4644 : aPixBounds.Y = 0;
761 : :
762 : 4644 : return lcl_PointInRectangle(aPoint, aPixBounds);
763 : : }
764 : :
765 : 8 : uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint(
766 : : const awt::Point& aPoint )
767 : : throw (uno::RuntimeException)
768 : : {
769 [ + - ]: 8 : SolarMutexGuard aGuard;
770 : :
771 [ + - ][ - + ]: 8 : CHECK_FOR_DEFUNC( XAccessibleComponent )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
772 : :
773 : 8 : uno::Reference< XAccessible > xAcc;
774 : :
775 : 8 : Window *pWin = GetWindow();
776 [ # # ][ # # ]: 8 : CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
[ # # ][ # # ]
[ - + ]
777 : :
778 : 8 : Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
779 [ + - ]: 8 : if( !GetFrm()->IsRootFrm() )
780 : : {
781 [ + - ]: 8 : SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
782 [ + - ][ + - ]: 8 : Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
783 : 8 : aPixPoint.X() += aPixPos.X();
784 : 8 : aPixPoint.Y() += aPixPos.Y();
785 : : }
786 : :
787 [ + - ]: 8 : const SwAccessibleChild aChild( GetChildAtPixel( aPixPoint, *(GetMap()) ) );
788 [ + - ][ + + ]: 8 : if( aChild.GetSwFrm() )
789 : : {
790 [ + - ][ + - ]: 4 : xAcc = GetMap()->GetContext( aChild.GetSwFrm() );
[ + - ]
791 : : }
792 [ + - ][ - + ]: 4 : else if( aChild.GetDrawObject() )
793 : : {
794 [ # # ][ # # ]: 0 : xAcc = GetMap()->GetContext( aChild.GetDrawObject(), this );
[ # # ]
795 : : }
796 [ + - ][ - + ]: 4 : else if ( aChild.GetWindow() )
797 : : {
798 [ # # ][ # # ]: 0 : xAcc = aChild.GetWindow()->GetAccessible();
[ # # ]
799 : : }
800 : :
801 [ + - ]: 8 : return xAcc;
802 : : }
803 : :
804 : :
805 : : /**
806 : : Get bounding box.
807 : :
808 : : There are two modes.
809 : :
810 : : - realative
811 : :
812 : : Return bounding box relative to parent if parent is no root
813 : : frame. Otherwise return the absolute bounding box.
814 : :
815 : : - absolute
816 : :
817 : : Return the absolute bounding box.
818 : :
819 : : @param bRelative
820 : : true: Use relative mode.
821 : : false: Use absolute mode.
822 : : */
823 : 4674 : awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(sal_Bool bRelative)
824 : : throw (uno::RuntimeException)
825 : : {
826 [ + - ]: 4674 : SolarMutexGuard aGuard;
827 : :
828 [ + - ][ - + ]: 4674 : CHECK_FOR_DEFUNC( XAccessibleComponent )
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
829 : :
830 [ + - ]: 4674 : const SwFrm *pParent = GetParent();
831 : : OSL_ENSURE( pParent, "no Parent found" );
832 : 4674 : Window *pWin = GetWindow();
833 : :
834 [ - + ][ # # ]: 4674 : CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent )
[ # # ][ # # ]
[ # # ][ + - ]
835 : :
836 [ + - ]: 4674 : SwRect aLogBounds( GetBounds( *(GetMap()), GetFrm() ) ); // twip rel to doc root
837 [ + - ]: 4674 : Rectangle aPixBounds( 0, 0, 0, 0 );
838 [ - + # # ]: 4674 : if( GetFrm()->IsPageFrm() &&
[ - + ]
839 : 0 : static_cast < const SwPageFrm * >( GetFrm() )->IsEmptyPage() )
840 : : {
841 : : OSL_ENSURE( GetShell()->IsPreView(), "empty page accessible?" );
842 [ # # ]: 0 : if( GetShell()->IsPreView() )
843 : : {
844 : : // adjust method call <GetMap()->GetPreViewPageSize()>
845 : : sal_uInt16 nPageNum =
846 : 0 : static_cast < const SwPageFrm * >( GetFrm() )->GetPhyPageNum();
847 [ # # ]: 0 : aLogBounds.SSize( GetMap()->GetPreViewPageSize( nPageNum ) );
848 : : }
849 : : }
850 [ + - ]: 4674 : if( !aLogBounds.IsEmpty() )
851 : : {
852 [ + - ][ + - ]: 4674 : aPixBounds = GetMap()->CoreToPixel( aLogBounds.SVRect() );
853 [ + + ][ + + ]: 4674 : if( !pParent->IsRootFrm() && bRelative)
[ + + ]
854 : : {
855 [ + - ]: 1248 : SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
856 [ + - ][ + - ]: 1248 : Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds.SVRect() ).TopLeft() );
857 [ + - ]: 1248 : aPixBounds.Move( -aParentPixPos.X(), -aParentPixPos.Y() );
858 : : }
859 : : }
860 : :
861 : 4674 : awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
862 [ + - ][ + - ]: 9348 : aPixBounds.GetWidth(), aPixBounds.GetHeight() );
863 : :
864 [ + - ]: 4674 : return aBox;
865 : : }
866 : :
867 : :
868 : 10 : awt::Rectangle SAL_CALL SwAccessibleContext::getBounds()
869 : : throw (uno::RuntimeException)
870 : : {
871 : 10 : return getBoundsImpl(sal_True);
872 : : }
873 : :
874 : 6 : awt::Point SAL_CALL SwAccessibleContext::getLocation()
875 : : throw (uno::RuntimeException)
876 : : {
877 [ + - ]: 6 : awt::Rectangle aRect = getBoundsImpl(sal_True);
878 : 6 : awt::Point aPoint(aRect.X, aRect.Y);
879 : :
880 : 6 : return aPoint;
881 : : }
882 : :
883 : :
884 : :
885 : 8 : awt::Point SAL_CALL SwAccessibleContext::getLocationOnScreen()
886 : : throw (uno::RuntimeException)
887 : : {
888 [ + - ]: 8 : awt::Rectangle aRect = getBoundsImpl(sal_False);
889 : :
890 : 8 : Point aPixPos(aRect.X, aRect.Y);
891 : :
892 : : /* getBoundsImpl already checked that GetWindow returns valid pointer. */
893 [ + - ]: 8 : aPixPos = GetWindow()->OutputToAbsoluteScreenPixel(aPixPos);
894 : 8 : awt::Point aPoint(aPixPos.X(), aPixPos.Y());
895 : :
896 : 8 : return aPoint;
897 : : }
898 : :
899 : :
900 : 6 : awt::Size SAL_CALL SwAccessibleContext::getSize()
901 : : throw (uno::RuntimeException)
902 : : {
903 [ + - ]: 6 : awt::Rectangle aRect = getBoundsImpl(sal_False);
904 : 6 : awt::Size aSize( aRect.Width, aRect.Height );
905 : :
906 : 6 : return aSize;
907 : : }
908 : :
909 : 4 : void SAL_CALL SwAccessibleContext::grabFocus()
910 : : throw (uno::RuntimeException)
911 : : {
912 [ + - ]: 4 : SolarMutexGuard aGuard;
913 : :
914 [ + - ][ - + ]: 4 : CHECK_FOR_DEFUNC( XAccessibleContext );
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
915 : :
916 [ - + ]: 4 : if( GetFrm()->IsFlyFrm() )
917 : : {
918 : : const SdrObject *pObj =
919 [ # # ]: 0 : static_cast < const SwFlyFrm * >( GetFrm() )->GetVirtDrawObj();
920 [ # # ]: 0 : if( pObj )
921 [ # # ]: 0 : Select( const_cast < SdrObject * >( pObj ), sal_False );
922 : : }
923 : : else
924 : : {
925 : 4 : const SwCntntFrm *pCFrm = 0;
926 [ - + ]: 4 : if( GetFrm()->IsCntntFrm() )
927 : 0 : pCFrm = static_cast< const SwCntntFrm * >( GetFrm() );
928 [ + - ]: 4 : else if( GetFrm()->IsLayoutFrm() )
929 [ + - ]: 4 : pCFrm = static_cast< const SwLayoutFrm * >( GetFrm() )->ContainsCntnt();
930 : :
931 [ + - ][ + - ]: 4 : if( pCFrm && pCFrm->IsTxtFrm() )
[ + - ]
932 : : {
933 : 4 : const SwTxtFrm *pTxtFrm = static_cast< const SwTxtFrm * >( pCFrm );
934 : 4 : const SwTxtNode *pTxtNd = pTxtFrm->GetTxtNode();
935 [ + - ]: 4 : if( pTxtNd )
936 : : {
937 : : // create pam for selection
938 : : SwIndex aIndex( const_cast< SwTxtNode * >( pTxtNd ),
939 [ + - ][ + - ]: 4 : pTxtFrm->GetOfst() );
940 [ + - ][ + - ]: 4 : SwPosition aStartPos( *pTxtNd, aIndex );
[ + - ]
941 [ + - ]: 4 : SwPaM aPaM( aStartPos );
942 : :
943 : : // set PaM at cursor shell
944 [ + - ][ + - ]: 4 : Select( aPaM );
[ + - ][ + - ]
945 : : }
946 : : }
947 [ + - ]: 4 : }
948 : 4 : }
949 : :
950 : :
951 : 0 : uno::Any SAL_CALL SwAccessibleContext::getAccessibleKeyBinding()
952 : : throw (uno::RuntimeException)
953 : : {
954 : : // There are no key bindings
955 : 0 : return uno::Any();
956 : : }
957 : :
958 : 4 : sal_Int32 SAL_CALL SwAccessibleContext::getForeground()
959 : : throw (uno::RuntimeException)
960 : : {
961 : 4 : return 0;
962 : : }
963 : :
964 : 4 : sal_Int32 SAL_CALL SwAccessibleContext::getBackground()
965 : : throw (uno::RuntimeException)
966 : : {
967 : 4 : return 0xffffff;
968 : : }
969 : :
970 : :
971 : 0 : OUString SAL_CALL SwAccessibleContext::getImplementationName()
972 : : throw( uno::RuntimeException )
973 : : {
974 : : OSL_ENSURE( !this, "implementation name needs to be overloaded" );
975 : :
976 [ # # ][ # # ]: 0 : THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "implementation name needs to be overloaded" )
[ # # ][ # # ]
977 : : }
978 : :
979 : : sal_Bool SAL_CALL
980 : 0 : SwAccessibleContext::supportsService (const ::rtl::OUString& )
981 : : throw (uno::RuntimeException)
982 : : {
983 : : OSL_ENSURE( !this, "supports service needs to be overloaded" );
984 [ # # ][ # # ]: 0 : THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supports service needs to be overloaded" )
[ # # ][ # # ]
985 : : }
986 : :
987 : 0 : uno::Sequence< OUString > SAL_CALL SwAccessibleContext::getSupportedServiceNames()
988 : : throw( uno::RuntimeException )
989 : : {
990 : : OSL_ENSURE( !this, "supported services names needs to be overloaded" );
991 [ # # ][ # # ]: 0 : THROW_RUNTIME_EXCEPTION( lang::XServiceInfo, "supported services needs to be overloaded" )
[ # # ][ # # ]
992 : : }
993 : :
994 : 0 : void SwAccessibleContext::DisposeShape( const SdrObject *pObj,
995 : : ::accessibility::AccessibleShape *pAccImpl )
996 : : {
997 : 0 : ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl( pAccImpl );
998 [ # # ]: 0 : if( !xAccImpl.is() )
999 [ # # ][ # # ]: 0 : xAccImpl = GetMap()->GetContextImpl( pObj, this, sal_True );
1000 : :
1001 [ # # ]: 0 : AccessibleEventObject aEvent;
1002 : 0 : aEvent.EventId = AccessibleEventId::CHILD;
1003 [ # # ][ # # ]: 0 : uno::Reference< XAccessible > xAcc( xAccImpl.get() );
1004 [ # # ]: 0 : aEvent.OldValue <<= xAcc;
1005 [ # # ]: 0 : FireAccessibleEvent( aEvent );
1006 : :
1007 [ # # ]: 0 : GetMap()->RemoveContext( pObj );
1008 [ # # ][ # # ]: 0 : xAccImpl->dispose();
1009 : 0 : }
1010 : :
1011 : 0 : void SwAccessibleContext::ScrolledInShape( const SdrObject* ,
1012 : : ::accessibility::AccessibleShape *pAccImpl )
1013 : : {
1014 [ # # ]: 0 : AccessibleEventObject aEvent;
1015 : 0 : aEvent.EventId = AccessibleEventId::CHILD;
1016 [ # # ][ # # ]: 0 : uno::Reference< XAccessible > xAcc( pAccImpl );
1017 [ # # ]: 0 : aEvent.NewValue <<= xAcc;
1018 [ # # ]: 0 : FireAccessibleEvent( aEvent );
1019 : :
1020 [ # # ][ # # ]: 0 : if( pAccImpl->GetState( AccessibleStateType::FOCUSED ) )
1021 : : {
1022 : 0 : Window *pWin = GetWindow();
1023 [ # # ][ # # ]: 0 : if( pWin && pWin->HasFocus() )
[ # # ][ # # ]
1024 : : {
1025 [ # # ]: 0 : AccessibleEventObject aStateChangedEvent;
1026 : 0 : aStateChangedEvent.EventId = AccessibleEventId::STATE_CHANGED;
1027 [ # # ]: 0 : aStateChangedEvent.NewValue <<= AccessibleStateType::FOCUSED;
1028 [ # # ]: 0 : aStateChangedEvent.Source = xAcc;
1029 : :
1030 [ # # ][ # # ]: 0 : FireAccessibleEvent( aStateChangedEvent );
1031 : : }
1032 [ # # ]: 0 : }
1033 : 0 : }
1034 : :
1035 : 68 : void SwAccessibleContext::Dispose( sal_Bool bRecursive )
1036 : : {
1037 [ + - ]: 68 : SolarMutexGuard aGuard;
1038 : :
1039 : : OSL_ENSURE( GetFrm() && GetMap(), "already disposed" );
1040 : : OSL_ENSURE( GetMap()->GetVisArea() == GetVisArea(),
1041 : : "invalid vis area for dispose" );
1042 : :
1043 : 68 : bDisposing = sal_True;
1044 : :
1045 : : // dispose children
1046 [ + - ]: 68 : if( bRecursive )
1047 [ + - ]: 68 : DisposeChildren( GetFrm(), bRecursive );
1048 : :
1049 : : // get parent
1050 [ + - ]: 68 : uno::Reference< XAccessible > xParent( GetWeakParent() );
1051 [ + - ]: 68 : uno::Reference < XAccessibleContext > xThis( this );
1052 : :
1053 : : // send child event at parent
1054 [ + + ]: 68 : if( xParent.is() )
1055 : : {
1056 [ + - ][ + - ]: 44 : SwAccessibleContext *pAcc = (SwAccessibleContext *)xParent.get();
1057 : :
1058 [ + - ]: 44 : AccessibleEventObject aEvent;
1059 : 44 : aEvent.EventId = AccessibleEventId::CHILD;
1060 [ + - ]: 44 : aEvent.OldValue <<= xThis;
1061 [ + - ][ + - ]: 44 : pAcc->FireAccessibleEvent( aEvent );
1062 : : }
1063 : :
1064 : : // set defunc state (its not required to broadcast a state changed
1065 : : // event if the object is diposed afterwards)
1066 : : {
1067 [ + - ]: 68 : osl::MutexGuard aDefuncStateGuard( aMutex );
1068 [ + - ]: 68 : bIsDefuncState = sal_True;
1069 : : }
1070 : :
1071 : : // broadcast dispose event
1072 [ - + ]: 68 : if ( nClientId )
1073 : : {
1074 [ # # ][ # # ]: 0 : comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, *this );
1075 : 0 : nClientId = 0;
1076 : : }
1077 : :
1078 [ + - ]: 68 : RemoveFrmFromAccessibleMap();
1079 : 68 : ClearFrm();
1080 : 68 : pMap = 0;
1081 : :
1082 [ + - ]: 68 : bDisposing = sal_False;
1083 : 68 : }
1084 : :
1085 : 0 : void SwAccessibleContext::DisposeChild( const SwAccessibleChild& rChildFrmOrObj,
1086 : : sal_Bool bRecursive )
1087 : : {
1088 [ # # ]: 0 : SolarMutexGuard aGuard;
1089 : :
1090 [ # # ][ # # ]: 0 : if ( IsShowing( *(GetMap()), rChildFrmOrObj ) ||
[ # # ][ # # ]
[ # # ]
1091 [ # # ]: 0 : rChildFrmOrObj.AlwaysIncludeAsChild() ||
1092 [ # # ][ # # ]: 0 : !SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly() )
[ # # ][ # # ]
1093 : : {
1094 : : // If the object could have existed before, than there is nothing to do,
1095 : : // because no wrapper exists now and therefor no one is interested to
1096 : : // get notified of the movement.
1097 [ # # ][ # # ]: 0 : if( rChildFrmOrObj.GetSwFrm() )
1098 : : {
1099 : : ::rtl::Reference< SwAccessibleContext > xAccImpl =
1100 : : GetMap()->GetContextImpl( rChildFrmOrObj.GetSwFrm(),
1101 [ # # ][ # # ]: 0 : sal_True );
1102 [ # # ]: 0 : xAccImpl->Dispose( bRecursive );
1103 : : }
1104 [ # # ][ # # ]: 0 : else if ( rChildFrmOrObj.GetDrawObject() )
1105 : : {
1106 : : ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl =
1107 : : GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
1108 [ # # ][ # # ]: 0 : this, sal_True );
1109 : : DisposeShape( rChildFrmOrObj.GetDrawObject(),
1110 [ # # ][ # # ]: 0 : xAccImpl.get() );
1111 : : }
1112 [ # # ][ # # ]: 0 : else if ( rChildFrmOrObj.GetWindow() )
1113 : : {
1114 [ # # ]: 0 : AccessibleEventObject aEvent;
1115 : 0 : aEvent.EventId = AccessibleEventId::CHILD;
1116 : : uno::Reference< XAccessible > xAcc =
1117 [ # # ][ # # ]: 0 : rChildFrmOrObj.GetWindow()->GetAccessible();
1118 [ # # ]: 0 : aEvent.OldValue <<= xAcc;
1119 [ # # ][ # # ]: 0 : FireAccessibleEvent( aEvent );
1120 : : }
1121 : : }
1122 [ # # ][ # # ]: 0 : else if( bRecursive && rChildFrmOrObj.GetSwFrm() )
[ # # ][ # # ]
1123 [ # # ][ # # ]: 0 : DisposeChildren( rChildFrmOrObj.GetSwFrm(), bRecursive );
[ # # ]
1124 : 0 : }
1125 : :
1126 : 56 : void SwAccessibleContext::InvalidatePosOrSize( const SwRect& )
1127 : : {
1128 [ + - ]: 56 : SolarMutexGuard aGuard;
1129 : :
1130 : : OSL_ENSURE( GetFrm() && !GetFrm()->Frm().IsEmpty(), "context should have a size" );
1131 : :
1132 : : sal_Bool bIsOldShowingState;
1133 [ + - ]: 56 : sal_Bool bIsNewShowingState = IsShowing( *(GetMap()) );
1134 : : {
1135 [ + - ]: 56 : osl::MutexGuard aShowingStateGuard( aMutex );
1136 : 56 : bIsOldShowingState = bIsShowingState;
1137 [ + - ]: 56 : bIsShowingState = bIsNewShowingState;
1138 : : }
1139 : :
1140 [ - + ]: 56 : if( bIsOldShowingState != bIsNewShowingState )
1141 : : {
1142 : : FireStateChangedEvent( AccessibleStateType::SHOWING,
1143 [ # # ]: 0 : bIsNewShowingState );
1144 : : }
1145 [ + - ]: 56 : else if( bIsNewShowingState )
1146 : : {
1147 : : // The frame stays visible -> broadcast event
1148 [ + - ]: 56 : FireVisibleDataEvent();
1149 : : }
1150 : :
1151 [ - + ][ # # ]: 112 : if( !bIsNewShowingState &&
[ - + ]
1152 [ # # ][ # # ]: 56 : SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
[ # # ][ - + ]
[ # # ]
1153 : : {
1154 : : // The frame is now invisible -> dispose it
1155 [ # # ]: 0 : Dispose( sal_True );
1156 : : }
1157 : : else
1158 : : {
1159 [ + - ]: 56 : _InvalidateContent( sal_True );
1160 [ + - ]: 56 : }
1161 : 56 : }
1162 : :
1163 : 17 : void SwAccessibleContext::InvalidateChildPosOrSize(
1164 : : const SwAccessibleChild& rChildFrmOrObj,
1165 : : const SwRect& rOldFrm )
1166 : : {
1167 [ + - ]: 17 : SolarMutexGuard aGuard;
1168 : :
1169 : : OSL_ENSURE( !rChildFrmOrObj.GetSwFrm() ||
1170 : : !rChildFrmOrObj.GetSwFrm()->Frm().IsEmpty(),
1171 : : "child context should have a size" );
1172 : :
1173 [ + - ][ - + ]: 17 : if ( rChildFrmOrObj.AlwaysIncludeAsChild() )
1174 : : {
1175 : : // nothing to do;
1176 : 17 : return;
1177 : : }
1178 : :
1179 [ + - ][ + - ]: 17 : const bool bVisibleChildrenOnly = SwAccessibleChild( GetFrm() ).IsVisibleChildrenOnly();
1180 : 17 : const bool bNew = rOldFrm.IsEmpty() ||
1181 [ - + ][ # # ]: 17 : ( rOldFrm.Left() == 0 && rOldFrm.Top() == 0 );
[ + + ]
1182 [ + - ][ + - ]: 17 : if( IsShowing( *(GetMap()), rChildFrmOrObj ) )
1183 : : {
1184 : : // If the object could have existed before, than there is nothing to do,
1185 : : // because no wrapper exists now and therefor no one is interested to
1186 : : // get notified of the movement.
1187 [ + + ][ + - ]: 17 : if( bNew || (bVisibleChildrenOnly && !IsShowing( rOldFrm )) )
[ + - ][ - + ]
[ + + ]
1188 : : {
1189 [ + - ][ + - ]: 1 : if( rChildFrmOrObj.GetSwFrm() )
1190 : : {
1191 : : // The frame becomes visible. A child event must be send.
1192 : : ::rtl::Reference< SwAccessibleContext > xAccImpl =
1193 : : GetMap()->GetContextImpl( rChildFrmOrObj.GetSwFrm(),
1194 [ + - ][ + - ]: 1 : sal_True );
1195 [ + - ]: 1 : xAccImpl->ScrolledIn();
1196 : : }
1197 [ # # ][ # # ]: 0 : else if ( rChildFrmOrObj.GetDrawObject() )
1198 : : {
1199 : : ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl =
1200 : : GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
1201 [ # # ][ # # ]: 0 : this, sal_True );
1202 : : // #i37790#
1203 [ # # ]: 0 : if ( xAccImpl.is() )
1204 : : {
1205 : : ScrolledInShape( rChildFrmOrObj.GetDrawObject(),
1206 [ # # ][ # # ]: 0 : xAccImpl.get() );
1207 : : }
1208 : : else
1209 : : {
1210 : : OSL_FAIL( "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - no accessible shape found." );
1211 : 0 : }
1212 : : }
1213 [ # # ][ # # ]: 0 : else if ( rChildFrmOrObj.GetWindow() )
1214 : : {
1215 [ # # ]: 0 : AccessibleEventObject aEvent;
1216 : 0 : aEvent.EventId = AccessibleEventId::CHILD;
1217 [ # # ][ # # ]: 0 : aEvent.NewValue <<= (rChildFrmOrObj.GetWindow()->GetAccessible());
[ # # ]
1218 [ # # ][ # # ]: 0 : FireAccessibleEvent( aEvent );
1219 : : }
1220 : : }
1221 : : }
1222 : : else
1223 : : {
1224 : : // If the frame was visible before, than a child event for the parent
1225 : : // needs to be send. However, there is no wrapper existing, and so
1226 : : // no notifications for grandchildren are required. If the are
1227 : : // grandgrandchildren, they would be notified by the layout.
1228 [ # # ][ # # ]: 0 : if( bVisibleChildrenOnly &&
[ # # ][ # # ]
1229 [ # # ]: 0 : !bNew && IsShowing( rOldFrm ) )
1230 : : {
1231 [ # # ][ # # ]: 0 : if( rChildFrmOrObj.GetSwFrm() )
1232 : : {
1233 : : ::rtl::Reference< SwAccessibleContext > xAccImpl =
1234 : : GetMap()->GetContextImpl( rChildFrmOrObj.GetSwFrm(),
1235 [ # # ][ # # ]: 0 : sal_True );
1236 [ # # ]: 0 : xAccImpl->SetParent( this );
1237 [ # # ]: 0 : xAccImpl->Dispose( sal_True );
1238 : : }
1239 [ # # ][ # # ]: 0 : else if ( rChildFrmOrObj.GetDrawObject() )
1240 : : {
1241 : : ::rtl::Reference< ::accessibility::AccessibleShape > xAccImpl =
1242 : : GetMap()->GetContextImpl( rChildFrmOrObj.GetDrawObject(),
1243 [ # # ][ # # ]: 0 : this, sal_True );
1244 : : DisposeShape( rChildFrmOrObj.GetDrawObject(),
1245 [ # # ][ # # ]: 0 : xAccImpl.get() );
1246 : : }
1247 [ # # ]: 17 : else if ( rChildFrmOrObj.GetWindow() )
1248 : : {
1249 : : OSL_FAIL( "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <Window>." );
1250 : : }
1251 : : }
1252 [ + - ][ + - ]: 17 : }
1253 : : }
1254 : :
1255 : 0 : void SwAccessibleContext::InvalidateContent()
1256 : : {
1257 [ # # ]: 0 : SolarMutexGuard aGuard;
1258 : :
1259 [ # # ][ # # ]: 0 : _InvalidateContent( sal_False );
1260 : 0 : }
1261 : :
1262 : 124 : void SwAccessibleContext::InvalidateCursorPos()
1263 : : {
1264 [ + - ]: 124 : SolarMutexGuard aGuard;
1265 : :
1266 [ + - ][ + - ]: 124 : _InvalidateCursorPos();
1267 : 124 : }
1268 : :
1269 : 18 : void SwAccessibleContext::InvalidateFocus()
1270 : : {
1271 [ + - ]: 18 : SolarMutexGuard aGuard;
1272 : :
1273 [ + - ][ + - ]: 18 : _InvalidateFocus();
1274 : 18 : }
1275 : :
1276 : : // #i27301# - use new type definition for <_nStates>
1277 : 0 : void SwAccessibleContext::InvalidateStates( tAccessibleStates _nStates )
1278 : : {
1279 [ # # ]: 0 : if( GetMap() )
1280 : : {
1281 : 0 : ViewShell *pVSh = GetMap()->GetShell();
1282 [ # # ]: 0 : if( pVSh )
1283 : : {
1284 [ # # ]: 0 : if( (_nStates & ACC_STATE_EDITABLE) != 0 )
1285 : : {
1286 : : sal_Bool bIsOldEditableState;
1287 : 0 : sal_Bool bIsNewEditableState = IsEditable( pVSh );
1288 : : {
1289 [ # # ]: 0 : osl::MutexGuard aGuard( aMutex );
1290 : 0 : bIsOldEditableState = bIsEditableState;
1291 [ # # ]: 0 : bIsEditableState = bIsNewEditableState;
1292 : : }
1293 : :
1294 [ # # ]: 0 : if( bIsOldEditableState != bIsNewEditableState )
1295 : : FireStateChangedEvent( AccessibleStateType::EDITABLE,
1296 : 0 : bIsNewEditableState );
1297 : : }
1298 [ # # ]: 0 : if( (_nStates & ACC_STATE_OPAQUE) != 0 )
1299 : : {
1300 : : sal_Bool bIsOldOpaqueState;
1301 : 0 : sal_Bool bIsNewOpaqueState = IsOpaque( pVSh );
1302 : : {
1303 [ # # ]: 0 : osl::MutexGuard aGuard( aMutex );
1304 : 0 : bIsOldOpaqueState = bIsOpaqueState;
1305 [ # # ]: 0 : bIsOpaqueState = bIsNewOpaqueState;
1306 : : }
1307 : :
1308 [ # # ]: 0 : if( bIsOldOpaqueState != bIsNewOpaqueState )
1309 : : FireStateChangedEvent( AccessibleStateType::OPAQUE,
1310 : 0 : bIsNewOpaqueState );
1311 : : }
1312 : : }
1313 : :
1314 : 0 : InvalidateChildrenStates( GetFrm(), _nStates );
1315 : : }
1316 : 0 : }
1317 : :
1318 : 0 : void SwAccessibleContext::InvalidateRelation( sal_uInt16 nType )
1319 : : {
1320 [ # # ]: 0 : AccessibleEventObject aEvent;
1321 : 0 : aEvent.EventId = nType;
1322 : :
1323 [ # # ][ # # ]: 0 : FireAccessibleEvent( aEvent );
1324 : 0 : }
1325 : :
1326 : : /** #i27301# - text selection has changed */
1327 : 0 : void SwAccessibleContext::InvalidateTextSelection()
1328 : : {
1329 [ # # ]: 0 : AccessibleEventObject aEvent;
1330 : 0 : aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
1331 : :
1332 [ # # ][ # # ]: 0 : FireAccessibleEvent( aEvent );
1333 : 0 : }
1334 : :
1335 : : /** #i88069# - attributes has changed */
1336 : 0 : void SwAccessibleContext::InvalidateAttr()
1337 : : {
1338 [ # # ]: 0 : AccessibleEventObject aEvent;
1339 : 0 : aEvent.EventId = AccessibleEventId::TEXT_ATTRIBUTE_CHANGED;
1340 : :
1341 [ # # ][ # # ]: 0 : FireAccessibleEvent( aEvent );
1342 : 0 : }
1343 : :
1344 : 6 : sal_Bool SwAccessibleContext::HasCursor()
1345 : : {
1346 : 6 : return sal_False;
1347 : : }
1348 : :
1349 : 12 : sal_Bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj,
1350 : : sal_Bool bAdd )
1351 : : {
1352 : 12 : SwCrsrShell* pCrsrShell = GetCrsrShell();
1353 [ - + ]: 12 : if( !pCrsrShell )
1354 : 0 : return sal_False;
1355 : :
1356 : 12 : SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell )
1357 : : ? static_cast<SwFEShell*>( pCrsrShell )
1358 [ + - ]: 12 : : 0;
1359 : : // Get rid of activated OLE object
1360 [ + - ]: 12 : if( pFEShell )
1361 : 12 : pFEShell->FinishOLEObj();
1362 : :
1363 : 12 : SwWrtShell* pWrtShell = pCrsrShell->ISA( SwWrtShell )
1364 : : ? static_cast<SwWrtShell*>( pCrsrShell )
1365 [ + - ]: 12 : : 0;
1366 : :
1367 : 12 : sal_Bool bRet = sal_False;
1368 [ - + ]: 12 : if( pObj )
1369 : : {
1370 [ # # ]: 0 : if( pFEShell )
1371 : : {
1372 : 0 : Point aDummy;
1373 [ # # ]: 0 : sal_uInt8 nFlags = bAdd ? SW_ADD_SELECT : 0;
1374 [ # # ]: 0 : pFEShell->SelectObj( aDummy, nFlags, pObj );
1375 : 0 : bRet = sal_True;
1376 : : }
1377 : : }
1378 [ + - ]: 12 : else if( pPaM )
1379 : : {
1380 : : // Get rid of frame selection. If there is one, make text cursor
1381 : : // visible again.
1382 : 12 : sal_Bool bCallShowCrsr = sal_False;
1383 [ + - ]: 24 : if( pFEShell && (pFEShell->IsFrmSelected() ||
[ + - - + ]
[ - + ]
1384 : 12 : pFEShell->IsObjSelected()) )
1385 : : {
1386 : 0 : Point aPt( LONG_MIN, LONG_MIN );
1387 [ # # ]: 0 : pFEShell->SelectObj( aPt, 0 );
1388 : 0 : bCallShowCrsr = sal_True;
1389 : : }
1390 : 12 : pCrsrShell->KillPams();
1391 [ + + ][ + + ]: 12 : if( pWrtShell && pPaM->HasMark() )
[ + - ]
1392 : : // We have to do this or SwWrtShell can't figure out that it needs
1393 : : // to kill the selection later, when the user moves the cursor.
1394 : 4 : pWrtShell->SttSelect();
1395 : 12 : pCrsrShell->SetSelection( *pPaM );
1396 [ - + ][ - + ]: 12 : if( pPaM->HasMark() && *pPaM->GetPoint() == *pPaM->GetMark())
[ + + ]
1397 : : // Setting a "Selection" that starts and ends at the same spot
1398 : : // should remove the selection rather than create an empty one, so
1399 : : // that we get defined behavior if accessibility sets the cursor
1400 : : // later.
1401 : 0 : pCrsrShell->ClearMark();
1402 [ - + ]: 12 : if( bCallShowCrsr )
1403 : 0 : pCrsrShell->ShowCrsr();
1404 : 12 : bRet = sal_True;
1405 : : }
1406 : :
1407 : 12 : return bRet;
1408 : : }
1409 : :
1410 : 72 : OUString SwAccessibleContext::GetResource( sal_uInt16 nResId,
1411 : : const OUString *pArg1,
1412 : : const OUString *pArg2 )
1413 : : {
1414 [ + - ]: 72 : String sStr;
1415 : : {
1416 [ + - ]: 72 : SolarMutexGuard aGuard;
1417 : :
1418 [ + - ][ + - ]: 72 : sStr = SW_RESSTR( nResId );
[ + - ]
1419 : : }
1420 : :
1421 [ + + ]: 72 : if( pArg1 )
1422 : : {
1423 : : sStr.SearchAndReplace( rtl::OUString("$(ARG1)"),
1424 [ + - ][ + - ]: 20 : String( *pArg1 ) );
[ + - ][ + - ]
[ + - ]
1425 : : }
1426 [ + + ]: 72 : if( pArg2 )
1427 : : {
1428 : : sStr.SearchAndReplace( rtl::OUString("$(ARG2)"),
1429 [ + - ][ + - ]: 4 : String( *pArg2 ) );
[ + - ][ + - ]
[ + - ]
1430 : : }
1431 : :
1432 [ + - ][ + - ]: 72 : return OUString( sStr );
1433 : : }
1434 : :
1435 : 147 : void SwAccessibleContext::RemoveFrmFromAccessibleMap()
1436 : : {
1437 [ + - ][ + + ]: 147 : if( bRegisteredAtAccessibleMap && GetFrm() && GetMap() )
[ + - ][ + + ]
1438 : 79 : GetMap()->RemoveContext( GetFrm() );
1439 : 147 : }
1440 : :
1441 : 0 : bool SwAccessibleContext::HasAdditionalAccessibleChildren()
1442 : : {
1443 : 0 : bool bRet( false );
1444 : :
1445 [ # # ]: 0 : if ( GetFrm()->IsTxtFrm() )
1446 : : {
1447 : 0 : SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1448 [ # # ][ # # ]: 0 : if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
[ # # ][ # # ]
1449 : : {
1450 : 0 : bRet = pPostItMgr->HasFrmConnectedSidebarWins( *(GetFrm()) );
1451 : : }
1452 : : }
1453 : :
1454 : 0 : return bRet;
1455 : : }
1456 : : /** #i88070# - get additional accessible child by index */
1457 : 134 : Window* SwAccessibleContext::GetAdditionalAccessibleChild( const sal_Int32 nIndex )
1458 : : {
1459 : 134 : Window* pAdditionalAccessibleChild( 0 );
1460 : :
1461 [ + - ]: 134 : if ( GetFrm()->IsTxtFrm() )
1462 : : {
1463 : 134 : SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1464 [ - + ][ # # ]: 134 : if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
[ - + ][ + + ]
1465 : : {
1466 : : pAdditionalAccessibleChild =
1467 : 0 : pPostItMgr->GetSidebarWinForFrmByIndex( *(GetFrm()), nIndex );
1468 : : }
1469 : : }
1470 : :
1471 : 134 : return pAdditionalAccessibleChild;
1472 : : }
1473 : :
1474 : : /** #i88070# - get all additional accessible children */
1475 : 0 : void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren )
1476 : : {
1477 [ # # ]: 0 : if ( GetFrm()->IsTxtFrm() )
1478 : : {
1479 : 0 : SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1480 [ # # ][ # # ]: 0 : if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
[ # # ][ # # ]
1481 : : {
1482 : 0 : pPostItMgr->GetAllSidebarWinForFrm( *(GetFrm()), pChildren );
1483 : : }
1484 : : }
1485 : 0 : }
1486 : :
1487 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|