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