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