25#include <rtl/ustring.hxx>
26#include <com/sun/star/awt/Point.hpp>
27#include <com/sun/star/awt/Rectangle.hpp>
28#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
29#include <com/sun/star/accessibility/AccessibleRole.hpp>
30#include <com/sun/star/accessibility/AccessibleStateType.hpp>
31#include <com/sun/star/accessibility/AccessibleEventId.hpp>
40#include <editeng/editrids.hrc>
55 mpEditSource( nullptr ),
63 mnNotifierClientId(::
comphelper::AccessibleEventNotifier::registerClient())
71 mnStateSet |= AccessibleStateType::VISIBLE;
72 mnStateSet |= AccessibleStateType::SHOWING;
73 mnStateSet |= AccessibleStateType::ENABLED;
74 mnStateSet |= AccessibleStateType::SENSITIVE;
76 catch(
const uno::Exception& ) {}
79 AccessibleImageBullet::~AccessibleImageBullet()
83 if( getNotifierClientId() != -1 )
89 catch(
const uno::Exception& ) {}
93 uno::Reference< XAccessibleContext > SAL_CALL AccessibleImageBullet::getAccessibleContext( )
97 return uno::Reference< XAccessibleContext > (
this );
100 sal_Int64 SAL_CALL AccessibleImageBullet::getAccessibleChildCount()
106 uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleChild( sal_Int64 )
108 throw lang::IndexOutOfBoundsException(
"No children available",
112 uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleParent()
118 sal_Int64 SAL_CALL AccessibleImageBullet::getAccessibleIndexInParent()
121 return mnIndexInParent;
124 sal_Int16 SAL_CALL AccessibleImageBullet::getAccessibleRole()
127 return AccessibleRole::GRAPHIC;
130 OUString SAL_CALL AccessibleImageBullet::getAccessibleDescription()
133 return EditResId(RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION);
136 OUString SAL_CALL AccessibleImageBullet::getAccessibleName()
139 return EditResId(RID_SVXSTR_A11Y_IMAGEBULLET_NAME);
142 uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleImageBullet::getAccessibleRelationSet()
146 return uno::Reference< XAccessibleRelationSet >();
149 sal_Int64 SAL_CALL AccessibleImageBullet::getAccessibleStateSet()
158 lang::Locale SAL_CALL AccessibleImageBullet::getLocale()
164 "AccessibleImageBullet::getLocale: paragraph index value overflow");
170 void SAL_CALL AccessibleImageBullet::addAccessibleEventListener(
const uno::Reference< XAccessibleEventListener >& xListener )
173 if( getNotifierClientId() != -1 )
177 void SAL_CALL AccessibleImageBullet::removeAccessibleEventListener(
const uno::Reference< XAccessibleEventListener >& xListener )
180 if( getNotifierClientId() == -1 )
184 if ( !nListenerCount )
191 mnNotifierClientId = -1;
196 sal_Bool SAL_CALL AccessibleImageBullet::containsPoint(
const awt::Point& rPoint )
202 "AccessibleEditableTextPara::contains: index value overflow");
204 awt::Rectangle aTmpRect = implGetBounds();
206 Point aPoint( rPoint.X, rPoint.Y );
211 uno::Reference< XAccessible > SAL_CALL AccessibleImageBullet::getAccessibleAtPoint(
const awt::Point& )
215 return uno::Reference< XAccessible >();
218 awt::Rectangle SAL_CALL AccessibleImageBullet::getBounds( )
222 return implGetBounds();
224 awt::Rectangle AccessibleImageBullet::implGetBounds( )
228 "AccessibleEditableTextPara::implGetBounds: index value overflow");
241 aRect.
Move( -aParentRect.
Left(), -aParentRect.
Top() );
244 tools::Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
246 GetViewForwarder() );
249 Point aOffset = maEEOffset;
251 return awt::Rectangle( aScreenRect.
Left() + aOffset.
X(),
252 aScreenRect.
Top() + aOffset.
Y(),
257 return awt::Rectangle();
260 awt::Point SAL_CALL AccessibleImageBullet::getLocation( )
265 awt::Rectangle aRect = implGetBounds();
267 return awt::Point( aRect.X, aRect.Y );
270 awt::Point SAL_CALL AccessibleImageBullet::getLocationOnScreen( )
276 uno::Reference< XAccessible > xParent = getAccessibleParent();
279 uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY );
280 if( xParentComponent.is() )
282 awt::Point aRefPoint = xParentComponent->getLocationOnScreen();
283 awt::Point aPoint = getLocation();
284 aPoint.X += aRefPoint.X;
285 aPoint.Y += aRefPoint.Y;
291 throw uno::RuntimeException(
"Cannot access parent",
292 uno::Reference< uno::XInterface >
293 (
static_cast< XAccessible*
> (
this) ) );
296 awt::Size SAL_CALL AccessibleImageBullet::getSize( )
301 awt::Rectangle aRect = implGetBounds();
303 return awt::Size( aRect.Width, aRect.Height );
306 void SAL_CALL AccessibleImageBullet::grabFocus( )
309 throw uno::RuntimeException(
"Not focusable",
310 uno::Reference< uno::XInterface >
311 (
static_cast< XAccessible*
> (
this) ) );
314 sal_Int32 SAL_CALL AccessibleImageBullet::getForeground( )
320 return static_cast<sal_Int32
>(nColor);
323 sal_Int32 SAL_CALL AccessibleImageBullet::getBackground( )
332 return static_cast<sal_Int32
>( aColor );
335 OUString SAL_CALL AccessibleImageBullet::getImplementationName()
338 return "AccessibleImageBullet";
341 sal_Bool SAL_CALL AccessibleImageBullet::supportsService (
const OUString& sServiceName)
347 uno::Sequence< OUString > SAL_CALL AccessibleImageBullet::getSupportedServiceNames()
349 return {
"com.sun.star.accessibility.AccessibleContext" };
352 void AccessibleImageBullet::SetIndexInParent( sal_Int32 nIndex )
358 void AccessibleImageBullet::SetEEOffset(
const Point& rOffset )
361 maEEOffset = rOffset;
364 void AccessibleImageBullet::Dispose()
367 int nClientId( getNotifierClientId() );
371 mnNotifierClientId = -1;
372 mpEditSource =
nullptr;
375 if( nClientId != -1 )
379 uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
384 catch(
const uno::Exception& ) {}
391 mpEditSource = pEditSource;
396 UnSetState( AccessibleStateType::SHOWING );
397 UnSetState( AccessibleStateType::VISIBLE );
398 SetState( AccessibleStateType::INVALID );
399 SetState( AccessibleStateType::DEFUNC );
405 void AccessibleImageBullet::FireEvent(
const sal_Int16 nEventId,
const uno::Any& rNewValue,
const uno::Any& rOldValue )
const
408 uno::Reference < XAccessibleContext > xThis(
const_cast< AccessibleImageBullet*
> (
this)->getAccessibleContext() );
410 AccessibleEventObject
aEvent(xThis, nEventId, rNewValue, rOldValue, -1);
417 void AccessibleImageBullet::SetState(
const sal_Int64 nStateId )
419 if( !(mnStateSet & nStateId) )
421 mnStateSet |= nStateId;
422 FireEvent( AccessibleEventId::STATE_CHANGED,
uno::Any( nStateId ) );
426 void AccessibleImageBullet::UnSetState(
const sal_Int64 nStateId )
428 if( mnStateSet & nStateId )
430 mnStateSet &= ~nStateId;
431 FireEvent( AccessibleEventId::STATE_CHANGED,
uno::Any(),
uno::Any( nStateId ) );
436 void AccessibleImageBullet::SetParagraphIndex( sal_Int32 nIndex )
444 aOldDesc <<= getAccessibleDescription();
445 aOldName <<= getAccessibleName();
447 catch(
const uno::Exception& ) {}
458 FireEvent( AccessibleEventId::DESCRIPTION_CHANGED,
uno::Any( getAccessibleDescription() ), aOldDesc );
459 FireEvent( AccessibleEventId::NAME_CHANGED,
uno::Any( getAccessibleName() ), aOldName );
462 catch(
const uno::Exception& ) {}
470 throw uno::RuntimeException(
"No edit source, object is defunct",
473 return *mpEditSource;
482 if( !pTextForwarder )
483 throw uno::RuntimeException(
"Unable to fetch text forwarder, object is defunct",
487 if( !pTextForwarder->
IsValid() )
488 throw uno::RuntimeException(
"Text forwarder is invalid, object is defunct",
491 return *pTextForwarder;
500 if( !pViewForwarder )
502 throw uno::RuntimeException(
"Unable to fetch view forwarder, object is defunct",
507 if( !pViewForwarder->
IsValid() )
508 throw uno::RuntimeException(
"View forwarder is invalid, object is defunct",
511 return *pViewForwarder;
constexpr OUStringLiteral sServiceName
unotools::WeakReference< AnimationNode > mxParent
static const AllSettings & GetSettings()
void SetAlpha(sal_uInt8 nAlpha)
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
Wrapper class for unified EditEngine/Outliner access.
virtual SvxTextForwarder * GetTextForwarder()=0
Query the text forwarder.
virtual SvxViewForwarder * GetViewForwarder()
Query the view forwarder.
Contains an EditEngine or an Outliner and unifies access to them.
virtual bool IsValid() const =0
Query state of forwarder.
virtual MapMode GetMapMode() const =0
Query the map mode of the underlying EditEngine/Outliner.
virtual EBulletInfo GetBulletInfo(sal_Int32 nPara) const =0
Query information regarding bullets for given paragraph on the underlying edit engine.
virtual tools::Rectangle GetParaBounds(sal_Int32 nPara) const =0
Query the bounding rectangle of the given paragraph.
Encapsulates the document view for the purpose of unified EditEngine/Outliner access.
virtual bool IsValid() const =0
Query state of forwarder.
This class implements the image bullets for the EditEngine/Outliner UAA.
AccessibleImageBullet(css::uno::Reference< css::accessibility::XAccessible > xParent)
Create accessible object for given parent.
static sal_Int32 addEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static void addEvent(const TClientId _nClient, const css::accessibility::AccessibleEventObject &_rEvent)
static sal_Int32 removeEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static void revokeClient(const TClientId _nClient)
static void revokeClientNotifyDisposing(const TClientId _nClient, const css::uno::Reference< css::uno::XInterface > &_rxEventSource)
#define DBG_ASSERT(sCon, aError)
#define EE_PARA_NOT_FOUND
OUString EditResId(TranslateId aId)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
void Dispose(const T &xInterface)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
sal_Int16 mnParagraphIndex