LibreOffice Module sw (master)  1
acccontext.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <vcl/window.hxx>
21 #include <swtypes.hxx>
22 
23 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
25 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
26 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
27 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28 #include <osl/mutex.hxx>
29 #include <sal/log.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/settings.hxx>
35 #include <viewsh.hxx>
36 #include <crsrsh.hxx>
37 #include <fesh.hxx>
38 #include <wrtsh.hxx>
39 #include <txtfrm.hxx>
40 #include <ndtxt.hxx>
41 #include <pagefrm.hxx>
42 #include <flyfrm.hxx>
43 #include <dflyobj.hxx>
44 #include <pam.hxx>
45 #include <accmap.hxx>
46 #include "accfrmobjslist.hxx"
47 #include "acccontext.hxx"
48 #include <svx/AccessibleShape.hxx>
51 #include <PostItMgr.hxx>
52 
53 using namespace sw::access;
54 using namespace ::com::sun::star;
55 using namespace ::com::sun::star::accessibility;
56 
58 {
59  m_isShowingState = GetMap() && IsShowing( *(GetMap()) );
60 
61  SwViewShell *pVSh = GetMap()->GetShell();
62  m_isEditableState = pVSh && IsEditable( pVSh );
63  m_isOpaqueState = pVSh && IsOpaque( pVSh );
64  m_isDefuncState = false;
65 }
66 
68 {
69  osl::MutexGuard aGuard( m_Mutex );
70 
71  uno::Reference < XAccessible > xParent( pParent );
72  m_xWeakParent = xParent;
73 }
74 
75 uno::Reference< XAccessible > SwAccessibleContext::GetWeakParent() const
76 {
77  osl::MutexGuard aGuard( m_Mutex );
78 
79  uno::Reference< XAccessible > xParent( m_xWeakParent );
80  return xParent;
81 }
82 
84 {
85  vcl::Window *pWin = nullptr;
86 
87  if( GetMap() )
88  {
89  const SwViewShell *pVSh = GetMap()->GetShell();
90  OSL_ENSURE( pVSh, "no view shell" );
91  if( pVSh )
92  pWin = pVSh->GetWin();
93 
94  OSL_ENSURE( pWin, "no window" );
95  }
96 
97  return pWin;
98 }
99 
100 // get SwViewShell from accessibility map, and cast to cursor shell
102 {
103  SwViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : nullptr;
104  OSL_ENSURE( pViewShell, "no view shell" );
105  return dynamic_cast<SwCursorShell*>( pViewShell);
106 }
107 
109 {
110  // just like non-const GetCursorShell
111  const SwViewShell* pViewShell = GetMap() ? GetMap()->GetShell() : nullptr;
112  OSL_ENSURE( pViewShell, "no view shell" );
113  return dynamic_cast<const SwCursorShell*>( pViewShell);
114 }
115 
118 
120  const SwRect& rOldVisArea )
121 {
122  const SwRect& rNewVisArea = GetVisArea();
123  const bool bVisibleChildrenOnly = SwAccessibleChild( pFrame ).IsVisibleChildrenOnly();
124 
125  const SwAccessibleChildSList aList( *pFrame, *(GetMap()) );
127  while( aIter != aList.end() )
128  {
129  const SwAccessibleChild& rLower = *aIter;
130  const SwRect aBox( rLower.GetBox( *(GetMap()) ) );
131  if( rLower.IsAccessible( GetShell()->IsPreview() ) )
132  {
133  Action eAction = Action::NONE;
134  if( aBox.IsOver( rNewVisArea ) )
135  {
136  if( aBox.IsOver( rOldVisArea ) )
137  {
138  eAction = Action::SCROLLED_WITHIN;
139  }
140  else
141  {
142  if ( bVisibleChildrenOnly &&
143  !rLower.AlwaysIncludeAsChild() )
144  {
145  eAction = Action::SCROLLED_IN;
146  }
147  else
148  {
149  eAction = Action::SCROLLED;
150  }
151  }
152  }
153  else if( aBox.IsOver( rOldVisArea ) )
154  {
155  if ( bVisibleChildrenOnly &&
156  !rLower.AlwaysIncludeAsChild() )
157  {
158  eAction = Action::SCROLLED_OUT;
159  }
160  else
161  {
162  eAction = Action::SCROLLED;
163  }
164  }
165  else if( !bVisibleChildrenOnly ||
166  rLower.AlwaysIncludeAsChild() )
167  {
168  // This wouldn't be required if the SwAccessibleFrame,
169  // wouldn't know about the visible area.
170  eAction = Action::SCROLLED;
171  }
172  if( Action::NONE != eAction )
173  {
174  if ( rLower.GetSwFrame() )
175  {
176  OSL_ENSURE( !rLower.AlwaysIncludeAsChild(),
177  "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
178  const SwFrame* pLower( rLower.GetSwFrame() );
180  GetMap()->GetContextImpl( pLower );
181  if( xAccImpl.is() )
182  {
183  switch( eAction )
184  {
185  case Action::SCROLLED:
186  xAccImpl->Scrolled( rOldVisArea );
187  break;
189  xAccImpl->ScrolledWithin( rOldVisArea );
190  break;
191  case Action::SCROLLED_IN:
192  xAccImpl->ScrolledIn();
193  break;
195  xAccImpl->ScrolledOut( rOldVisArea );
196  break;
197  case Action::NONE:
198  break;
199  }
200  }
201  else
202  {
203  ChildrenScrolled( pLower, rOldVisArea );
204  }
205  }
206  else if ( rLower.GetDrawObject() )
207  {
208  OSL_ENSURE( !rLower.AlwaysIncludeAsChild(),
209  "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
211  GetMap()->GetContextImpl( rLower.GetDrawObject(),
212  this );
213  if( xAccImpl.is() )
214  {
215  switch( eAction )
216  {
217  case Action::SCROLLED:
219  xAccImpl->ViewForwarderChanged();
220  break;
221  case Action::SCROLLED_IN:
222  ScrolledInShape( xAccImpl.get() );
223  break;
225  {
226  xAccImpl->ViewForwarderChanged();
227  // this DisposeShape call was removed by
228  // IAccessibility2 implementation
229  // without giving any reason why
230  DisposeShape( rLower.GetDrawObject(),
231  xAccImpl.get() );
232  }
233  break;
234  // coverity[dead_error_begin] - following conditions exist to avoid compiler warning
235  case Action::NONE:
236  break;
237  }
238  }
239  }
240  else if ( rLower.GetWindow() )
241  {
242  // nothing to do - as such children are always included as children.
243  OSL_ENSURE( rLower.AlwaysIncludeAsChild(),
244  "<SwAccessibleContext::ChildrenScrolled(..)> - not always included child not considered!" );
245  }
246  }
247  }
248  else if ( rLower.GetSwFrame() &&
249  ( !bVisibleChildrenOnly ||
250  aBox.IsOver( rOldVisArea ) ||
251  aBox.IsOver( rNewVisArea ) ) )
252  {
253  // There are no unaccessible SdrObjects that need to be notified
254  ChildrenScrolled( rLower.GetSwFrame(), rOldVisArea );
255  }
256  ++aIter;
257  }
258 }
259 
260 void SwAccessibleContext::Scrolled( const SwRect& rOldVisArea )
261 {
262  SetVisArea( GetMap()->GetVisArea() );
263 
264  ChildrenScrolled( GetFrame(), rOldVisArea );
265 
266  bool bIsOldShowingState;
267  bool bIsNewShowingState = IsShowing( *(GetMap()) );
268  {
269  osl::MutexGuard aGuard( m_Mutex );
270  bIsOldShowingState = m_isShowingState;
271  m_isShowingState = bIsNewShowingState;
272  }
273 
274  if( bIsOldShowingState != bIsNewShowingState )
275  FireStateChangedEvent( AccessibleStateType::SHOWING,
276  bIsNewShowingState );
277 }
278 
279 void SwAccessibleContext::ScrolledWithin( const SwRect& rOldVisArea )
280 {
281  SetVisArea( GetMap()->GetVisArea() );
282 
283  ChildrenScrolled( GetFrame(), rOldVisArea );
284 
285  FireVisibleDataEvent();
286 }
287 
289 {
290  // This accessible should be freshly created, because it
291  // was not visible before. Therefore, its visible area must already
292  // reflect the scrolling.
293  OSL_ENSURE( GetVisArea() == GetMap()->GetVisArea(),
294  "Visible area of child is wrong. Did it exist already?" );
295 
296  // Send child event at parent. That's all we have to do here.
297  const SwFrame* pParent = GetParent();
299  GetMap()->GetContextImpl( pParent, false ) );
300  uno::Reference < XAccessibleContext > xThis( this );
301  if( xParentImpl.is() )
302  {
303  SetParent( xParentImpl.get() );
304 
305  AccessibleEventObject aEvent;
306  aEvent.EventId = AccessibleEventId::CHILD;
307  aEvent.NewValue <<= xThis;
308 
309  xParentImpl->FireAccessibleEvent( aEvent );
310 
311  if( HasCursor() )
312  {
313  vcl::Window *pWin = GetWindow();
314  if( pWin && pWin->HasFocus() )
315  {
316  FireStateChangedEvent( AccessibleStateType::FOCUSED, true );
317  }
318  }
319 
320  }
321 }
322 
323 void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
324 {
325  SetVisArea( GetMap()->GetVisArea() );
326 
327  // First of all, update the children. That's required to dispose
328  // all children that are existing only if they are visible. They
329  // are not disposed by the recursive Dispose call that follows later on,
330  // because this call will only dispose children that are in the
331  // new visible area. The children we want to dispose however are in the
332  // old visible area all.
333  ChildrenScrolled( GetFrame(), rOldVisArea );
334 
335  // Broadcast a state changed event for the showing state.
336  // It might be that the child is freshly created just to send
337  // the child event. In this case no listener will exist.
338  FireStateChangedEvent( AccessibleStateType::SHOWING, false );
339 
340  // this Dispose call was removed by IAccessibility2 implementation
341  // without giving any reason why - without it we get stale
342  // entries in SwAccessibleMap::mpFrameMap.
343  Dispose(true);
344 }
345 
346 // #i27301# - use new type definition for <_nStates>
348  AccessibleStates _nStates )
349 {
350  const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrame, *(GetMap()) );
351 
352  SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
353  while( aIter != aVisList.end() )
354  {
355  const SwAccessibleChild& rLower = *aIter;
356  const SwFrame* pLower = rLower.GetSwFrame();
357  if( pLower )
358  {
360  if( rLower.IsAccessible( GetShell()->IsPreview() ) )
361  xAccImpl = GetMap()->GetContextImpl( pLower, false );
362  if( xAccImpl.is() )
363  xAccImpl->InvalidateStates( _nStates );
364  else
365  InvalidateChildrenStates( pLower, _nStates );
366  }
367  else if ( rLower.GetDrawObject() )
368  {
369  // TODO: SdrObjects
370  }
371  else if ( rLower.GetWindow() )
372  {
373  // nothing to do ?
374  }
375 
376  ++aIter;
377  }
378 }
379 
381  bool bRecursive,
382  bool bCanSkipInvisible)
383 {
384  const SwAccessibleChildSList aVisList( GetVisArea(), *pFrame, *(GetMap()) );
385  SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
386  while( aIter != aVisList.end() )
387  {
388  const SwAccessibleChild& rLower = *aIter;
389  const SwFrame* pLower = rLower.GetSwFrame();
390  if( pLower )
391  {
392  // tdf#117601 dispose the darn thing if it ever was accessible
393  ::rtl::Reference<SwAccessibleContext> xAccImpl = GetMap()->GetContextImpl(pLower, false);
394  if( xAccImpl.is() )
395  xAccImpl->Dispose( bRecursive );
396  else
397  {
398  // it's possible that the xAccImpl *does* exist with a
399  // ref-count of 0 and blocked in its dtor in another thread -
400  // this call here could be from SwAccessibleMap dtor so
401  // remove it from any maps now!
402  GetMap()->RemoveContext(pLower);
403  // in this case the context will check with a weak_ptr
404  // that the map is still alive so it's not necessary
405  // to clear its m_pMap here.
406  if (bRecursive)
407  {
408  DisposeChildren(pLower, bRecursive, bCanSkipInvisible);
409  }
410  }
411  }
412  else if ( rLower.GetDrawObject() )
413  {
415  GetMap()->GetContextImpl( rLower.GetDrawObject(),
416  this, false ) );
417  if( xAccImpl.is() )
418  DisposeShape( rLower.GetDrawObject(), xAccImpl.get() );
419  }
420  else if ( rLower.GetWindow() )
421  {
422  DisposeChild(rLower, false, bCanSkipInvisible);
423  }
424  ++aIter;
425  }
426 }
427 
429 {
430 }
431 
433 {
434 }
435 
437 {
438 }
439 
440 void SwAccessibleContext::FireAccessibleEvent( AccessibleEventObject& rEvent )
441 {
442  OSL_ENSURE( GetFrame(), "fire event for disposed frame?" );
443  if( !GetFrame() )
444  return;
445 
446  if( !rEvent.Source.is() )
447  {
448  uno::Reference < XAccessibleContext > xThis( this );
449  rEvent.Source = xThis;
450  }
451 
452  if (m_nClientId)
453  comphelper::AccessibleEventNotifier::addEvent( m_nClientId, rEvent );
454 }
455 
457 {
458  AccessibleEventObject aEvent;
459  aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
460 
461  FireAccessibleEvent( aEvent );
462 }
463 
465  bool bNewState )
466 {
467  AccessibleEventObject aEvent;
468 
469  aEvent.EventId = AccessibleEventId::STATE_CHANGED;
470  if( bNewState )
471  aEvent.NewValue <<= nState;
472  else
473  aEvent.OldValue <<= nState;
474 
475  FireAccessibleEvent( aEvent );
476 }
477 
479  ::utl::AccessibleStateSetHelper& rStateSet )
480 {
481  SolarMutexGuard aGuard;
482 
483  // SHOWING
484  if (m_isShowingState)
485  rStateSet.AddState( AccessibleStateType::SHOWING );
486 
487  // EDITABLE
488  if (m_isEditableState)
489  //Set editable state to graphic and other object when the document is editable
490  {
491  rStateSet.AddState( AccessibleStateType::EDITABLE );
492  rStateSet.AddState( AccessibleStateType::RESIZABLE );
493  rStateSet.AddState( AccessibleStateType::MOVEABLE );
494  }
495  // ENABLED
496  rStateSet.AddState( AccessibleStateType::ENABLED );
497 
498  // OPAQUE
499  if (m_isOpaqueState)
500  rStateSet.AddState( AccessibleStateType::OPAQUE );
501 
502  // VISIBLE
504 
505  if (m_isDefuncState)
506  rStateSet.AddState( AccessibleStateType::DEFUNC );
507 }
508 
510 {
511  bool bRet;
512  {
513  osl::MutexGuard aGuard( m_Mutex );
514  bRet = m_isEditableState;
515  }
516 
517  return bRet;
518 }
519 
521 {
522  if (!(GetFrame() && GetMap()))
523  {
524  throw lang::DisposedException("object is nonfunctional",
525  static_cast<cppu::OWeakObject*>(this));
526  }
527 }
528 
529 SwAccessibleContext::SwAccessibleContext(std::shared_ptr<SwAccessibleMap> const& pMap,
530  sal_Int16 const nRole,
531  const SwFrame *pF )
532  : SwAccessibleFrame( pMap->GetVisArea().SVRect(), pF,
533  pMap->GetShell()->IsPreview() )
534  , m_pMap(pMap.get())
535  , m_wMap(pMap)
536  , m_nClientId(0)
537  , m_nRole(nRole)
538  , m_isDisposing( false )
539  , m_isRegisteredAtAccessibleMap( true )
540  , m_isSelectedInDoc(false)
541 {
542  InitStates();
543 }
544 
546 {
547  // must have for 2 reasons: 2. as long as this thread has SolarMutex
548  // another thread cannot destroy the SwAccessibleMap so our temporary
549  // taking a hard ref to SwAccessibleMap won't delay its destruction
550  SolarMutexGuard aGuard;
551  // must check with weak_ptr that m_pMap is still alive
552  std::shared_ptr<SwAccessibleMap> pMap(m_wMap.lock());
553  if (m_isRegisteredAtAccessibleMap && GetFrame() && pMap)
554  {
555  pMap->RemoveContext( GetFrame() );
556  }
557 }
558 
559 uno::Reference< XAccessibleContext > SAL_CALL
561 {
562  uno::Reference < XAccessibleContext > xRet( this );
563  return xRet;
564 }
565 
567 {
568  SolarMutexGuard aGuard;
569 
570  ThrowIfDisposed();
571 
572  return m_isDisposing ? 0 : GetChildCount( *(GetMap()) );
573 }
574 
575 uno::Reference< XAccessible> SAL_CALL
577 {
578  SolarMutexGuard aGuard;
579 
580  ThrowIfDisposed();
581 
582  const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
583  if( !aChild.IsValid() )
584  {
585  uno::Reference < XAccessibleContext > xThis( this );
586  lang::IndexOutOfBoundsException aExcept(
587  "index out of bounds",
588  xThis );
589  throw aExcept;
590  }
591 
592  uno::Reference< XAccessible > xChild;
593  if( aChild.GetSwFrame() )
594  {
596  GetMap()->GetContextImpl( aChild.GetSwFrame(), !m_isDisposing ) );
597  if( xChildImpl.is() )
598  {
599  xChildImpl->SetParent( this );
600  xChild = xChildImpl.get();
601  }
602  }
603  else if ( aChild.GetDrawObject() )
604  {
606  GetMap()->GetContextImpl( aChild.GetDrawObject(),
607  this, !m_isDisposing) );
608  if( xChildImpl.is() )
609  xChild = xChildImpl.get();
610  }
611  else if ( aChild.GetWindow() )
612  {
613  xChild = aChild.GetWindow()->GetAccessible();
614  }
615 
616  return xChild;
617 }
618 
619 uno::Reference< XAccessible> SwAccessibleContext::getAccessibleParentImpl()
620 {
621  SolarMutexGuard aGuard;
622 
623  const SwFrame *pUpper = GetParent();
624  OSL_ENSURE( pUpper != nullptr || m_isDisposing, "no upper found" );
625 
626  uno::Reference< XAccessible > xAcc;
627  if( pUpper )
628  xAcc = GetMap()->GetContext( pUpper, !m_isDisposing );
629 
630  OSL_ENSURE( xAcc.is() || m_isDisposing, "no parent found" );
631 
632  // Remember the parent as weak ref.
633  {
634  osl::MutexGuard aWeakParentGuard( m_Mutex );
635  m_xWeakParent = xAcc;
636  }
637 
638  return xAcc;
639 }
640 
641 uno::Reference< XAccessible> SAL_CALL SwAccessibleContext::getAccessibleParent()
642 {
643  SolarMutexGuard aGuard;
644 
645  ThrowIfDisposed();
646 
647  return getAccessibleParentImpl();
648 }
649 
651 {
652  SolarMutexGuard aGuard;
653 
654  ThrowIfDisposed();
655 
656  const SwFrame *pUpper = GetParent();
657  OSL_ENSURE( pUpper != nullptr || m_isDisposing, "no upper found" );
658 
659  sal_Int32 nIndex = -1;
660  if( pUpper )
661  {
663  GetMap()->GetContextImpl(pUpper, !m_isDisposing) );
664  OSL_ENSURE( xAccImpl.is() || m_isDisposing, "no parent found" );
665  if( xAccImpl.is() )
666  nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrame()) );
667  }
668 
669  return nIndex;
670 }
671 
673 {
674  return m_nRole;
675 }
676 
678 {
679  return m_sName;
680 }
681 
682 uno::Reference< XAccessibleRelationSet> SAL_CALL
684 {
685  // by default there are no relations
686  uno::Reference< XAccessibleRelationSet> xRet( new utl::AccessibleRelationSetHelper() );
687  return xRet;
688 }
689 
690 uno::Reference<XAccessibleStateSet> SAL_CALL
692 {
693  SolarMutexGuard aGuard;
694 
695  ThrowIfDisposed();
696 
698  new ::utl::AccessibleStateSetHelper;
699 
700  if (m_isSelectedInDoc)
701  pStateSet->AddState( AccessibleStateType::SELECTED );
702 
703  uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
704  GetStates( *pStateSet );
705 
706  return xStateSet;
707 }
708 
709 lang::Locale SAL_CALL SwAccessibleContext::getLocale()
710 {
711  SolarMutexGuard aGuard;
712 
713  lang::Locale aLoc( Application::GetSettings().GetLanguageTag().getLocale() );
714  return aLoc;
715 }
716 
718  const uno::Reference< XAccessibleEventListener >& xListener )
719 {
720  if (xListener.is())
721  {
722  SolarMutexGuard aGuard;
723  if (!m_nClientId)
726  }
727 }
728 
730  const uno::Reference< XAccessibleEventListener >& xListener )
731 {
732  if (xListener.is() && m_nClientId)
733  {
734  SolarMutexGuard aGuard;
735  sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
736  if ( !nListenerCount )
737  {
738  // no listeners anymore
739  // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
740  // and at least to us not firing any events anymore, in case somebody calls
741  // NotifyAccessibleEvent, again
743  m_nClientId = 0;
744  }
745  }
746 }
747 
748 static bool lcl_PointInRectangle(const awt::Point & aPoint,
749  const awt::Rectangle & aRect)
750 {
751  long nDiffX = aPoint.X - aRect.X;
752  long nDiffY = aPoint.Y - aRect.Y;
753 
754  return
755  nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
756  nDiffY < aRect.Height;
757 
758 }
759 
761  const awt::Point& aPoint )
762 {
763  awt::Rectangle aPixBounds = getBoundsImpl(true);
764  aPixBounds.X = 0;
765  aPixBounds.Y = 0;
766 
767  return lcl_PointInRectangle(aPoint, aPixBounds);
768 }
769 
770 uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint(
771  const awt::Point& aPoint )
772 {
773  SolarMutexGuard aGuard;
774 
775  ThrowIfDisposed();
776 
777  uno::Reference< XAccessible > xAcc;
778 
779  vcl::Window *pWin = GetWindow();
780  if (!pWin)
781  {
782  throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
783  }
784 
785  Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
786  if( !GetFrame()->IsRootFrame() )
787  {
788  SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
789  Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() );
790  aPixPoint.setX(aPixPoint.getX() + aPixPos.getX());
791  aPixPoint.setY(aPixPoint.getY() + aPixPos.getY());
792  }
793 
794  const SwAccessibleChild aChild( GetChildAtPixel( aPixPoint, *(GetMap()) ) );
795  if( aChild.GetSwFrame() )
796  {
797  xAcc = GetMap()->GetContext( aChild.GetSwFrame() );
798  }
799  else if( aChild.GetDrawObject() )
800  {
801  xAcc = GetMap()->GetContext( aChild.GetDrawObject(), this );
802  }
803  else if ( aChild.GetWindow() )
804  {
805  xAcc = aChild.GetWindow()->GetAccessible();
806  }
807 
808  return xAcc;
809 }
810 
829 awt::Rectangle SwAccessibleContext::getBoundsImpl(bool bRelative)
830 {
831  SolarMutexGuard aGuard;
832 
833  ThrowIfDisposed();
834 
835  const SwFrame *pParent = GetParent();
836  OSL_ENSURE( pParent, "no Parent found" );
837  vcl::Window *pWin = GetWindow();
838 
839  if (!pParent)
840  {
841  throw uno::RuntimeException("no Parent", static_cast<cppu::OWeakObject*>(this));
842  }
843  if (!pWin)
844  {
845  throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
846  }
847 
848  SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip relative to document root
849  tools::Rectangle aPixBounds( 0, 0, 0, 0 );
850  if( GetFrame()->IsPageFrame() &&
851  static_cast < const SwPageFrame * >( GetFrame() )->IsEmptyPage() )
852  {
853  OSL_ENSURE( GetShell()->IsPreview(), "empty page accessible?" );
854  if( GetShell()->IsPreview() )
855  {
856  // adjust method call <GetMap()->GetPreviewPageSize()>
857  sal_uInt16 nPageNum =
858  static_cast < const SwPageFrame * >( GetFrame() )->GetPhyPageNum();
859  aLogBounds.SSize( GetMap()->GetPreviewPageSize( nPageNum ) );
860  }
861  }
862  if( !aLogBounds.IsEmpty() )
863  {
864  aPixBounds = GetMap()->CoreToPixel( aLogBounds.SVRect() );
865  if( !pParent->IsRootFrame() && bRelative)
866  {
867  SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
868  Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds.SVRect() ).TopLeft() );
869  aPixBounds.Move( -aParentPixPos.getX(), -aParentPixPos.getY() );
870  }
871  }
872 
873  awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
874  aPixBounds.GetWidth(), aPixBounds.GetHeight() );
875 
876  return aBox;
877 }
878 
879 awt::Rectangle SAL_CALL SwAccessibleContext::getBounds()
880 {
881  return getBoundsImpl(true);
882 }
883 
884 awt::Point SAL_CALL SwAccessibleContext::getLocation()
885 {
886  awt::Rectangle aRect = getBoundsImpl(true);
887  awt::Point aPoint(aRect.X, aRect.Y);
888 
889  return aPoint;
890 }
891 
893 {
894  awt::Rectangle aRect = getBoundsImpl(false);
895 
896  Point aPixPos(aRect.X, aRect.Y);
897 
898  vcl::Window *pWin = GetWindow();
899  if (!pWin)
900  {
901  throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
902  }
903 
904  aPixPos = pWin->OutputToAbsoluteScreenPixel(aPixPos);
905  awt::Point aPoint(aPixPos.getX(), aPixPos.getY());
906 
907  return aPoint;
908 }
909 
910 awt::Size SAL_CALL SwAccessibleContext::getSize()
911 {
912  awt::Rectangle aRect = getBoundsImpl(false);
913  awt::Size aSize( aRect.Width, aRect.Height );
914 
915  return aSize;
916 }
917 
919 {
920  SolarMutexGuard aGuard;
921 
922  ThrowIfDisposed();
923 
924  if( GetFrame()->IsFlyFrame() )
925  {
926  const SdrObject *pObj =
927  static_cast < const SwFlyFrame * >( GetFrame() )->GetVirtDrawObj();
928  if( pObj )
929  Select( const_cast < SdrObject * >( pObj ), false );
930  }
931  else
932  {
933  const SwContentFrame *pCFrame = nullptr;
934  if( GetFrame()->IsContentFrame() )
935  pCFrame = static_cast< const SwContentFrame * >( GetFrame() );
936  else if( GetFrame()->IsLayoutFrame() )
937  pCFrame = static_cast< const SwLayoutFrame * >( GetFrame() )->ContainsContent();
938 
939  if( pCFrame && pCFrame->IsTextFrame() )
940  {
941  const SwTextFrame *pTextFrame = static_cast< const SwTextFrame * >( pCFrame );
942  const SwTextNode *pTextNd = pTextFrame->GetTextNodeFirst();
943  assert(pTextNd); // can it actually be null? probably not=>simplify
944  if( pTextNd )
945  {
946  // create pam for selection
947  SwPosition const aStartPos(pTextFrame->MapViewToModelPos(pTextFrame->GetOfst()));
948  SwPaM aPaM( aStartPos );
949 
950  // set PaM at cursor shell
951  Select( aPaM );
952  }
953  }
954  }
955 }
956 
958 {
959  return sal_Int32(COL_BLACK);
960 }
961 
963 {
964  return sal_Int32(COL_WHITE);
965 }
966 
967 sal_Bool SAL_CALL SwAccessibleContext::supportsService (const OUString& ServiceName)
968 {
969  return cppu::supportsService(this, ServiceName);
970 }
971 
973  ::accessibility::AccessibleShape *pAccImpl )
974 {
976  if( !xAccImpl.is() )
977  xAccImpl = GetMap()->GetContextImpl( pObj, this );
978 
979  AccessibleEventObject aEvent;
980  aEvent.EventId = AccessibleEventId::CHILD;
981  uno::Reference< XAccessible > xAcc( xAccImpl.get() );
982  aEvent.OldValue <<= xAcc;
983  FireAccessibleEvent( aEvent );
984 
985  GetMap()->RemoveContext( pObj );
986  xAccImpl->dispose();
987 }
988 
990 {
991  if(nullptr == pAccImpl)
992  {
993  return ;
994  }
995  AccessibleEventObject aEvent;
996  aEvent.EventId = AccessibleEventId::CHILD;
997  uno::Reference< XAccessible > xAcc( pAccImpl );
998  aEvent.NewValue <<= xAcc;
999  FireAccessibleEvent( aEvent );
1000 
1001  if( pAccImpl->GetState( AccessibleStateType::FOCUSED ) )
1002  {
1003  vcl::Window *pWin = GetWindow();
1004  if( pWin && pWin->HasFocus() )
1005  {
1006  AccessibleEventObject aStateChangedEvent;
1007  aStateChangedEvent.EventId = AccessibleEventId::STATE_CHANGED;
1008  aStateChangedEvent.NewValue <<= AccessibleStateType::FOCUSED;
1009  aStateChangedEvent.Source = xAcc;
1010 
1011  FireAccessibleEvent( aStateChangedEvent );
1012  }
1013  }
1014 }
1015 
1016 void SwAccessibleContext::Dispose(bool bRecursive, bool bCanSkipInvisible)
1017 {
1018  SolarMutexGuard aGuard;
1019 
1020  OSL_ENSURE( GetFrame() && GetMap(), "already disposed" );
1021  OSL_ENSURE( GetMap()->GetVisArea() == GetVisArea(),
1022  "invalid visible area for dispose" );
1023 
1024  m_isDisposing = true;
1025 
1026  // dispose children
1027  if( bRecursive )
1028  DisposeChildren(GetFrame(), bRecursive, bCanSkipInvisible);
1029 
1030  // get parent
1031  uno::Reference< XAccessible > xParent( GetWeakParent() );
1032  uno::Reference < XAccessibleContext > xThis( this );
1033 
1034  // send child event at parent
1035  if( xParent.is() )
1036  {
1037  SwAccessibleContext *pAcc = static_cast<SwAccessibleContext *>(xParent.get());
1038 
1039  AccessibleEventObject aEvent;
1040  aEvent.EventId = AccessibleEventId::CHILD;
1041  aEvent.OldValue <<= xThis;
1042  pAcc->FireAccessibleEvent( aEvent );
1043  }
1044 
1045  // set defunc state (it's not required to broadcast a state changed
1046  // event if the object is disposed afterwards)
1047  {
1048  osl::MutexGuard aDefuncStateGuard( m_Mutex );
1049  m_isDefuncState = true;
1050  }
1051 
1052  // broadcast dispose event
1053  if (m_nClientId)
1054  {
1056  m_nClientId = 0;
1057  }
1058 
1060  ClearFrame();
1061  m_pMap = nullptr;
1062  m_wMap.reset();
1063 
1064  m_isDisposing = false;
1065 }
1066 
1068  bool bRecursive, bool bCanSkipInvisible )
1069 {
1070  SolarMutexGuard aGuard;
1071 
1072  if ( !bCanSkipInvisible ||
1073  rChildFrameOrObj.AlwaysIncludeAsChild() ||
1074  IsShowing( *(GetMap()), rChildFrameOrObj ) ||
1076  {
1077  // If the object could have existed before, then there is nothing to do,
1078  // because no wrapper exists now and therefore no one is interested to
1079  // get notified of the movement.
1080  if( rChildFrameOrObj.GetSwFrame() )
1081  {
1083  GetMap()->GetContextImpl( rChildFrameOrObj.GetSwFrame(), false );
1084  if (xAccImpl)
1085  xAccImpl->Dispose( bRecursive );
1086  }
1087  else if ( rChildFrameOrObj.GetDrawObject() )
1088  {
1090  GetMap()->GetContextImpl( rChildFrameOrObj.GetDrawObject(),
1091  this, false );
1092  if (xAccImpl)
1093  DisposeShape( rChildFrameOrObj.GetDrawObject(),
1094  xAccImpl.get() );
1095  }
1096  else if ( rChildFrameOrObj.GetWindow() )
1097  {
1098  AccessibleEventObject aEvent;
1099  aEvent.EventId = AccessibleEventId::CHILD;
1100  uno::Reference< XAccessible > xAcc =
1101  rChildFrameOrObj.GetWindow()->GetAccessible();
1102  aEvent.OldValue <<= xAcc;
1103  FireAccessibleEvent( aEvent );
1104  }
1105  }
1106  else if( bRecursive && rChildFrameOrObj.GetSwFrame() )
1107  DisposeChildren(rChildFrameOrObj.GetSwFrame(), bRecursive, bCanSkipInvisible);
1108 }
1109 
1111 {
1112  SolarMutexGuard aGuard;
1113 
1114  OSL_ENSURE( GetFrame() && !GetFrame()->getFrameArea().IsEmpty(), "context should have a size" );
1115 
1116  bool bIsOldShowingState;
1117  bool bIsNewShowingState = IsShowing( *(GetMap()) );
1118  {
1119  osl::MutexGuard aShowingStateGuard( m_Mutex );
1120  bIsOldShowingState = m_isShowingState;
1121  m_isShowingState = bIsNewShowingState;
1122  }
1123 
1124  if( bIsOldShowingState != bIsNewShowingState )
1125  {
1126  FireStateChangedEvent( AccessibleStateType::SHOWING,
1127  bIsNewShowingState );
1128  }
1129  else if( bIsNewShowingState )
1130  {
1131  // The frame stays visible -> broadcast event
1133  }
1134 
1135  // note: InvalidatePosOrSize must call InvalidateContent_ so that
1136  // SwAccessibleParagraph updates its portions, or dispose it
1137  // (see accmap.cxx: INVALID_CONTENT is contained in POS_CHANGED)
1138  if( !bIsNewShowingState &&
1139  SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
1140  {
1141  // this Dispose call was removed by IAccessibility2 implementation
1142  // without giving any reason why - without it we get stale
1143  // entries in SwAccessibleMap::mpFrameMap.
1144  Dispose(true);
1145  }
1146  else
1147  {
1148  InvalidateContent_( true );
1149  }
1150 }
1151 
1153  const SwAccessibleChild& rChildFrameOrObj,
1154  const SwRect& rOldFrame )
1155 {
1156  SolarMutexGuard aGuard;
1157 
1158  // this happens during layout, e.g. when a page is deleted and next page's
1159  // header/footer moves backward such an event is generated
1160  SAL_INFO_IF(rChildFrameOrObj.GetSwFrame() &&
1161  rChildFrameOrObj.GetSwFrame()->getFrameArea().IsEmpty(),
1162  "sw.a11y", "child context should have a size");
1163 
1164  if ( rChildFrameOrObj.AlwaysIncludeAsChild() )
1165  {
1166  // nothing to do;
1167  return;
1168  }
1169 
1170  const bool bVisibleChildrenOnly = SwAccessibleChild( GetFrame() ).IsVisibleChildrenOnly();
1171  const bool bNew = rOldFrame.IsEmpty() ||
1172  ( rOldFrame.Left() == 0 && rOldFrame.Top() == 0 );
1173  if( IsShowing( *(GetMap()), rChildFrameOrObj ) )
1174  {
1175  // If the object could have existed before, then there is nothing to do,
1176  // because no wrapper exists now and therefore no one is interested to
1177  // get notified of the movement.
1178  if( bNew || (bVisibleChildrenOnly && !IsShowing( rOldFrame )) )
1179  {
1180  if( rChildFrameOrObj.GetSwFrame() )
1181  {
1182  // The frame becomes visible. A child event must be send.
1184  GetMap()->GetContextImpl( rChildFrameOrObj.GetSwFrame() );
1185  xAccImpl->ScrolledIn();
1186  }
1187  else if ( rChildFrameOrObj.GetDrawObject() )
1188  {
1190  GetMap()->GetContextImpl( rChildFrameOrObj.GetDrawObject(),
1191  this );
1192  // #i37790#
1193  if ( xAccImpl.is() )
1194  {
1195  ScrolledInShape( xAccImpl.get() );
1196  }
1197  else
1198  {
1199  OSL_FAIL( "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - no accessible shape found." );
1200  }
1201  }
1202  else if ( rChildFrameOrObj.GetWindow() )
1203  {
1204  AccessibleEventObject aEvent;
1205  aEvent.EventId = AccessibleEventId::CHILD;
1206  aEvent.NewValue <<= rChildFrameOrObj.GetWindow()->GetAccessible();
1207  FireAccessibleEvent( aEvent );
1208  }
1209  }
1210  }
1211  else
1212  {
1213  // If the frame was visible before, then a child event for the parent
1214  // needs to be send. However, there is no wrapper existing, and so
1215  // no notifications for grandchildren are required. If the are
1216  // grandgrandchildren, they would be notified by the layout.
1217  if( bVisibleChildrenOnly &&
1218  !bNew && IsShowing( rOldFrame ) )
1219  {
1220  if( rChildFrameOrObj.GetSwFrame() )
1221  {
1223  GetMap()->GetContextImpl( rChildFrameOrObj.GetSwFrame() );
1224  xAccImpl->SetParent( this );
1225  xAccImpl->Dispose( true );
1226  }
1227  else if ( rChildFrameOrObj.GetDrawObject() )
1228  {
1230  GetMap()->GetContextImpl( rChildFrameOrObj.GetDrawObject(),
1231  this );
1232  DisposeShape( rChildFrameOrObj.GetDrawObject(),
1233  xAccImpl.get() );
1234  }
1235  else if ( rChildFrameOrObj.GetWindow() )
1236  {
1237  OSL_FAIL( "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <vcl::Window>." );
1238  }
1239  }
1240  }
1241 }
1242 
1244 {
1245  SolarMutexGuard aGuard;
1246 
1247  InvalidateContent_( false );
1248 }
1249 
1251 {
1252  SolarMutexGuard aGuard;
1253 
1255 }
1256 
1258 {
1259  SolarMutexGuard aGuard;
1260 
1261  InvalidateFocus_();
1262 }
1263 
1264 // #i27301# - use new type definition for <_nStates>
1266 {
1267  if( GetMap() )
1268  {
1269  SwViewShell *pVSh = GetMap()->GetShell();
1270  if( pVSh )
1271  {
1272  if( _nStates & AccessibleStates::EDITABLE )
1273  {
1274  bool bIsOldEditableState;
1275  bool bIsNewEditableState = IsEditable( pVSh );
1276  {
1277  osl::MutexGuard aGuard( m_Mutex );
1278  bIsOldEditableState = m_isEditableState;
1279  m_isEditableState = bIsNewEditableState;
1280  }
1281 
1282  if( bIsOldEditableState != bIsNewEditableState )
1283  FireStateChangedEvent( AccessibleStateType::EDITABLE,
1284  bIsNewEditableState );
1285  }
1286  if( _nStates & AccessibleStates::OPAQUE )
1287  {
1288  bool bIsOldOpaqueState;
1289  bool bIsNewOpaqueState = IsOpaque( pVSh );
1290  {
1291  osl::MutexGuard aGuard( m_Mutex );
1292  bIsOldOpaqueState = m_isOpaqueState;
1293  m_isOpaqueState = bIsNewOpaqueState;
1294  }
1295 
1296  if( bIsOldOpaqueState != bIsNewOpaqueState )
1297  FireStateChangedEvent( AccessibleStateType::OPAQUE,
1298  bIsNewOpaqueState );
1299  }
1300  }
1301 
1302  InvalidateChildrenStates( GetFrame(), _nStates );
1303  }
1304 }
1305 
1307 {
1308  AccessibleEventObject aEvent;
1309  aEvent.EventId = nType;
1310 
1311  FireAccessibleEvent( aEvent );
1312 }
1313 
1316 {
1317  AccessibleEventObject aEvent;
1318  aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
1319 
1320  FireAccessibleEvent( aEvent );
1321 }
1322 
1325 {
1326  AccessibleEventObject aEvent;
1327  aEvent.EventId = AccessibleEventId::TEXT_ATTRIBUTE_CHANGED;
1328 
1329  FireAccessibleEvent( aEvent );
1330 }
1331 
1333 {
1334  return false;
1335 }
1336 
1338  bool bAdd )
1339 {
1340  SwCursorShell* pCursorShell = GetCursorShell();
1341  if( !pCursorShell )
1342  return false;
1343 
1344  SwFEShell* pFEShell = dynamic_cast<const SwFEShell*>( pCursorShell) != nullptr
1345  ? static_cast<SwFEShell*>( pCursorShell )
1346  : nullptr;
1347  // Get rid of activated OLE object
1348  if( pFEShell )
1349  pFEShell->FinishOLEObj();
1350 
1351  SwWrtShell* pWrtShell = dynamic_cast<const SwWrtShell*>( pCursorShell) != nullptr
1352  ? static_cast<SwWrtShell*>( pCursorShell )
1353  : nullptr;
1354 
1355  bool bRet = false;
1356  if( pObj )
1357  {
1358  if( pFEShell )
1359  {
1360  sal_uInt8 nFlags = bAdd ? SW_ADD_SELECT : 0;
1361  pFEShell->SelectObj( Point(), nFlags, pObj );
1362  bRet = true;
1363  }
1364  }
1365  else if( pPaM )
1366  {
1367  // Get rid of frame selection. If there is one, make text cursor
1368  // visible again.
1369  bool bCallShowCursor = false;
1370  if( pFEShell && (pFEShell->IsFrameSelected() ||
1371  pFEShell->IsObjSelected()) )
1372  {
1373  Point aPt( LONG_MIN, LONG_MIN );
1374  pFEShell->SelectObj( aPt );
1375  bCallShowCursor = true;
1376  }
1377  pCursorShell->KillPams();
1378  if( pWrtShell && pPaM->HasMark() )
1379  // We have to do this or SwWrtShell can't figure out that it needs
1380  // to kill the selection later, when the user moves the cursor.
1381  pWrtShell->SttSelect();
1382  pCursorShell->SetSelection( *pPaM );
1383  if( pPaM->HasMark() && *pPaM->GetPoint() == *pPaM->GetMark())
1384  // Setting a "Selection" that starts and ends at the same spot
1385  // should remove the selection rather than create an empty one, so
1386  // that we get defined behavior if accessibility sets the cursor
1387  // later.
1388  pCursorShell->ClearMark();
1389  if( bCallShowCursor )
1390  pCursorShell->ShowCursor();
1391  bRet = true;
1392  }
1393 
1394  return bRet;
1395 }
1396 
1397 OUString SwAccessibleContext::GetResource(const char* pResId,
1398  const OUString *pArg1,
1399  const OUString *pArg2)
1400 {
1401  OUString sStr = SwResId(pResId);
1402 
1403  if( pArg1 )
1404  {
1405  sStr = sStr.replaceFirst( "$(ARG1)", *pArg1 );
1406  }
1407  if( pArg2 )
1408  {
1409  sStr = sStr.replaceFirst( "$(ARG2)", *pArg2 );
1410  }
1411 
1412  return sStr;
1413 }
1414 
1416 {
1417  assert(m_refCount > 0); // must be alive to do this without using m_wMap
1419  GetMap()->RemoveContext( GetFrame() );
1420 }
1421 
1423 {
1424  bool bRet( false );
1425 
1426  if ( GetFrame()->IsTextFrame() )
1427  {
1428  SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1429  if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1430  {
1431  bRet = pPostItMgr->HasFrameConnectedSidebarWins( *(GetFrame()) );
1432  }
1433  }
1434 
1435  return bRet;
1436 }
1437 
1440 {
1441  vcl::Window* pAdditionalAccessibleChild( nullptr );
1442 
1443  if ( GetFrame()->IsTextFrame() )
1444  {
1445  SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1446  if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1447  {
1448  pAdditionalAccessibleChild =
1449  pPostItMgr->GetSidebarWinForFrameByIndex( *(GetFrame()), nIndex );
1450  }
1451  }
1452 
1453  return pAdditionalAccessibleChild;
1454 }
1455 
1457 void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< vcl::Window* >* pChildren )
1458 {
1459  if ( GetFrame()->IsTextFrame() )
1460  {
1461  SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1462  if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1463  {
1464  pPostItMgr->GetAllSidebarWinForFrame( *(GetFrame()), pChildren );
1465  }
1466  }
1467 }
1468 
1469 bool SwAccessibleContext::SetSelectedState(bool const bSelected)
1470 {
1471  if (m_isSelectedInDoc != bSelected)
1472  {
1473  m_isSelectedInDoc = bSelected;
1474  FireStateChangedEvent( AccessibleStateType::SELECTED, bSelected );
1475  return true;
1476  }
1477  return false;
1478 };
1479 
1480 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void ScrolledOut(const SwRect &rOldVisArea)
Definition: acccontext.cxx:323
css::uno::Reference< css::accessibility::XAccessible > getAccessibleParentImpl()
Definition: acccontext.cxx:619
std::weak_ptr< SwAccessibleMap > m_wMap
note: the m_pMap is guaranteed to be valid until we hit the dtor ~SwAccessibleContext, then m_wMap must be checked if it's still alive, after locking SolarMutex (alternatively, Dispose clears m_pMap)
Definition: acccontext.hxx:78
Base class of the Writer layout elements.
Definition: frame.hxx:295
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
virtual css::awt::Point SAL_CALL getLocation() override
Definition: acccontext.cxx:884
long GetWidth() const
void KillPams()
Definition: crsrsh.cxx:1009
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
Definition: acccontext.cxx:892
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
Definition: acccontext.cxx:760
virtual css::awt::Size SAL_CALL getSize() override
Definition: acccontext.cxx:910
void FireAccessibleEvent(css::accessibility::AccessibleEventObject &rEvent)
Definition: acccontext.cxx:440
void RemoveContext(const SwFrame *pFrame)
Definition: accmap.cxx:2145
long GetHeight() const
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
Marks a position in the document model.
Definition: pam.hxx:35
vcl::Window * GetSidebarWinForFrameByIndex(const SwFrame &rFrame, const sal_Int32 nIndex)
Definition: PostItMgr.cxx:2417
static OUString GetResource(const char *pResId, const OUString *pArg1=nullptr, const OUString *pArg2=nullptr)
virtual void InvalidateCursorPos_()
Definition: acccontext.cxx:432
bool IsRootFrame() const
Definition: frame.hxx:1150
virtual void InvalidateChildPosOrSize(const sw::access::SwAccessibleChild &rFrameOrObj, const SwRect &rFrame)
void ChildrenScrolled(const SwFrame *pFrame, const SwRect &rOldVisArea)
Definition: acccontext.cxx:119
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Definition: acccontext.cxx:566
void SetParent(SwAccessibleContext *pParent)
Definition: acccontext.cxx:67
virtual sal_Int32 SAL_CALL getForeground() override
Definition: acccontext.cxx:957
#define SAL_INFO_IF(condition, area, stream)
void DisposeChildren(const SwFrame *pFrame, bool bRecursive, bool bCanSkipInvisible)
Definition: acccontext.cxx:380
vcl::Window * GetWindow()
Definition: acccontext.cxx:83
static bool lcl_PointInRectangle(const awt::Point &aPoint, const awt::Rectangle &aRect)
Definition: acccontext.cxx:748
static const AllSettings & GetSettings()
const SwPosition * GetMark() const
Definition: pam.hxx:209
void Scrolled(const SwRect &rOldVisArea)
Definition: acccontext.cxx:260
virtual void SAL_CALL grabFocus() override
Definition: acccontext.cxx:918
SwViewShell * GetShell()
convenience method to get the SwViewShell through accessibility map
Definition: acccontext.hxx:116
TextFrameIndex GetOfst() const
Definition: txtfrm.hxx:426
virtual bool HasCursor()
virtual css::lang::Locale SAL_CALL getLocale() override
Return the parents locale or throw exception if this object has no parent yet/anymore.
Definition: acccontext.cxx:709
vcl::Window * GetAdditionalAccessibleChild(const sal_Int32 nIndex)
#i88070# - get additional accessible child by index
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
SwAccessibleContext(std::shared_ptr< SwAccessibleMap > const &pMap, sal_Int16 nRole, const SwFrame *pFrame)
Definition: acccontext.cxx:529
static sal_Int32 GetChildCount(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame *pFrame, bool bInPagePreviewr)
Definition: accframe.cxx:41
bool GetState(sal_Int16 aState)
void Move(long nHorzMoveDelta, long nVertMoveDelta)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
SwCursorShell * GetCursorShell()
convenience method to get SwCursorShell through accessibility map
Definition: acccontext.cxx:101
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
Definition: acccontext.cxx:967
SwViewShell * GetShell() const
Definition: accmap.hxx:169
::rtl::Reference< SwAccessibleContext > GetContextImpl(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1976
static sw::access::SwAccessibleChild GetChild(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame &rFrame, sal_Int32 &rPos, bool bInPagePreview)
Definition: accframe.cxx:71
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Definition: acccontext.cxx:683
void Top(const long nTop)
Definition: swrect.hxx:202
NONE
const SdrObject * GetDrawObject() const
Definition: accfrmobj.hxx:59
const SwFrame * GetFrame() const
Definition: accframe.hxx:103
const SwRect & getFrameArea() const
Definition: frame.hxx:175
void setX(long nX)
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool IsTextFrame() const
Definition: frame.hxx:1210
void GetAdditionalAccessibleChildren(std::vector< vcl::Window * > *pChildren)
#i88070# - get all additional accessible children
virtual void InvalidateContent_(bool bVisibleDataFired)
Definition: acccontext.cxx:428
long Top() const
virtual void DisposeChild(const sw::access::SwAccessibleChild &rFrameOrObj, bool bRecursive, bool bCanSkipInvisible)
bool IsVisibleChildrenOnly() const
Definition: accfrmobj.cxx:202
void setY(long nY)
bool IsEmpty() const
Definition: swrect.hxx:294
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
Definition: acccontext.cxx:717
void GetAllSidebarWinForFrame(const SwFrame &rFrame, std::vector< vcl::Window * > *pChildren)
Definition: PostItMgr.cxx:2430
bool Select(SwPaM *pPaM, SdrObject *pObj, bool bAdd)
long getY() const
bool IsOpaque(SwViewShell const *pVSh) const
Definition: accframe.cxx:356
void FireStateChangedEvent(sal_Int16 nState, bool bNewState)
Definition: acccontext.cxx:464
long getX() const
const SwFrame * GetSwFrame() const
Definition: accfrmobj.hxx:58
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:445
Shell * GetShell()
SwAccessibleMap * m_pMap
Definition: acccontext.hxx:74
const SwPosition * GetPoint() const
Definition: pam.hxx:207
const_iterator begin() const
bool FinishOLEObj()
Shutdown server.
Definition: feflyole.cxx:98
static sal_Int32 removeEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
bool HasAdditionalAccessibleChildren()
void InvalidateChildrenStates(const SwFrame *_pFrame, AccessibleStates _nStates)
Definition: acccontext.cxx:347
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
void InvalidateStates(AccessibleStates _nStates)
tools::Rectangle CoreToPixel(const tools::Rectangle &rRect) const
Definition: accmap.cxx:3263
void InvalidateAttr()
#i88069# - attributes has changed
void SetSelection(const SwPaM &rCursor)
Definition: crsrsh.cxx:3476
unsigned char sal_Bool
bool m_isRegisteredAtAccessibleMap
Definition: acccontext.hxx:94
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Definition: acccontext.cxx:641
#define SW_ADD_SELECT
Definition: fesh.hxx:165
bool AlwaysIncludeAsChild() const
indicating, if accessible child is included even, if the corresponding object is not visible...
Definition: accfrmobj.cxx:299
void InvalidateRelation(sal_uInt16 nType)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
sal_Int16 const m_nRole
Definition: acccontext.hxx:81
void SttSelect()
Definition: select.cxx:386
virtual void InvalidatePosOrSize(const SwRect &rFrame)
void SSize(const Size &rNew)
Definition: swrect.hxx:176
const_iterator end() const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Definition: acccontext.cxx:576
css::uno::WeakReference< css::accessibility::XAccessible > m_xWeakParent
Definition: acccontext.hxx:72
SwRect GetBounds(const SwAccessibleMap &rAccMap, const SwFrame *pFrame=nullptr)
Definition: accframe.cxx:328
A page of the document layout.
Definition: pagefrm.hxx:40
static void revokeClientNotifyDisposing(const TClientId _nClient, const css::uno::Reference< css::uno::XInterface > &_rxEventSource)
static void SetParent(std::shared_ptr< const SfxItemSet > &rpAttrSet, const SwContentNode &rNode, const SwFormat *pParentFormat, const SwFormat *pConditionalFormat)
Definition: node.cxx:102
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
virtual css::awt::Rectangle SAL_CALL getBounds() override
Definition: acccontext.cxx:879
void ScrolledWithin(const SwRect &rOldVisArea)
Definition: acccontext.cxx:279
bool HasFrameConnectedSidebarWins(const SwFrame &rFrame)
Definition: PostItMgr.cxx:2405
void ScrolledInShape(::accessibility::AccessibleShape *pAccImpl)
Definition: acccontext.cxx:989
void DisposeShape(const SdrObject *pObj,::accessibility::AccessibleShape *pAccImpl)
Definition: acccontext.cxx:972
css::awt::Rectangle getBoundsImpl(bool bRelative)
Get bounding box.
Definition: acccontext.cxx:829
bool IsLayoutFrame() const
Definition: frame.hxx:1146
void Left(const long nLeft)
Definition: swrect.hxx:193
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
Definition: acccontext.cxx:650
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
bool IsEditable(SwViewShell const *pVSh) const
Definition: accframe.cxx:339
virtual sal_Int32 SAL_CALL getBackground() override
Definition: acccontext.cxx:962
void RemoveFrameFromAccessibleMap()
virtual OUString SAL_CALL getAccessibleName() override
Definition: acccontext.cxx:677
tools::Rectangle SVRect() const
Definition: swrect.hxx:282
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Definition: acccontext.cxx:691
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
static void revokeClient(const TClientId _nClient)
virtual void Dispose(bool bRecursive, bool bCanSkipInvisible=true)
unsigned char sal_uInt8
vcl::Window * GetWin() const
Definition: viewsh.hxx:340
virtual void GetStates(::utl::AccessibleStateSetHelper &rStateSet)
Definition: acccontext.cxx:478
bool IsAccessible(bool bPagePreview) const
Definition: accfrmobj.cxx:122
sal_uInt32 m_nClientId
Definition: acccontext.hxx:80
virtual bool SetSelectedState(bool bSeleted)
const SwFrame * GetParent() const
Definition: accframe.hxx:155
void ShowCursor()
Definition: crsrsh.cxx:2371
size_t IsObjSelected() const
Definition: feshview.cxx:1167
css::uno::Reference< css::accessibility::XAccessible > GetContext(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1848
bool HasNotes() const
Definition: PostItMgr.cxx:2067
bool SelectObj(const Point &rSelPt, sal_uInt8 nFlag=0, SdrObject *pObj=nullptr)
If an object has been given, exactly this object is selected (instead of searching over position)...
Definition: feshview.cxx:185
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
void InvalidateTextSelection()
#i27301# - text selection has changed
css::uno::Reference< css::accessibility::XAccessible > GetWeakParent() const
Definition: acccontext.cxx:75
SwAccessibleMap * GetMap()
Definition: acccontext.hxx:112
long Left() const
vcl::Window * GetWindow() const
Definition: accfrmobj.hxx:60
virtual void InvalidateFocus_()
Definition: acccontext.cxx:436
void ClearMark()
Definition: crsrsh.cxx:926
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:559
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
Definition: acccontext.cxx:729
mutable::osl::Mutex m_Mutex
Definition: acccontext.hxx:64
SwRect GetBox(const SwAccessibleMap &rAccMap) const
Definition: accfrmobj.cxx:222
static void addEvent(const TClientId _nClient, const css::accessibility::AccessibleEventObject &_rEvent)
void Dispose(const T &xInterface)
const SwRect & GetVisArea() const
Definition: accframe.hxx:136
bool ShowNotes() const
Definition: PostItMgr.cxx:2061
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
Definition: acccontext.cxx:770
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Definition: acccontext.cxx:672
bool HasFocus() const
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
Definition: acccontext.cxx:560
void AddState(sal_Int16 aState)
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1245
AccessibleStates
Definition: accmap.hxx:70
bool IsFrameSelected() const
Definition: feshview.cxx:1175
virtual ~SwAccessibleContext() override
Definition: acccontext.cxx:545
static sal_Int32 addEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static sw::access::SwAccessibleChild GetChildAtPixel(const SwRect &rVisArea, const SwFrame &rFrame, const Point &rPos, bool bInPagePreview, SwAccessibleMap &rAccMap)
Definition: accframe.cxx:204
bool IsShowing(const SwAccessibleMap &rAccMap, const sw::access::SwAccessibleChild &rFrameOrObj) const
Definition: accframe.cxx:473