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