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