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