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