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