1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleImageBullet.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
32 #define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
34 #include <tools/gen.hxx>
35 #include <cppuhelper/weakref.hxx>
36 #include <cppuhelper/implbase5.hxx>
38 #ifndef _CPPUHELPER_INTERFACECONTAINER_H_
39 #include <cppuhelper/interfacecontainer.hxx>
41 #include <com/sun/star/uno/Reference.hxx>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/accessibility/XAccessible.hpp>
44 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
45 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
46 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
47 #include "AccessibleParaManager.hxx"
48 #include <svx/unoedsrc.hxx>
50 namespace accessibility
52 typedef ::cppu::WeakImplHelper5
< ::com::sun::star::accessibility::XAccessible
,
53 ::com::sun::star::accessibility::XAccessibleContext
,
54 ::com::sun::star::accessibility::XAccessibleComponent
,
55 ::com::sun::star::accessibility::XAccessibleEventBroadcaster
,
56 ::com::sun::star::lang::XServiceInfo
> AccessibleImageBulletInterfaceBase
;
58 /** This class implements the image bullets for the EditEngine/Outliner UAA
60 class AccessibleImageBullet
: public AccessibleImageBulletInterfaceBase
64 /// Create accessible object for given parent
65 AccessibleImageBullet ( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& rParent
);
67 virtual ~AccessibleImageBullet ();
70 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface (const ::com::sun::star::uno::Type
& rType
) throw (::com::sun::star::uno::RuntimeException
);
73 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException
);
76 virtual sal_Int32 SAL_CALL
getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException
);
77 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
);
78 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleParent() throw (::com::sun::star::uno::RuntimeException
);
79 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException
);
80 virtual sal_Int16 SAL_CALL
getAccessibleRole() throw (::com::sun::star::uno::RuntimeException
);
81 /// Maximal length of text returned by getAccessibleDescription()
82 enum { MaxDescriptionLen
= 40 };
83 virtual ::rtl::OUString SAL_CALL
getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException
);
84 virtual ::rtl::OUString SAL_CALL
getAccessibleName() throw (::com::sun::star::uno::RuntimeException
);
85 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException
);
86 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException
);
87 virtual ::com::sun::star::lang::Locale SAL_CALL
getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException
, ::com::sun::star::uno::RuntimeException
);
89 // XAccessibleEventBroadcaster
90 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
91 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
93 // XAccessibleComponent
94 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
95 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
);
96 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
99 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
grabFocus( ) throw (::com::sun::star::uno::RuntimeException
);
101 virtual sal_Int32 SAL_CALL
getForeground( ) throw (::com::sun::star::uno::RuntimeException
);
102 virtual sal_Int32 SAL_CALL
getBackground( ) throw (::com::sun::star::uno::RuntimeException
);
105 virtual ::rtl::OUString SAL_CALL
getImplementationName (void) throw (::com::sun::star::uno::RuntimeException
);
106 virtual sal_Bool SAL_CALL
supportsService (const ::rtl::OUString
& sServiceName
) throw (::com::sun::star::uno::RuntimeException
);
107 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException
);
110 virtual ::rtl::OUString SAL_CALL
getServiceName (void) throw (::com::sun::star::uno::RuntimeException
);
112 /** Set the current index in the accessibility parent
114 @attention This method does not lock the SolarMutex,
115 leaving that to the calling code. This is because only
116 there potential deadlock situations can be resolved. Thus,
117 make sure SolarMutex is locked when calling this.
119 void SetIndexInParent( sal_Int32 nIndex
);
121 /** Get the current index in the accessibility parent
123 @attention This method does not lock the SolarMutex,
124 leaving that to the calling code. This is because only
125 there potential deadlock situations can be resolved. Thus,
126 make sure SolarMutex is locked when calling this.
128 sal_Int32
GetIndexInParent() const;
130 /** Set the edit engine offset
132 @attention This method does not lock the SolarMutex,
133 leaving that to the calling code. This is because only
134 there potential deadlock situations can be resolved. Thus,
135 make sure SolarMutex is locked when calling this.
137 void SetEEOffset( const Point
& rOffset
);
139 /** Set the EditEngine offset
141 @attention This method does not lock the SolarMutex,
142 leaving that to the calling code. This is because only
143 there potential deadlock situations can be resolved. Thus,
144 make sure SolarMutex is locked when calling this.
146 void SetEditSource( SvxEditSource
* pEditSource
);
148 /** Dispose this object
150 Notifies and deregisters the listeners, drops all references.
154 /** Set the current paragraph number
156 @attention This method does not lock the SolarMutex,
157 leaving that to the calling code. This is because only
158 there potential deadlock situations can be resolved. Thus,
159 make sure SolarMutex is locked when calling this.
161 void SetParagraphIndex( sal_Int32 nIndex
);
163 /** Query the current paragraph number (0 - nParas-1)
165 @attention This method does not lock the SolarMutex,
166 leaving that to the calling code. This is because only
167 there potential deadlock situations can be resolved. Thus,
168 make sure SolarMutex is locked when calling this.
170 sal_Int32
GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
172 /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
173 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;
177 // declared, but not defined
178 AccessibleImageBullet( const AccessibleImageBullet
& );
179 AccessibleImageBullet
& operator= ( const AccessibleImageBullet
& );
181 // syntactic sugar for FireEvent
182 void GotPropertyEvent( const ::com::sun::star::uno::Any
& rNewValue
, const sal_Int16 nEventId
) const;
183 void LostPropertyEvent( const ::com::sun::star::uno::Any
& rOldValue
, const sal_Int16 nEventId
) const;
185 // maintain state set and send STATE_CHANGE events
186 void SetState( const sal_Int16 nStateId
);
187 void UnSetState( const sal_Int16 nStateId
);
189 SvxEditSource
& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
191 int getNotifierClientId() const;
193 /** Query the SvxTextForwarder for EditEngine access.
195 @attention This method does not lock the SolarMutex,
196 leaving that to the calling code. This is because only
197 there potential deadlock situations can be resolved. Thus,
198 make sure SolarMutex is locked when calling this.
200 SvxTextForwarder
& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
202 /** Query the SvxViewForwarder for EditEngine access.
204 @attention This method does not lock the SolarMutex,
205 leaving that to the calling code. This is because only
206 there potential deadlock situations can be resolved. Thus,
207 make sure SolarMutex is locked when calling this.
209 SvxViewForwarder
& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException
));
211 const Point
& GetEEOffset() const;
213 // the paragraph index in the edit engine (guarded by solar mutex)
214 sal_Int32 mnParagraphIndex
;
216 // our current index in the parent (guarded by solar mutex)
217 sal_Int32 mnIndexInParent
;
219 // the current edit source (guarded by solar mutex)
220 SvxEditSource
* mpEditSource
;
222 // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
225 // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
226 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> mxStateSet
;
228 mutable osl::Mutex maMutex
;
230 /// The shape we're the accessible for (unguarded)
231 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> mxParent
;
233 /// Our listeners (guarded by maMutex)
234 int mnNotifierClientId
;
237 } // end of namespace accessibility