LibreOffice Module sw (master)  1
accmap.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 <rtl/ref.hxx>
21 #include <cppuhelper/weakref.hxx>
22 #include <vcl/window.hxx>
23 #include <svx/svdmodel.hxx>
24 #include <svx/unomod.hxx>
25 #include <algorithm>
26 #include <map>
27 #include <unordered_map>
28 #include <list>
29 #include <vector>
30 #include <accmap.hxx>
31 #include "acccontext.hxx"
32 #include "accdoc.hxx"
33 #include <strings.hrc>
34 #include "accpreview.hxx"
35 #include "accpage.hxx"
36 #include "accpara.hxx"
37 #include "accheaderfooter.hxx"
38 #include "accfootnote.hxx"
39 #include "acctextframe.hxx"
40 #include "accgraphic.hxx"
41 #include "accembedded.hxx"
42 #include "acccell.hxx"
43 #include "acctable.hxx"
44 #include <fesh.hxx>
45 #include <istype.hxx>
46 #include <rootfrm.hxx>
47 #include <txtfrm.hxx>
48 #include <hffrm.hxx>
49 #include <ftnfrm.hxx>
50 #include <cellfrm.hxx>
51 #include <tabfrm.hxx>
52 #include <pagefrm.hxx>
53 #include <flyfrm.hxx>
54 #include <ndtyp.hxx>
57 #include <svx/ShapeTypeHandler.hxx>
58 #include <svx/SvxShapeTypes.hxx>
59 #include <svx/svdpage.hxx>
60 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
61 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
62 #include <com/sun/star/accessibility/AccessibleRole.hpp>
63 #include <com/sun/star/beans/XPropertySet.hpp>
64 #include <com/sun/star/document/XShapeEventBroadcaster.hpp>
65 #include <cppuhelper/implbase.hxx>
67 #include <pagepreviewlayout.hxx>
68 #include <dcontact.hxx>
69 #include <svx/svdmark.hxx>
70 #include <doc.hxx>
71 #include <drawdoc.hxx>
72 #include <pam.hxx>
73 #include <ndtxt.hxx>
74 #include <dflyobj.hxx>
75 #include <prevwpage.hxx>
76 #include <calbck.hxx>
77 #include <undobj.hxx>
78 #include <tools/diagnose_ex.h>
79 #include <tools/debug.hxx>
80 
81 using namespace ::com::sun::star;
82 using namespace ::com::sun::star::accessibility;
83 using namespace ::sw::access;
84 
86 {
87 public:
88  typedef const SwFrame * key_type;
89  typedef uno::WeakReference < XAccessible > mapped_type;
90  typedef std::pair<const key_type,mapped_type> value_type;
91  typedef std::map<key_type, mapped_type>::iterator iterator;
92  typedef std::map<key_type, mapped_type>::const_iterator const_iterator;
93 private:
94  std::map <key_type, mapped_type> maMap;
95 public:
96 
97 #if OSL_DEBUG_LEVEL > 0
98  bool mbLocked;
99 #endif
100 
102 #if OSL_DEBUG_LEVEL > 0
103  : mbLocked( false )
104 #endif
105  {}
106 
107  iterator begin() { return maMap.begin(); }
108  iterator end() { return maMap.end(); }
109  bool empty() const { return maMap.empty(); }
110  void clear() { maMap.clear(); }
111  iterator find(const key_type& key) { return maMap.find(key); }
112  template<class... Args>
113  std::pair<iterator,bool> emplace(Args&&... args) { return maMap.emplace(std::forward<Args>(args)...); }
114  iterator erase(const_iterator const & pos) { return maMap.erase(pos); }
115 };
116 
117 namespace {
118 
119 class SwDrawModellListener_Impl : public SfxListener,
120  public ::cppu::WeakImplHelper< document::XShapeEventBroadcaster >
121 {
122  mutable ::osl::Mutex maListenerMutex;
124  std::unordered_multimap<css::uno::Reference< css::drawing::XShape >, css::uno::Reference< css::document::XShapeEventListener >> maShapeListeners;
125  SdrModel *mpDrawModel;
126 protected:
127  virtual ~SwDrawModellListener_Impl() override;
128 
129 public:
130  explicit SwDrawModellListener_Impl( SdrModel *pDrawModel );
131 
132  // css::document::XEventBroadcaster
133  virtual void SAL_CALL addEventListener( const uno::Reference< document::XEventListener >& xListener ) override;
134  virtual void SAL_CALL removeEventListener( const uno::Reference< document::XEventListener >& xListener ) override;
135  // css::document::XShapeEventBroadcaster
136  virtual void SAL_CALL addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::document::XShapeEventListener >& xListener ) override;
137  virtual void SAL_CALL removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::document::XShapeEventListener >& xListener ) override;
138 
139  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
140  void Dispose();
141 };
142 
143 }
144 
145 SwDrawModellListener_Impl::SwDrawModellListener_Impl( SdrModel *pDrawModel ) :
146  maEventListeners( maListenerMutex ),
147  mpDrawModel( pDrawModel )
148 {
149  StartListening( *mpDrawModel );
150 }
151 
152 SwDrawModellListener_Impl::~SwDrawModellListener_Impl()
153 {
154  Dispose();
155 }
156 
157 void SAL_CALL SwDrawModellListener_Impl::addEventListener( const uno::Reference< document::XEventListener >& xListener )
158 {
159  maEventListeners.addInterface( xListener );
160 }
161 
162 void SAL_CALL SwDrawModellListener_Impl::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
163 {
164  maEventListeners.removeInterface( xListener );
165 }
166 
167 void SAL_CALL SwDrawModellListener_Impl::addShapeEventListener(
168  const css::uno::Reference< css::drawing::XShape >& xShape,
169  const uno::Reference< document::XShapeEventListener >& xListener )
170 {
171  assert(xShape.is() && "no shape?");
172  osl::MutexGuard aGuard(maListenerMutex);
173  maShapeListeners.emplace(xShape, xListener);
174 }
175 
176 void SAL_CALL SwDrawModellListener_Impl::removeShapeEventListener(
177  const css::uno::Reference< css::drawing::XShape >& xShape,
178  const uno::Reference< document::XShapeEventListener >& xListener )
179 {
180  osl::MutexGuard aGuard(maListenerMutex);
181  auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
182  for (auto it = itBegin; it != itEnd; ++it)
183  if (it->second == xListener)
184  {
185  maShapeListeners.erase(it);
186  return;
187  }
188 }
189 
191  const SfxHint& rHint )
192 {
193  // do not broadcast notifications for writer fly frames, because there
194  // are no shapes that need to know about them.
195  if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
196  return;
197  const SdrHint *pSdrHint = static_cast<const SdrHint*>( &rHint );
198  if (pSdrHint->GetObject() &&
199  ( dynamic_cast< const SwFlyDrawObj* >(pSdrHint->GetObject()) != nullptr ||
200  dynamic_cast< const SwVirtFlyDrawObj* >(pSdrHint->GetObject()) != nullptr ||
201  isType<SdrObject>(pSdrHint->GetObject()) ) )
202  {
203  return;
204  }
205 
206  OSL_ENSURE( mpDrawModel, "draw model listener is disposed" );
207  if( !mpDrawModel )
208  return;
209 
210  document::EventObject aEvent;
211  if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) )
212  return;
213 
214  ::comphelper::OInterfaceIteratorHelper3 aIter( maEventListeners );
215  while( aIter.hasMoreElements() )
216  {
217  try
218  {
219  aIter.next()->notifyEvent( aEvent );
220  }
221  catch( uno::RuntimeException const & )
222  {
223  TOOLS_WARN_EXCEPTION("sw.a11y", "Runtime exception caught while notifying shape");
224  }
225  }
226 
227  // right now, we're only handling the specific event necessary to fix this performance problem
228  if (pSdrHint->GetKind() == SdrHintKind::ObjectChange)
229  {
230  auto pSdrObject = const_cast<SdrObject*>(pSdrHint->GetObject());
231  uno::Reference<drawing::XShape> xShape(pSdrObject->getUnoShape(), uno::UNO_QUERY);
232  osl::MutexGuard aGuard(maListenerMutex);
233  auto [itBegin, itEnd] = maShapeListeners.equal_range(xShape);
234  for (auto it = itBegin; it != itEnd; ++it)
235  it->second->notifyShapeEvent(aEvent);
236  }
237 }
238 
239 void SwDrawModellListener_Impl::Dispose()
240 {
241  if (mpDrawModel != nullptr) {
242  EndListening( *mpDrawModel );
243  }
244  mpDrawModel = nullptr;
245 }
246 
247 typedef std::pair < const SdrObject *, ::rtl::Reference < ::accessibility::AccessibleShape > > SwAccessibleObjShape_Impl;
248 
250 {
251 public:
252 
253  typedef const SdrObject * key_type;
254  typedef uno::WeakReference<XAccessible> mapped_type;
255  typedef std::pair<const key_type,mapped_type> value_type;
256  typedef std::map<key_type, mapped_type>::iterator iterator;
257  typedef std::map<key_type, mapped_type>::const_iterator const_iterator;
258 
259 private:
260 
262  std::map<key_type, mapped_type> maMap;
263 
264 public:
265 
267  {
268  maInfo.SetSdrView( pMap->GetShell()->GetDrawView() );
269  maInfo.SetWindow( pMap->GetShell()->GetWin() );
270  maInfo.SetViewForwarder( pMap );
271  uno::Reference < document::XShapeEventBroadcaster > xModelBroadcaster =
272  new SwDrawModellListener_Impl(
274  maInfo.SetModelBroadcaster( xModelBroadcaster );
275  }
276 
278 
279  const ::accessibility::AccessibleShapeTreeInfo& GetInfo() const { return maInfo; }
280 
281  std::unique_ptr<SwAccessibleObjShape_Impl[]> Copy( size_t& rSize,
282  const SwFEShell *pFESh,
283  SwAccessibleObjShape_Impl **pSelShape ) const;
284 
285  iterator end() { return maMap.end(); }
286  const_iterator cbegin() const { return maMap.cbegin(); }
287  const_iterator cend() const { return maMap.cend(); }
288  bool empty() const { return maMap.empty(); }
289  iterator find(const key_type& key) { return maMap.find(key); }
290  template<class... Args>
291  std::pair<iterator,bool> emplace(Args&&... args) { return maMap.emplace(std::forward<Args>(args)...); }
292  iterator erase(const_iterator const & pos) { return maMap.erase(pos); }
293 };
294 
296 {
297  uno::Reference < document::XEventBroadcaster > xBrd( maInfo.GetModelBroadcaster() );
298  if( xBrd.is() )
299  static_cast < SwDrawModellListener_Impl * >( xBrd.get() )->Dispose();
300 }
301 
302 std::unique_ptr<SwAccessibleObjShape_Impl[]>
304  size_t& rSize, const SwFEShell *pFESh,
305  SwAccessibleObjShape_Impl **pSelStart ) const
306 {
307  std::unique_ptr<SwAccessibleObjShape_Impl[]> pShapes;
308  SwAccessibleObjShape_Impl *pSelShape = nullptr;
309 
310  size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
311  rSize = maMap.size();
312 
313  if( rSize > 0 )
314  {
315  pShapes.reset(new SwAccessibleObjShape_Impl[rSize]);
316 
317  SwAccessibleObjShape_Impl *pShape = pShapes.get();
318  pSelShape = &(pShapes[rSize]);
319  for( const auto& rEntry : maMap )
320  {
321  const SdrObject *pObj = rEntry.first;
322  uno::Reference < XAccessible > xAcc( rEntry.second );
323  if( nSelShapes && pFESh && pFESh->IsObjSelected( *pObj ) )
324  {
325  // selected objects are inserted from the back
326  --pSelShape;
327  pSelShape->first = pObj;
328  pSelShape->second =
329  static_cast < ::accessibility::AccessibleShape* >(
330  xAcc.get() );
331  --nSelShapes;
332  }
333  else
334  {
335  pShape->first = pObj;
336  pShape->second =
337  static_cast < ::accessibility::AccessibleShape* >(
338  xAcc.get() );
339  ++pShape;
340  }
341  }
342  assert(pSelShape == pShape);
343  }
344 
345  if( pSelStart )
346  *pSelStart = pSelShape;
347 
348  return pShapes;
349 }
350 
352 {
353 public:
361 
362 private:
363  SwRect maOldBox; // the old bounds for CHILD_POS_CHANGED
364  // and POS_CHANGED
365  uno::WeakReference < XAccessible > mxAcc; // The object that fires the event
366  SwAccessibleChild maFrameOrObj; // the child for CHILD_POS_CHANGED and
367  // the same as xAcc for any other
368  // event type
369  EventType meType; // The event type
370  AccessibleStates mnStates; // check states or update caret pos
371 
372 public:
373  const SwFrame* mpParentFrame; // The object that fires the event
374  bool IsNoXaccParentFrame() const
375  {
376  return CHILD_POS_CHANGED == meType && mpParentFrame != nullptr;
377  }
378 
379 public:
382  const SwAccessibleChild& rFrameOrObj )
383  : mxAcc( pA ),
384  maFrameOrObj( rFrameOrObj ),
385  meType( eT ),
386  mnStates( AccessibleStates::NONE ),
387  mpParentFrame( nullptr )
388  {}
389 
391  const SwAccessibleChild& rFrameOrObj )
392  : maFrameOrObj( rFrameOrObj ),
393  meType( eT ),
394  mnStates( AccessibleStates::NONE ),
395  mpParentFrame( nullptr )
396  {
397  assert(SwAccessibleEvent_Impl::DISPOSE == meType &&
398  "wrong event constructor, DISPOSE only");
399  }
400 
402  : meType( eT ),
403  mnStates( AccessibleStates::NONE ),
404  mpParentFrame( nullptr )
405  {
406  assert(SwAccessibleEvent_Impl::SHAPE_SELECTION == meType &&
407  "wrong event constructor, SHAPE_SELECTION only" );
408  }
409 
412  const SwAccessibleChild& rFrameOrObj,
413  const SwRect& rR )
414  : maOldBox( rR ),
415  mxAcc( pA ),
416  maFrameOrObj( rFrameOrObj ),
417  meType( eT ),
418  mnStates( AccessibleStates::NONE ),
419  mpParentFrame( nullptr )
420  {
421  assert((SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType ||
423  "wrong event constructor, (CHILD_)POS_CHANGED only" );
424  }
425 
428  const SwAccessibleChild& rFrameOrObj,
429  const AccessibleStates _nStates )
430  : mxAcc( pA ),
431  maFrameOrObj( rFrameOrObj ),
432  meType( eT ),
433  mnStates( _nStates ),
434  mpParentFrame( nullptr )
435  {
436  assert( SwAccessibleEvent_Impl::CARET_OR_STATES == meType &&
437  "wrong event constructor, CARET_OR_STATES only" );
438  }
439 
440  SwAccessibleEvent_Impl( EventType eT, const SwFrame *pParentFrame,
441  const SwAccessibleChild& rFrameOrObj, const SwRect& rR ) :
442  maOldBox( rR ),
443  maFrameOrObj( rFrameOrObj ),
444  meType( eT ),
445  mnStates( AccessibleStates::NONE ),
446  mpParentFrame( pParentFrame )
447  {
448  assert( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType &&
449  "wrong event constructor, CHILD_POS_CHANGED only" );
450  }
451 
452  // <SetType(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
453  void SetType( EventType eT )
454  {
455  meType = eT;
456  }
458  {
459  return meType;
460  }
461 
463  {
464  uno::Reference < XAccessible > xTmp( mxAcc );
466  static_cast<SwAccessibleContext*>( xTmp.get() ) );
467 
468  return xAccImpl;
469  }
470 
471  const SwRect& GetOldBox() const
472  {
473  return maOldBox;
474  }
475  // <SetOldBox(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
476  void SetOldBox( const SwRect& rOldBox )
477  {
478  maOldBox = rOldBox;
479  }
480 
481  const SwAccessibleChild& GetFrameOrObj() const
482  {
483  return maFrameOrObj;
484  }
485 
486  // <SetStates(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
487  void SetStates( AccessibleStates _nStates )
488  {
489  mnStates |= _nStates;
490  }
491 
492  bool IsUpdateCursorPos() const
493  {
494  return bool(mnStates & AccessibleStates::CARET);
495  }
496  bool IsInvalidateStates() const
497  {
498  return bool(mnStates & (AccessibleStates::EDITABLE | AccessibleStates::OPAQUE));
499  }
500  bool IsInvalidateRelation() const
501  {
503  }
505  {
506  return bool( mnStates & AccessibleStates::TEXT_SELECTION_CHANGED );
507  }
508 
510  {
511  return bool( mnStates & AccessibleStates::TEXT_ATTRIBUTE_CHANGED );
512  }
513 
515  {
516  return mnStates;
517  }
518 
520  {
521  return mnStates;
522  }
523 };
524 
526 {
527  std::list<SwAccessibleEvent_Impl> maEvents;
528  bool mbFiring;
529 
530 public:
532  : mbFiring( false )
533  {}
534 
535  void SetFiring()
536  {
537  mbFiring = true;
538  }
539  bool IsFiring() const
540  {
541  return mbFiring;
542  }
543 
544  void MoveMissingXAccToEnd();
545 
546  size_t size() const { return maEvents.size(); }
547  std::list<SwAccessibleEvent_Impl>::iterator begin() { return maEvents.begin(); }
548  std::list<SwAccessibleEvent_Impl>::iterator end() { return maEvents.end(); }
549  std::list<SwAccessibleEvent_Impl>::iterator insert( const std::list<SwAccessibleEvent_Impl>::iterator& aIter,
550  const SwAccessibleEvent_Impl& rEvent )
551  {
552  return maEvents.insert( aIter, rEvent );
553  }
554  std::list<SwAccessibleEvent_Impl>::iterator erase( const std::list<SwAccessibleEvent_Impl>::iterator& aPos )
555  {
556  return maEvents.erase( aPos );
557  }
558 };
559 
560 // see comment in SwAccessibleMap::InvalidatePosOrSize()
561 // last case "else if(pParent)" for why this surprising hack exists
563 {
564  size_t nSize = size();
565  if (nSize < 2 )
566  {
567  return;
568  }
570  for (auto li = begin(); li != end(); )
571  {
572  if (li->IsNoXaccParentFrame())
573  {
574  lstEvent.insert(lstEvent.end(), *li);
575  li = erase(li);
576  }
577  else
578  ++li;
579  }
580  assert(size() + lstEvent.size() == nSize);
581  maEvents.insert(end(),lstEvent.begin(),lstEvent.end());
582  assert(size() == nSize);
583 }
584 
585 namespace {
586 
587 struct SwAccessibleChildFunc
588 {
589  bool operator()( const SwAccessibleChild& r1,
590  const SwAccessibleChild& r2 ) const
591  {
592  const void *p1 = r1.GetSwFrame()
593  ? static_cast < const void * >( r1.GetSwFrame())
594  : ( r1.GetDrawObject()
595  ? static_cast < const void * >( r1.GetDrawObject() )
596  : static_cast < const void * >( r1.GetWindow() ) );
597  const void *p2 = r2.GetSwFrame()
598  ? static_cast < const void * >( r2.GetSwFrame())
599  : ( r2.GetDrawObject()
600  ? static_cast < const void * >( r2.GetDrawObject() )
601  : static_cast < const void * >( r2.GetWindow() ) );
602  return p1 < p2;
603  }
604 };
605 
606 }
607 
609 {
610 public:
611  typedef SwAccessibleChild key_type;
612  typedef std::list<SwAccessibleEvent_Impl>::iterator mapped_type;
613  typedef std::pair<const key_type,mapped_type> value_type;
614  typedef SwAccessibleChildFunc key_compare;
615  typedef std::map<key_type,mapped_type,key_compare>::iterator iterator;
616  typedef std::map<key_type,mapped_type,key_compare>::const_iterator const_iterator;
617 private:
618  std::map <key_type,mapped_type,key_compare> maMap;
619 public:
620  iterator end() { return maMap.end(); }
621  iterator find(const key_type& key) { return maMap.find(key); }
622  template<class... Args>
623  std::pair<iterator,bool> emplace(Args&&... args) { return maMap.emplace(std::forward<Args>(args)...); }
624  iterator erase(const_iterator const & pos) { return maMap.erase(pos); }
625 };
626 
627 namespace {
628 
629 struct SwAccessibleParaSelection
630 {
631  TextFrameIndex nStartOfSelection;
632  TextFrameIndex nEndOfSelection;
633 
634  SwAccessibleParaSelection(const TextFrameIndex nStartOfSelection_,
635  const TextFrameIndex nEndOfSelection_)
636  : nStartOfSelection(nStartOfSelection_)
637  , nEndOfSelection(nEndOfSelection_)
638  {}
639 };
640 
641 struct SwXAccWeakRefComp
642 {
643  bool operator()( const uno::WeakReference<XAccessible>& _rXAccWeakRef1,
644  const uno::WeakReference<XAccessible>& _rXAccWeakRef2 ) const
645  {
646  return _rXAccWeakRef1.get() < _rXAccWeakRef2.get();
647  }
648 };
649 
650 }
651 
653 {
654 public:
655  typedef uno::WeakReference < XAccessible > key_type;
656  typedef SwAccessibleParaSelection mapped_type;
657  typedef std::pair<const key_type,mapped_type> value_type;
658  typedef SwXAccWeakRefComp key_compare;
659  typedef std::map<key_type,mapped_type,key_compare>::iterator iterator;
660  typedef std::map<key_type,mapped_type,key_compare>::const_iterator const_iterator;
661 private:
662  std::map<key_type,mapped_type,key_compare> maMap;
663 public:
664  iterator begin() { return maMap.begin(); }
665  iterator end() { return maMap.end(); }
666  iterator find(const key_type& key) { return maMap.find(key); }
667  template<class... Args>
668  std::pair<iterator,bool> emplace(Args&&... args) { return maMap.emplace(std::forward<Args>(args)...); }
669  iterator erase(const_iterator const & pos) { return maMap.erase(pos); }
670 };
671 
672 // helper class that stores preview data
674 {
675  typedef std::vector<tools::Rectangle> Rectangles;
676  Rectangles maPreviewRects;
677  Rectangles maLogicRects;
678 
681 
683 
698  static void AdjustLogicPgRectToVisibleArea( SwRect& _iorLogicPgSwRect,
699  const SwRect& _rPreviewPgSwRect,
700  const Size& _rPreviewWinSize );
701 
702 public:
704 
705  void Update( const SwAccessibleMap& rAccMap,
706  const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
707  const Fraction& _rScale,
708  const SwPageFrame* _pSelectedPageFrame,
709  const Size& _rPreviewWinSize );
710 
711  void InvalidateSelection( const SwPageFrame* _pSelectedPageFrame );
712 
713  const SwRect& GetVisArea() const { return maVisArea;}
714 
719  void AdjustMapMode( MapMode& rMapMode,
720  const Point& rPoint ) const;
721 
722  const SwPageFrame *GetSelPage() const { return mpSelPage; }
723 
724  void DisposePage(const SwPageFrame *pPageFrame );
725 };
726 
728  mpSelPage( nullptr )
729 {
730 }
731 
733  const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
734  const Fraction& _rScale,
735  const SwPageFrame* _pSelectedPageFrame,
736  const Size& _rPreviewWinSize )
737 {
738  // store preview scaling, maximal preview page size and selected page
739  maScale = _rScale;
740  mpSelPage = _pSelectedPageFrame;
741 
742  // prepare loop on preview pages
743  maPreviewRects.clear();
744  maLogicRects.clear();
745  SwAccessibleChild aPage;
746  maVisArea.Clear();
747 
748  // loop on preview pages to calculate <maPreviewRects>, <maLogicRects> and
749  // <maVisArea>
750  for ( auto & rpPreviewPage : _rPreviewPages )
751  {
752  aPage = rpPreviewPage->pPage;
753 
754  // add preview page rectangle to <maPreviewRects>
755  tools::Rectangle aPreviewPgRect( rpPreviewPage->aPreviewWinPos, rpPreviewPage->aPageSize );
756  maPreviewRects.push_back( aPreviewPgRect );
757 
758  // add logic page rectangle to <maLogicRects>
759  SwRect aLogicPgSwRect( aPage.GetBox( rAccMap ) );
760  tools::Rectangle aLogicPgRect( aLogicPgSwRect.SVRect() );
761  maLogicRects.push_back( aLogicPgRect );
762  // union visible area with visible part of logic page rectangle
763  if ( rpPreviewPage->bVisible )
764  {
765  if ( !rpPreviewPage->pPage->IsEmptyPage() )
766  {
767  AdjustLogicPgRectToVisibleArea( aLogicPgSwRect,
768  SwRect( aPreviewPgRect ),
769  _rPreviewWinSize );
770  }
771  if ( maVisArea.IsEmpty() )
772  maVisArea = aLogicPgSwRect;
773  else
774  maVisArea.Union( aLogicPgSwRect );
775  }
776  }
777 }
778 
779 void SwAccPreviewData::InvalidateSelection( const SwPageFrame* _pSelectedPageFrame )
780 {
781  mpSelPage = _pSelectedPageFrame;
782  assert(mpSelPage);
783 }
784 
785 namespace {
786 
787 struct ContainsPredicate
788 {
789  const Point& mrPoint;
790  explicit ContainsPredicate( const Point& rPoint ) : mrPoint(rPoint) {}
791  bool operator() ( const tools::Rectangle& rRect ) const
792  {
793  return rRect.Contains( mrPoint );
794  }
795 };
796 
797 }
798 
800  const Point& rPoint ) const
801 {
802  // adjust scale
803  rMapMode.SetScaleX( maScale );
804  rMapMode.SetScaleY( maScale );
805 
806  // find proper rectangle
807  Rectangles::const_iterator aBegin = maLogicRects.begin();
808  Rectangles::const_iterator aEnd = maLogicRects.end();
809  Rectangles::const_iterator aFound = std::find_if( aBegin, aEnd,
810  ContainsPredicate( rPoint ) );
811 
812  if( aFound != aEnd )
813  {
814  // found! set new origin
815  Point aPoint = (maPreviewRects.begin() + (aFound - aBegin))->TopLeft();
816  aPoint -= (maLogicRects.begin() + (aFound-aBegin))->TopLeft();
817  rMapMode.SetOrigin( aPoint );
818  }
819  // else: don't adjust MapMode
820 }
821 
823 {
824  if( mpSelPage == pPageFrame )
825  mpSelPage = nullptr;
826 }
827 
828 // adjust logic page rectangle to its visible part
830  SwRect& _iorLogicPgSwRect,
831  const SwRect& _rPreviewPgSwRect,
832  const Size& _rPreviewWinSize )
833 {
834  // determine preview window rectangle
835  const SwRect aPreviewWinSwRect( Point( 0, 0 ), _rPreviewWinSize );
836  // calculate visible preview page rectangle
837  SwRect aVisPreviewPgSwRect( _rPreviewPgSwRect );
838  aVisPreviewPgSwRect.Intersection( aPreviewWinSwRect );
839  // adjust logic page rectangle
840  SwTwips nTmpDiff;
841  // left
842  nTmpDiff = aVisPreviewPgSwRect.Left() - _rPreviewPgSwRect.Left();
843  _iorLogicPgSwRect.AddLeft( nTmpDiff );
844  // top
845  nTmpDiff = aVisPreviewPgSwRect.Top() - _rPreviewPgSwRect.Top();
846  _iorLogicPgSwRect.AddTop( nTmpDiff );
847  // right
848  nTmpDiff = _rPreviewPgSwRect.Right() - aVisPreviewPgSwRect.Right();
849  _iorLogicPgSwRect.AddRight( - nTmpDiff );
850  // bottom
851  nTmpDiff = _rPreviewPgSwRect.Bottom() - aVisPreviewPgSwRect.Bottom();
852  _iorLogicPgSwRect.AddBottom( - nTmpDiff );
853 }
854 
855 static bool AreInSameTable( const uno::Reference< XAccessible >& rAcc,
856  const SwFrame *pFrame )
857 {
858  bool bRet = false;
859 
860  if( pFrame && pFrame->IsCellFrame() && rAcc.is() )
861  {
862  // Is it in the same table? We check that
863  // by comparing the last table frame in the
864  // follow chain, because that's cheaper than
865  // searching the first one.
866  SwAccessibleContext *pAccImpl =
867  static_cast< SwAccessibleContext *>( rAcc.get() );
868  if( pAccImpl->GetFrame()->IsCellFrame() )
869  {
870  const SwTabFrame *pTabFrame1 = pAccImpl->GetFrame()->FindTabFrame();
871  if (pTabFrame1)
872  {
873  while (pTabFrame1->GetFollow())
874  pTabFrame1 = pTabFrame1->GetFollow();
875  }
876 
877  const SwTabFrame *pTabFrame2 = pFrame->FindTabFrame();
878  if (pTabFrame2)
879  {
880  while (pTabFrame2->GetFollow())
881  pTabFrame2 = pTabFrame2->GetFollow();
882  }
883 
884  bRet = (pTabFrame1 == pTabFrame2);
885  }
886  }
887 
888  return bRet;
889 }
890 
892 {
894  if (!xAccImpl.is() && rEvent.mpParentFrame != nullptr)
895  {
897  mpFrameMap->find( rEvent.mpParentFrame );
898  if( aIter != mpFrameMap->end() )
899  {
900  uno::Reference < XAccessible > xAcc( (*aIter).second );
901  if (xAcc.is())
902  {
903  uno::Reference < XAccessibleContext > xContext(xAcc,uno::UNO_QUERY);
904  if (xContext.is() && xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
905  {
906  xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
907  }
908  }
909  }
910  }
912  {
914  }
915  else if( xAccImpl.is() && xAccImpl->GetFrame() )
916  {
917  if ( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE &&
918  rEvent.IsInvalidateTextAttrs() )
919  {
920  xAccImpl->InvalidateAttr();
921  }
922  switch( rEvent.GetType() )
923  {
925  xAccImpl->InvalidateContent();
926  break;
928  xAccImpl->InvalidatePosOrSize( rEvent.GetOldBox() );
929  break;
931  xAccImpl->InvalidateChildPosOrSize( rEvent.GetFrameOrObj(),
932  rEvent.GetOldBox() );
933  break;
935  assert(!"dispose event has been stored");
936  break;
938  // nothing to do here - handled above
939  break;
940  default:
941  break;
942  }
943  if( SwAccessibleEvent_Impl::DISPOSE != rEvent.GetType() )
944  {
945  if( rEvent.IsUpdateCursorPos() )
946  xAccImpl->InvalidateCursorPos();
947  if( rEvent.IsInvalidateStates() )
948  xAccImpl->InvalidateStates( rEvent.GetStates() );
949  if( rEvent.IsInvalidateRelation() )
950  {
951  // both events CONTENT_FLOWS_FROM_RELATION_CHANGED and
952  // CONTENT_FLOWS_TO_RELATION_CHANGED are possible
954  {
955  xAccImpl->InvalidateRelation(
956  AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED );
957  }
959  {
960  xAccImpl->InvalidateRelation(
961  AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED );
962  }
963  }
964 
965  if ( rEvent.IsInvalidateTextSelection() )
966  {
967  xAccImpl->InvalidateTextSelection();
968  }
969  }
970  }
971 }
972 
974 {
975  osl::MutexGuard aGuard( maEventMutex );
976 
977  if( !mpEvents )
979  if( !mpEventMap )
981 
982  if( mpEvents->IsFiring() )
983  {
984  // While events are fired new ones are generated. They have to be fired
985  // now. This does not work for DISPOSE events!
986  OSL_ENSURE( rEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE,
987  "dispose event while firing events" );
988  FireEvent( rEvent );
989  }
990  else
991  {
992 
994  mpEventMap->find( rEvent.GetFrameOrObj() );
995  if( aIter != mpEventMap->end() )
996  {
997  SwAccessibleEvent_Impl aEvent( *(*aIter).second );
998  assert( aEvent.GetType() != SwAccessibleEvent_Impl::DISPOSE &&
999  "dispose events should not be stored" );
1000  bool bAppendEvent = true;
1001  switch( rEvent.GetType() )
1002  {
1004  // A CARET_OR_STATES event is added to any other
1005  // event only. It is broadcasted after any other event, so the
1006  // event should be put to the back.
1007  OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
1008  "invalid event combination" );
1009  aEvent.SetStates( rEvent.GetAllStates() );
1010  break;
1012  // An INVALID_CONTENT event overwrites a CARET_OR_STATES
1013  // event (but keeps its flags) and it is contained in a
1014  // POS_CHANGED event.
1015  // Therefore, the event's type has to be adapted and the event
1016  // has to be put at the end.
1017  //
1018  // fdo#56031 An INVALID_CONTENT event overwrites a INVALID_ATTR
1019  // event and overwrites its flags
1020  OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
1021  "invalid event combination" );
1024  else if ( aEvent.GetType() == SwAccessibleEvent_Impl::INVALID_ATTR )
1025  {
1027  aEvent.SetStates( rEvent.GetAllStates() );
1028  }
1029 
1030  break;
1032  // A pos changed event overwrites CARET_STATES (keeping its
1033  // flags) as well as INVALID_CONTENT. The old box position
1034  // has to be stored however if the old event is not a
1035  // POS_CHANGED itself.
1036  OSL_ENSURE( aEvent.GetType() != SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
1037  "invalid event combination" );
1039  aEvent.SetOldBox( rEvent.GetOldBox() );
1041  break;
1043  // CHILD_POS_CHANGED events can only follow CHILD_POS_CHANGED
1044  // events. The only action that needs to be done again is
1045  // to put the old event to the back. The new one cannot be used,
1046  // because we are interested in the old frame bounds.
1047  OSL_ENSURE( aEvent.GetType() == SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
1048  "invalid event combination" );
1049  break;
1051  OSL_ENSURE( aEvent.GetType() == SwAccessibleEvent_Impl::SHAPE_SELECTION,
1052  "invalid event combination" );
1053  break;
1055  // DISPOSE events overwrite all others. They are not stored
1056  // but executed immediately to avoid broadcasting of
1057  // nonfunctional objects. So what needs to be done here is to
1058  // remove all events for the frame in question.
1059  bAppendEvent = false;
1060  break;
1062  OSL_ENSURE( aEvent.GetType() == SwAccessibleEvent_Impl::INVALID_ATTR,
1063  "invalid event combination" );
1064  break;
1065  }
1066  if( bAppendEvent )
1067  {
1068  mpEvents->erase( (*aIter).second );
1069  (*aIter).second = mpEvents->insert( mpEvents->end(), aEvent );
1070  }
1071  else
1072  {
1073  mpEvents->erase( (*aIter).second );
1074  mpEventMap->erase( aIter );
1075  }
1076  }
1077  else if( SwAccessibleEvent_Impl::DISPOSE != rEvent.GetType() )
1078  {
1079  mpEventMap->emplace( rEvent.GetFrameOrObj(),
1080  mpEvents->insert( mpEvents->end(), rEvent ) );
1081  }
1082  }
1083 }
1084 
1086  const uno::Reference< XAccessible >& rAcc )
1087 {
1088  SwAccessibleContext *pAccImpl =
1089  static_cast< SwAccessibleContext *>( rAcc.get() );
1090  assert(pAccImpl);
1091  assert(pAccImpl->GetFrame());
1092  if( GetShell()->ActionPend() )
1093  {
1095  pAccImpl,
1096  SwAccessibleChild(pAccImpl->GetFrame()),
1098  AppendEvent( aEvent );
1099  }
1100  else
1101  {
1102  FireEvents();
1103  // While firing events the current frame might have
1104  // been disposed because it moved out of the visible area.
1105  // Setting the cursor for such frames is useless and even
1106  // causes asserts.
1107  if( pAccImpl->GetFrame() )
1108  pAccImpl->InvalidateCursorPos();
1109  }
1110 }
1111 
1113 {
1114  if( GetShell()->ActionPend() )
1115  {
1116  SwAccessibleEvent_Impl aEvent(
1118  AppendEvent( aEvent );
1119  }
1120  else
1121  {
1122  FireEvents();
1124  }
1125 }
1126 
1127 //This method should implement the following functions:
1128 //1.find the shape objects and set the selected state.
1129 //2.find the Swframe objects and set the selected state.
1130 //3.find the paragraph objects and set the selected state.
1132 {
1133  std::unique_ptr<SwAccessibleObjShape_Impl[]> pShapes;
1134  SwAccessibleObjShape_Impl *pSelShape = nullptr;
1135  size_t nShapes = 0;
1136 
1137  const SwViewShell *pVSh = GetShell();
1138  const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>(pVSh);
1139  SwPaM* pCursor = pFESh ? pFESh->GetCursor( false /* ??? */ ) : nullptr;
1140 
1141  //const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
1142 
1143  {
1144  osl::MutexGuard aGuard( maMutex );
1145  if( mpShapeMap )
1146  pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
1147  }
1148 
1149  bool bIsSelAll =IsDocumentSelAll();
1150 
1151  if( mpShapeMap )
1152  {
1153  //Checked for shapes.
1156 
1157  if( bIsSelAll)
1158  {
1159  while( aIter != aEndIter )
1160  {
1161  uno::Reference < XAccessible > xAcc( (*aIter).second );
1162  if( xAcc.is() )
1163  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->SetState( AccessibleStateType::SELECTED );
1164 
1165  ++aIter;
1166  }
1167  }
1168  else
1169  {
1170  while( aIter != aEndIter )
1171  {
1172  const SwFrameFormat *pFrameFormat = (*aIter).first ? ::FindFrameFormat( (*aIter).first ) : nullptr;
1173  if( !pFrameFormat )
1174  {
1175  ++aIter;
1176  continue;
1177  }
1178  const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
1179  const SwPosition *pPos = rAnchor.GetContentAnchor();
1180 
1181  if(rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1182  {
1183  uno::Reference < XAccessible > xAcc( (*aIter).second );
1184  if(xAcc.is())
1185  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->ResetState( AccessibleStateType::SELECTED );
1186 
1187  ++aIter;
1188  continue;
1189  }
1190 
1191  if( !pPos )
1192  {
1193  ++aIter;
1194  continue;
1195  }
1196  if( pPos->nNode.GetNode().GetTextNode() )
1197  {
1198  int nIndex = pPos->nContent.GetIndex();
1199  bool bMarked = false;
1200  if( pCursor != nullptr )
1201  {
1202  const SwTextNode* pNode = pPos->nNode.GetNode().GetTextNode();
1203  SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pVSh->GetLayout())));
1204  SwNodeOffset nFirstNode(pFrame->GetTextNodeFirst()->GetIndex());
1205  SwNodeOffset nLastNode;
1206  if (sw::MergedPara const*const pMerged = pFrame->GetMergedPara())
1207  {
1208  nLastNode = pMerged->pLastNode->GetIndex();
1209  }
1210  else
1211  {
1212  nLastNode = nFirstNode;
1213  }
1214 
1215  SwNodeOffset nHere = pNode->GetIndex();
1216 
1217  for(SwPaM& rTmpCursor : pCursor->GetRingContainer())
1218  {
1219  // ignore, if no mark
1220  if( rTmpCursor.HasMark() )
1221  {
1222  bMarked = true;
1223  // check whether nHere is 'inside' pCursor
1224  SwPosition* pStart = rTmpCursor.Start();
1225  SwNodeOffset nStartIndex = pStart->nNode.GetIndex();
1226  SwPosition* pEnd = rTmpCursor.End();
1227  SwNodeOffset nEndIndex = pEnd->nNode.GetIndex();
1228  if ((nStartIndex <= nLastNode) && (nFirstNode <= nEndIndex))
1229  {
1230  if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1231  {
1232  if( ( ((nHere == nStartIndex) && (nIndex >= pStart->nContent.GetIndex())) || (nHere > nStartIndex) )
1233  &&( ((nHere == nEndIndex) && (nIndex < pEnd->nContent.GetIndex())) || (nHere < nEndIndex) ) )
1234  {
1235  uno::Reference < XAccessible > xAcc( (*aIter).second );
1236  if( xAcc.is() )
1237  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->SetState( AccessibleStateType::SELECTED );
1238  }
1239  else
1240  {
1241  uno::Reference < XAccessible > xAcc( (*aIter).second );
1242  if( xAcc.is() )
1243  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->ResetState( AccessibleStateType::SELECTED );
1244  }
1245  }
1246  else if( rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA )
1247  {
1248  uno::Reference<XAccessible> const xAcc((*aIter).second);
1249  if (xAcc.is())
1250  {
1251  if (IsSelectFrameAnchoredAtPara(*pPos, *pStart, *pEnd))
1252  {
1253  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->SetState( AccessibleStateType::SELECTED );
1254  }
1255  else
1256  {
1257  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->ResetState( AccessibleStateType::SELECTED );
1258  }
1259  }
1260  }
1261  else if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
1262  {
1263  uno::Reference<XAccessible> const xAcc((*aIter).second);
1264  if (xAcc.is())
1265  {
1266  if (IsDestroyFrameAnchoredAtChar(*pPos, *pStart, *pEnd))
1267  {
1268  static_cast<::accessibility::AccessibleShape*>(xAcc.get())->SetState( AccessibleStateType::SELECTED );
1269  }
1270  else
1271  {
1272  static_cast<::accessibility::AccessibleShape*>(xAcc.get())->ResetState( AccessibleStateType::SELECTED );
1273  }
1274  }
1275  }
1276  }
1277  }
1278  }
1279  }
1280  if( !bMarked )
1281  {
1282  SwAccessibleObjShape_Impl *pShape = pShapes.get();
1283  size_t nNumShapes = nShapes;
1284  while( nNumShapes )
1285  {
1286  if( pShape < pSelShape && (pShape->first==(*aIter).first) )
1287  {
1288  uno::Reference < XAccessible > xAcc( (*aIter).second );
1289  if(xAcc.is())
1290  static_cast < ::accessibility::AccessibleShape* >(xAcc.get())->ResetState( AccessibleStateType::SELECTED );
1291  }
1292  --nNumShapes;
1293  ++pShape;
1294  }
1295  }
1296  }
1297 
1298  ++aIter;
1299  }//while( aIter != aEndIter )
1300  }//else
1301  }
1302 
1303  pShapes.reset();
1304 
1305  //Checked for FlyFrame
1306  if (mpFrameMap)
1307  {
1309  while( aIter != mpFrameMap->end() )
1310  {
1311  const SwFrame *pFrame = (*aIter).first;
1312  if(pFrame->IsFlyFrame())
1313  {
1314  uno::Reference < XAccessible > xAcc = (*aIter).second;
1315 
1316  if(xAcc.is())
1317  {
1318  SwAccessibleFrameBase *pAccFrame = static_cast< SwAccessibleFrameBase * >(xAcc.get());
1319  bool bFrameChanged = pAccFrame->SetSelectedState( true );
1320  if (bFrameChanged)
1321  {
1322  const SwFlyFrame *pFlyFrame = static_cast< const SwFlyFrame * >( pFrame );
1323  const SwFrameFormat *pFrameFormat = pFlyFrame->GetFormat();
1324  if (pFrameFormat)
1325  {
1326  const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
1327  if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1328  {
1329  uno::Reference< XAccessible > xAccParent = pAccFrame->getAccessibleParent();
1330  if (xAccParent.is())
1331  {
1332  uno::Reference< XAccessibleContext > xAccContext = xAccParent->getAccessibleContext();
1333  if(xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
1334  {
1335  SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xAccContext.get());
1336  if(pAccFrame->IsSelectedInDoc())
1337  {
1338  m_setParaAdd.insert(pAccPara);
1339  }
1340  else if(m_setParaAdd.count(pAccPara) == 0)
1341  {
1342  m_setParaRemove.insert(pAccPara);
1343  }
1344  }
1345  }
1346  }
1347  }
1348  }
1349  }
1350  }
1351  ++aIter;
1352  }
1353  }
1354 
1355  typedef std::vector< SwAccessibleContext* > VEC_PARA;
1356  VEC_PARA vecAdd;
1357  VEC_PARA vecRemove;
1358  //Checked for Paras.
1359  bool bMarkChanged = false;
1361  if( pCursor != nullptr )
1362  {
1363  for(SwPaM& rTmpCursor : pCursor->GetRingContainer())
1364  {
1365  if( rTmpCursor.HasMark() )
1366  {
1367  SwNodeIndex nStartIndex( rTmpCursor.Start()->nNode );
1368  SwNodeIndex nEndIndex( rTmpCursor.End()->nNode );
1369  for (; nStartIndex <= nEndIndex; ++nStartIndex)
1370  {
1371  SwFrame *pFrame = nullptr;
1372  if(nStartIndex.GetNode().IsContentNode())
1373  {
1374  SwContentNode* pCNd = static_cast<SwContentNode*>(&(nStartIndex.GetNode()));
1376  if (mapTemp.find(pFrame) != mapTemp.end())
1377  {
1378  continue; // sw_redlinehide: once is enough
1379  }
1380  }
1381  else if( nStartIndex.GetNode().IsTableNode() )
1382  {
1383  SwTableNode * pTable = static_cast<SwTableNode *>(&(nStartIndex.GetNode()));
1384  SwTableFormat* pFormat = pTable->GetTable().GetFrameFormat();
1385  pFrame = SwIterator<SwFrame, SwTableFormat>(*pFormat).First();
1386  }
1387 
1388  if( pFrame && mpFrameMap)
1389  {
1390  SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->find( pFrame );
1391  if( aIter != mpFrameMap->end() )
1392  {
1393  uno::Reference < XAccessible > xAcc = (*aIter).second;
1394  bool isChanged = false;
1395  if( xAcc.is() )
1396  {
1397  isChanged = static_cast< SwAccessibleContext * >(xAcc.get())->SetSelectedState( true );
1398  }
1399  if(!isChanged)
1400  {
1401  SwAccessibleContextMap_Impl::iterator aEraseIter = mpSelectedFrameMap->find( pFrame );
1402  if(aEraseIter != mpSelectedFrameMap->end())
1403  mpSelectedFrameMap->erase(aEraseIter);
1404  }
1405  else
1406  {
1407  bMarkChanged = true;
1408  vecAdd.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
1409  }
1410 
1411  mapTemp.emplace( pFrame, xAcc );
1412  }
1413  }
1414  }
1415  }
1416  }
1417  }
1418  if( !mpSelectedFrameMap )
1420  if( !mpSelectedFrameMap->empty() )
1421  {
1423  while( aIter != mpSelectedFrameMap->end() )
1424  {
1425  uno::Reference < XAccessible > xAcc = (*aIter).second;
1426  if(xAcc.is())
1427  static_cast< SwAccessibleContext * >(xAcc.get())->SetSelectedState( false );
1428  ++aIter;
1429  vecRemove.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
1430  }
1431  bMarkChanged = true;
1432  mpSelectedFrameMap->clear();
1433  }
1434 
1435  SwAccessibleContextMap_Impl::iterator aIter = mapTemp.begin();
1436  while( aIter != mapTemp.end() )
1437  {
1438  mpSelectedFrameMap->emplace( (*aIter).first, (*aIter).second );
1439  ++aIter;
1440  }
1441  mapTemp.clear();
1442 
1443  if( !(bMarkChanged && mpFrameMap))
1444  return;
1445 
1446  for (SwAccessibleContext* pAccPara : vecAdd)
1447  {
1448  AccessibleEventObject aEvent;
1449  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
1450  if (pAccPara)
1451  {
1452  pAccPara->FireAccessibleEvent( aEvent );
1453  }
1454  }
1455  for (SwAccessibleContext* pAccPara : vecRemove)
1456  {
1457  AccessibleEventObject aEvent;
1458  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
1459  if (pAccPara)
1460  {
1461  pAccPara->FireAccessibleEvent( aEvent );
1462  }
1463  }
1464 }
1465 
1466 //Merge with DoInvalidateShapeFocus
1467 void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=false*/)
1468 {
1469  std::unique_ptr<SwAccessibleObjShape_Impl[]> pShapes;
1470  SwAccessibleObjShape_Impl *pSelShape = nullptr;
1471  size_t nShapes = 0;
1472 
1473  const SwViewShell *pVSh = GetShell();
1474  const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>(pVSh);
1475  const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
1476 
1477  //when InvalidateFocus Call this function ,and the current selected shape count is not 1 ,
1478  //return
1479  if (bInvalidateFocusMode && nSelShapes != 1)
1480  {
1481  return;
1482  }
1483  {
1484  osl::MutexGuard aGuard( maMutex );
1485  if( mpShapeMap )
1486  pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
1487  }
1488 
1489  if( !pShapes )
1490  return;
1491 
1492  typedef std::vector< ::rtl::Reference < ::accessibility::AccessibleShape > > VEC_SHAPE;
1493  VEC_SHAPE vecxShapeAdd;
1494  VEC_SHAPE vecxShapeRemove;
1495  int nCountSelectedShape=0;
1496 
1497  vcl::Window *pWin = GetShell()->GetWin();
1498  bool bFocused = pWin && pWin->HasFocus();
1499  SwAccessibleObjShape_Impl *pShape = pShapes.get();
1500  int nShapeCount = nShapes;
1501  while( nShapeCount )
1502  {
1503  if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
1504  {
1505  if( pShape < pSelShape )
1506  {
1507  if(pShape->second->ResetState( AccessibleStateType::SELECTED ))
1508  {
1509  vecxShapeRemove.push_back(pShape->second);
1510  }
1511  pShape->second->ResetState( AccessibleStateType::FOCUSED );
1512  }
1513  }
1514  --nShapeCount;
1515  ++pShape;
1516  }
1517 
1518  for (const auto& rpShape : vecxShapeRemove)
1519  {
1520  ::accessibility::AccessibleShape *pAccShape = rpShape.get();
1521  if (pAccShape)
1522  {
1523  pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any());
1524  }
1525  }
1526 
1527  pShape = pShapes.get();
1528 
1529  while( nShapes )
1530  {
1531  if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
1532  {
1533  if( pShape >= pSelShape )
1534  {
1535  //first fire focus event
1536  if( bFocused && 1 == nSelShapes )
1537  pShape->second->SetState( AccessibleStateType::FOCUSED );
1538  else
1539  pShape->second->ResetState( AccessibleStateType::FOCUSED );
1540 
1541  if(pShape->second->SetState( AccessibleStateType::SELECTED ))
1542  {
1543  vecxShapeAdd.push_back(pShape->second);
1544  }
1545  ++nCountSelectedShape;
1546  }
1547  }
1548 
1549  --nShapes;
1550  ++pShape;
1551  }
1552 
1553  const unsigned int SELECTION_WITH_NUM = 10;
1554  if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
1555  {
1556  uno::Reference< XAccessible > xDoc = GetDocumentView( );
1557  SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get());
1558  if (pCont)
1559  {
1560  AccessibleEventObject aEvent;
1561  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
1562  pCont->FireAccessibleEvent(aEvent);
1563  }
1564  }
1565  else
1566  {
1567  short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
1568  if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
1569  {
1570  nEventID = AccessibleEventId::SELECTION_CHANGED;
1571  }
1572  for (const auto& rpShape : vecxShapeAdd)
1573  {
1574  ::accessibility::AccessibleShape *pAccShape = rpShape.get();
1575  if (pAccShape)
1576  {
1577  pAccShape->CommitChange(nEventID, uno::Any(), uno::Any());
1578  }
1579  }
1580  }
1581 
1582  for (const auto& rpShape : vecxShapeAdd)
1583  {
1584  ::accessibility::AccessibleShape *pAccShape = rpShape.get();
1585  if (pAccShape)
1586  {
1588  SwFrameFormat *pFrameFormat = pObj ? FindFrameFormat( pObj ) : nullptr;
1589  if (pFrameFormat)
1590  {
1591  const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
1592  if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
1593  {
1594  uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
1595  if (xPara.is())
1596  {
1597  uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
1598  if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
1599  {
1600  SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
1601  if (pAccPara)
1602  {
1603  m_setParaAdd.insert(pAccPara);
1604  }
1605  }
1606  }
1607  }
1608  }
1609  }
1610  }
1611  for (const auto& rpShape : vecxShapeRemove)
1612  {
1613  ::accessibility::AccessibleShape *pAccShape = rpShape.get();
1614  if (pAccShape && !pAccShape->IsDisposed())
1615  {
1616  uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
1617  uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
1618  if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
1619  {
1620  SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
1621  if (m_setParaAdd.count(pAccPara) == 0 )
1622  {
1623  m_setParaRemove.insert(pAccPara);
1624  }
1625  }
1626  }
1627  }
1628 }
1629 
1631  mpVSh( pSh ),
1632  mbShapeSelected( false ),
1633  maDocName(SwAccessibleContext::GetResource(STR_ACCESS_DOC_NAME))
1634 {
1635  pSh->GetLayout()->AddAccessibleShell();
1636 }
1637 
1639 {
1641  uno::Reference < XAccessible > xAcc;
1642  {
1643  osl::MutexGuard aGuard( maMutex );
1644  if( mpFrameMap )
1645  {
1646  const SwRootFrame *pRootFrame = GetShell()->GetLayout();
1647  SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->find( pRootFrame );
1648  if( aIter != mpFrameMap->end() )
1649  xAcc = (*aIter).second;
1650  if( !xAcc.is() )
1651  assert(false); // let's hope this can't happen? the vcl::Window apparently owns the top-level
1652  //xAcc = new SwAccessibleDocument(shared_from_this());
1653  }
1654  }
1655 
1656  if(xAcc.is())
1657  {
1658  SwAccessibleDocumentBase *const pAcc =
1659  static_cast<SwAccessibleDocumentBase *>(xAcc.get());
1660  pAcc->Dispose( true );
1661  }
1662 #if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
1663  if( mpFrameMap )
1664  {
1666  while( aIter != mpFrameMap->end() )
1667  {
1668  uno::Reference < XAccessible > xTmp = (*aIter).second;
1669  if( xTmp.is() )
1670  {
1671  SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() );
1672  assert(pTmp->GetMap() == nullptr); // must be disposed
1673  }
1674  ++aIter;
1675  }
1676  }
1677 #endif
1678  {
1679  osl::MutexGuard aGuard( maMutex );
1680  assert((!mpFrameMap || mpFrameMap->empty()) &&
1681  "Frame map should be empty after disposing the root frame");
1682  assert((!mpShapeMap || mpShapeMap->empty()) &&
1683  "Object map should be empty after disposing the root frame");
1684  mpFrameMap.reset();
1685  mpShapeMap.reset();
1686  mvShapes.clear();
1687  mpSelectedParas.reset();
1688  }
1689 
1690  mpPreview.reset();
1691 
1692  {
1693  osl::MutexGuard aGuard( maEventMutex );
1694  assert(!mpEvents);
1695  assert(!mpEventMap);
1696  mpEventMap.reset();
1697  mpEvents.reset();
1698  }
1700 }
1701 
1702 uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView_(
1703  bool bPagePreview )
1704 {
1705  uno::Reference < XAccessible > xAcc;
1706  bool bSetVisArea = false;
1707 
1708  {
1709  osl::MutexGuard aGuard( maMutex );
1710 
1711  if( !mpFrameMap )
1712  {
1714 #if OSL_DEBUG_LEVEL > 0
1715  mpFrameMap->mbLocked = false;
1716 #endif
1717  }
1718 
1719 #if OSL_DEBUG_LEVEL > 0
1720  assert(!mpFrameMap->mbLocked);
1721  mpFrameMap->mbLocked = true;
1722 #endif
1723 
1724  const SwRootFrame *pRootFrame = GetShell()->GetLayout();
1725  SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->find( pRootFrame );
1726  if( aIter != mpFrameMap->end() )
1727  xAcc = (*aIter).second;
1728  if( xAcc.is() )
1729  {
1730  bSetVisArea = true; // Set VisArea when map mutex is not locked
1731  }
1732  else
1733  {
1734  if( bPagePreview )
1735  xAcc = new SwAccessiblePreview(shared_from_this());
1736  else
1737  xAcc = new SwAccessibleDocument(shared_from_this());
1738 
1739  if( aIter != mpFrameMap->end() )
1740  {
1741  (*aIter).second = xAcc;
1742  }
1743  else
1744  {
1745  mpFrameMap->emplace( pRootFrame, xAcc );
1746  }
1747  }
1748 
1749 #if OSL_DEBUG_LEVEL > 0
1750  mpFrameMap->mbLocked = false;
1751 #endif
1752  }
1753 
1754  if( bSetVisArea )
1755  {
1756  SwAccessibleDocumentBase *pAcc =
1757  static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
1758  pAcc->SetVisArea();
1759  }
1760 
1761  return xAcc;
1762 }
1763 
1764 uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView( )
1765 {
1766  return GetDocumentView_( false );
1767 }
1768 
1769 uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
1770  const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
1771  const Fraction& _rScale,
1772  const SwPageFrame* _pSelectedPageFrame,
1773  const Size& _rPreviewWinSize )
1774 {
1775  // create & update preview data object
1776  if( mpPreview == nullptr )
1777  mpPreview.reset( new SwAccPreviewData() );
1778  mpPreview->Update( *this, _rPreviewPages, _rScale, _pSelectedPageFrame, _rPreviewWinSize );
1779 
1780  uno::Reference<XAccessible> xAcc = GetDocumentView_( true );
1781  return xAcc;
1782 }
1783 
1784 uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame,
1785  bool bCreate )
1786 {
1788  uno::Reference < XAccessible > xAcc;
1789  uno::Reference < XAccessible > xOldCursorAcc;
1790  bool bOldShapeSelected = false;
1791 
1792  {
1793  osl::MutexGuard aGuard( maMutex );
1794 
1795  if( !mpFrameMap && bCreate )
1797  if( mpFrameMap )
1798  {
1799  SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->find( pFrame );
1800  if( aIter != mpFrameMap->end() )
1801  xAcc = (*aIter).second;
1802 
1803  if( !xAcc.is() && bCreate )
1804  {
1806  switch( pFrame->GetType() )
1807  {
1808  case SwFrameType::Txt:
1809  pAcc = new SwAccessibleParagraph(shared_from_this(),
1810  static_cast< const SwTextFrame& >( *pFrame ) );
1811  break;
1812  case SwFrameType::Header:
1813  pAcc = new SwAccessibleHeaderFooter(shared_from_this(),
1814  static_cast< const SwHeaderFrame *>( pFrame ) );
1815  break;
1816  case SwFrameType::Footer:
1817  pAcc = new SwAccessibleHeaderFooter(shared_from_this(),
1818  static_cast< const SwFooterFrame *>( pFrame ) );
1819  break;
1820  case SwFrameType::Ftn:
1821  {
1822  const SwFootnoteFrame *pFootnoteFrame =
1823  static_cast < const SwFootnoteFrame * >( pFrame );
1824  bool bIsEndnote =
1825  SwAccessibleFootnote::IsEndnote( pFootnoteFrame );
1826  pAcc = new SwAccessibleFootnote(shared_from_this(), bIsEndnote,
1827  /*(bIsEndnote ? mnEndnote++ : mnFootnote++),*/
1828  pFootnoteFrame );
1829  }
1830  break;
1831  case SwFrameType::Fly:
1832  {
1833  const SwFlyFrame *pFlyFrame =
1834  static_cast < const SwFlyFrame * >( pFrame );
1835  switch( SwAccessibleFrameBase::GetNodeType( pFlyFrame ) )
1836  {
1837  case SwNodeType::Grf:
1838  pAcc = new SwAccessibleGraphic(shared_from_this(), pFlyFrame );
1839  break;
1840  case SwNodeType::Ole:
1841  pAcc = new SwAccessibleEmbeddedObject(shared_from_this(), pFlyFrame );
1842  break;
1843  default:
1844  pAcc = new SwAccessibleTextFrame(shared_from_this(), *pFlyFrame );
1845  break;
1846  }
1847  }
1848  break;
1849  case SwFrameType::Cell:
1850  pAcc = new SwAccessibleCell(shared_from_this(),
1851  static_cast< const SwCellFrame *>( pFrame ) );
1852  break;
1853  case SwFrameType::Tab:
1854  pAcc = new SwAccessibleTable(shared_from_this(),
1855  static_cast< const SwTabFrame *>( pFrame ) );
1856  break;
1857  case SwFrameType::Page:
1858  OSL_ENSURE( GetShell()->IsPreview(),
1859  "accessible page frames only in PagePreview" );
1860  pAcc = new SwAccessiblePage(shared_from_this(), pFrame);
1861  break;
1862  default: break;
1863  }
1864  xAcc = pAcc;
1865  assert(xAcc.is());
1866 
1867  if( aIter != mpFrameMap->end() )
1868  {
1869  (*aIter).second = xAcc;
1870  }
1871  else
1872  {
1873  mpFrameMap->emplace( pFrame, xAcc );
1874  }
1875 
1876  if( pAcc->HasCursor() &&
1877  !AreInSameTable( mxCursorContext, pFrame ) )
1878  {
1879  // If the new context has the focus, and if we know
1880  // another context that had the focus, then the focus
1881  // just moves from the old context to the new one. We
1882  // then have to send a focus event and a caret event for
1883  // the old context. We have to do that now,
1884  // because after we have left this method, anyone might
1885  // call getStates for the new context and will get a
1886  // focused state then. Sending the focus changes event
1887  // after that seems to be strange. However, we cannot
1888  // send a focus event for the new context now, because
1889  // no one except us knows it. In any case, we remember
1890  // the new context as the one that has the focus
1891  // currently.
1892 
1893  xOldCursorAcc = mxCursorContext;
1894  mxCursorContext = xAcc;
1895 
1896  bOldShapeSelected = mbShapeSelected;
1897  mbShapeSelected = false;
1898  }
1899  }
1900  }
1901  }
1902 
1903  // Invalidate focus for old object when map is not locked
1904  if( xOldCursorAcc.is() )
1905  InvalidateCursorPosition( xOldCursorAcc );
1906  if( bOldShapeSelected )
1908 
1909  return xAcc;
1910 }
1911 
1913  const SwFrame *pFrame,
1914  bool bCreate )
1915 {
1916  uno::Reference < XAccessible > xAcc( GetContext( pFrame, bCreate ) );
1917 
1919  static_cast< SwAccessibleContext * >( xAcc.get() ) );
1920 
1921  return xAccImpl;
1922 }
1923 
1924 uno::Reference< XAccessible> SwAccessibleMap::GetContext(
1925  const SdrObject *pObj,
1926  SwAccessibleContext *pParentImpl,
1927  bool bCreate )
1928 {
1929  uno::Reference < XAccessible > xAcc;
1930  uno::Reference < XAccessible > xOldCursorAcc;
1931 
1932  {
1933  osl::MutexGuard aGuard( maMutex );
1934 
1935  if( !mpShapeMap && bCreate )
1936  mpShapeMap.reset(new SwAccessibleShapeMap_Impl( this ));
1937  if( mpShapeMap )
1938  {
1939  SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->find( pObj );
1940  if( aIter != mpShapeMap->end() )
1941  xAcc = (*aIter).second;
1942 
1943  if( !xAcc.is() && bCreate )
1944  {
1946  uno::Reference < drawing::XShape > xShape(
1947  const_cast< SdrObject * >( pObj )->getUnoShape(),
1948  uno::UNO_QUERY );
1949  if( xShape.is() )
1950  {
1951  ::accessibility::ShapeTypeHandler& rShapeTypeHandler =
1953  uno::Reference < XAccessible > xParent( pParentImpl );
1955  xShape, xParent, this );
1956 
1957  pAcc = rShapeTypeHandler.CreateAccessibleObject(
1958  aShapeInfo, mpShapeMap->GetInfo() );
1959  }
1960  xAcc = pAcc.get();
1961  assert(xAcc.is());
1962  pAcc->Init();
1963  if( aIter != mpShapeMap->end() )
1964  {
1965  (*aIter).second = xAcc;
1966  }
1967  else
1968  {
1969  mpShapeMap->emplace( pObj, xAcc );
1970  }
1971  // TODO: focus!!!
1972  AddGroupContext(pObj, xAcc);
1973  }
1974  }
1975  }
1976 
1977  // Invalidate focus for old object when map is not locked
1978  if( xOldCursorAcc.is() )
1979  InvalidateCursorPosition( xOldCursorAcc );
1980 
1981  return xAcc;
1982 }
1983 
1984 bool SwAccessibleMap::IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh)
1985 {
1986  if (pFESh)
1987  return pFESh->IsObjSameLevelWithMarked(pObj);
1988  return false;
1989 }
1990 
1991 void SwAccessibleMap::AddShapeContext(const SdrObject *pObj, uno::Reference < XAccessible > const & xAccShape)
1992 {
1993  osl::MutexGuard aGuard( maMutex );
1994 
1995  if( mpShapeMap )
1996  {
1997  mpShapeMap->emplace( pObj, xAccShape );
1998  }
1999 
2000 }
2001 
2002 //Added by yanjun for sym2_6407
2004 {
2005  osl::MutexGuard aGuard( maMutex );
2006  // TODO: Why are sub-shapes of group shapes even added to our map?
2007  // Doesn't the AccessibleShape of the top-level shape create them
2008  // on demand anyway? Why does SwAccessibleMap need to know them?
2009  // We cannot rely on getAccessibleChild here to remove the sub-shapes
2010  // from mpShapes because the top-level shape may not only be disposed here
2011  // but also by visibility checks in svx, then it doesn't return children.
2012  if (mpShapeMap && pParentObj && pParentObj->IsGroupObject())
2013  {
2014  SdrObjList *const pChildren(pParentObj->GetSubList());
2015  for (size_t i = 0; pChildren && i < pChildren->GetObjCount(); ++i)
2016  {
2017  SdrObject *const pChild(pChildren->GetObj(i));
2018  assert(pChild);
2019  RemoveContext(pChild);
2020  }
2021  }
2022 }
2023 //End
2024 
2025 void SwAccessibleMap::AddGroupContext(const SdrObject *pParentObj, uno::Reference < XAccessible > const & xAccParent)
2026 {
2027  osl::MutexGuard aGuard( maMutex );
2028  if( !mpShapeMap )
2029  return;
2030 
2031  //here get all the sub list.
2032  if (!pParentObj->IsGroupObject())
2033  return;
2034 
2035  if (!xAccParent.is())
2036  return;
2037 
2038  uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
2039  if (!xContext.is())
2040  return;
2041 
2042  sal_Int32 nChildren = xContext->getAccessibleChildCount();
2043  for(sal_Int32 i = 0; i<nChildren; i++)
2044  {
2045  uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
2046  if (xChild.is())
2047  {
2048  uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
2049  if (xChildContext.is())
2050  {
2051  short nRole = xChildContext->getAccessibleRole();
2052  if (nRole == AccessibleRole::SHAPE)
2053  {
2054  ::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
2055  uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
2056  if (xShape.is())
2057  {
2059  AddShapeContext(pObj, xChild);
2060  AddGroupContext(pObj,xChild);
2061  }
2062  }
2063  }
2064  }
2065  }
2066 }
2067 
2069  const SdrObject *pObj,
2070  SwAccessibleContext *pParentImpl,
2071  bool bCreate )
2072 {
2073  uno::Reference < XAccessible > xAcc( GetContext( pObj, pParentImpl, bCreate ) );
2074 
2076  static_cast< ::accessibility::AccessibleShape* >( xAcc.get() ) );
2077 
2078  return xAccImpl;
2079 }
2080 
2082 {
2083  osl::MutexGuard aGuard( maMutex );
2084 
2085  if( !mpFrameMap )
2086  return;
2087 
2089  mpFrameMap->find( pFrame );
2090  if( aIter == mpFrameMap->end() )
2091  return;
2092 
2093  mpFrameMap->erase( aIter );
2094 
2095  // Remove reference to old caret object. Though mxCursorContext
2096  // is a weak reference and cleared automatically, clearing it
2097  // directly makes sure to not keep a non-functional object.
2098  uno::Reference < XAccessible > xOldAcc( mxCursorContext );
2099  if( xOldAcc.is() )
2100  {
2101  SwAccessibleContext *pOldAccImpl =
2102  static_cast< SwAccessibleContext *>( xOldAcc.get() );
2103  OSL_ENSURE( pOldAccImpl->GetFrame(), "old caret context is disposed" );
2104  if( pOldAccImpl->GetFrame() == pFrame )
2105  {
2106  xOldAcc.clear(); // get an empty ref
2107  mxCursorContext = xOldAcc;
2108  }
2109  }
2110 
2111  if( mpFrameMap->empty() )
2112  {
2113  mpFrameMap.reset();
2114  }
2115 }
2116 
2118 {
2119  osl::MutexGuard aGuard( maMutex );
2120 
2121  if( !mpShapeMap )
2122  return;
2123 
2124  SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->find( pObj );
2125  if( aIter == mpShapeMap->end() )
2126  return;
2127 
2128  uno::Reference < XAccessible > xTempHold( (*aIter).second );
2129  mpShapeMap->erase( aIter );
2130  RemoveGroupContext(pObj);
2131  // The shape selection flag is not cleared, but one might do
2132  // so but has to make sure that the removed context is the one
2133  // that is selected.
2134 
2135  if( mpShapeMap && mpShapeMap->empty() )
2136  {
2137  mpShapeMap.reset();
2138  }
2139 }
2140 
2141 bool SwAccessibleMap::Contains(const SwFrame *pFrame) const
2142 {
2143  return (pFrame && mpFrameMap && mpFrameMap->find(pFrame) != mpFrameMap->end());
2144 }
2145 
2147  const SdrObject *pObj,
2148  vcl::Window* pWindow,
2149  bool bRecursive,
2150  bool bCanSkipInvisible )
2151 {
2152  SwAccessibleChild aFrameOrObj( pFrame, pObj, pWindow );
2153 
2154  // Indeed, the following assert checks the frame's accessible flag,
2155  // because that's the one that is evaluated in the layout. The frame
2156  // might not be accessible anyway. That's the case for cell frames that
2157  // contain further cells.
2158  OSL_ENSURE( !aFrameOrObj.GetSwFrame() || aFrameOrObj.GetSwFrame()->IsAccessibleFrame(),
2159  "non accessible frame should be disposed" );
2160 
2161  if (!(aFrameOrObj.IsAccessible(GetShell()->IsPreview())
2162  // fdo#87199 dispose the darn thing if it ever was accessible
2163  || Contains(pFrame)))
2164  return;
2165 
2169  // get accessible context for frame
2170  {
2171  osl::MutexGuard aGuard( maMutex );
2172 
2173  // First of all look for an accessible context for a frame
2174  if( aFrameOrObj.GetSwFrame() && mpFrameMap )
2175  {
2177  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2178  if( aIter != mpFrameMap->end() )
2179  {
2180  uno::Reference < XAccessible > xAcc( (*aIter).second );
2181  xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
2182  }
2183  }
2184  if( !xAccImpl.is() && mpFrameMap )
2185  {
2186  // If there is none, look if the parent is accessible.
2187  const SwFrame *pParent =
2188  SwAccessibleFrame::GetParent( aFrameOrObj,
2189  GetShell()->IsPreview());
2190 
2191  if( pParent )
2192  {
2194  mpFrameMap->find( pParent );
2195  if( aIter != mpFrameMap->end() )
2196  {
2197  uno::Reference < XAccessible > xAcc( (*aIter).second );
2198  xParentAccImpl =
2199  static_cast< SwAccessibleContext *>( xAcc.get() );
2200  }
2201  }
2202  }
2203  if( !xParentAccImpl.is() && !aFrameOrObj.GetSwFrame() && mpShapeMap )
2204  {
2206  mpShapeMap->find( aFrameOrObj.GetDrawObject() );
2207  if( aIter != mpShapeMap->end() )
2208  {
2209  uno::Reference < XAccessible > xAcc( (*aIter).second );
2210  xShapeAccImpl =
2211  static_cast< ::accessibility::AccessibleShape *>( xAcc.get() );
2212  }
2213  }
2214  if( pObj && GetShell()->ActionPend() &&
2215  (xParentAccImpl.is() || xShapeAccImpl.is()) )
2216  {
2217  // Keep a reference to the XShape to avoid that it
2218  // is deleted with a SwFrameFormat::SwClientNotify.
2219  uno::Reference < drawing::XShape > xShape(
2220  const_cast< SdrObject * >( pObj )->getUnoShape(),
2221  uno::UNO_QUERY );
2222  if( xShape.is() )
2223  {
2224  mvShapes.push_back( xShape );
2225  }
2226  }
2227  }
2228 
2229  // remove events stored for the frame
2230  {
2231  osl::MutexGuard aGuard( maEventMutex );
2232  if( mpEvents )
2233  {
2235  mpEventMap->find( aFrameOrObj );
2236  if( aIter != mpEventMap->end() )
2237  {
2238  SwAccessibleEvent_Impl aEvent(
2239  SwAccessibleEvent_Impl::DISPOSE, aFrameOrObj );
2240  AppendEvent( aEvent );
2241  }
2242  }
2243  }
2244 
2245  // If the frame is accessible and there is a context for it, dispose
2246  // the frame. If the frame is no context for it but disposing should
2247  // take place recursive, the frame's children have to be disposed
2248  // anyway, so we have to create the context then.
2249  if( xAccImpl.is() )
2250  {
2251  xAccImpl->Dispose( bRecursive );
2252  }
2253  else if( xParentAccImpl.is() )
2254  {
2255  // If the frame is a cell frame, the table must be notified.
2256  // If we are in an action, a table model change event will
2257  // be broadcasted at the end of the action to give the table
2258  // a chance to generate a single table change event.
2259 
2260  xParentAccImpl->DisposeChild( aFrameOrObj, bRecursive, bCanSkipInvisible );
2261  }
2262  else if( xShapeAccImpl.is() )
2263  {
2264  RemoveContext( aFrameOrObj.GetDrawObject() );
2265  xShapeAccImpl->dispose();
2266  }
2267 
2268  if( mpPreview && pFrame && pFrame->IsPageFrame() )
2269  mpPreview->DisposePage( static_cast< const SwPageFrame *>( pFrame ) );
2270 }
2271 
2273  const SdrObject *pObj,
2274  vcl::Window* pWindow,
2275  const SwRect& rOldBox )
2276 {
2277  SwAccessibleChild aFrameOrObj( pFrame, pObj, pWindow );
2278  if( !aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2279  return;
2280 
2283  const SwFrame *pParent =nullptr;
2284  {
2285  osl::MutexGuard aGuard( maMutex );
2286 
2287  if( mpFrameMap )
2288  {
2289  if( aFrameOrObj.GetSwFrame() )
2290  {
2292  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2293  if( aIter != mpFrameMap->end() )
2294  {
2295  // If there is an accessible object already it is
2296  // notified directly.
2297  uno::Reference < XAccessible > xAcc( (*aIter).second );
2298  xAccImpl =
2299  static_cast< SwAccessibleContext *>( xAcc.get() );
2300  }
2301  }
2302  if( !xAccImpl.is() )
2303  {
2304  // Otherwise we look if the parent is accessible.
2305  // If not, there is nothing to do.
2306  pParent =
2307  SwAccessibleFrame::GetParent( aFrameOrObj,
2308  GetShell()->IsPreview());
2309 
2310  if( pParent )
2311  {
2313  mpFrameMap->find( pParent );
2314  if( aIter != mpFrameMap->end() )
2315  {
2316  uno::Reference < XAccessible > xAcc( (*aIter).second );
2317  xParentAccImpl =
2318  static_cast< SwAccessibleContext *>( xAcc.get() );
2319  }
2320  }
2321  }
2322  }
2323  }
2324 
2325  if( xAccImpl.is() )
2326  {
2327  if( GetShell()->ActionPend() )
2328  {
2329  SwAccessibleEvent_Impl aEvent(
2330  SwAccessibleEvent_Impl::POS_CHANGED, xAccImpl.get(),
2331  aFrameOrObj, rOldBox );
2332  AppendEvent( aEvent );
2333  }
2334  else
2335  {
2336  FireEvents();
2337  if (xAccImpl->GetFrame()) // not if disposed by FireEvents()
2338  {
2339  xAccImpl->InvalidatePosOrSize(rOldBox);
2340  }
2341  }
2342  }
2343  else if( xParentAccImpl.is() )
2344  {
2345  if( GetShell()->ActionPend() )
2346  {
2347  assert(pParent);
2348  // tdf#99722 faster not to buffer events that won't be sent
2349  if (!SwAccessibleChild(pParent).IsVisibleChildrenOnly()
2350  || xParentAccImpl->IsShowing(rOldBox)
2351  || xParentAccImpl->IsShowing(*this, aFrameOrObj))
2352  {
2353  SwAccessibleEvent_Impl aEvent(
2355  xParentAccImpl.get(), aFrameOrObj, rOldBox );
2356  AppendEvent( aEvent );
2357  }
2358  }
2359  else
2360  {
2361  FireEvents();
2362  xParentAccImpl->InvalidateChildPosOrSize( aFrameOrObj,
2363  rOldBox );
2364  }
2365  }
2366  else if(pParent)
2367  {
2368 /*
2369 For child graphic and its parent paragraph,if split 2 graphic to 2 paragraph,
2370 will delete one graphic swfrm and new create 1 graphic swfrm ,
2371 then the new paragraph and the new graphic SwFrame will add .
2372 but when add graphic SwFrame ,the accessible of the new Paragraph is not created yet.
2373 so the new graphic accessible 'parent is NULL,
2374 so run here: save the parent's SwFrame not the accessible object parent,
2375 */
2376  bool bIsValidFrame = false;
2377  bool bIsTextParent = false;
2378  if (aFrameOrObj.GetSwFrame())
2379  {
2380  if (SwFrameType::Fly == pFrame->GetType())
2381  {
2382  bIsValidFrame =true;
2383  }
2384  }
2385  else if(pObj)
2386  {
2387  if (SwFrameType::Txt == pParent->GetType())
2388  {
2389  bIsTextParent =true;
2390  }
2391  }
2392  if( bIsValidFrame || bIsTextParent )
2393  {
2394  if( GetShell()->ActionPend() )
2395  {
2396  SwAccessibleEvent_Impl aEvent(
2398  pParent, aFrameOrObj, rOldBox );
2399  AppendEvent( aEvent );
2400  }
2401  else
2402  {
2403  OSL_ENSURE(false,"");
2404  }
2405  }
2406  }
2407 }
2408 
2410 {
2411  SwAccessibleChild aFrameOrObj( pFrame );
2412  if( !aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2413  return;
2414 
2415  uno::Reference < XAccessible > xAcc;
2416  {
2417  osl::MutexGuard aGuard( maMutex );
2418 
2419  if( mpFrameMap )
2420  {
2422  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2423  if( aIter != mpFrameMap->end() )
2424  xAcc = (*aIter).second;
2425  }
2426  }
2427 
2428  if( !xAcc.is() )
2429  return;
2430 
2431  SwAccessibleContext *pAccImpl =
2432  static_cast< SwAccessibleContext *>( xAcc.get() );
2433  if( GetShell()->ActionPend() )
2434  {
2435  SwAccessibleEvent_Impl aEvent(
2437  aFrameOrObj );
2438  AppendEvent( aEvent );
2439  }
2440  else
2441  {
2442  FireEvents();
2443  pAccImpl->InvalidateContent();
2444  }
2445 }
2446 
2448 {
2449  SwAccessibleChild aFrameOrObj( &rTextFrame );
2450  if( !aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2451  return;
2452 
2453  uno::Reference < XAccessible > xAcc;
2454  {
2455  osl::MutexGuard aGuard( maMutex );
2456 
2457  if( mpFrameMap )
2458  {
2460  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2461  if( aIter != mpFrameMap->end() )
2462  xAcc = (*aIter).second;
2463  }
2464  }
2465 
2466  if( !xAcc.is() )
2467  return;
2468 
2469  SwAccessibleContext *pAccImpl =
2470  static_cast< SwAccessibleContext *>( xAcc.get() );
2471  if( GetShell()->ActionPend() )
2472  {
2474  pAccImpl, aFrameOrObj );
2476  AppendEvent( aEvent );
2477  }
2478  else
2479  {
2480  FireEvents();
2481  pAccImpl->InvalidateAttr();
2482  }
2483 }
2484 
2486 {
2487  SwAccessibleChild aFrameOrObj( pFrame );
2488  bool bShapeSelected = false;
2489  const SwViewShell *pVSh = GetShell();
2490  if( auto pCSh = dynamic_cast<const SwCursorShell*>(pVSh) )
2491  {
2492  if( pCSh->IsTableMode() )
2493  {
2494  while( aFrameOrObj.GetSwFrame() && !aFrameOrObj.GetSwFrame()->IsCellFrame() )
2495  aFrameOrObj = aFrameOrObj.GetSwFrame()->GetUpper();
2496  }
2497  else if( auto pFESh = dynamic_cast<const SwFEShell*>(pVSh) )
2498  {
2499  const SwFrame *pFlyFrame = pFESh->GetSelectedFlyFrame();
2500  if( pFlyFrame )
2501  {
2502  OSL_ENSURE( !pFrame || pFrame->FindFlyFrame() == pFlyFrame,
2503  "cursor is not contained in fly frame" );
2504  aFrameOrObj = pFlyFrame;
2505  }
2506  else if( pFESh->IsObjSelected() > 0 )
2507  {
2508  bShapeSelected = true;
2509  aFrameOrObj = static_cast<const SwFrame *>( nullptr );
2510  }
2511  }
2512  }
2513 
2514  OSL_ENSURE( bShapeSelected || aFrameOrObj.IsAccessible(GetShell()->IsPreview()),
2515  "frame is not accessible" );
2516 
2517  uno::Reference < XAccessible > xOldAcc;
2518  uno::Reference < XAccessible > xAcc;
2519  bool bOldShapeSelected = false;
2520 
2521  {
2522  osl::MutexGuard aGuard( maMutex );
2523 
2524  xOldAcc = mxCursorContext;
2525  mxCursorContext = xAcc; // clear reference
2526 
2527  bOldShapeSelected = mbShapeSelected;
2528  mbShapeSelected = bShapeSelected;
2529 
2530  if( aFrameOrObj.GetSwFrame() && mpFrameMap )
2531  {
2533  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2534  if( aIter != mpFrameMap->end() )
2535  xAcc = (*aIter).second;
2536  else
2537  {
2538  SwRect rcEmpty;
2539  const SwTabFrame* pTabFrame = aFrameOrObj.GetSwFrame()->FindTabFrame();
2540  if (pTabFrame)
2541  {
2542  InvalidatePosOrSize(pTabFrame, nullptr, nullptr, rcEmpty);
2543  }
2544  else
2545  {
2546  InvalidatePosOrSize(aFrameOrObj.GetSwFrame(), nullptr, nullptr, rcEmpty);
2547  }
2548 
2549  aIter = mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2550  if( aIter != mpFrameMap->end() )
2551  {
2552  xAcc = (*aIter).second;
2553  }
2554  }
2555 
2556  // For cells, some extra thoughts are necessary,
2557  // because invalidating the cursor for one cell
2558  // invalidates the cursor for all cells of the same
2559  // table. For this reason, we don't want to
2560  // invalidate the cursor for the old cursor object
2561  // and the new one if they are within the same table,
2562  // because this would result in doing the work twice.
2563  // Moreover, we have to make sure to invalidate the
2564  // cursor even if the current cell has no accessible object.
2565  // If the old cursor objects exists and is in the same
2566  // table, it's the best choice, because using it avoids
2567  // an unnecessary cursor invalidation cycle when creating
2568  // a new object for the current cell.
2569  if( aFrameOrObj.GetSwFrame()->IsCellFrame() )
2570  {
2571  if( xOldAcc.is() &&
2572  AreInSameTable( xOldAcc, aFrameOrObj.GetSwFrame() ) )
2573  {
2574  if( xAcc.is() )
2575  xOldAcc = xAcc; // avoid extra invalidation
2576  else
2577  xAcc = xOldAcc; // make sure at least one
2578  }
2579  if( !xAcc.is() )
2580  xAcc = GetContext( aFrameOrObj.GetSwFrame() );
2581  }
2582  }
2583  else if (bShapeSelected)
2584  {
2585  const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
2586  const SdrMarkList *pMarkList = pFESh->GetMarkList();
2587  if (pMarkList != nullptr && pMarkList->GetMarkCount() == 1)
2588  {
2589  SdrObject *pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
2590  ::rtl::Reference < ::accessibility::AccessibleShape > pAccShapeImpl = GetContextImpl(pObj,nullptr,false);
2591  if (!pAccShapeImpl.is())
2592  {
2593  while (pObj && pObj->getParentSdrObjectFromSdrObject())
2594  {
2595  pObj = pObj->getParentSdrObjectFromSdrObject();
2596  }
2597  if (pObj != nullptr)
2598  {
2599  const SwFrame *pParent = SwAccessibleFrame::GetParent( SwAccessibleChild(pObj), GetShell()->IsPreview() );
2600  if( pParent )
2601  {
2602  ::rtl::Reference< SwAccessibleContext > xParentAccImpl = GetContextImpl(pParent,false);
2603  if (!xParentAccImpl.is())
2604  {
2605  const SwTabFrame* pTabFrame = pParent->FindTabFrame();
2606  if (pTabFrame)
2607  {
2608  //The Table should not add in acc.because the "pParent" is not add to acc .
2609  uno::Reference< XAccessible> xAccParentTab = GetContext(pTabFrame);//Should Create.
2610 
2611  const SwFrame *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pTabFrame), GetShell()->IsPreview() );
2612  if (pParentRoot)
2613  {
2614  ::rtl::Reference< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,false);
2615  if(xParentAccImplRoot.is())
2616  {
2617  AccessibleEventObject aEvent;
2618  aEvent.EventId = AccessibleEventId::CHILD;
2619  aEvent.NewValue <<= xAccParentTab;
2620  xParentAccImplRoot->FireAccessibleEvent( aEvent );
2621  }
2622  }
2623 
2624  //Get "pParent" acc again.
2625  xParentAccImpl = GetContextImpl(pParent,false);
2626  }
2627  else
2628  {
2629  //directly create this acc para .
2630  xParentAccImpl = GetContextImpl(pParent);//Should Create.
2631 
2632  const SwFrame *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pParent), GetShell()->IsPreview() );
2633 
2634  ::rtl::Reference< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,false);
2635  if(xParentAccImplRoot.is())
2636  {
2637  AccessibleEventObject aEvent;
2638  aEvent.EventId = AccessibleEventId::CHILD;
2639  aEvent.NewValue <<= uno::Reference< XAccessible>(xParentAccImpl);
2640  xParentAccImplRoot->FireAccessibleEvent( aEvent );
2641  }
2642  }
2643  }
2644  if (xParentAccImpl.is())
2645  {
2646  uno::Reference< XAccessible> xAccShape =
2647  GetContext(pObj,xParentAccImpl.get());
2648 
2649  AccessibleEventObject aEvent;
2650  aEvent.EventId = AccessibleEventId::CHILD;
2651  aEvent.NewValue <<= xAccShape;
2652  xParentAccImpl->FireAccessibleEvent( aEvent );
2653  }
2654  }
2655  }
2656  }
2657  }
2658  }
2659  }
2660 
2661  m_setParaAdd.clear();
2662  m_setParaRemove.clear();
2663  if( xOldAcc.is() && xOldAcc != xAcc )
2664  InvalidateCursorPosition( xOldAcc );
2665  if( bOldShapeSelected || bShapeSelected )
2666  InvalidateShapeSelection();
2667  if( xAcc.is() )
2668  InvalidateCursorPosition( xAcc );
2669 
2670  InvalidateShapeInParaSelection();
2671 
2672  for (SwAccessibleParagraph* pAccPara : m_setParaRemove)
2673  {
2674  if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && pAccPara->getSelectedText().getLength() == 0)
2675  {
2676  if(pAccPara->SetSelectedState(false))
2677  {
2678  AccessibleEventObject aEvent;
2679  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
2680  pAccPara->FireAccessibleEvent( aEvent );
2681  }
2682  }
2683  }
2684  for (SwAccessibleParagraph* pAccPara : m_setParaAdd)
2685  {
2686  if(pAccPara && pAccPara->SetSelectedState(true))
2687  {
2688  AccessibleEventObject aEvent;
2689  aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
2690  pAccPara->FireAccessibleEvent( aEvent );
2691  }
2692  }
2693 }
2694 
2696 {
2697  if(GetShell()->IsPreview())
2698  {
2699  uno::Reference<XAccessible> xAcc = GetDocumentView_( true );
2700  if (xAcc)
2701  {
2702  SwAccessiblePreview *pAccPreview = static_cast<SwAccessiblePreview *>(xAcc.get());
2703  if (pAccPreview)
2704  {
2705  pAccPreview->InvalidateFocus();
2706  return ;
2707  }
2708  }
2709  }
2710  uno::Reference < XAccessible > xAcc;
2711  {
2712  osl::MutexGuard aGuard( maMutex );
2713 
2714  xAcc = mxCursorContext;
2715  }
2716 
2717  if( xAcc.is() )
2718  {
2719  SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
2720  pAccImpl->InvalidateFocus();
2721  }
2722  else
2723  {
2725  }
2726 }
2727 
2729  const ::rtl::Reference < SwAccessibleContext >& rCursorContext )
2730 {
2731  osl::MutexGuard aGuard( maMutex );
2732  uno::Reference < XAccessible > xAcc( rCursorContext );
2733  mxCursorContext = xAcc;
2734 }
2735 
2737 {
2738  // Start with the frame or the first upper that is accessible
2739  SwAccessibleChild aFrameOrObj( _pFrame );
2740  while( aFrameOrObj.GetSwFrame() &&
2741  !aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2742  aFrameOrObj = aFrameOrObj.GetSwFrame()->GetUpper();
2743  if( !aFrameOrObj.GetSwFrame() )
2744  aFrameOrObj = GetShell()->GetLayout();
2745 
2746  uno::Reference< XAccessible > xAcc( GetContext( aFrameOrObj.GetSwFrame() ) );
2747  SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
2748  if( GetShell()->ActionPend() )
2749  {
2751  pAccImpl,
2752  SwAccessibleChild(pAccImpl->GetFrame()),
2754  AppendEvent( aEvent );
2755  }
2756  else
2757  {
2758  FireEvents();
2760  }
2761 }
2762 
2764  bool bFrom )
2765 {
2766  // first, see if this frame is accessible, and if so, get the respective
2767  SwAccessibleChild aFrameOrObj( pFrame );
2768  if( !aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2769  return;
2770 
2771  uno::Reference < XAccessible > xAcc;
2772  {
2773  osl::MutexGuard aGuard( maMutex );
2774 
2775  if( mpFrameMap )
2776  {
2778  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2779  if( aIter != mpFrameMap->end() )
2780  {
2781  xAcc = (*aIter).second;
2782  }
2783  }
2784  }
2785 
2786  // deliver event directly, or queue event
2787  if( !xAcc.is() )
2788  return;
2789 
2790  SwAccessibleContext *pAccImpl =
2791  static_cast< SwAccessibleContext *>( xAcc.get() );
2792  if( GetShell()->ActionPend() )
2793  {
2795  pAccImpl, SwAccessibleChild(pFrame),
2796  ( bFrom
2799  AppendEvent( aEvent );
2800  }
2801  else
2802  {
2803  FireEvents();
2804  pAccImpl->InvalidateRelation( bFrom
2805  ? AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED
2806  : AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED );
2807  }
2808 }
2809 
2811  const SwFrame* pFollow )
2812 {
2813  InvalidateRelationSet_( pMaster, false );
2814  InvalidateRelationSet_( pFollow, true );
2815 }
2816 
2817 // invalidation of CONTENT_FLOW_FROM/_TO relation of a paragraph
2819  const bool _bFrom )
2820 {
2821  InvalidateRelationSet_( &_rTextFrame, _bFrom );
2822 }
2823 
2824 // invalidation of text selection of a paragraph
2826 {
2827  // first, see if this frame is accessible, and if so, get the respective
2828  SwAccessibleChild aFrameOrObj( &_rTextFrame );
2829  if( !aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2830  return;
2831 
2832  uno::Reference < XAccessible > xAcc;
2833  {
2834  osl::MutexGuard aGuard( maMutex );
2835 
2836  if( mpFrameMap )
2837  {
2839  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2840  if( aIter != mpFrameMap->end() )
2841  {
2842  xAcc = (*aIter).second;
2843  }
2844  }
2845  }
2846 
2847  // deliver event directly, or queue event
2848  if( !xAcc.is() )
2849  return;
2850 
2851  SwAccessibleContext *pAccImpl =
2852  static_cast< SwAccessibleContext *>( xAcc.get() );
2853  if( GetShell()->ActionPend() )
2854  {
2855  SwAccessibleEvent_Impl aEvent(
2857  pAccImpl,
2858  SwAccessibleChild( &_rTextFrame ),
2860  AppendEvent( aEvent );
2861  }
2862  else
2863  {
2864  FireEvents();
2865  pAccImpl->InvalidateTextSelection();
2866  }
2867 }
2868 
2869 sal_Int32 SwAccessibleMap::GetChildIndex( const SwFrame& rParentFrame,
2870  vcl::Window& rChild ) const
2871 {
2872  sal_Int32 nIndex( -1 );
2873 
2874  SwAccessibleChild aFrameOrObj( &rParentFrame );
2875  if( aFrameOrObj.IsAccessible( GetShell()->IsPreview() ) )
2876  {
2877  uno::Reference < XAccessible > xAcc;
2878  {
2879  osl::MutexGuard aGuard( maMutex );
2880 
2881  if( mpFrameMap )
2882  {
2884  mpFrameMap->find( aFrameOrObj.GetSwFrame() );
2885  if( aIter != mpFrameMap->end() )
2886  {
2887  xAcc = (*aIter).second;
2888  }
2889  }
2890  }
2891 
2892  if( xAcc.is() )
2893  {
2894  SwAccessibleContext *pAccImpl =
2895  static_cast< SwAccessibleContext *>( xAcc.get() );
2896 
2897  nIndex = pAccImpl->GetChildIndex( const_cast<SwAccessibleMap&>(*this),
2898  SwAccessibleChild( &rChild ) );
2899  }
2900  }
2901 
2902  return nIndex;
2903 }
2904 
2905 void SwAccessibleMap::UpdatePreview( const std::vector<std::unique_ptr<PreviewPage>>& _rPreviewPages,
2906  const Fraction& _rScale,
2907  const SwPageFrame* _pSelectedPageFrame,
2908  const Size& _rPreviewWinSize )
2909 {
2910  assert(GetShell()->IsPreview() && "no preview?");
2911  assert(mpPreview != nullptr && "no preview data?");
2912 
2913  mpPreview->Update( *this, _rPreviewPages, _rScale, _pSelectedPageFrame, _rPreviewWinSize );
2914 
2915  // propagate change of VisArea through the document's
2916  // accessibility tree; this will also send appropriate scroll
2917  // events
2918  SwAccessibleContext* pDoc =
2919  GetContextImpl( GetShell()->GetLayout() ).get();
2920  static_cast<SwAccessibleDocumentBase*>( pDoc )->SetVisArea();
2921 
2922  uno::Reference < XAccessible > xOldAcc;
2923  uno::Reference < XAccessible > xAcc;
2924  {
2925  osl::MutexGuard aGuard( maMutex );
2926 
2927  xOldAcc = mxCursorContext;
2928 
2929  const SwPageFrame *pSelPage = mpPreview->GetSelPage();
2930  if( pSelPage && mpFrameMap )
2931  {
2933  mpFrameMap->find( pSelPage );
2934  if( aIter != mpFrameMap->end() )
2935  xAcc = (*aIter).second;
2936  }
2937  }
2938 
2939  if( xOldAcc.is() && xOldAcc != xAcc )
2940  InvalidateCursorPosition( xOldAcc );
2941  if( xAcc.is() )
2942  InvalidateCursorPosition( xAcc );
2943 }
2944 
2946 {
2947  assert(GetShell()->IsPreview());
2948  assert(mpPreview != nullptr);
2949 
2950  mpPreview->InvalidateSelection( GetShell()->GetLayout()->GetPageByPageNum( nSelPage ) );
2951 
2952  uno::Reference < XAccessible > xOldAcc;
2953  uno::Reference < XAccessible > xAcc;
2954  {
2955  osl::MutexGuard aGuard( maMutex );
2956 
2957  xOldAcc = mxCursorContext;
2958 
2959  const SwPageFrame *pSelPage = mpPreview->GetSelPage();
2960  if( pSelPage && mpFrameMap )
2961  {
2962  SwAccessibleContextMap_Impl::iterator aIter = mpFrameMap->find( pSelPage );
2963  if( aIter != mpFrameMap->end() )
2964  xAcc = (*aIter).second;
2965  }
2966  }
2967 
2968  if( xOldAcc.is() && xOldAcc != xAcc )
2969  InvalidateCursorPosition( xOldAcc );
2970  if( xAcc.is() )
2971  InvalidateCursorPosition( xAcc );
2972 }
2973 
2974 bool SwAccessibleMap::IsPageSelected( const SwPageFrame *pPageFrame ) const
2975 {
2976  return mpPreview && mpPreview->GetSelPage() == pPageFrame;
2977 }
2978 
2980 {
2981  {
2982  osl::MutexGuard aGuard( maEventMutex );
2983  if( mpEvents )
2984  {
2985  if (mpEvents->IsFiring())
2986  {
2987  return; // prevent recursive FireEvents()
2988  }
2989 
2990  mpEvents->SetFiring();
2991  mpEvents->MoveMissingXAccToEnd();
2992  for( auto const& aEvent : *mpEvents )
2993  FireEvent(aEvent);
2994 
2995  mpEventMap.reset();
2996  mpEvents.reset();
2997  }
2998  }
2999  {
3000  osl::MutexGuard aGuard( maMutex );
3001  mvShapes.clear();
3002  }
3003 
3004 }
3005 
3007 {
3009 }
3010 
3011 // Convert a MM100 value relative to the document root into a pixel value
3012 // relative to the screen!
3013 Point SwAccessibleMap::LogicToPixel( const Point& rPoint ) const
3014 {
3015  Point aPoint = o3tl::toTwips( rPoint, o3tl::Length::mm100 );
3016  if (const vcl::Window* pWin = GetShell()->GetWin())
3017  {
3018  MapMode aMapMode;
3019  GetMapMode( aPoint, aMapMode );
3020  aPoint = pWin->LogicToPixel( aPoint, aMapMode );
3021  aPoint = pWin->OutputToAbsoluteScreenPixel( aPoint );
3022  }
3023 
3024  return aPoint;
3025 }
3026 
3028 {
3029  Size aSize( o3tl::toTwips( rSize, o3tl::Length::mm100 ) );
3030  if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
3031  {
3032  MapMode aMapMode;
3033  GetMapMode( Point(0,0), aMapMode );
3034  aSize = pWin->LogicToPixel( aSize, aMapMode );
3035  }
3036 
3037  return aSize;
3038 }
3039 
3041  ::accessibility::AccessibleShape* pCurrentChild,
3042  const uno::Reference< drawing::XShape >& _rxShape,
3043  const tools::Long /*_nIndex*/,
3044  const ::accessibility::AccessibleShapeTreeInfo& /*_rShapeTreeInfo*/
3045  )
3046 {
3047  const SdrObject *pObj = nullptr;
3048  {
3049  osl::MutexGuard aGuard( maMutex );
3050  if( mpShapeMap )
3051  {
3054  while( aIter != aEndIter && !pObj )
3055  {
3056  uno::Reference < XAccessible > xAcc( (*aIter).second );
3058  static_cast < ::accessibility::AccessibleShape* >( xAcc.get() );
3059  if( pAccShape == pCurrentChild )
3060  {
3061  pObj = (*aIter).first;
3062  }
3063  ++aIter;
3064  }
3065  }
3066  }
3067  if( !pObj )
3068  return false;
3069 
3070  uno::Reference < drawing::XShape > xShape( _rxShape ); // keep reference to shape, because
3071  // we might be the only one that
3072  // holds it.
3073  // Also get keep parent.
3074  uno::Reference < XAccessible > xParent( pCurrentChild->getAccessibleParent() );
3075  pCurrentChild = nullptr; // will be released by dispose
3076  A11yDispose( nullptr, pObj, nullptr );
3077 
3078  {
3079  osl::MutexGuard aGuard( maMutex );
3080 
3081  if( !mpShapeMap )
3082  mpShapeMap.reset(new SwAccessibleShapeMap_Impl( this ));
3083 
3084  // create the new child
3085  ::accessibility::ShapeTypeHandler& rShapeTypeHandler =
3088  xShape, xParent, this );
3090  rShapeTypeHandler.CreateAccessibleObject (
3091  aShapeInfo, mpShapeMap->GetInfo() ));
3092 
3093  uno::Reference < XAccessible > xAcc( pReplacement );
3094  if( xAcc.is() )
3095  {
3096  pReplacement->Init();
3097 
3098  SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap->find( pObj );
3099  if( aIter != mpShapeMap->end() )
3100  {
3101  (*aIter).second = xAcc;
3102  }
3103  else
3104  {
3105  mpShapeMap->emplace( pObj, xAcc );
3106  }
3107  }
3108  }
3109 
3110  SwRect aEmptyRect;
3111  InvalidatePosOrSize( nullptr, pObj, nullptr, aEmptyRect );
3112 
3113  return true;
3114 }
3115 
3116 //Get the accessible control shape from the model object, here model object is with XPropertySet type
3118 {
3119  if( mpShapeMap )
3120  {
3123  while( aIter != aEndIter)
3124  {
3125  uno::Reference < XAccessible > xAcc( (*aIter).second );
3127  static_cast < ::accessibility::AccessibleShape* >( xAcc.get() );
3129  {
3130  ::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
3131  if (pCtlAccShape->GetControlModel() == pSet)
3132  return pCtlAccShape;
3133  }
3134  ++aIter;
3135  }
3136  }
3137  return nullptr;
3138 }
3139 
3140 css::uno::Reference< XAccessible >
3141  SwAccessibleMap::GetAccessibleCaption (const css::uno::Reference< css::drawing::XShape >&)
3142 {
3143  return nullptr;
3144 }
3145 
3146 Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const
3147 {
3148  Point aPoint;
3149  if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
3150  {
3151  MapMode aMapMode;
3152  GetMapMode( rPoint, aMapMode );
3153  aPoint = pWin->PixelToLogic( rPoint, aMapMode );
3154  }
3155  return aPoint;
3156 }
3157 
3159  tools::Long aRefValue, bool bToLower)
3160 {
3161  tools::Long aResult = aCoarseValue;
3162 
3163  if (bToLower)
3164  {
3165  if (aFineValue < aRefValue)
3166  aResult -= 1;
3167  }
3168  else
3169  {
3170  if (aFineValue > aRefValue)
3171  aResult += 1;
3172  }
3173 
3174  return aResult;
3175 }
3176 
3178  const tools::Rectangle & rSource,
3179  const tools::Rectangle & rInGrid)
3180 {
3181  rRect.SetLeft( lcl_CorrectCoarseValue(rRect.Left(), rSource.Left(),
3182  rInGrid.Left(), false) );
3183  rRect.SetTop( lcl_CorrectCoarseValue(rRect.Top(), rSource.Top(),
3184  rInGrid.Top(), false) );
3185  rRect.SetRight( lcl_CorrectCoarseValue(rRect.Right(), rSource.Right(),
3186  rInGrid.Right(), true) );
3187  rRect.SetBottom( lcl_CorrectCoarseValue(rRect.Bottom(), rSource.Bottom(),
3188  rInGrid.Bottom(), true) );
3189 }
3190 
3192 {
3193  tools::Rectangle aRect;
3194  if (const OutputDevice* pWin = GetShell()->GetWin()->GetOutDev())
3195  {
3196  MapMode aMapMode;
3197  GetMapMode( rRect.TopLeft(), aMapMode );
3198  aRect = pWin->LogicToPixel( rRect.SVRect(), aMapMode );
3199 
3200  tools::Rectangle aTmpRect = pWin->PixelToLogic( aRect, aMapMode );
3201  lcl_CorrectRectangle(aRect, rRect.SVRect(), aTmpRect);
3202  }
3203 
3204  return aRect;
3205 }
3206 
3215 void SwAccessibleMap::GetMapMode( const Point& _rPoint,
3216  MapMode& _orMapMode ) const
3217 {
3218  MapMode aMapMode = GetShell()->GetWin()->GetMapMode();
3219  if( GetShell()->IsPreview() )
3220  {
3221  assert(mpPreview != nullptr);
3222  mpPreview->AdjustMapMode( aMapMode, _rPoint );
3223  }
3224  _orMapMode = aMapMode;
3225 }
3226 
3227 Size SwAccessibleMap::GetPreviewPageSize(sal_uInt16 const nPreviewPageNum) const
3228 {
3229  assert(mpVSh->IsPreview());
3230  assert(mpPreview != nullptr);
3231  return mpVSh->PagePreviewLayout()->GetPreviewPageSizeByPageNum(nPreviewPageNum);
3232 }
3233 
3238 std::unique_ptr<SwAccessibleSelectedParas_Impl> SwAccessibleMap::BuildSelectedParas()
3239 {
3240  // no accessible contexts, no selection
3241  if ( !mpFrameMap )
3242  {
3243  return nullptr;
3244  }
3245 
3246  // get cursor as an instance of its base class <SwPaM>
3247  SwPaM* pCursor( nullptr );
3248  {
3249  SwCursorShell* pCursorShell = dynamic_cast<SwCursorShell*>(GetShell());
3250  if ( pCursorShell )
3251  {
3252  SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCursorShell);
3253  if ( !pFEShell ||
3254  ( !pFEShell->IsFrameSelected() &&
3255  pFEShell->IsObjSelected() == 0 ) )
3256  {
3257  // get cursor without updating an existing table cursor.
3258  pCursor = pCursorShell->GetCursor( false );
3259  }
3260  }
3261  }
3262  // no cursor, no selection
3263  if ( !pCursor )
3264  {
3265  return nullptr;
3266  }
3267 
3268  std::unique_ptr<SwAccessibleSelectedParas_Impl> pRetSelectedParas;
3269 
3270  // loop on all cursors
3271  SwPaM* pRingStart = pCursor;
3272  do {
3273 
3274  // for a selection the cursor has to have a mark.
3275  // for safety reasons assure that point and mark are in text nodes
3276  if ( pCursor->HasMark() &&
3277  pCursor->GetPoint()->nNode.GetNode().IsTextNode() &&
3278  pCursor->GetMark()->nNode.GetNode().IsTextNode() )
3279  {
3280  SwPosition* pStartPos = pCursor->Start();
3281  SwPosition* pEndPos = pCursor->End();
3282  // loop on all text nodes inside the selection
3283  SwNodeIndex aIdx( pStartPos->nNode );
3284  for ( ; aIdx.GetIndex() <= pEndPos->nNode.GetIndex(); ++aIdx )
3285  {
3286  SwTextNode* pTextNode( aIdx.GetNode().GetTextNode() );
3287  if ( pTextNode )
3288  {
3289  // loop on all text frames registered at the text node.
3291  for( SwTextFrame* pTextFrame = aIter.First(); pTextFrame; pTextFrame = aIter.Next() )
3292  {
3293  uno::WeakReference < XAccessible > xWeakAcc;
3295  mpFrameMap->find( pTextFrame );
3296  if( aMapIter != mpFrameMap->end() )
3297  {
3298  xWeakAcc = (*aMapIter).second;
3299  SwAccessibleParaSelection aDataEntry(
3300  sw::FrameContainsNode(*pTextFrame, pStartPos->nNode.GetIndex())
3301  ? pTextFrame->MapModelToViewPos(*pStartPos)
3302  : TextFrameIndex(0),
3303 
3304  sw::FrameContainsNode(*pTextFrame, pEndPos->nNode.GetIndex())
3305  ? pTextFrame->MapModelToViewPos(*pEndPos)
3307  if ( !pRetSelectedParas )
3308  {
3309  pRetSelectedParas.reset(
3311  }
3312  // sw_redlinehide: should be idempotent for multiple nodes in a merged para
3313  pRetSelectedParas->emplace( xWeakAcc, aDataEntry );
3314  }
3315  }
3316  }
3317  }
3318  }
3319 
3320  // prepare next turn: get next cursor in ring
3321  pCursor = pCursor->GetNext();
3322  } while ( pCursor != pRingStart );
3323 
3324  return pRetSelectedParas;
3325 }
3326 
3328 {
3329  osl::MutexGuard aGuard( maMutex );
3330 
3331  // keep previously known selected paragraphs
3332  std::unique_ptr<SwAccessibleSelectedParas_Impl> pPrevSelectedParas( std::move(mpSelectedParas) );
3333 
3334  // determine currently selected paragraphs
3336 
3337  // compare currently selected paragraphs with the previously selected
3338  // paragraphs and submit corresponding TEXT_SELECTION_CHANGED events.
3339  // first, search for new and changed selections.
3340  // on the run remove selections from previously known ones, if they are
3341  // also in the current ones.
3342  if ( mpSelectedParas )
3343  {
3345  for ( ; aIter != mpSelectedParas->end(); ++aIter )
3346  {
3347  bool bSubmitEvent( false );
3348  if ( !pPrevSelectedParas )
3349  {
3350  // new selection
3351  bSubmitEvent = true;
3352  }
3353  else
3354  {
3356  pPrevSelectedParas->find( (*aIter).first );
3357  if ( aPrevSelected != pPrevSelectedParas->end() )
3358  {
3359  // check, if selection has changed
3360  if ( (*aIter).second.nStartOfSelection !=
3361  (*aPrevSelected).second.nStartOfSelection ||
3362  (*aIter).second.nEndOfSelection !=
3363  (*aPrevSelected).second.nEndOfSelection )
3364  {
3365  // changed selection
3366  bSubmitEvent = true;
3367  }
3368  pPrevSelectedParas->erase( aPrevSelected );
3369  }
3370  else
3371  {
3372  // new selection
3373  bSubmitEvent = true;
3374  }
3375  }
3376 
3377  if ( bSubmitEvent )
3378  {
3379  uno::Reference < XAccessible > xAcc( (*aIter).first );
3380  if ( xAcc.is() )
3381  {
3383  static_cast<SwAccessibleContext*>( xAcc.get() ) );
3384  if ( xAccImpl.is() && xAccImpl->GetFrame() )
3385  {
3386  const SwTextFrame* pTextFrame = xAccImpl->GetFrame()->DynCastTextFrame();
3387  OSL_ENSURE( pTextFrame,
3388  "<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexpected type of frame" );
3389  if ( pTextFrame )
3390  {
3391  InvalidateParaTextSelection( *pTextFrame );
3392  }
3393  }
3394  }
3395  }
3396  }
3397  }
3398 
3399  // second, handle previous selections - after the first step the data
3400  // structure of the previously known only contains the 'old' selections
3401  if ( !pPrevSelectedParas )
3402  return;
3403 
3404  SwAccessibleSelectedParas_Impl::iterator aIter = pPrevSelectedParas->begin();
3405  for ( ; aIter != pPrevSelectedParas->end(); ++aIter )
3406  {
3407  uno::Reference < XAccessible > xAcc( (*aIter).first );
3408  if ( xAcc.is() )
3409  {
3411  static_cast<SwAccessibleContext*>( xAcc.get() ) );
3412  if ( xAccImpl.is() && xAccImpl->GetFrame() )
3413  {
3414  const SwTextFrame* pTextFrame = xAccImpl->GetFrame()->DynCastTextFrame();
3415  OSL_ENSURE( pTextFrame,
3416  "<SwAccessibleMap::_SubmitTextSelectionChangedEvents()> - unexpected type of frame" );
3417  if ( pTextFrame )
3418  {
3419  InvalidateParaTextSelection( *pTextFrame );
3420  }
3421  }
3422  }
3423  }
3424 }
3425 
3427 {
3428  assert(!GetShell()->IsPreview() || (mpPreview != nullptr));
3429 
3430  return GetShell()->IsPreview()
3431  ? mpPreview->GetVisArea()
3432  : GetShell()->VisArea();
3433 }
3434 
3436 {
3437  return GetShell()->GetDoc()->IsPrepareSelAll();
3438 }
3439 
3440 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AdjustMapMode(MapMode &rMapMode, const Point &rPoint) const
Adjust the MapMode so that the preview page appears at the proper position.
Definition: accmap.cxx:799
bool IsInvalidateTextSelection() const
Definition: accmap.cxx:504
Base class of the Writer layout elements.
Definition: frame.hxx:314
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:159
void SetStates(AccessibleStates _nStates)
Definition: accmap.cxx:487
void InvalidateRelationSet(const SwFrame *pMaster, const SwFrame *pFollow)
Definition: accmap.cxx:2810
std::unique_ptr< SwAccessibleContextMap_Impl > mpFrameMap
Definition: accmap.hxx:94
void DisposePage(const SwPageFrame *pPageFrame)
Definition: accmap.cxx:822
void InvalidateContent(const SwFrame *pFrame)
Definition: accmap.cxx:2409
virtual tools::Rectangle GetVisibleArea() const override
Definition: accmap.cxx:3006
virtual bool IsDocumentSelAll() override
Definition: accmap.cxx:3435
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
void FireAccessibleEvent(css::accessibility::AccessibleEventObject &rEvent)
Definition: acccontext.cxx:442
sal_Int32 nIndex
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2893
const SwFrame * mpParentFrame
Definition: accmap.cxx:373
static bool createEvent(const SdrModel *pDoc, const SdrHint *pSdrHint, css::document::EventObject &aEvent)
std::map< key_type, mapped_type >::iterator iterator
Definition: accmap.cxx:256
void RemoveContext(const SwFrame *pFrame)
Definition: accmap.cxx:2081
SdrHintKind GetKind() const
size_t GetMarkCount() const
bool IsInvalidateRelation() const
Definition: accmap.cxx:500
Marks a position in the document model.
Definition: pam.hxx:36
std::pair< const SdrObject *,::rtl::Reference< ::accessibility::AccessibleShape > > SwAccessibleObjShape_Impl
Definition: accmap.cxx:247
iterator erase(const_iterator const &pos)
Definition: accmap.cxx:669
SdrView * GetDrawView()
Definition: vnew.cxx:373
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:35
constexpr auto toTwips(N number, Length from)
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:3242
SwAccessibleEvent_Impl(EventType eT, SwAccessibleContext *pA, const SwAccessibleChild &rFrameOrObj, const SwRect &rR)
Definition: accmap.cxx:410
SwAccessibleChild maFrameOrObj
Definition: accmap.cxx:366
sal_Int32 GetChildIndex(const SwFrame &rParentFrame, vcl::Window &rChild) const
Definition: accmap.cxx:2869
size_type count(const Value &v) const
size_t size() const
Definition: accmap.cxx:546
const_iterator cend() const
Definition: accmap.cxx:287
std::pair< iterator, bool > emplace(Args &&...args)
Definition: accmap.cxx:291
SwAccessibleParaSelection mapped_type
Definition: accmap.cxx:656
constexpr tools::Long Left() const
std::unique_ptr< SwAccessibleContextMap_Impl > mpSelectedFrameMap
Definition: accmap.hxx:126
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
SwNodeIndex nNode
Definition: pam.hxx:38
bool Contains(const Point &rPOINT) const
SwFrameType GetType() const
Definition: frame.hxx:519
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
Definition: txtfrm.cxx:290
std::unique_ptr< SwAccessibleEventList_Impl > mpEvents
Definition: accmap.hxx:97
std::map< key_type, mapped_type, key_compare >::const_iterator const_iterator
Definition: accmap.cxx:616
long Long
void InvalidateShapeSelection()
Definition: accmap.cxx:1112
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
const SwPageFrame * mpSelPage
Definition: accmap.cxx:682
const css::uno::Reference< css::drawing::XShape > & GetXShape() const
static bool IsEndnote(const SwFootnoteFrame *pFrame)
virtual ::accessibility::AccessibleControlShape * GetAccControlShapeFromModel(css::beans::XPropertySet *pSet) override
Definition: accmap.cxx:3117
const SwPosition * GetMark() const
Definition: pam.hxx:210
SwRect maVisArea
Definition: accmap.cxx:679
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:46
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1210
std::pair< iterator, bool > emplace(Args &&...args)
Definition: accmap.cxx:668
TElementType * Next()
Definition: calbck.hxx:364
const SwAccessibleChild & GetFrameOrObj() const
Definition: accmap.cxx:481
std::map< key_type, mapped_type, key_compare >::iterator iterator
Definition: accmap.cxx:615
const SwRect & GetVisArea() const
Definition: accmap.cxx:713
tuple args
const SdrMarkList * GetMarkList() const
Definition: fesh.hxx:520
SwNode & GetNode() const
Definition: ndindex.hxx:119
SwViewShell * mpVSh
Definition: accmap.hxx:107
iterator erase(const_iterator const &pos)
Definition: accmap.cxx:624
bool IsSelectFrameAnchoredAtPara(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
is a fly anchored at paragraph at rAnchorPos selected?
Definition: undobj.cxx:1643
SdrMark * GetMark(size_t nNum) const
uno::WeakReference< XAccessible > mapped_type
Definition: accmap.cxx:254
rtl::Reference< AccessibleShape > CreateAccessibleObject(const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo) const
::osl::Mutex maEventMutex
Definition: accmap.hxx:93
void FireEvents()
Definition: accmap.cxx:2979
bool IsCellFrame() const
Definition: frame.hxx:1226
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool IsDestroyFrameAnchoredAtChar(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
will DelContentIndex destroy a frame anchored at character at rAnchorPos?
Definition: undobj.cxx:1602
AccessibleStates GetAllStates() const
Definition: accmap.cxx:519
std::map< key_type, mapped_type >::const_iterator const_iterator
Definition: accmap.cxx:257
virtual bool SetSelectedState(bool bSelected) override
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
std::pair< iterator, bool > emplace(Args &&...args)
Definition: accmap.cxx:113
void InvalidatePreviewSelection(sal_uInt16 nSelPage)
Definition: accmap.cxx:2945
std::unique_ptr< SwAccessibleObjShape_Impl[]> Copy(size_t &rSize, const SwFEShell *pFESh, SwAccessibleObjShape_Impl **pSelShape) const
Definition: accmap.cxx:303
virtual SdrObjList * GetSubList() const
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
SfxHintId GetId() const
const unsigned int SELECTION_WITH_NUM
Definition: acctable.cxx:59
void AddTop(const tools::Long nAdd)
Definition: swrect.cxx:128
mutable::osl::Mutex maMutex
Definition: accmap.hxx:92
Point TopLeft() const
Definition: swrect.hxx:254
void InvalidatePosOrSize(const SwFrame *pFrame, const SdrObject *pObj, vcl::Window *pWindow, const SwRect &rOldFrame)
Definition: accmap.cxx:2272
std::list< SwAccessibleEvent_Impl > maEvents
Definition: accmap.cxx:527
bool IsFlyFrame() const
Definition: frame.hxx:1210
SwViewShell * GetShell() const
Definition: accmap.hxx:174
static tools::Long lcl_CorrectCoarseValue(tools::Long aCoarseValue, tools::Long aFineValue, tools::Long aRefValue, bool bToLower)
Definition: accmap.cxx:3158
::rtl::Reference< SwAccessibleContext > GetContextImpl(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1912
NONE
SwIndex nContent
Definition: pam.hxx:39
const SwFrame * GetFrame() const
Definition: accframe.hxx:103
AccessibleStates GetStates() const
Definition: accmap.cxx:514
svx::diagram::Point & mrPoint
void SetModelBroadcaster(const css::uno::Reference< css::document::XShapeEventBroadcaster > &rxModelBroadcaster)
static bool IsInSameLevel(const SdrObject *pObj, const SwFEShell *pFESh)
Definition: accmap.cxx:1984
css::uno::Reference< css::accessibility::XAccessible > GetDocumentPreview(const std::vector< std::unique_ptr< PreviewPage >> &_rPreviewPages, const Fraction &_rScale, const SwPageFrame *_pSelectedPageFrame, const Size &_rPreviewWinSize)
Definition: accmap.cxx:1769
::accessibility::AccessibleShapeTreeInfo maInfo
Definition: accmap.cxx:261
Size GetPreviewPageSizeByPageNum(sal_uInt16 _nPageNum) const
get size of a preview page by its physical page number
std::vector< tools::Rectangle > Rectangles
Definition: accmap.cxx:675
std::map< key_type, mapped_type, key_compare > maMap
Definition: accmap.cxx:618
SwRect & Intersection(const SwRect &rRect)
Definition: swrect.cxx:57
std::map< key_type, mapped_type > maMap
Definition: accmap.cxx:262
Point PixelToCore(const Point &rPoint) const
Definition: accmap.cxx:3146
const SwRect & GetOldBox() const
Definition: accmap.cxx:471
const SwTable & GetTable() const
Definition: node.hxx:506
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
void AddShapeContext(const SdrObject *pObj, css::uno::Reference< css::accessibility::XAccessible > const &xAccShape)
Definition: accmap.cxx:1991
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:957
std::pair< iterator, bool > emplace(Args &&...args)
Definition: accmap.cxx:623
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:152
bool IsSelectedInDoc() const
Definition: acccontext.hxx:355
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1111
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:121
bool IsUpdateCursorPos() const
Definition: accmap.cxx:492
static void lcl_CorrectRectangle(tools::Rectangle &rRect, const tools::Rectangle &rSource, const tools::Rectangle &rInGrid)
Definition: accmap.cxx:3177
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: viewsh.cxx:2783
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewpg.cxx:35
const SwPageFrame * GetSelPage() const
Definition: accmap.cxx:722
static void AdjustLogicPgRectToVisibleArea(SwRect &_iorLogicPgSwRect, const SwRect &_rPreviewPgSwRect, const Size &_rPreviewWinSize)
adjust logic page rectangle to its visible part
Definition: accmap.cxx:829
bool IsEmpty() const
Definition: swrect.hxx:304
SwPaM * GetNext()
Definition: pam.hxx:265
void InvalidateParaTextSelection(const SwTextFrame &_rTextFrame)
invalidation of text selection of a paragraph
Definition: accmap.cxx:2825
std::pair< const key_type, mapped_type > value_type
Definition: accmap.cxx:255
constexpr void SetLeft(tools::Long v)
void FireEvent(const SwAccessibleEvent_Impl &rEvent)
Definition: accmap.cxx:891
std::pair< const key_type, mapped_type > value_type
Definition: accmap.cxx:613
std::unique_ptr< SwAccessibleEventMap_Impl > mpEventMap
Definition: accmap.hxx:98
SdrObject * GetMarkedSdrObj() const
EventType GetType() const
Definition: accmap.cxx:457
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessibleCaption(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: accmap.cxx:3141
UNDERLYING_TYPE get() const
Style of a layout element.
Definition: frmfmt.hxx:59
iterator erase(const_iterator const &pos)
Definition: accmap.cxx:114
void SetScaleX(const Fraction &rScaleX)
#define TOOLS_WARN_EXCEPTION(area, stream)
bool IsPrepareSelAll() const
Definition: doc.hxx:565
const_iterator cbegin() const
Definition: accmap.cxx:286
css::uno::Reference< css::accessibility::XAccessible > GetDocumentView()
Definition: accmap.cxx:1764
Size GetPreviewPageSize(sal_uInt16 _nPreviewPageNum) const
get size of a dedicated preview page
Definition: accmap.cxx:3227
iterator find(const key_type &key)
Definition: accmap.cxx:666
const SdrObject * key_type
Definition: accmap.cxx:253
iterator find(const key_type &key)
Definition: accmap.cxx:111
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
const SwRect & VisArea() const
Definition: viewsh.cxx:630
void InvalidateCursorPosition(const css::uno::Reference< css::accessibility::XAccessible > &rAcc)
const SwPosition * GetPoint() const
Definition: pam.hxx:208
const SwFrame * key_type
Definition: accmap.cxx:88
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
SwAccessibleEvent_Impl(EventType eT)
Definition: accmap.cxx:401
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:130
css::uno::Reference< css::accessibility::XAccessible > GetDocumentView_(bool bPagePreview)
Definition: accmap.cxx:1702
o3tl::sorted_vector< SwAccessibleParagraph * > m_setParaAdd
Definition: accmap.hxx:101
const MapMode & GetMapMode() const
bool ActionPend() const
Definition: viewsh.hxx:196
TElementType * First()
Definition: calbck.hxx:356
SwNodeOffset GetIndex() const
Definition: node.hxx:292
accessibility implementation for the page (SwPageFrame) The page is only visible in the page preview...
Definition: accpage.hxx:32
void SetWindow(vcl::Window *pWindow)
bool IsPreview() const
Definition: viewsh.hxx:493
FlyAnchors.
Definition: fmtanchr.hxx:34
void SetOrigin(const Point &rOrigin)
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
uno::WeakReference< XAccessible > key_type
Definition: accmap.cxx:655
std::map< key_type, mapped_type, key_compare >::iterator iterator
Definition: accmap.cxx:659
static bool GetChildIndex(SwAccessibleMap &rAccMap, const SwRect &rVisArea, const SwFrame &rFrame, const sw::access::SwAccessibleChild &rChild, sal_Int32 &rPos, bool bInPagePreview)
Definition: accframe.cxx:138
void InvalidateStates(AccessibleStates _nStates)
void InvalidateAttr()
#i88069# - attributes has changed
void GetMapMode(const Point &_rPoint, MapMode &_orMapMode) const
get mapping mode for LogicToPixel and PixelToLogic conversions
Definition: accmap.cxx:3215
constexpr tools::Long Right() const
o3tl::sorted_vector< SwAccessibleParagraph * > m_setParaRemove
Definition: accmap.hxx:102
const css::uno::Reference< css::beans::XPropertySet > & GetControlModel() const
SwAccessibleChildFunc key_compare
Definition: accmap.cxx:614
static ShapeTypeHandler & Instance()
const SwRect & GetVisArea() const
Definition: accmap.cxx:3426
void SetScaleY(const Fraction &rScaleY)
std::pair< const key_type, mapped_type > value_type
Definition: accmap.cxx:90
constexpr tools::Long Top() const
bool IsGroupObject() const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Definition: acccontext.cxx:685
Marks a node in the document model.
Definition: ndindex.hxx:30
constexpr void SetRight(tools::Long v)
virtual ~SwAccessibleMap() override
Definition: accmap.cxx:1638
Fraction maScale
Definition: accmap.cxx:680
void InvalidateRelation(sal_uInt16 nType)
ring_container GetRingContainer()
Definition: ring.hxx:240
constexpr void SetBottom(tools::Long v)
void AddRight(const tools::Long nAdd)
Definition: swrect.cxx:127
bool IsInvalidateStates() const
Definition: accmap.cxx:496
iterator find(const key_type &key)
Definition: accmap.cxx:289
access to an accessible Writer document
Definition: accdoc.hxx:92
virtual bool ReplaceChild(::accessibility::AccessibleShape *pCurrentChild, const css::uno::Reference< css::drawing::XShape > &_rxShape, const tools::Long _nIndex, const ::accessibility::AccessibleShapeTreeInfo &_rShapeTreeInfo) override
Definition: accmap.cxx:3040
A page of the document layout.
Definition: pagefrm.hxx:57
static SwNodeType GetNodeType(const SwFlyFrame *pFlyFrame)
void AddAccessibleShell()
Definition: rootfrm.hxx:390
constexpr void SetTop(tools::Long v)
tools::Long SwTwips
Definition: swtypes.hxx:51
const SwPosition * Start() const
Definition: pam.hxx:213
AccessibleStates mnStates
Definition: accmap.cxx:370
std::list< SwAccessibleEvent_Impl >::iterator begin()
Definition: accmap.cxx:547
void SetOldBox(const SwRect &rOldBox)
Definition: accmap.cxx:476
void InvalidateFocus()
Definition: accmap.cxx:2695
constexpr tools::Long Bottom() const
void SetViewForwarder(const IAccessibleViewForwarder *pViewForwarder)
std::unique_ptr< SwAccessibleShapeMap_Impl > mpShapeMap
Definition: accmap.hxx:95
std::map< key_type, mapped_type >::const_iterator const_iterator
Definition: accmap.cxx:92
bool empty() const
Definition: accmap.cxx:288
uno::WeakReference< XAccessible > mxAcc
Definition: accmap.cxx:365
void RemoveAccessibleShell()
Definition: rootfrm.hxx:391
void AddLeft(const tools::Long nAdd)
Definition: swrect.cxx:125
std::pair< const key_type, mapped_type > value_type
Definition: accmap.cxx:657
void A11yDispose(const SwFrame *pFrame, const SdrObject *pObj, vcl::Window *pWindow, bool bRecursive=false, bool bCanSkipInvisible=true)
Definition: accmap.cxx:2146
std::map< key_type, mapped_type, key_compare > maMap
Definition: accmap.cxx:662
void AddGroupContext(const SdrObject *pParentObj, css::uno::Reference< css::accessibility::XAccessible > const &xAccParent)
Definition: accmap.cxx:2025
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void InvalidateRelationSet_(const SwFrame *pFrame, bool bFrom)
Definition: accmap.cxx:2763
void InvalidateShapeInParaSelection()
Definition: accmap.cxx:1131
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
const css::uno::Reference< css::document::XShapeEventBroadcaster > & GetModelBroadcaster() const
iterator erase(const_iterator const &pos)
Definition: accmap.cxx:292
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
const ::accessibility::AccessibleShapeTreeInfo & GetInfo() const
Definition: accmap.cxx:279
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
std::map< key_type, mapped_type >::iterator iterator
Definition: accmap.cxx:91
std::map< key_type, mapped_type, key_compare >::const_iterator const_iterator
Definition: accmap.cxx:660
virtual void Dispose(bool bRecursive, bool bCanSkipInvisible=true)
::rtl::Reference< SwAccessibleContext > GetContext() const
Definition: accmap.cxx:462
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
void InvalidateAttr(const SwTextFrame &rTextFrame)
Definition: accmap.cxx:2447
Rectangles maPreviewRects
Definition: accmap.cxx:676
ShapeTypeId GetTypeId(const OUString &aServiceName) const
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual SwDrawModel * GetOrCreateDrawModel()=0
void InvalidateEditableStates(const SwFrame *_pFrame)
Definition: accmap.cxx:2736
void UpdatePreview(const std::vector< std::unique_ptr< PreviewPage >> &_rPreviewPages, const Fraction &_rScale, const SwPageFrame *_pSelectedPageFrame, const Size &_rPreviewWinSize)
Definition: accmap.cxx:2905
std::unique_ptr< SwAccessibleSelectedParas_Impl > BuildSelectedParas()
method to build up a new data structure of the accessible paragraphs, which have a selection ...
Definition: accmap.cxx:3238
SwAccessibleEvent_Impl(EventType eT, SwAccessibleContext *pA, const SwAccessibleChild &rFrameOrObj)
Definition: accmap.cxx:380
const SwPosition * End() const
Definition: pam.hxx:218
bool Contains(const SwFrame *pFrame) const
Definition: accmap.cxx:2141
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
tools::Rectangle CoreToPixel(const SwRect &rRect) const
Definition: accmap.cxx:3191
const SwFrame * GetParent() const
Definition: accframe.hxx:155
size_t IsObjSelected() const
Definition: feshview.cxx:1246
bool IsPageFrame() const
Definition: frame.hxx:1178
virtual Point LogicToPixel(const Point &rPoint) const override
Definition: accmap.cxx:3013
void InvalidateParaFlowRelation(const SwTextFrame &_rTextFrame, const bool _bFrom)
invalidation CONTENT_FLOWS_FROM/_TO relation of a paragraph
Definition: accmap.cxx:2818
css::uno::Reference< css::accessibility::XAccessible > GetContext(const SwFrame *pFrame, bool bCreate=true)
Definition: accmap.cxx:1784
void InvalidateTextSelection()
#i27301# - text selection has changed
SwAccessibleMap * GetMap()
Definition: acccontext.hxx:115
SwAccessibleChild key_type
Definition: accmap.cxx:611
SdrObject * getParentSdrObjectFromSdrObject() const
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
void Update(const SwAccessibleMap &rAccMap, const std::vector< std::unique_ptr< PreviewPage >> &_rPreviewPages, const Fraction &_rScale, const SwPageFrame *_pSelectedPageFrame, const Size &_rPreviewWinSize)
Definition: accmap.cxx:732
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:250
bool IsFiring() const
Definition: accmap.cxx:539
SwAccessibleShapeMap_Impl(SwAccessibleMap const *pMap)
Definition: accmap.cxx:266
virtual bool SetState(sal_Int16 aState) override
accessibility implementation for the page preview.
Definition: accpreview.hxx:33
bool IsObjSameLevelWithMarked(const SdrObject *pObj) const
Definition: feshview.cxx:1294
void Clear()
Definition: swrect.hxx:308
#define DBG_TESTSOLARMUTEX()
void SetCursorContext(const ::rtl::Reference< SwAccessibleContext > &rCursorContext)
Definition: accmap.cxx:2728
void Dispose(const T &xInterface)
bool IsPageSelected(const SwPageFrame *pPageFrame) const
Definition: accmap.cxx:2974
std::unique_ptr< SwAccPreviewData > mpPreview
for page preview: store preview data, VisArea, and mapping of preview-to-display coordinates ...
Definition: accmap.hxx:110
std::list< SwAccessibleEvent_Impl >::iterator erase(const std::list< SwAccessibleEvent_Impl >::iterator &aPos)
Definition: accmap.cxx:554
SwShapeList_Impl mvShapes
Definition: accmap.hxx:96
static bool AreInSameTable(const uno::Reference< XAccessible > &rAcc, const SwFrame *pFrame)
Definition: accmap.cxx:855
SwAccessibleEvent_Impl(EventType eT, SwAccessibleContext *pA, const SwAccessibleChild &rFrameOrObj, const AccessibleStates _nStates)
Definition: accmap.cxx:426
void InvalidateTextSelectionOfAllParas()
invalidation of text selection of all paragraphs
Definition: accmap.cxx:3327
std::map< key_type, mapped_type > maMap
Definition: accmap.cxx:94
std::list< SwAccessibleEvent_Impl >::iterator mapped_type
Definition: accmap.cxx:612
uno::WeakReference< XAccessible > mapped_type
Definition: accmap.cxx:89
std::pair< const_iterator, bool > insert(Value &&x)
SwXAccWeakRefComp key_compare
Definition: accmap.cxx:658
void SetType(EventType eT)
Definition: accmap.cxx:453
std::list< SwAccessibleEvent_Impl >::iterator insert(const std::list< SwAccessibleEvent_Impl >::iterator &aIter, const SwAccessibleEvent_Impl &rEvent)
Definition: accmap.cxx:549
void RemoveGroupContext(const SdrObject *pParentObj)
Definition: accmap.cxx:2003
bool HasFocus() const
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
iterator find(const key_type &key)
Definition: accmap.cxx:621
bool IsTextNode() const
Definition: node.hxx:646
SwAccessibleEvent_Impl(EventType eT, const SwAccessibleChild &rFrameOrObj)
Definition: accmap.cxx:390
void DoInvalidateShapeSelection(bool bInvalidateFocusMode=false)
Definition: accmap.cxx:1467
AccessibleStates
Definition: accmap.hxx:70
SwAccessibleEvent_Impl(EventType eT, const SwFrame *pParentFrame, const SwAccessibleChild &rFrameOrObj, const SwRect &rR)
Definition: accmap.cxx:440
void InvalidateSelection(const SwPageFrame *_pSelectedPageFrame)
Definition: accmap.cxx:779
bool IsFrameSelected() const
Definition: feshview.cxx:1254
bool mbShapeSelected
Definition: accmap.hxx:114
AnyEventRef aEvent
std::list< SwAccessibleEvent_Impl >::iterator end()
Definition: accmap.cxx:548
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
void AppendEvent(const SwAccessibleEvent_Impl &rEvent)
Definition: accmap.cxx:973
Rectangles maLogicRects
Definition: accmap.cxx:677
bool m_bDetectedRangeSegmentation false
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1099
bool IsInvalidateTextAttrs() const
Definition: accmap.cxx:509
css::uno::WeakReference< css::accessibility::XAccessible > mxCursorContext
Definition: accmap.hxx:112
std::unique_ptr< SwAccessibleSelectedParas_Impl > mpSelectedParas
Definition: accmap.hxx:106
bool IsNoXaccParentFrame() const
Definition: accmap.cxx:374
SwAccessibleMap(SwViewShell *pSh)
Definition: accmap.cxx:1630
const SdrObject * GetObject() const