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