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
311 xParentImpl->FireAccessibleEvent( aEvent );
312
313 if( HasCursor() )
314 {
315 vcl::Window *pWin = GetWindow();
316 if( pWin && pWin->HasFocus() )
317 {
318 FireStateChangedEvent( AccessibleStateType::FOCUSED, true );
319 }
320 }
321}
322
323void SwAccessibleContext::ScrolledOut( const SwRect& rOldVisArea )
324{
326
327 // First of all, update the children. That's required to dispose
328 // all children that are existing only if they are visible. They
329 // are not disposed by the recursive Dispose call that follows later on,
330 // because this call will only dispose children that are in the
331 // new visible area. The children we want to dispose however are in the
332 // old visible area all.
333 ChildrenScrolled( GetFrame(), rOldVisArea );
334
335 // Broadcast a state changed event for the showing state.
336 // It might be that the child is freshly created just to send
337 // the child event. In this case no listener will exist.
338 FireStateChangedEvent( AccessibleStateType::SHOWING, false );
339
340 // this Dispose call was removed by IAccessibility2 implementation
341 // without giving any reason why - without it we get stale
342 // entries in SwAccessibleMap::mpFrameMap.
343 Dispose(true);
344}
345
346// #i27301# - use new type definition for <_nStates>
348 AccessibleStates _nStates )
349{
350 const SwAccessibleChildSList aVisList( GetVisArea(), *_pFrame, *(GetMap()) );
351
353 while( aIter != aVisList.end() )
354 {
355 const SwAccessibleChild& rLower = *aIter;
356 const SwFrame* pLower = rLower.GetSwFrame();
357 if( pLower )
358 {
360 if( rLower.IsAccessible( GetShell()->IsPreview() ) )
361 xAccImpl = GetMap()->GetContextImpl( pLower, false );
362 if( xAccImpl.is() )
363 xAccImpl->InvalidateStates( _nStates );
364 else
365 InvalidateChildrenStates( pLower, _nStates );
366 }
367 else if ( rLower.GetDrawObject() )
368 {
369 // TODO: SdrObjects
370 }
371 else if ( rLower.GetWindow() )
372 {
373 // nothing to do ?
374 }
375
376 ++aIter;
377 }
378}
379
381 bool bRecursive,
382 bool bCanSkipInvisible)
383{
384 const SwAccessibleChildSList aVisList( GetVisArea(), *pFrame, *(GetMap()) );
386 while( aIter != aVisList.end() )
387 {
388 const SwAccessibleChild& rLower = *aIter;
389 const SwFrame* pLower = rLower.GetSwFrame();
390 if( pLower )
391 {
392 // tdf#117601 dispose the darn thing if it ever was accessible
394 if( xAccImpl.is() )
395 xAccImpl->Dispose( bRecursive );
396 else
397 {
398 // it's possible that the xAccImpl *does* exist with a
399 // ref-count of 0 and blocked in its dtor in another thread -
400 // this call here could be from SwAccessibleMap dtor so
401 // remove it from any maps now!
402 GetMap()->RemoveContext(pLower);
403 // in this case the context will check with a weak_ptr
404 // that the map is still alive so it's not necessary
405 // to clear its m_pMap here.
406 if (bRecursive)
407 {
408 DisposeChildren(pLower, bRecursive, bCanSkipInvisible);
409 }
410 }
411 }
412 else if ( rLower.GetDrawObject() )
413 {
415 GetMap()->GetContextImpl( rLower.GetDrawObject(),
416 this, false ) );
417 if( xAccImpl.is() )
418 DisposeShape( rLower.GetDrawObject(), xAccImpl.get() );
419 }
420 else if ( rLower.GetWindow() )
421 {
422 DisposeChild(rLower, false, bCanSkipInvisible);
423 }
424 ++aIter;
425 }
426}
427
429{
430}
431
433{
434}
435
437{
438}
439
440void SwAccessibleContext::FireAccessibleEvent( AccessibleEventObject& rEvent )
441{
442 if( !GetFrame() )
443 {
444 SAL_WARN("sw.a11y", "SwAccessibleContext::FireAccessibleEvent called for already disposed frame?");
445 return;
446 }
447
448 if( !rEvent.Source.is() )
449 {
450 uno::Reference < XAccessibleContext > xThis( this );
451 rEvent.Source = xThis;
452 }
453
454 if (m_nClientId)
456}
457
459{
460 AccessibleEventObject aEvent;
461 aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
462
464}
465
467 bool bNewState )
468{
469 AccessibleEventObject aEvent;
470
471 aEvent.EventId = AccessibleEventId::STATE_CHANGED;
472 if( bNewState )
473 aEvent.NewValue <<= nState;
474 else
475 aEvent.OldValue <<= nState;
476
478}
479
480void SwAccessibleContext::GetStates( sal_Int64& rStateSet )
481{
482 SolarMutexGuard aGuard;
483
484 // SHOWING
486 rStateSet |= AccessibleStateType::SHOWING;
487
488 // EDITABLE
490 //Set editable state to graphic and other object when the document is editable
491 {
492 rStateSet |= AccessibleStateType::EDITABLE;
493 rStateSet |= AccessibleStateType::RESIZABLE;
494 rStateSet |= AccessibleStateType::MOVEABLE;
495 }
496 // ENABLED
497 rStateSet |= AccessibleStateType::ENABLED;
498
499 // OPAQUE
500 if (m_isOpaqueState)
501 rStateSet |= AccessibleStateType::OPAQUE;
502
503 // VISIBLE
504 rStateSet |= AccessibleStateType::VISIBLE;
505
506 if (m_isDefuncState)
507 rStateSet |= AccessibleStateType::DEFUNC;
508}
509
511{
512 bool bRet;
513 {
514 std::scoped_lock aGuard( m_Mutex );
515 bRet = m_isEditableState;
516 }
517
518 return bRet;
519}
520
522{
523 if (!(GetFrame() && GetMap()))
524 {
525 throw lang::DisposedException("object is nonfunctional",
526 static_cast<cppu::OWeakObject*>(this));
527 }
528}
529
530SwAccessibleContext::SwAccessibleContext(std::shared_ptr<SwAccessibleMap> const& pMap,
531 sal_Int16 const nRole,
532 const SwFrame *pF )
533 : SwAccessibleFrame( pMap->GetVisArea(), pF,
534 pMap->GetShell()->IsPreview() )
535 , m_pMap(pMap.get())
536 , m_wMap(pMap)
537 , m_nClientId(0)
538 , m_nRole(nRole)
539 , m_isDisposing( false )
540 , m_isRegisteredAtAccessibleMap( true )
541 , m_isSelectedInDoc(false)
542{
543 InitStates();
544}
545
547{
548 // must have for 2 reasons: 2. as long as this thread has SolarMutex
549 // another thread cannot destroy the SwAccessibleMap so our temporary
550 // taking a hard ref to SwAccessibleMap won't delay its destruction
551 SolarMutexGuard aGuard;
552 // must check with weak_ptr that m_pMap is still alive
553 std::shared_ptr<SwAccessibleMap> pMap(m_wMap.lock());
555 {
556 pMap->RemoveContext( GetFrame() );
557 }
558}
559
560uno::Reference< XAccessibleContext > SAL_CALL
562{
563 uno::Reference < XAccessibleContext > xRet( this );
564 return xRet;
565}
566
568{
569 SolarMutexGuard aGuard;
570
572
573 return m_isDisposing ? 0 : GetChildCount( *(GetMap()) );
574}
575
576uno::Reference< XAccessible> SAL_CALL
578{
579 SolarMutexGuard aGuard;
580
582
583 if (nIndex < 0 || nIndex >= getAccessibleChildCount())
584 throw lang::IndexOutOfBoundsException();
585
586 const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
587 if( !aChild.IsValid() )
588 {
589 uno::Reference < XAccessibleContext > xThis( this );
590 lang::IndexOutOfBoundsException aExcept(
591 "index out of bounds",
592 xThis );
593 throw aExcept;
594 }
595
596 uno::Reference< XAccessible > xChild;
597 if( aChild.GetSwFrame() )
598 {
600 GetMap()->GetContextImpl( aChild.GetSwFrame(), !m_isDisposing ) );
601 if( xChildImpl.is() )
602 {
603 xChildImpl->SetParent( this );
604 xChild = xChildImpl.get();
605 }
606 }
607 else if ( aChild.GetDrawObject() )
608 {
610 GetMap()->GetContextImpl( aChild.GetDrawObject(),
611 this, !m_isDisposing) );
612 if( xChildImpl.is() )
613 xChild = xChildImpl.get();
614 }
615 else if ( aChild.GetWindow() )
616 {
617 xChild = aChild.GetWindow()->GetAccessible();
618 }
619
620 return xChild;
621}
622
623css::uno::Sequence<uno::Reference<XAccessible>> SAL_CALL
625{
626 SolarMutexGuard aGuard;
627
629
630 std::list< sw::access::SwAccessibleChild > aChildren;
631 GetChildren( *GetMap(), aChildren );
632
633 std::vector<uno::Reference<XAccessible>> aRet;
634 aRet.reserve(aChildren.size());
635 for (const auto & rSwChild : aChildren)
636 {
637 uno::Reference< XAccessible > xChild;
638 if( rSwChild.GetSwFrame() )
639 {
641 GetMap()->GetContextImpl( rSwChild.GetSwFrame(), !m_isDisposing ) );
642 if( xChildImpl.is() )
643 {
644 xChildImpl->SetParent( this );
645 xChild = xChildImpl.get();
646 }
647 }
648 else if ( rSwChild.GetDrawObject() )
649 {
651 GetMap()->GetContextImpl( rSwChild.GetDrawObject(),
652 this, !m_isDisposing) );
653 if( xChildImpl.is() )
654 xChild = xChildImpl.get();
655 }
656 else if ( rSwChild.GetWindow() )
657 {
658 xChild = rSwChild.GetWindow()->GetAccessible();
659 }
660 aRet.push_back(xChild);
661 }
663}
664
666{
667 SolarMutexGuard aGuard;
668
669 const SwFrame *pUpper = GetParent();
670 OSL_ENSURE( pUpper != nullptr || m_isDisposing, "no upper found" );
671
672 uno::Reference< XAccessible > xAcc;
673 if( pUpper )
674 xAcc = GetMap()->GetContext( pUpper, !m_isDisposing );
675
676 OSL_ENSURE( xAcc.is() || m_isDisposing, "no parent found" );
677
678 // Remember the parent as weak ref.
679 {
680 std::scoped_lock aWeakParentGuard( m_Mutex );
681 m_xWeakParent = xAcc;
682 }
683
684 return xAcc;
685}
686
687uno::Reference< XAccessible> SAL_CALL SwAccessibleContext::getAccessibleParent()
688{
689 SolarMutexGuard aGuard;
690
692
694}
695
697{
698 SolarMutexGuard aGuard;
699
701
702 const SwFrame *pUpper = GetParent();
703 OSL_ENSURE( pUpper != nullptr || m_isDisposing, "no upper found" );
704
705 sal_Int64 nIndex = -1;
706 if( pUpper )
707 {
709 GetMap()->GetContextImpl(pUpper, !m_isDisposing) );
710 OSL_ENSURE( xAccImpl.is() || m_isDisposing, "no parent found" );
711 if( xAccImpl.is() )
712 nIndex = xAccImpl->GetChildIndex( *(GetMap()), SwAccessibleChild(GetFrame()) );
713 }
714
715 return nIndex;
716}
717
719{
720 return m_nRole;
721}
722
724{
725 return m_sName;
726}
727
728uno::Reference< XAccessibleRelationSet> SAL_CALL
730{
731 // by default there are no relations
732 uno::Reference< XAccessibleRelationSet> xRet( new utl::AccessibleRelationSetHelper() );
733 return xRet;
734}
735
737{
738 SolarMutexGuard aGuard;
739
741
742 sal_Int64 nStateSet = 0;
743
745 nStateSet |= AccessibleStateType::SELECTED;
746
747 GetStates( nStateSet );
748
749 return nStateSet;
750}
751
752lang::Locale SAL_CALL SwAccessibleContext::getLocale()
753{
754 SolarMutexGuard aGuard;
755
756 lang::Locale aLoc( Application::GetSettings().GetLanguageTag().getLocale() );
757 return aLoc;
758}
759
761 const uno::Reference< XAccessibleEventListener >& xListener )
762{
763 if (xListener.is())
764 {
765 SolarMutexGuard aGuard;
766 if (!m_nClientId)
769 }
770}
771
773 const uno::Reference< XAccessibleEventListener >& xListener )
774{
775 if (!(xListener.is() && m_nClientId))
776 return;
777
778 SolarMutexGuard aGuard;
779 sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
780 if ( !nListenerCount )
781 {
782 // no listeners anymore
783 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
784 // and at least to us not firing any events anymore, in case somebody calls
785 // NotifyAccessibleEvent, again
787 m_nClientId = 0;
788 }
789}
790
791static bool lcl_PointInRectangle(const awt::Point & aPoint,
792 const awt::Rectangle & aRect)
793{
794 tools::Long nDiffX = aPoint.X - aRect.X;
795 tools::Long nDiffY = aPoint.Y - aRect.Y;
796
797 return
798 nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
799 nDiffY < aRect.Height;
800
801}
802
804 const awt::Point& aPoint )
805{
806 awt::Rectangle aPixBounds = getBoundsImpl(true);
807 aPixBounds.X = 0;
808 aPixBounds.Y = 0;
809
810 return lcl_PointInRectangle(aPoint, aPixBounds);
811}
812
813uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint(
814 const awt::Point& aPoint )
815{
816 SolarMutexGuard aGuard;
817
819
820 uno::Reference< XAccessible > xAcc;
821
822 vcl::Window *pWin = GetWindow();
823 if (!pWin)
824 {
825 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
826 }
827
828 Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
829 if( !GetFrame()->IsRootFrame() )
830 {
831 SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
832 Point aPixPos( GetMap()->CoreToPixel( aLogBounds ).TopLeft() );
833 aPixPoint.setX(aPixPoint.getX() + aPixPos.getX());
834 aPixPoint.setY(aPixPoint.getY() + aPixPos.getY());
835 }
836
837 const SwAccessibleChild aChild( GetChildAtPixel( aPixPoint, *(GetMap()) ) );
838 if( aChild.GetSwFrame() )
839 {
840 xAcc = GetMap()->GetContext( aChild.GetSwFrame() );
841 }
842 else if( aChild.GetDrawObject() )
843 {
844 xAcc = GetMap()->GetContext( aChild.GetDrawObject(), this );
845 }
846 else if ( aChild.GetWindow() )
847 {
848 xAcc = aChild.GetWindow()->GetAccessible();
849 }
850
851 return xAcc;
852}
853
872awt::Rectangle SwAccessibleContext::getBoundsImpl(bool bRelative)
873{
874 SolarMutexGuard aGuard;
875
877
878 const SwFrame *pParent = GetParent();
879 OSL_ENSURE( pParent, "no Parent found" );
880 vcl::Window *pWin = GetWindow();
881
882 if (!pParent)
883 {
884 throw uno::RuntimeException("no Parent", static_cast<cppu::OWeakObject*>(this));
885 }
886 if (!pWin)
887 {
888 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
889 }
890
891 SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip relative to document root
892 tools::Rectangle aPixBounds( 0, 0, 0, 0 );
893 if( GetFrame()->IsPageFrame() &&
894 static_cast < const SwPageFrame * >( GetFrame() )->IsEmptyPage() )
895 {
896 OSL_ENSURE( GetShell()->IsPreview(), "empty page accessible?" );
897 if( GetShell()->IsPreview() )
898 {
899 // adjust method call <GetMap()->GetPreviewPageSize()>
900 sal_uInt16 nPageNum =
901 static_cast < const SwPageFrame * >( GetFrame() )->GetPhyPageNum();
902 aLogBounds.SSize( GetMap()->GetPreviewPageSize( nPageNum ) );
903 }
904 }
905 if( !aLogBounds.IsEmpty() )
906 {
907 aPixBounds = GetMap()->CoreToPixel( aLogBounds );
908 if( !pParent->IsRootFrame() && bRelative)
909 {
910 SwRect aParentLogBounds( GetBounds( *(GetMap()), pParent ) ); // twip rel to doc root
911 Point aParentPixPos( GetMap()->CoreToPixel( aParentLogBounds ).TopLeft() );
912 aPixBounds.Move( -aParentPixPos.getX(), -aParentPixPos.getY() );
913 }
914 }
915
916 awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
917 aPixBounds.GetWidth(), aPixBounds.GetHeight() );
918
919 return aBox;
920}
921
922awt::Rectangle SAL_CALL SwAccessibleContext::getBounds()
923{
924 return getBoundsImpl(true);
925}
926
928{
929 awt::Rectangle aRect = getBoundsImpl(true);
930 awt::Point aPoint(aRect.X, aRect.Y);
931
932 return aPoint;
933}
934
936{
937 awt::Rectangle aRect = getBoundsImpl(false);
938
939 Point aPixPos(aRect.X, aRect.Y);
940
941 vcl::Window *pWin = GetWindow();
942 if (!pWin)
943 {
944 throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
945 }
946
947 aPixPos = pWin->OutputToAbsoluteScreenPixel(aPixPos);
948 awt::Point aPoint(aPixPos.getX(), aPixPos.getY());
949
950 return aPoint;
951}
952
954{
955 awt::Rectangle aRect = getBoundsImpl(false);
956 awt::Size aSize( aRect.Width, aRect.Height );
957
958 return aSize;
959}
960
962{
963 SolarMutexGuard aGuard;
964
966
967 if( GetFrame()->IsFlyFrame() )
968 {
969 const SdrObject *pObj =
970 static_cast < const SwFlyFrame * >( GetFrame() )->GetVirtDrawObj();
971 if( pObj )
972 Select( const_cast < SdrObject * >( pObj ), false );
973 }
974 else
975 {
976 const SwContentFrame *pCFrame = nullptr;
977 if( GetFrame()->IsContentFrame() )
978 pCFrame = static_cast< const SwContentFrame * >( GetFrame() );
979 else if( GetFrame()->IsLayoutFrame() )
980 pCFrame = static_cast< const SwLayoutFrame * >( GetFrame() )->ContainsContent();
981
982 if( pCFrame && pCFrame->IsTextFrame() )
983 {
984 const SwTextFrame *pTextFrame = static_cast< const SwTextFrame * >( pCFrame );
985 const SwTextNode *pTextNd = pTextFrame->GetTextNodeFirst();
986 assert(pTextNd); // can it actually be null? probably not=>simplify
987 if( pTextNd )
988 {
989 // create pam for selection
990 SwPosition const aStartPos(pTextFrame->MapViewToModelPos(pTextFrame->GetOffset()));
991 SwPaM aPaM( aStartPos );
992
993 // set PaM at cursor shell
994 Select( aPaM );
995 }
996 }
997 }
998}
999
1001{
1002 return sal_Int32(COL_BLACK);
1003}
1004
1006{
1007 return sal_Int32(COL_WHITE);
1008}
1009
1010sal_Bool SAL_CALL SwAccessibleContext::supportsService (const OUString& ServiceName)
1011{
1012 return cppu::supportsService(this, ServiceName);
1013}
1014
1017{
1019 if( !xAccImpl.is() )
1020 xAccImpl = GetMap()->GetContextImpl( pObj, this );
1021
1022 AccessibleEventObject aEvent;
1023 aEvent.EventId = AccessibleEventId::CHILD;
1024 uno::Reference< XAccessible > xAcc( xAccImpl );
1025 aEvent.OldValue <<= xAcc;
1027
1028 GetMap()->RemoveContext( pObj );
1029 xAccImpl->dispose();
1030}
1031
1033{
1034 if(nullptr == pAccImpl)
1035 {
1036 return ;
1037 }
1038 AccessibleEventObject aEvent;
1039 aEvent.EventId = AccessibleEventId::CHILD;
1040 uno::Reference< XAccessible > xAcc( pAccImpl );
1041 aEvent.NewValue <<= xAcc;
1043
1044 if( !pAccImpl->GetState( AccessibleStateType::FOCUSED ) )
1045 return;
1046
1047 vcl::Window *pWin = GetWindow();
1048 if( pWin && pWin->HasFocus() )
1049 {
1050 AccessibleEventObject aStateChangedEvent;
1051 aStateChangedEvent.EventId = AccessibleEventId::STATE_CHANGED;
1052 aStateChangedEvent.NewValue <<= AccessibleStateType::FOCUSED;
1053 aStateChangedEvent.Source = xAcc;
1054
1055 FireAccessibleEvent( aStateChangedEvent );
1056 }
1057}
1058
1059void SwAccessibleContext::Dispose(bool bRecursive, bool bCanSkipInvisible)
1060{
1061 SolarMutexGuard aGuard;
1062
1063 OSL_ENSURE( GetFrame() && GetMap(), "already disposed" );
1064 OSL_ENSURE( GetMap()->GetVisArea() == GetVisArea(),
1065 "invalid visible area for dispose" );
1066
1067 m_isDisposing = true;
1068
1069 // dispose children
1070 if( bRecursive )
1071 DisposeChildren(GetFrame(), bRecursive, bCanSkipInvisible);
1072
1073 // get parent
1074 uno::Reference< XAccessible > xParent( GetWeakParent() );
1075 uno::Reference < XAccessibleContext > xThis( this );
1076
1077 // send child event at parent
1078 if( xParent.is() )
1079 {
1080 SwAccessibleContext *pAcc = static_cast<SwAccessibleContext *>(xParent.get());
1081
1082 AccessibleEventObject aEvent;
1083 aEvent.EventId = AccessibleEventId::CHILD;
1084 aEvent.OldValue <<= xThis;
1085 pAcc->FireAccessibleEvent( aEvent );
1086 }
1087
1088 // set defunc state (it's not required to broadcast a state changed
1089 // event if the object is disposed afterwards)
1090 {
1091 std::scoped_lock aDefuncStateGuard( m_Mutex );
1092 m_isDefuncState = true;
1093 }
1094
1095 // broadcast dispose event
1096 if (m_nClientId)
1097 {
1099 m_nClientId = 0;
1100 }
1101
1103 ClearFrame();
1104 m_pMap = nullptr;
1105 m_wMap.reset();
1106
1107 m_isDisposing = false;
1108}
1109
1111 bool bRecursive, bool bCanSkipInvisible )
1112{
1113 SolarMutexGuard aGuard;
1114
1115 if ( !bCanSkipInvisible ||
1116 rChildFrameOrObj.AlwaysIncludeAsChild() ||
1117 IsShowing( *(GetMap()), rChildFrameOrObj ) ||
1118 !SwAccessibleChild( GetFrame() ).IsVisibleChildrenOnly() )
1119 {
1120 // If the object could have existed before, then there is nothing to do,
1121 // because no wrapper exists now and therefore no one is interested to
1122 // get notified of the movement.
1123 if( rChildFrameOrObj.GetSwFrame() )
1124 {
1126 GetMap()->GetContextImpl( rChildFrameOrObj.GetSwFrame(), false );
1127 if (xAccImpl)
1128 xAccImpl->Dispose( bRecursive );
1129 }
1130 else if ( rChildFrameOrObj.GetDrawObject() )
1131 {
1133 GetMap()->GetContextImpl( rChildFrameOrObj.GetDrawObject(),
1134 this, false );
1135 if (xAccImpl)
1136 DisposeShape( rChildFrameOrObj.GetDrawObject(),
1137 xAccImpl.get() );
1138 }
1139 else if ( rChildFrameOrObj.GetWindow() )
1140 {
1141 AccessibleEventObject aEvent;
1142 aEvent.EventId = AccessibleEventId::CHILD;
1143 uno::Reference< XAccessible > xAcc =
1144 rChildFrameOrObj.GetWindow()->GetAccessible();
1145 aEvent.OldValue <<= xAcc;
1147 }
1148 }
1149 else if( bRecursive && rChildFrameOrObj.GetSwFrame() )
1150 DisposeChildren(rChildFrameOrObj.GetSwFrame(), bRecursive, bCanSkipInvisible);
1151}
1152
1154{
1155 SolarMutexGuard aGuard;
1156
1157 OSL_ENSURE( GetFrame() && !GetFrame()->getFrameArea().IsEmpty(), "context should have a size" );
1158
1159 bool bIsOldShowingState;
1160 bool bIsNewShowingState = IsShowing( *(GetMap()) );
1161 {
1162 std::scoped_lock aShowingStateGuard( m_Mutex );
1163 bIsOldShowingState = m_isShowingState;
1164 m_isShowingState = bIsNewShowingState;
1165 }
1166
1167 if( bIsOldShowingState != bIsNewShowingState )
1168 {
1169 FireStateChangedEvent( AccessibleStateType::SHOWING,
1170 bIsNewShowingState );
1171 }
1172 else if( bIsNewShowingState )
1173 {
1174 // The frame stays visible -> broadcast event
1176 }
1177
1178 // note: InvalidatePosOrSize must call InvalidateContent_ so that
1179 // SwAccessibleParagraph updates its portions, or dispose it
1180 // (see accmap.cxx: INVALID_CONTENT is contained in POS_CHANGED)
1181 if( !bIsNewShowingState &&
1182 SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
1183 {
1184 // this Dispose call was removed by IAccessibility2 implementation
1185 // without giving any reason why - without it we get stale
1186 // entries in SwAccessibleMap::mpFrameMap.
1187 Dispose(true);
1188 }
1189 else
1190 {
1191 InvalidateContent_( true );
1192 }
1193}
1194
1196 const SwAccessibleChild& rChildFrameOrObj,
1197 const SwRect& rOldFrame )
1198{
1199 SolarMutexGuard aGuard;
1200
1201 // this happens during layout, e.g. when a page is deleted and next page's
1202 // header/footer moves backward such an event is generated
1203 SAL_INFO_IF(rChildFrameOrObj.GetSwFrame() &&
1204 rChildFrameOrObj.GetSwFrame()->getFrameArea().IsEmpty(),
1205 "sw.a11y", "child context should have a size");
1206
1207 if ( rChildFrameOrObj.AlwaysIncludeAsChild() )
1208 {
1209 // nothing to do;
1210 return;
1211 }
1212
1213 const bool bVisibleChildrenOnly = SwAccessibleChild( GetFrame() ).IsVisibleChildrenOnly();
1214 const bool bNew = rOldFrame.IsEmpty() ||
1215 ( rOldFrame.Left() == 0 && rOldFrame.Top() == 0 );
1216 if( IsShowing( *(GetMap()), rChildFrameOrObj ) )
1217 {
1218 // If the object could have existed before, then there is nothing to do,
1219 // because no wrapper exists now and therefore no one is interested to
1220 // get notified of the movement.
1221 if( bNew || (bVisibleChildrenOnly && !IsShowing( rOldFrame )) )
1222 {
1223 if( rChildFrameOrObj.GetSwFrame() )
1224 {
1225 // The frame becomes visible. A child event must be send.
1227 GetMap()->GetContextImpl( rChildFrameOrObj.GetSwFrame() );
1228 xAccImpl->ScrolledIn();
1229 }
1230 else if ( rChildFrameOrObj.GetDrawObject() )
1231 {
1233 GetMap()->GetContextImpl( rChildFrameOrObj.GetDrawObject(),
1234 this );
1235 // #i37790#
1236 if ( xAccImpl.is() )
1237 {
1238 ScrolledInShape( xAccImpl.get() );
1239 }
1240 else
1241 {
1242 OSL_FAIL( "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - no accessible shape found." );
1243 }
1244 }
1245 else if ( rChildFrameOrObj.GetWindow() )
1246 {
1247 AccessibleEventObject aEvent;
1248 aEvent.EventId = AccessibleEventId::CHILD;
1249 aEvent.NewValue <<= rChildFrameOrObj.GetWindow()->GetAccessible();
1251 }
1252 }
1253 }
1254 else
1255 {
1256 // If the frame was visible before, then a child event for the parent
1257 // needs to be send. However, there is no wrapper existing, and so
1258 // no notifications for grandchildren are required. If the are
1259 // grandgrandchildren, they would be notified by the layout.
1260 if( bVisibleChildrenOnly &&
1261 !bNew && IsShowing( rOldFrame ) )
1262 {
1263 if( rChildFrameOrObj.GetSwFrame() )
1264 {
1266 GetMap()->GetContextImpl( rChildFrameOrObj.GetSwFrame() );
1267 xAccImpl->SetParent( this );
1268 xAccImpl->Dispose( true );
1269 }
1270 else if ( rChildFrameOrObj.GetDrawObject() )
1271 {
1273 GetMap()->GetContextImpl( rChildFrameOrObj.GetDrawObject(),
1274 this );
1275 DisposeShape( rChildFrameOrObj.GetDrawObject(),
1276 xAccImpl.get() );
1277 }
1278 else if ( rChildFrameOrObj.GetWindow() )
1279 {
1280 OSL_FAIL( "<SwAccessibleContext::InvalidateChildPosOrSize(..)> - not expected to handle dispose of child of type <vcl::Window>." );
1281 }
1282 }
1283 }
1284}
1285
1287{
1288 SolarMutexGuard aGuard;
1289
1290 InvalidateContent_( false );
1291}
1292
1294{
1295 SolarMutexGuard aGuard;
1296
1298}
1299
1301{
1302 SolarMutexGuard aGuard;
1303
1305}
1306
1307// #i27301# - use new type definition for <_nStates>
1309{
1310 if( !GetMap() )
1311 return;
1312
1313 SwViewShell *pVSh = GetMap()->GetShell();
1314 if( pVSh )
1315 {
1316 if( _nStates & AccessibleStates::EDITABLE )
1317 {
1318 bool bIsOldEditableState;
1319 bool bIsNewEditableState = IsEditable( pVSh );
1320 {
1321 std::scoped_lock aGuard( m_Mutex );
1322 bIsOldEditableState = m_isEditableState;
1323 m_isEditableState = bIsNewEditableState;
1324 }
1325
1326 if( bIsOldEditableState != bIsNewEditableState )
1327 FireStateChangedEvent( AccessibleStateType::EDITABLE,
1328 bIsNewEditableState );
1329 }
1330 if( _nStates & AccessibleStates::OPAQUE )
1331 {
1332 bool bIsOldOpaqueState;
1333 bool bIsNewOpaqueState = IsOpaque( pVSh );
1334 {
1335 std::scoped_lock aGuard( m_Mutex );
1336 bIsOldOpaqueState = m_isOpaqueState;
1337 m_isOpaqueState = bIsNewOpaqueState;
1338 }
1339
1340 if( bIsOldOpaqueState != bIsNewOpaqueState )
1341 FireStateChangedEvent( AccessibleStateType::OPAQUE,
1342 bIsNewOpaqueState );
1343 }
1344 }
1345
1346 InvalidateChildrenStates( GetFrame(), _nStates );
1347}
1348
1350{
1351 AccessibleEventObject aEvent;
1352 aEvent.EventId = nType;
1353
1355}
1356
1359{
1360 AccessibleEventObject aEvent;
1361 aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
1362
1364}
1365
1368{
1369 AccessibleEventObject aEvent;
1370 aEvent.EventId = AccessibleEventId::TEXT_ATTRIBUTE_CHANGED;
1371
1373}
1374
1376{
1377 return false;
1378}
1379
1381 bool bAdd )
1382{
1383 SwCursorShell* pCursorShell = GetCursorShell();
1384 if( !pCursorShell )
1385 return false;
1386
1387 SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCursorShell);
1388 // Get rid of activated OLE object
1389 if( pFEShell )
1390 pFEShell->FinishOLEObj();
1391
1392 SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(pCursorShell);
1393
1394 bool bRet = false;
1395 if( pObj )
1396 {
1397 if( pFEShell )
1398 {
1399 sal_uInt8 nFlags = bAdd ? SW_ADD_SELECT : 0;
1400 pFEShell->SelectObj( Point(), nFlags, pObj );
1401 bRet = true;
1402 }
1403 }
1404 else if( pPaM )
1405 {
1406 // Get rid of frame selection. If there is one, make text cursor
1407 // visible again.
1408 bool bCallShowCursor = false;
1409 if( pFEShell && (pFEShell->IsFrameSelected() ||
1410 pFEShell->IsObjSelected()) )
1411 {
1412 Point aPt( LONG_MIN, LONG_MIN );
1413 pFEShell->SelectObj( aPt );
1414 bCallShowCursor = true;
1415 }
1416 pCursorShell->KillPams();
1417 if( pWrtShell && pPaM->HasMark() )
1418 // We have to do this or SwWrtShell can't figure out that it needs
1419 // to kill the selection later, when the user moves the cursor.
1420 pWrtShell->SttSelect();
1421 pCursorShell->SetSelection( *pPaM );
1422 if( pPaM->HasMark() && *pPaM->GetPoint() == *pPaM->GetMark())
1423 // Setting a "Selection" that starts and ends at the same spot
1424 // should remove the selection rather than create an empty one, so
1425 // that we get defined behavior if accessibility sets the cursor
1426 // later.
1427 pCursorShell->ClearMark();
1428 if( bCallShowCursor )
1429 pCursorShell->ShowCursor();
1430 bRet = true;
1431 }
1432
1433 return bRet;
1434}
1435
1437 const OUString *pArg1,
1438 const OUString *pArg2)
1439{
1440 OUString sStr = SwResId(pResId);
1441
1442 if( pArg1 )
1443 {
1444 sStr = sStr.replaceFirst( "$(ARG1)", *pArg1 );
1445 }
1446 if( pArg2 )
1447 {
1448 sStr = sStr.replaceFirst( "$(ARG2)", *pArg2 );
1449 }
1450
1451 return sStr;
1452}
1453
1455{
1456 assert(m_refCount > 0); // must be alive to do this without using m_wMap
1459}
1460
1462{
1463 bool bRet( false );
1464
1465 if ( GetFrame()->IsTextFrame() )
1466 {
1467 SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1468 if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1469 {
1470 bRet = pPostItMgr->HasFrameConnectedSidebarWins( *(GetFrame()) );
1471 }
1472 }
1473
1474 return bRet;
1475}
1476
1479{
1480 vcl::Window* pAdditionalAccessibleChild( nullptr );
1481
1482 if ( GetFrame()->IsTextFrame() )
1483 {
1484 SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1485 if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1486 {
1487 pAdditionalAccessibleChild =
1488 pPostItMgr->GetSidebarWinForFrameByIndex( *(GetFrame()), nIndex );
1489 }
1490 }
1491
1492 return pAdditionalAccessibleChild;
1493}
1494
1496void SwAccessibleContext::GetAdditionalAccessibleChildren( std::vector< vcl::Window* >* pChildren )
1497{
1498 if ( GetFrame()->IsTextFrame() )
1499 {
1500 SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
1501 if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1502 {
1503 pPostItMgr->GetAllSidebarWinForFrame( *(GetFrame()), pChildren );
1504 }
1505 }
1506}
1507
1509{
1510 if (m_isSelectedInDoc != bSelected)
1511 {
1512 m_isSelectedInDoc = bSelected;
1513 FireStateChangedEvent( AccessibleStateType::SELECTED, bSelected );
1514 return true;
1515 }
1516 return false;
1517};
1518
1519/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool lcl_PointInRectangle(const awt::Point &aPoint, const awt::Rectangle &aRect)
Definition: acccontext.cxx:791
AccessibleStates
Definition: accmap.hxx:71
AnyEventRef aEvent
static const AllSettings & GetSettings()
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:567
virtual ~SwAccessibleContext() override
Definition: acccontext.cxx:546
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:624
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:927
void FireStateChangedEvent(sal_Int64 nState, bool bNewState)
Definition: acccontext.cxx:466
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
Definition: acccontext.cxx:803
virtual OUString SAL_CALL getAccessibleName() override
Definition: acccontext.cxx:723
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:813
void DisposeShape(const SdrObject *pObj, ::accessibility::AccessibleShape *pAccImpl)
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Definition: acccontext.cxx:729
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Definition: acccontext.cxx:718
css::awt::Rectangle getBoundsImpl(bool bRelative)
Get bounding box.
Definition: acccontext.cxx:872
virtual void InvalidateCursorPos_()
Definition: acccontext.cxx:432
virtual void InvalidateChildPosOrSize(const sw::access::SwAccessibleChild &rFrameOrObj, const SwRect &rFrame)
void FireAccessibleEvent(css::accessibility::AccessibleEventObject &rEvent)
Definition: acccontext.cxx:440
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:480
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Definition: acccontext.cxx:687
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:752
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
Definition: acccontext.cxx:561
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:380
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:436
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:428
virtual void SAL_CALL grabFocus() override
Definition: acccontext.cxx:961
SwAccessibleMap * GetMap()
Definition: acccontext.hxx:112
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
Definition: acccontext.cxx:696
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
Definition: acccontext.cxx:772
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
Definition: acccontext.cxx:736
bool Select(SwPaM *pPaM, SdrObject *pObj, bool bAdd)
virtual css::awt::Rectangle SAL_CALL getBounds() override
Definition: acccontext.cxx:922
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:530
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
Definition: acccontext.cxx:760
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:953
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:323
void InvalidateChildrenStates(const SwFrame *_pFrame, AccessibleStates _nStates)
Definition: acccontext.cxx:347
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:577
void InvalidateStates(AccessibleStates _nStates)
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
Definition: acccontext.cxx:935
css::uno::Reference< css::accessibility::XAccessible > getAccessibleParentImpl()
Definition: acccontext.cxx:665
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:103
const SwFrame * GetParent() const
Definition: accframe.hxx:155
void SetVisArea(const SwRect &rNewVisArea)
Definition: accframe.hxx:131
const SwRect & GetVisArea() const
Definition: accframe.hxx:136
tools::Rectangle CoreToPixel(const SwRect &rRect) const
Definition: accmap.cxx:3199
Size GetPreviewPageSize(sal_uInt16 _nPreviewPageNum) const
get size of a dedicated preview page
Definition: accmap.cxx:3235
::rtl::Reference< SwAccessibleContext > GetContextImpl(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1913
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:1785
SwViewShell * GetShell() const
Definition: accmap.hxx:174
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
void ShowCursor()
Definition: crsrsh.cxx:2410
void SetSelection(const SwPaM &rCursor)
Definition: crsrsh.cxx:3529
void ClearMark()
Definition: crsrsh.cxx:939
void KillPams()
Definition: crsrsh.cxx:1022
bool IsFrameSelected() const
Definition: feshview.cxx:1253
bool FinishOLEObj()
Shutdown server.
Definition: feflyole.cxx:88
size_t IsObjSelected() const
Definition: feshview.cxx:1245
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:177
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:1234
bool IsRootFrame() const
Definition: frame.hxx:1174
bool IsLayoutFrame() const
Definition: frame.hxx:1170
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:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
const SwPosition * GetPoint() const
Definition: pam.hxx:261
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
A page of the document layout.
Definition: pagefrm.hxx:58
bool HasNotes() const
Definition: PostItMgr.cxx:2122
bool ShowNotes() const
Definition: PostItMgr.cxx:2116
vcl::Window * GetSidebarWinForFrameByIndex(const SwFrame &rFrame, const sal_Int32 nIndex)
Definition: PostItMgr.cxx:2474
bool HasFrameConnectedSidebarWins(const SwFrame &rFrame)
Definition: PostItMgr.cxx:2462
void GetAllSidebarWinForFrame(const SwFrame &rFrame, std::vector< vcl::Window * > *pChildren)
Definition: PostItMgr.cxx:2487
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:165
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1246
TextFrameIndex GetOffset() const
Definition: txtfrm.hxx:444
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:463
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
vcl::Window * GetWin() const
Definition: viewsh.hxx:346
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:566
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void SttSelect()
Definition: select.cxx:385
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_WARN(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:37
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
unsigned char sal_uInt8
unsigned char sal_Bool