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