1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
21 #define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
23 #include <tools/gen.hxx>
24 #include <cppuhelper/weakref.hxx>
25 #include <cppuhelper/implbase5.hxx>
27 #include <cppuhelper/interfacecontainer.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/accessibility/XAccessible.hpp>
31 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
32 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
33 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
34 #include "editeng/AccessibleParaManager.hxx"
35 #include <editeng/unoedsrc.hxx>
37 namespace accessibility
39 typedef ::cppu::WeakImplHelper5
< ::com::sun::star::accessibility::XAccessible
,
40 ::com::sun::star::accessibility::XAccessibleContext
,
41 ::com::sun::star::accessibility::XAccessibleComponent
,
42 ::com::sun::star::accessibility::XAccessibleEventBroadcaster
,
43 ::com::sun::star::lang::XServiceInfo
> AccessibleImageBulletInterfaceBase
;
45 /** This class implements the image bullets for the EditEngine/Outliner UAA
47 class AccessibleImageBullet
: public AccessibleImageBulletInterfaceBase
51 /// Create accessible object for given parent
52 AccessibleImageBullet ( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& rParent
);
54 virtual ~AccessibleImageBullet ();
57 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface (const ::com::sun::star::uno::Type
& rType
) throw (::com::sun::star::uno::RuntimeException
);
60 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException
);
63 virtual sal_Int32 SAL_CALL
getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException
);
64 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int32 i
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
65 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleParent() throw (::com::sun::star::uno::RuntimeException
);
66 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException
);
67 virtual sal_Int16 SAL_CALL
getAccessibleRole() throw (::com::sun::star::uno::RuntimeException
);
68 /// Maximal length of text returned by getAccessibleDescription()
69 enum { MaxDescriptionLen
= 40 };
70 virtual OUString SAL_CALL
getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException
);
71 virtual OUString SAL_CALL
getAccessibleName() throw (::com::sun::star::uno::RuntimeException
);
72 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException
);
73 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException
);
74 virtual ::com::sun::star::lang::Locale SAL_CALL
getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException
, ::com::sun::star::uno::RuntimeException
);
76 // XAccessibleEventBroadcaster
77 virtual void SAL_CALL
addAccessibleEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
78 virtual void SAL_CALL
removeAccessibleEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
80 // XAccessibleComponent
81 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
82 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
83 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
84 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
85 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
86 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
87 virtual void SAL_CALL
grabFocus( ) throw (::com::sun::star::uno::RuntimeException
);
88 virtual sal_Int32 SAL_CALL
getForeground( ) throw (::com::sun::star::uno::RuntimeException
);
89 virtual sal_Int32 SAL_CALL
getBackground( ) throw (::com::sun::star::uno::RuntimeException
);
92 virtual OUString SAL_CALL
getImplementationName (void) throw (::com::sun::star::uno::RuntimeException
);
93 virtual sal_Bool SAL_CALL
supportsService (const OUString
& sServiceName
) throw (::com::sun::star::uno::RuntimeException
);
94 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException
);
97 virtual OUString SAL_CALL
getServiceName (void) throw (::com::sun::star::uno::RuntimeException
);
99 /** Set the current index in the accessibility parent
101 @attention This method does not lock the SolarMutex,
102 leaving that to the calling code. This is because only
103 there potential deadlock situations can be resolved. Thus,
104 make sure SolarMutex is locked when calling this.
106 void SetIndexInParent( sal_Int32 nIndex
);
108 /** Set the edit engine offset
110 @attention This method does not lock the SolarMutex,
111 leaving that to the calling code. This is because only
112 there potential deadlock situations can be resolved. Thus,
113 make sure SolarMutex is locked when calling this.
115 void SetEEOffset( const Point
& rOffset
);
117 /** Set the EditEngine offset
119 @attention This method does not lock the SolarMutex,
120 leaving that to the calling code. This is because only
121 there potential deadlock situations can be resolved. Thus,
122 make sure SolarMutex is locked when calling this.
124 void SetEditSource( SvxEditSource
* pEditSource
);
126 /** Dispose this object
128 Notifies and deregisters the listeners, drops all references.
132 /** Set the current paragraph number
134 @attention This method does not lock the SolarMutex,
135 leaving that to the calling code. This is because only
136 there potential deadlock situations can be resolved. Thus,
137 make sure SolarMutex is locked when calling this.
139 void SetParagraphIndex( sal_Int32 nIndex
);
141 /** Query the current paragraph number (0 - nParas-1)
143 @attention This method does not lock the SolarMutex,
144 leaving that to the calling code. This is because only
145 there potential deadlock situations can be resolved. Thus,
146 make sure SolarMutex is locked when calling this.
148 sal_Int32
GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
150 /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
151 virtual void FireEvent(const sal_Int16 nEventId
, const ::com::sun::star::uno::Any
& rNewValue
= ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any
& rOldValue
= ::com::sun::star::uno::Any() ) const;
155 // declared, but not defined
156 AccessibleImageBullet( const AccessibleImageBullet
& );
157 AccessibleImageBullet
& operator= ( const AccessibleImageBullet
& );
159 // syntactic sugar for FireEvent
160 void GotPropertyEvent( const ::com::sun::star::uno::Any
& rNewValue
, const sal_Int16 nEventId
) const;
161 void LostPropertyEvent( const ::com::sun::star::uno::Any
& rOldValue
, const sal_Int16 nEventId
) const;
163 // maintain state set and send STATE_CHANGE events
164 void SetState( const sal_Int16 nStateId
);
165 void UnSetState( const sal_Int16 nStateId
);
167 SvxEditSource
& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
169 int getNotifierClientId() const;
171 /** Query the SvxTextForwarder for EditEngine access.
173 @attention This method does not lock the SolarMutex,
174 leaving that to the calling code. This is because only
175 there potential deadlock situations can be resolved. Thus,
176 make sure SolarMutex is locked when calling this.
178 SvxTextForwarder
& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
180 /** Query the SvxViewForwarder for EditEngine access.
182 @attention This method does not lock the SolarMutex,
183 leaving that to the calling code. This is because only
184 there potential deadlock situations can be resolved. Thus,
185 make sure SolarMutex is locked when calling this.
187 SvxViewForwarder
& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
189 const Point
& GetEEOffset() const;
191 // the paragraph index in the edit engine (guarded by solar mutex)
192 sal_Int32 mnParagraphIndex
;
194 // our current index in the parent (guarded by solar mutex)
195 sal_Int32 mnIndexInParent
;
197 // the current edit source (guarded by solar mutex)
198 SvxEditSource
* mpEditSource
;
200 // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
203 // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
204 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> mxStateSet
;
206 mutable osl::Mutex maMutex
;
208 /// The shape we're the accessible for (unguarded)
209 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> mxParent
;
211 /// Our listeners (guarded by maMutex)
212 int mnNotifierClientId
;
215 } // end of namespace accessibility
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */