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