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