LibreOffice Module svx (master)  1
AccessibleShape.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 <svx/AccessibleShape.hxx>
22 #include <com/sun/star/accessibility/AccessibleRole.hpp>
23 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
24 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
25 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/drawing/XShapes.hpp>
28 #include <com/sun/star/document/XShapeEventBroadcaster.hpp>
29 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30 #include <com/sun/star/drawing/FillStyle.hpp>
31 #include <com/sun/star/text/XText.hpp>
32 #include <sal/log.hxx>
33 #include <editeng/unoedsrc.hxx>
35 #include <svx/ChildrenManager.hxx>
38 #include <svx/unoshtxt.hxx>
39 #include <svx/svdobj.hxx>
40 #include <svx/unoapi.hxx>
41 #include <svx/svdpage.hxx>
42 #include <svx/ShapeTypeHandler.hxx>
43 #include <svx/SvxShapeTypes.hxx>
44 
45 #include <vcl/svapp.hxx>
46 #include <vcl/window.hxx>
49 #include <svx/svdview.hxx>
50 #include <tools/diagnose_ex.h>
52 #include <comphelper/sequence.hxx>
54 
55 #include <algorithm>
56 #include <memory>
57 
58 using namespace ::com::sun::star;
59 using namespace ::com::sun::star::accessibility;
60 using ::com::sun::star::uno::Reference;
61 using ::com::sun::star::lang::IndexOutOfBoundsException;
62 using ::com::sun::star::uno::RuntimeException;
63 
64 namespace accessibility {
65 
66 namespace {
67 
68 OUString GetOptionalProperty (
69  const Reference<beans::XPropertySet>& rxSet,
70  const OUString& rsPropertyName)
71 {
72  OUString sValue;
73 
74  if (rxSet.is())
75  {
76  const Reference<beans::XPropertySetInfo> xInfo (rxSet->getPropertySetInfo());
77  if ( ! xInfo.is() || xInfo->hasPropertyByName(rsPropertyName))
78  {
79  try
80  {
81  rxSet->getPropertyValue(rsPropertyName) >>= sValue;
82  }
83  catch (beans::UnknownPropertyException&)
84  {
85  // This exception should only be thrown when the property
86  // does not exits (of course) and the XPropertySetInfo is
87  // not available.
88  }
89  }
90  }
91  return sValue;
92 }
93 
94 } // end of anonymous namespace
95 
96 // internal
98  const AccessibleShapeInfo& rShapeInfo,
99  const AccessibleShapeTreeInfo& rShapeTreeInfo)
100  : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::SHAPE),
101  mxShape (rShapeInfo.mxShape),
102  maShapeTreeInfo (rShapeTreeInfo),
103  m_nIndexInParent(-1),
104  mpParent (rShapeInfo.mpChildrenManager)
105 {
108 }
109 
111 {
112  mpChildrenManager.reset();
113  mpText.reset();
114  SAL_INFO("svx", "~AccessibleShape");
115 
116  // Unregistering from the various broadcasters should be unnecessary
117  // since this destructor would not have been called if one of the
118  // broadcasters would still hold a strong reference to this object.
119 }
120 
122 {
123  // Update the OPAQUE and SELECTED shape.
124  UpdateStates ();
125 
126  // Create a children manager when this shape has children of its own.
127  Reference<drawing::XShapes> xShapes (mxShape, uno::UNO_QUERY);
128  if (xShapes.is() && xShapes->getCount() > 0)
130  this, xShapes, maShapeTreeInfo, *this) );
131  if (mpChildrenManager != nullptr)
132  mpChildrenManager->Update();
133 
134  // Register at model as document::XEventListener.
135  if (mxShape.is() && maShapeTreeInfo.GetModelBroadcaster().is())
136  maShapeTreeInfo.GetModelBroadcaster()->addShapeEventListener(mxShape,
137  static_cast<document::XShapeEventListener*>(this));
138 
139  // Beware! Here we leave the paths of the UNO API and descend into the
140  // depths of the core. Necessary for making the edit engine
141  // accessible.
142  Reference<text::XText> xText (mxShape, uno::UNO_QUERY);
143  if (!xText.is())
144  return;
145 
146  SdrView* pView = maShapeTreeInfo.GetSdrView ();
147  const vcl::Window* pWindow = maShapeTreeInfo.GetWindow ();
148  if (!(pView != nullptr && pWindow != nullptr && mxShape.is()))
149  return;
150 
151  // #107948# Determine whether shape text is empty
153  if( !pSdrObject )
154  return;
155 
156  SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>( pSdrObject );
157  const bool hasOutlinerParaObject = (pTextObj && pTextObj->CanCreateEditOutlinerParaObject()) || (pSdrObject->GetOutlinerParaObject() != nullptr);
158 
159  // create AccessibleTextHelper to handle this shape's text
160  if( !hasOutlinerParaObject )
161  {
162  // empty text -> use proxy edit source to delay creation of EditEngine
163  mpText.reset( new AccessibleTextHelper( std::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow->GetOutDev()) ) );
164  }
165  else
166  {
167  // non-empty text -> use full-fledged edit source right away
168  mpText.reset( new AccessibleTextHelper( std::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow->GetOutDev()) ) );
169  }
170  if( pWindow->HasFocus() )
171  mpText->SetFocus();
172 
173  mpText->SetEventSource(this);
174 }
175 
176 
178 {
180  static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
181  if (pStateSet == nullptr)
182  return;
183 
184  // Set the opaque state for certain shape types when their fill style is
185  // solid.
186  bool bShapeIsOpaque = false;
188  {
189  case DRAWING_PAGE:
190  case DRAWING_RECTANGLE:
191  case DRAWING_TEXT:
192  {
193  uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
194  if (xSet.is())
195  {
196  try
197  {
198  drawing::FillStyle aFillStyle;
199  bShapeIsOpaque = ( xSet->getPropertyValue ("FillStyle") >>= aFillStyle)
200  && aFillStyle == drawing::FillStyle_SOLID;
201  }
202  catch (css::beans::UnknownPropertyException&)
203  {
204  // Ignore.
205  }
206  }
207  }
208  }
209  if (bShapeIsOpaque)
210  pStateSet->AddState (AccessibleStateType::OPAQUE);
211  else
212  pStateSet->RemoveState (AccessibleStateType::OPAQUE);
213 
214  // Set the selected state.
215  bool bShapeIsSelected = false;
216  // XXX fix_me this has to be done with an extra interface later on
218  {
219  bShapeIsSelected = maShapeTreeInfo.GetSdrView()->IsObjMarked(m_pShape);
220  }
221 
222  if (bShapeIsSelected)
223  pStateSet->AddState (AccessibleStateType::SELECTED);
224  else
225  pStateSet->RemoveState (AccessibleStateType::SELECTED);
226 }
227 
229 {
231 }
232 
233 bool AccessibleShape::SetState (sal_Int16 aState)
234 {
235  bool bStateHasChanged = false;
236 
237  if (aState == AccessibleStateType::FOCUSED && mpText != nullptr)
238  {
239  // Offer FOCUSED state to edit engine and detect whether the state
240  // changes.
241  bool bIsFocused = mpText->HaveFocus ();
242  mpText->SetFocus();
243  bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
244  }
245  else
246  bStateHasChanged = AccessibleContextBase::SetState (aState);
247 
248  return bStateHasChanged;
249 }
250 
251 
252 bool AccessibleShape::ResetState (sal_Int16 aState)
253 {
254  bool bStateHasChanged = false;
255 
256  if (aState == AccessibleStateType::FOCUSED && mpText != nullptr)
257  {
258  // Try to remove FOCUSED state from the edit engine and detect
259  // whether the state changes.
260  bool bIsFocused = mpText->HaveFocus ();
261  mpText->SetFocus (false);
262  bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
263  }
264  else
265  bStateHasChanged = AccessibleContextBase::ResetState (aState);
266 
267  return bStateHasChanged;
268 }
269 
270 
271 bool AccessibleShape::GetState (sal_Int16 aState)
272 {
273  if (aState == AccessibleStateType::FOCUSED && mpText != nullptr)
274  {
275  // Just delegate the call to the edit engine. The state is not
276  // merged into the state set.
277  return mpText->HaveFocus();
278  }
279  else
280  return AccessibleContextBase::GetState (aState);
281 }
282 
283 // OverWrite the parent's getAccessibleName method
285 {
286  ThrowIfDisposed ();
287  if (m_pShape && !m_pShape->GetTitle().isEmpty())
288  return CreateAccessibleName() + " " + m_pShape->GetTitle();
289  else
290  return CreateAccessibleName();
291 }
292 
294 {
295  ThrowIfDisposed ();
296  if( m_pShape && !m_pShape->GetDescription().isEmpty())
297  return m_pShape->GetDescription() ;
298  else
299  return " ";
300 }
301 
302 // XAccessibleContext
306 sal_Int32 SAL_CALL
308 {
309  if (IsDisposed())
310  {
311  return 0;
312  }
313 
314  sal_Int32 nChildCount = 0;
315 
316  // Add the number of shapes that are children of this shape.
317  if (mpChildrenManager != nullptr)
318  nChildCount += mpChildrenManager->GetChildCount ();
319  // Add the number text paragraphs.
320  if (mpText != nullptr)
321  nChildCount += mpText->GetChildCount ();
322 
323  return nChildCount;
324 }
325 
326 
330 uno::Reference<XAccessible> SAL_CALL
332 {
333  ThrowIfDisposed ();
334 
335  uno::Reference<XAccessible> xChild;
336 
337  // Depending on the index decide whether to delegate this call to the
338  // children manager or the edit engine.
339  if ((mpChildrenManager != nullptr)
340  && (nIndex < mpChildrenManager->GetChildCount()))
341  {
342  xChild = mpChildrenManager->GetChild (nIndex);
343  }
344  else if (mpText != nullptr)
345  {
346  sal_Int32 nI = nIndex;
347  if (mpChildrenManager != nullptr)
348  nI -= mpChildrenManager->GetChildCount();
349  xChild = mpText->GetChild (nI);
350  }
351  else
352  throw lang::IndexOutOfBoundsException (
353  "shape has no child with index " + OUString::number(nIndex),
354  static_cast<uno::XWeak*>(this));
355 
356  return xChild;
357 }
358 
359 uno::Reference<XAccessibleRelationSet> SAL_CALL
361 {
362  ::osl::MutexGuard aGuard (maMutex);
363  if (mpParent == nullptr)
364  return uno::Reference<XAccessibleRelationSet>();
365 
367 
368  //this mxshape is the captioned shape
369  uno::Sequence< uno::Reference< uno::XInterface > > aSequence { mpParent->GetAccessibleCaption(mxShape) };
370  if(aSequence[0])
371  {
372  pRelationSet->AddRelation(
373  AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) );
374  }
375  return pRelationSet;
376 }
377 
384 uno::Reference<XAccessibleStateSet> SAL_CALL
386 {
387  ::osl::MutexGuard aGuard (maMutex);
388 
389  if (IsDisposed())
390  {
391  // Return a minimal state set that only contains the DEFUNC state.
393  }
394 
396  static_cast<::utl::AccessibleStateSetHelper*>(mxStateSet.get());
397 
398  if (!pStateSet)
399  return Reference<XAccessibleStateSet>();
400 
401  // Merge current FOCUSED state from edit engine.
402  if (mpText)
403  {
404  if (mpText->HaveFocus())
405  pStateSet->AddState (AccessibleStateType::FOCUSED);
406  else
407  pStateSet->RemoveState (AccessibleStateType::FOCUSED);
408  }
409  //Just when the document is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
410  css::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
411  if( xTempAcc.is() )
412  {
413  css::uno::Reference<XAccessibleContext>
414  xTempAccContext = xTempAcc->getAccessibleContext();
415  if( xTempAccContext.is() )
416  {
417  css::uno::Reference<XAccessibleStateSet> rState =
418  xTempAccContext->getAccessibleStateSet();
419  if (rState.is())
420  {
421  css::uno::Sequence<short> aStates = rState->getStates();
422  if (std::find(aStates.begin(), aStates.end(), AccessibleStateType::EDITABLE) != aStates.end())
423  {
424  pStateSet->AddState (AccessibleStateType::EDITABLE);
425  pStateSet->AddState (AccessibleStateType::RESIZABLE);
426  pStateSet->AddState (AccessibleStateType::MOVEABLE);
427  }
428  }
429  }
430  }
431 
432  // Create a copy of the state set that may be modified by the
433  // caller without affecting the current state set.
434  Reference<XAccessibleStateSet> xStateSet(new ::utl::AccessibleStateSetHelper(*pStateSet));
435 
437  {
438  ::utl::AccessibleStateSetHelper* pCopyStateSet =
439  static_cast<::utl::AccessibleStateSetHelper*>(xStateSet.get());
440  pCopyStateSet->AddState (AccessibleStateType::SELECTED);
441  }
442 
443  return xStateSet;
444 }
445 
446 // XAccessibleComponent
455 uno::Reference<XAccessible > SAL_CALL
457  const awt::Point& aPoint)
458 {
459  ::osl::MutexGuard aGuard (maMutex);
460 
461  sal_Int32 nChildCount = getAccessibleChildCount ();
462  for (sal_Int32 i=0; i<nChildCount; ++i)
463  {
464  Reference<XAccessible> xChild (getAccessibleChild (i));
465  if (xChild.is())
466  {
467  Reference<XAccessibleComponent> xChildComponent (
468  xChild->getAccessibleContext(), uno::UNO_QUERY);
469  if (xChildComponent.is())
470  {
471  awt::Rectangle aBBox (xChildComponent->getBounds());
472  if ( (aPoint.X >= aBBox.X)
473  && (aPoint.Y >= aBBox.Y)
474  && (aPoint.X < aBBox.X+aBBox.Width)
475  && (aPoint.Y < aBBox.Y+aBBox.Height) )
476  return xChild;
477  }
478  }
479  }
480 
481  // Have not found a child under the given point. Returning empty
482  // reference to indicate this.
483  return uno::Reference<XAccessible>();
484 }
485 
486 
487 awt::Rectangle SAL_CALL AccessibleShape::getBounds()
488 {
489  SolarMutexGuard aSolarGuard;
490  ::osl::MutexGuard aGuard (maMutex);
491 
492  ThrowIfDisposed ();
493  awt::Rectangle aBoundingBox;
494  if ( mxShape.is() )
495  {
496 
497  static constexpr OUStringLiteral sBoundRectName = u"BoundRect";
498  static constexpr OUStringLiteral sAnchorPositionName = u"AnchorPosition";
499 
500  // Get the shape's bounding box in internal coordinates (in 100th of
501  // mm). Use the property BoundRect. Only if that is not supported ask
502  // the shape for its position and size directly.
503  Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
505  bool bFoundBoundRect = false;
506  if (xSet.is())
507  {
508  xSetInfo = xSet->getPropertySetInfo ();
509  if (xSetInfo.is())
510  {
511  if (xSetInfo->hasPropertyByName (sBoundRectName))
512  {
513  try
514  {
515  uno::Any aValue = xSet->getPropertyValue (sBoundRectName);
516  aValue >>= aBoundingBox;
517  bFoundBoundRect = true;
518  }
519  catch (beans::UnknownPropertyException const&)
520  {
521  // Handled below (bFoundBoundRect stays false).
522  }
523  }
524  else
525  SAL_WARN("svx", "no property BoundRect");
526  }
527  }
528 
529  // Fallback when there is no BoundRect Property.
530  if ( ! bFoundBoundRect )
531  {
532  awt::Point aPosition (mxShape->getPosition());
533  awt::Size aSize (mxShape->getSize());
534  aBoundingBox = awt::Rectangle (
535  aPosition.X, aPosition.Y,
536  aSize.Width, aSize.Height);
537 
538  // While BoundRects have absolute positions, the position returned
539  // by XPosition::getPosition is relative. Get the anchor position
540  // (usually not (0,0) for Writer shapes).
541  if (xSetInfo.is())
542  {
543  if (xSetInfo->hasPropertyByName (sAnchorPositionName))
544  {
545  uno::Any aPos = xSet->getPropertyValue (sAnchorPositionName);
546  awt::Point aAnchorPosition;
547  aPos >>= aAnchorPosition;
548  aBoundingBox.X += aAnchorPosition.X;
549  aBoundingBox.Y += aAnchorPosition.Y;
550  }
551  }
552  }
553 
554  // Transform coordinates from internal to pixel.
555  if (maShapeTreeInfo.GetViewForwarder() == nullptr)
556  throw uno::RuntimeException (
557  "AccessibleShape has no valid view forwarder",
558  static_cast<uno::XWeak*>(this));
560  ::Size (aBoundingBox.Width, aBoundingBox.Height));
561  ::Point aPixelPosition = maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
562  ::Point (aBoundingBox.X, aBoundingBox.Y));
563 
564  // Clip the shape's bounding box with the bounding box of its parent.
565  Reference<XAccessibleComponent> xParentComponent (
566  getAccessibleParent(), uno::UNO_QUERY);
567  if (xParentComponent.is())
568  {
569  // Make the coordinates relative to the parent.
570  awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
571  int x = aPixelPosition.getX() - aParentLocation.X;
572  int y = aPixelPosition.getY() - aParentLocation.Y;
573 
574  // Clip with parent (with coordinates relative to itself).
575  ::tools::Rectangle aBBox (
576  x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight());
577  awt::Size aParentSize (xParentComponent->getSize());
578  ::tools::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
579  aBBox = aBBox.GetIntersection (aParentBBox);
580  aBoundingBox = awt::Rectangle (
581  aBBox.Left(),
582  aBBox.Top(),
583  aBBox.getWidth(),
584  aBBox.getHeight());
585  }
586  else
587  {
588  SAL_INFO("svx", "parent does not support component");
589  aBoundingBox = awt::Rectangle (
590  aPixelPosition.getX(), aPixelPosition.getY(),
591  aPixelSize.getWidth(), aPixelSize.getHeight());
592  }
593  }
594 
595  return aBoundingBox;
596 }
597 
598 
599 awt::Point SAL_CALL AccessibleShape::getLocation()
600 {
601  ThrowIfDisposed ();
602  awt::Rectangle aBoundingBox (getBounds());
603  return awt::Point (aBoundingBox.X, aBoundingBox.Y);
604 }
605 
606 
608 {
609  ThrowIfDisposed ();
610 
611  // Get relative position...
612  awt::Point aLocation (getLocation ());
613 
614  // ... and add absolute position of the parent.
615  uno::Reference<XAccessibleComponent> xParentComponent (
616  getAccessibleParent(), uno::UNO_QUERY);
617  if (xParentComponent.is())
618  {
619  awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
620  aLocation.X += aParentLocation.X;
621  aLocation.Y += aParentLocation.Y;
622  }
623  else
624  SAL_WARN("svx", "parent does not support XAccessibleComponent");
625  return aLocation;
626 }
627 
628 
629 awt::Size SAL_CALL AccessibleShape::getSize()
630 {
631  ThrowIfDisposed ();
632  awt::Rectangle aBoundingBox (getBounds());
633  return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
634 }
635 
636 
637 sal_Int32 SAL_CALL AccessibleShape::getForeground()
638 {
639  ThrowIfDisposed ();
640  sal_Int32 nColor (0x0ffffffL);
641 
642  try
643  {
644  uno::Reference<beans::XPropertySet> aSet (mxShape, uno::UNO_QUERY);
645  if (aSet.is())
646  {
647  uno::Any aColor;
648  aColor = aSet->getPropertyValue ("LineColor");
649  aColor >>= nColor;
650  }
651  }
652  catch (const css::beans::UnknownPropertyException &)
653  {
654  // Ignore exception and return default color.
655  }
656  return nColor;
657 }
658 
659 
660 sal_Int32 SAL_CALL AccessibleShape::getBackground()
661 {
662  ThrowIfDisposed ();
663  Color nColor;
664 
665  try
666  {
667  uno::Reference<beans::XPropertySet> aSet (mxShape, uno::UNO_QUERY);
668  if (aSet.is())
669  {
670  uno::Any aColor;
671  aColor = aSet->getPropertyValue ("FillColor");
672  aColor >>= nColor;
673  aColor = aSet->getPropertyValue ("FillTransparence");
674  short nTrans=0;
675  aColor >>= nTrans;
676  Color crBk(nColor);
677  if (nTrans == 0 )
678  {
679  crBk.SetAlpha(0);
680  }
681  else
682  {
683  nTrans = short(256 - nTrans / 100. * 256);
684  crBk.SetAlpha(255 - sal_uInt8(nTrans));
685  }
686  nColor = crBk;
687  }
688  }
689  catch (const css::beans::UnknownPropertyException &)
690  {
691  // Ignore exception and return default color.
692  }
693  return sal_Int32(nColor);
694 }
695 
696 // XAccessibleEventBroadcaster
698  const Reference<XAccessibleEventListener >& rxListener)
699 {
700  if (rBHelper.bDisposed || rBHelper.bInDispose)
701  {
702  uno::Reference<uno::XInterface> xThis (
703  static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
704  rxListener->disposing (lang::EventObject (xThis));
705  }
706  else
707  {
709  if (mpText != nullptr)
710  mpText->AddEventListener (rxListener);
711  }
712 }
713 
714 
716  const Reference<XAccessibleEventListener >& rxListener)
717 {
719  if (mpText != nullptr)
720  mpText->RemoveEventListener (rxListener);
721 }
722 
723 // XInterface
724 css::uno::Any SAL_CALL
725  AccessibleShape::queryInterface (const css::uno::Type & rType)
726 {
727  css::uno::Any aReturn = AccessibleContextBase::queryInterface (rType);
728  if ( ! aReturn.hasValue())
729  aReturn = ::cppu::queryInterface (rType,
730  static_cast<XAccessibleComponent*>(this),
731  static_cast<XAccessibleExtendedComponent*>(this),
732  static_cast< css::accessibility::XAccessibleSelection* >(this),
733  static_cast< css::accessibility::XAccessibleExtendedAttributes* >(this),
734  static_cast<document::XShapeEventListener*>(this),
735  static_cast<lang::XUnoTunnel*>(this),
736  static_cast<XAccessibleGroupPosition*>(this),
737  static_cast<XAccessibleHypertext*>(this)
738  );
739  return aReturn;
740 }
741 
742 
743 void SAL_CALL
745  noexcept
746 {
747  AccessibleContextBase::acquire ();
748 }
749 
750 
751 void SAL_CALL
753  noexcept
754 {
755  AccessibleContextBase::release ();
756 }
757 
758 // XAccessibleSelection
759 void SAL_CALL AccessibleShape::selectAccessibleChild( sal_Int32 )
760 {
761 }
762 
763 
764 sal_Bool SAL_CALL AccessibleShape::isAccessibleChildSelected( sal_Int32 nChildIndex )
765 {
766  uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
767  uno::Reference<XAccessibleContext> xContext;
768  if( xAcc.is() )
769  {
770  xContext = xAcc->getAccessibleContext();
771  }
772 
773  if( xContext.is() )
774  {
775  if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
776  {
777  uno::Reference< css::accessibility::XAccessibleText >
778  xText(xAcc, uno::UNO_QUERY);
779  if( xText.is() )
780  {
781  if( xText->getSelectionStart() >= 0 ) return true;
782  }
783  }
784  else if( xContext->getAccessibleRole() == AccessibleRole::SHAPE )
785  {
786  Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
787  if( !pRState.is() )
788  return false;
789 
790  uno::Sequence<short> aStates = pRState->getStates();
791  return std::find(aStates.begin(), aStates.end(), AccessibleStateType::SELECTED) != aStates.end();
792  }
793  }
794 
795  return false;
796 }
797 
798 
800 {
801 }
802 
803 
805 {
806 }
807 
808 
810 {
811  sal_Int32 nCount = 0;
812  sal_Int32 TotalCount = getAccessibleChildCount();
813  for( sal_Int32 i = 0; i < TotalCount; i++ )
814  if( isAccessibleChildSelected(i) ) nCount++;
815 
816  return nCount;
817 }
818 
819 
820 Reference<XAccessible> SAL_CALL AccessibleShape::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
821 {
822  if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
823  throw IndexOutOfBoundsException();
824  sal_Int32 i1, i2;
825  for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
826  if( isAccessibleChildSelected(i1) )
827  {
828  if( i2 == nSelectedChildIndex )
829  return getAccessibleChild( i1 );
830  i2++;
831  }
832  return Reference<XAccessible>();
833 }
834 
835 
837 {
838 
839 }
840 
841 // XAccessibleExtendedAttributes
843 {
844  uno::Any strRet;
845  OUString style;
846  if( getAccessibleRole() != AccessibleRole::SHAPE ) return strRet;
847  if( m_pShape )
848  {
849  style = "style:" + GetStyle();
850  }
851  style += ";";
852  strRet <<= style;
853  return strRet;
854 }
855 
856 // XServiceInfo
857 OUString SAL_CALL
859 {
860  return "AccessibleShape";
861 }
862 
863 
864 uno::Sequence<OUString> SAL_CALL
866 {
867  ThrowIfDisposed ();
868  const css::uno::Sequence<OUString> vals { "com.sun.star.drawing.AccessibleShape" };
870 }
871 
872 // XTypeProvider
873 uno::Sequence<uno::Type> SAL_CALL
875 {
876  ThrowIfDisposed ();
877  // Get list of types from the context base implementation, ...
878  uno::Sequence<uno::Type> aTypeList (AccessibleContextBase::getTypes());
879  // ... get list of types from component base implementation, ...
880  uno::Sequence<uno::Type> aComponentTypeList (AccessibleComponentBase::getTypes());
881  // ... define local types
882  uno::Sequence<uno::Type> localTypesList = {
886  };
887 
888  return comphelper::concatSequences(aTypeList, aComponentTypeList, localTypesList);
889 }
890 
891 // lang::XEventListener
896 void AccessibleShape::disposing (const lang::EventObject& aEvent)
897 {
898  SolarMutexGuard aSolarGuard;
899  ::osl::MutexGuard aGuard (maMutex);
900 
901  try
902  {
903  if (aEvent.Source == maShapeTreeInfo.GetModelBroadcaster())
904  {
905  // Remove reference to model broadcaster to allow it to pass
906  // away.
908  }
909 
910  }
911  catch (uno::RuntimeException const&)
912  {
913  TOOLS_WARN_EXCEPTION("svx", "caught exception while disposing");
914  }
915 }
916 
917 // document::XShapeEventListener
918 void SAL_CALL
919  AccessibleShape::notifyShapeEvent (const document::EventObject& rEventObject)
920 {
921  if (rEventObject.EventName != "ShapeModified")
922  return;
923 
924  //Need to update text children when receiving ShapeModified hint when exiting edit mode for text box
925  if (mpText)
926  mpText->UpdateChildren();
927 
928 
929  // Some property of a shape has been modified. Send an event
930  // that indicates a change of the visible data to all listeners.
931  CommitChange (
932  AccessibleEventId::VISIBLE_DATA_CHANGED,
933  uno::Any(),
934  uno::Any());
935 
936  // Name and Description may have changed. Update the local
937  // values accordingly.
939 }
940 
941 // lang::XUnoTunnel
943 
944 // IAccessibleViewForwarderListener
945 void AccessibleShape::ViewForwarderChanged()
946 {
947  // Inform all listeners that the graphical representation (i.e. size
948  // and/or position) of the shape has changed.
949  CommitChange (AccessibleEventId::VISIBLE_DATA_CHANGED,
950  uno::Any(),
951  uno::Any());
952 
953  // Tell children manager of the modified view forwarder.
954  if (mpChildrenManager != nullptr)
955  mpChildrenManager->ViewForwarderChanged();
956 
957  // update our children that our screen position might have changed
958  if( mpText )
959  mpText->UpdateChildren();
960 }
961 
962 // protected internal
963 // Set this object's name if is different to the current name.
965 {
967 }
968 
969 
971 {
972  return GetFullAccessibleName(this);
973 }
974 
976 {
977  OUString sName (shape->CreateAccessibleBaseName());
978  // Append the shape's index to the name to disambiguate between shapes
979  // of the same type. If such an index where not given to the
980  // constructor then use the z-order instead. If even that does not exist
981  // we throw an exception.
982  OUString nameStr;
983  if (shape->m_pShape)
984  nameStr = shape->m_pShape->GetName();
985  if (nameStr.isEmpty())
986  {
987  sName += " ";
988  }
989  else
990  {
991  sName = nameStr;
992  }
993 
994  //If the new produced name if not the same with last,notify name changed
995  //Event
996  if (aAccName != sName && !aAccName.isEmpty())
997  {
998  uno::Any aOldValue, aNewValue;
999  aOldValue <<= aAccName;
1000  aNewValue <<= sName;
1001  CommitChange(
1002  AccessibleEventId::NAME_CHANGED,
1003  aNewValue,
1004  aOldValue);
1005  }
1006  aAccName = sName;
1007  return sName;
1008 }
1009 
1010 // protected
1012 {
1013  SolarMutexGuard aSolarGuard;
1014  ::osl::MutexGuard aGuard (maMutex);
1015 
1016  // Make sure to send an event that this object loses the focus in the
1017  // case that it has the focus.
1018  ::utl::AccessibleStateSetHelper* pStateSet =
1019  static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
1020  if (pStateSet != nullptr)
1021  pStateSet->RemoveState (AccessibleStateType::FOCUSED);
1022 
1023  // Unregister from model.
1024  if (mxShape.is() && maShapeTreeInfo.GetModelBroadcaster().is())
1025  maShapeTreeInfo.GetModelBroadcaster()->removeShapeEventListener(mxShape,
1026  static_cast<document::XShapeEventListener*>(this));
1027 
1028  // Release the child containers.
1029  if (mpChildrenManager != nullptr)
1030  {
1031  mpChildrenManager.reset();
1032  }
1033  if (mpText != nullptr)
1034  {
1035  mpText->Dispose();
1036  mpText.reset();
1037  }
1038 
1039  // Cleanup. Remove references to objects to allow them to be
1040  // destroyed.
1041  mxShape = nullptr;
1043 
1044  // Call base classes.
1045  AccessibleContextBase::dispose ();
1046 }
1047 
1048 sal_Int32 SAL_CALL
1050 {
1051  ThrowIfDisposed ();
1052  // Use a simple but slow solution for now. Optimize later.
1053 
1054  sal_Int32 nIndex = m_nIndexInParent;
1055  if ( -1 == nIndex )
1057  return nIndex;
1058 }
1059 
1060 
1062 {
1063  // Ignore missing title, name, or description. There are fallbacks for
1064  // them.
1065  try
1066  {
1067  Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY_THROW);
1068 
1069  // Get the accessible name.
1070  OUString sString = GetOptionalProperty(xSet, "Title");
1071  if (!sString.isEmpty())
1072  {
1074  }
1075  else
1076  {
1077  sString = GetOptionalProperty(xSet, "Name");
1078  if (!sString.isEmpty())
1080  }
1081 
1082  // Get the accessible description.
1083  sString = GetOptionalProperty(xSet, "Description");
1084  if (!sString.isEmpty())
1086  }
1087  catch (uno::RuntimeException&)
1088  {
1089  }
1090 }
1091 
1092 // Return this object's role.
1094 {
1095  sal_Int16 nAccessibleRole = AccessibleRole::SHAPE ;
1096  switch (ShapeTypeHandler::Instance().GetTypeId (mxShape))
1097  {
1099  nAccessibleRole = AccessibleRole::GRAPHIC ; break;
1100  case DRAWING_OLE:
1101  nAccessibleRole = AccessibleRole::EMBEDDED_OBJECT ; break;
1102 
1103  default:
1104  nAccessibleRole = AccessibleContextBase::getAccessibleRole();
1105  break;
1106  }
1107 
1108  return nAccessibleRole;
1109 }
1110 
1111 namespace {
1112 
1113 //sort the drawing objects from up to down, from left to right
1114 struct XShapePosCompareHelper
1115 {
1116  bool operator() ( const uno::Reference<drawing::XShape>& xshape1,
1117  const uno::Reference<drawing::XShape>& xshape2 ) const
1118  {
1119  SdrObject* pObj1 = SdrObject::getSdrObjectFromXShape(xshape1);
1120  SdrObject* pObj2 = SdrObject::getSdrObjectFromXShape(xshape2);
1121  if(pObj1 && pObj2)
1122  return pObj1->GetOrdNum() < pObj2->GetOrdNum();
1123  else
1124  return false;
1125  }
1126 };
1127 
1128 }
1129 //end of group position
1130 
1131 // XAccessibleGroupPosition
1132 uno::Sequence< sal_Int32 > SAL_CALL
1134 {
1135  // we will return the:
1136  // [0] group level
1137  // [1] similar items counts in the group
1138  // [2] the position of the object in the group
1139  uno::Sequence< sal_Int32 > aRet( 3 );
1140  aRet[0] = 0;
1141  aRet[1] = 0;
1142  aRet[2] = 0;
1143 
1144  css::uno::Reference<XAccessible> xParent = getAccessibleParent();
1145  if (!xParent.is())
1146  {
1147  return aRet;
1148  }
1150 
1151 
1152  if(pObj == nullptr )
1153  {
1154  return aRet;
1155  }
1156 
1157  // Compute object's group level.
1158  sal_Int32 nGroupLevel = 0;
1159  SdrObject * pUper = pObj->getParentSdrObjectFromSdrObject();
1160  while( pUper )
1161  {
1162  ++nGroupLevel;
1163  pUper = pUper->getParentSdrObjectFromSdrObject();
1164  }
1165 
1166  css::uno::Reference<XAccessibleContext> xParentContext = xParent->getAccessibleContext();
1167  if( xParentContext->getAccessibleRole() == AccessibleRole::DOCUMENT ||
1168  xParentContext->getAccessibleRole() == AccessibleRole::DOCUMENT_PRESENTATION ||
1169  xParentContext->getAccessibleRole() == AccessibleRole::DOCUMENT_SPREADSHEET ||
1170  xParentContext->getAccessibleRole() == AccessibleRole::DOCUMENT_TEXT )//Document
1171  {
1172  Reference< XAccessibleGroupPosition > xGroupPosition( xParent,uno::UNO_QUERY );
1173  if ( xGroupPosition.is() )
1174  {
1175  aRet = xGroupPosition->getGroupPosition( uno::makeAny( getAccessibleContext() ) );
1176  }
1177  return aRet;
1178  }
1179  if (xParentContext->getAccessibleRole() != AccessibleRole::SHAPE)
1180  {
1181  return aRet;
1182  }
1183 
1184  SdrObjList *pGrpList = nullptr;
1185  if( pObj->getParentSdrObjectFromSdrObject() )
1186  pGrpList = pObj->getParentSdrObjectFromSdrObject()->GetSubList();
1187  else
1188  return aRet;
1189 
1190  std::vector< uno::Reference<drawing::XShape> > vXShapes;
1191  if (pGrpList)
1192  {
1193  const size_t nObj = pGrpList->GetObjCount();
1194  for(size_t i = 0 ; i < nObj ; ++i)
1195  {
1196  SdrObject *pSubObj = pGrpList->GetObj(i);
1197  if (pSubObj &&
1198  xParentContext->getAccessibleChild(i)->getAccessibleContext()->getAccessibleRole() != AccessibleRole::GROUP_BOX)
1199  {
1200  vXShapes.push_back( GetXShapeForSdrObject(pSubObj) );
1201  }
1202  }
1203  }
1204 
1205  std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() );
1206 
1207  //get the index of the selected object in the group
1208  //we start counting position from 1
1209  sal_Int32 nPos = 1;
1210  for ( const auto& rpShape : vXShapes )
1211  {
1212  if ( rpShape.get() == mxShape.get() )
1213  {
1214  sal_Int32* pArray = aRet.getArray();
1215  pArray[0] = nGroupLevel;
1216  pArray[1] = vXShapes.size();
1217  pArray[2] = nPos;
1218  break;
1219  }
1220  nPos++;
1221  }
1222 
1223  return aRet;
1224 }
1225 
1227 {
1228  OUString aRet;
1229 
1231  if(pObj == nullptr )
1232  {
1233  return aRet;
1234  }
1236  {
1237  Reference< XAccessibleGroupPosition > xGroupPosition( maShapeTreeInfo.GetDocumentWindow(), uno::UNO_QUERY );
1238  if (xGroupPosition.is())
1239  {
1240  aRet = xGroupPosition->getObjectLink( uno::makeAny( getAccessibleContext() ) );
1241  }
1242  }
1243  return aRet;
1244 }
1245 
1246 // XAccessibleHypertext
1248 {
1249  // MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile.
1250  // Code need to be adapted...
1251  return 0;
1252 
1253  /*
1254  SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this);
1255  if (pLink->IsValidHyperlink())
1256  return 1;
1257  else
1258  return 0;
1259  */
1260 }
1261 uno::Reference< XAccessibleHyperlink > SAL_CALL
1263 {
1264  uno::Reference< XAccessibleHyperlink > xRet;
1265  // MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile.
1266  // Code need to be adapted...
1267  /*
1268  SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this);
1269  if (pLink->IsValidHyperlink())
1270  xRet = pLink;
1271  if( !xRet.is() )
1272  throw css::lang::IndexOutOfBoundsException();
1273  */
1274  return xRet;
1275 }
1276 sal_Int32 SAL_CALL AccessibleShape::getHyperLinkIndex( sal_Int32 )
1277 {
1278  return 0;
1279 }
1280 // XAccessibleText
1281 sal_Int32 SAL_CALL AccessibleShape::getCaretPosition( ){return 0;}
1282 sal_Bool SAL_CALL AccessibleShape::setCaretPosition( sal_Int32 ){return false;}
1283 sal_Unicode SAL_CALL AccessibleShape::getCharacter( sal_Int32 ){return 0;}
1284 css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleShape::getCharacterAttributes( sal_Int32, const css::uno::Sequence< OUString >& )
1285 {
1286  uno::Sequence< css::beans::PropertyValue > aValues(0);
1287  return aValues;
1288 }
1289 css::awt::Rectangle SAL_CALL AccessibleShape::getCharacterBounds( sal_Int32 )
1290 {
1291  return css::awt::Rectangle(0, 0, 0, 0 );
1292 }
1293 sal_Int32 SAL_CALL AccessibleShape::getCharacterCount( ){return 0;}
1294 sal_Int32 SAL_CALL AccessibleShape::getIndexAtPoint( const css::awt::Point& ){return 0;}
1295 OUString SAL_CALL AccessibleShape::getSelectedText( ){return OUString();}
1296 sal_Int32 SAL_CALL AccessibleShape::getSelectionStart( ){return 0;}
1297 sal_Int32 SAL_CALL AccessibleShape::getSelectionEnd( ){return 0;}
1298 sal_Bool SAL_CALL AccessibleShape::setSelection( sal_Int32, sal_Int32 ){return true;}
1299 OUString SAL_CALL AccessibleShape::getText( ){return OUString();}
1300 OUString SAL_CALL AccessibleShape::getTextRange( sal_Int32, sal_Int32 ){return OUString();}
1301 css::accessibility::TextSegment SAL_CALL AccessibleShape::getTextAtIndex( sal_Int32, sal_Int16 )
1302 {
1303  css::accessibility::TextSegment aResult;
1304  return aResult;
1305 }
1306 css::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBeforeIndex( sal_Int32, sal_Int16 )
1307 {
1308  css::accessibility::TextSegment aResult;
1309  return aResult;
1310 }
1311 css::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBehindIndex( sal_Int32, sal_Int16 )
1312 {
1313  css::accessibility::TextSegment aResult;
1314  return aResult;
1315 }
1316 sal_Bool SAL_CALL AccessibleShape::copyText( sal_Int32, sal_Int32 ){return true;}
1317 sal_Bool SAL_CALL AccessibleShape::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ){return false;}
1318 
1319 } // end of namespace accessibility
1320 
1321 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
uno::Reference< drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj) noexcept
returns a StarOffice API wrapper for the given SdrObject
Definition: unoshape.cxx:4009
sal_Int32 nIndex
virtual OUString SAL_CALL getSelectedText() override
void SetAlpha(sal_uInt8 nAlpha)
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual void SAL_CALL disposing() override
This method is called from the component helper base class while disposing.
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nSelectedChildIndex) override
UNO3_GETIMPLEMENTATION_IMPL(SvxDrawPage)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getGroupPosition(const css::uno::Any &rAny) override
virtual sal_Int32 SAL_CALL getHyperLinkCount() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rxListener) override
This call is forwarded to a) the base class and b) to the accessible edit engine if it is present...
Helper class for objects containing EditEngine/Outliner text.
vcl::Window * GetWindow() const
Return the current Window.
css::uno::Reference< css::accessibility::XAccessibleStateSet > mxStateSet
virtual void SAL_CALL selectAllAccessibleChildren() override
SdrView * GetSdrView() const
Return the current SdrView.
virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override
sal_Int32 m_nIndexInParent
the index in parent.
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
Definition: unoshape.cxx:4016
OUString GetDescription() const
Definition: svdobj.cxx:890
WeakReference< XInterface > mxParent
The AccessibleChildrenManager class acts as a cache of the accessible objects of the currently visibl...
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:822
void SetAccessibleDescription(const OUString &rsDescription, StringOrigin eDescriptionOrigin)
size_t GetObjCount() const
Definition: svdpage.cxx:816
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual void SAL_CALL release() noexcept override
virtual sal_Int32 SAL_CALL getCaretPosition() override
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
void UpdateNameAndDescription()
Call this method when the title, name, or description of the mxShape member (may) have been changed...
virtual OUString CreateAccessibleBaseName()
Create a base name string that contains the accessible name.
virtual sal_Int32 SAL_CALL getBackground() override
void CommitChange(sal_Int16 aEventId, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue)
float x
bool GetState(sal_Int16 aState)
Return the state of the specified state.
virtual css::awt::Size SAL_CALL getSize() override
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:748
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &rxListener) override
This call is forwarded to a) the base class and b) to the accessible edit engine if it is present...
virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) override
uno::Reference< drawing::XShape > const mxShape
IAccessibleParent * mpParent
This object can be used to modify the child list of our parent.
mutable::osl::Mutex maMutex
sal_uInt16 sal_Unicode
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
virtual sal_Bool SAL_CALL scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override
virtual OUString SAL_CALL getObjectLink(const css::uno::Any &accoject) override
void SetModelBroadcaster(const css::uno::Reference< css::document::XShapeEventBroadcaster > &rxModelBroadcaster)
Set a new broadcaster that sends events indicating shape changes.
int nCount
virtual OUString SAL_CALL getAccessibleName() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
The implementation below is at the moment straightforward.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
constexpr tools::Long getHeight() const
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Return this object's role.
virtual css::uno::Reference< css::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink(sal_Int32 nLinkIndex) override
std::unique_ptr< ChildrenManager > mpChildrenManager
Children manager. May be empty if there are no children.
virtual ~AccessibleShape() override
The destructor releases its children manager and text engine if still existent.
virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
float y
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual OUString SAL_CALL getText() override
AccessibleShape(const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo)
Create a new accessible object that makes the given shape accessible.
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual sal_Int32 SAL_CALL getSelectionEnd() override
css::uno::Reference< css::drawing::XShape > mxShape
Reference to the actual shape.
int i
bool GetState(sal_Int16 aState)
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
OUString sName
OUString GetFullAccessibleName(AccessibleShape *shape)
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
float u
OUString GetTitle() const
Definition: svdobj.cxx:846
unsigned char sal_Bool
static ShapeTypeHandler & Instance()
This function returns a reference to the only instance of this class.
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
Definition: svdobj.cxx:900
virtual sal_Int32 SAL_CALL getSelectionStart() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
void UpdateStates()
Update the OPAQUE and SELECTED state.
css::uno::Type const & get()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
static OUString CreateAccessibleBaseName(const css::uno::Reference< css::drawing::XShape > &rxShape)
get the accessible base name for an object
virtual void SAL_CALL acquire() noexcept override
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &...rSn)
Abstract DrawObject.
Definition: svdobj.hxx:259
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual Point LogicToPixel(const Point &rPoint) const =0
Transform the specified point from internal coordinates in 100th of mm to an absolute screen position...
virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessibleCaption(const css::uno::Reference< css::drawing::XShape > &)
exports com.sun.star. style
OUString GetName() const
Definition: svdobj.cxx:802
std::unique_ptr< AccessibleTextHelper > mpText
The accessible text engine.
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
Return this objects index among the parents children.
AccessibleShapeTreeInfo maShapeTreeInfo
Bundle of information passed to all shapes in a document tree.
virtual sal_Int32 SAL_CALL getCharacterCount() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
This base class provides a base implementation for all shapes.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Return the specified child.
RegionData_Impl * mpParent
bool CanCreateEditOutlinerParaObject() const
Definition: svdotext.cxx:864
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Return the set of current states.
const css::uno::Reference< css::document::XShapeEventBroadcaster > & GetModelBroadcaster() const
Return the current model broadcaster.
virtual OUString CreateAccessibleName() override
Create a unique name string that contains the accessible name.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
unsigned char sal_uInt8
ShapeTypeId GetTypeId(const OUString &aServiceName) const
Determines the type id of a shape with the given service name.
#define SAL_INFO(area, stream)
const css::uno::Reference< css::accessibility::XAccessibleComponent > & GetDocumentWindow() const
Deprecated.
::OutputDevice const * GetOutDev() const
virtual css::awt::Point SAL_CALL getLocation() override
virtual void SAL_CALL notifyShapeEvent(const css::document::EventObject &rEventObject) override
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Return the number of currently visible children.
virtual void Init()
Initialize a new shape.
const IAccessibleViewForwarder * GetViewForwarder() const
Return the current view forwarder.
virtual bool ResetState(sal_Int16 aState) override
Reset the specified state.
SdrObject * getParentSdrObjectFromSdrObject() const
Definition: svdobj.cxx:753
virtual bool SetState(sal_Int16 aState) override
Set the specified state.
virtual bool SetState(sal_Int16 aState)
virtual void SAL_CALL clearAccessibleSelection() override
This class is a container for the information specific for a single shape that is passed to the const...
#define SAL_WARN(area, stream)
virtual sal_Int32 SAL_CALL getHyperLinkIndex(sal_Int32 nCharIndex) override
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
constexpr tools::Long getWidth() const
virtual bool ResetState(sal_Int16 aState)
void SetAccessibleName(const OUString &rsName, StringOrigin eNameOrigin)
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual css::awt::Rectangle SAL_CALL getBounds() override
SdrObject * m_pShape
This object can be removed when we have an extra interface to ask if the shape is selected...
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes(sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
bool HasFocus() const
void AddState(sal_Int16 aState)
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override
virtual OutlinerParaObject * GetOutlinerParaObject() const
Definition: svdobj.cxx:1837
virtual sal_Int32 SAL_CALL getForeground() override
This class bundles all information that is passed down the tree of accessible shapes so that each sha...
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override
virtual OUString SAL_CALL getAccessibleDescription() override
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
sal_uInt16 nPos
bool IsObjMarked(SdrObject const *pObj) const
Definition: svdmrkv.cxx:2150
virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point &aPoint) override
void RemoveState(sal_Int16 aState)