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: AccessibleSlideView.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 SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_VIEW_HXX
32 #define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_VIEW_HXX
34 #include <cppuhelper/implbase6.hxx>
35 #include <cppuhelper/implbase7.hxx>
36 #include "SlideView.hxx"
37 #include <com/sun/star/lang/XUnoTunnel.hpp>
38 #include <com/sun/star/accessibility/XAccessible.hpp>
39 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
40 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
41 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
42 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
48 class AccessibleSlideView
;
55 // -----------------------------
56 // - AccessibleSlideViewObject -
57 // -----------------------------
59 class AccessibleSlideViewObject
: public ::cppu::WeakImplHelper6
<
60 ::com::sun::star::lang::XUnoTunnel
,
61 ::com::sun::star::accessibility::XAccessible
,
62 ::com::sun::star::accessibility::XAccessibleEventBroadcaster
,
63 ::com::sun::star::accessibility::XAccessibleContext
,
64 ::com::sun::star::accessibility::XAccessibleComponent
,
65 ::com::sun::star::lang::XServiceInfo
>
70 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> mxParent
;
71 AccessibleSlideView
* mpManager
;
72 /// client id in the AccessibleEventNotifier queue
73 sal_uInt32 mnClientId
;
81 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
84 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw( ::com::sun::star::uno::RuntimeException
);
87 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) throw (::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
);
94 virtual sal_Int32 SAL_CALL
getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException
);
95 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
);
96 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException
);
97 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException
);
98 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException
);
99 virtual ::rtl::OUString SAL_CALL
getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException
);
100 virtual ::rtl::OUString SAL_CALL
getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException
);
101 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException
);
102 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException
);
103 virtual ::com::sun::star::lang::Locale SAL_CALL
getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException
, ::com::sun::star::uno::RuntimeException
);
105 // XAccessibleComponent
106 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
107 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
);
108 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
109 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
110 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
111 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
112 virtual void SAL_CALL
grabFocus( ) throw (::com::sun::star::uno::RuntimeException
);
114 virtual sal_Int32 SAL_CALL
getForeground (void)
115 throw (::com::sun::star::uno::RuntimeException
);
117 virtual sal_Int32 SAL_CALL
getBackground (void)
118 throw (::com::sun::star::uno::RuntimeException
);
120 //===== XServiceInfo ====================================================
122 /** Returns an identifier for the implementation of this object.
124 virtual ::rtl::OUString SAL_CALL
125 getImplementationName (void)
126 throw (::com::sun::star::uno::RuntimeException
);
128 /** Return whether the specified service is supported by this class.
130 virtual sal_Bool SAL_CALL
131 supportsService (const ::rtl::OUString
& sServiceName
)
132 throw (::com::sun::star::uno::RuntimeException
);
134 /** Returns a list of all supported services.
136 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
137 getSupportedServiceNames (void)
138 throw (::com::sun::star::uno::RuntimeException
);
142 static AccessibleSlideViewObject
* getImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rxData
) throw();
146 AccessibleSlideViewObject( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& rxParent
, sal_uInt16 nPage
, sal_Bool bVisible
);
147 ~AccessibleSlideViewObject();
149 void FireAccessibleEvent( short nEventId
, const ::com::sun::star::uno::Any
& rOldValue
, const ::com::sun::star::uno::Any
& rNewValue
);
151 /** This method acts like a dispose call. It sends a disposing to all
152 of its listeners. It may be called twice.
154 void Destroyed (void);
156 sal_uInt16
GetPageNum() const { return mnPage
; }
158 void SetVisible( sal_Bool bVisible
);
159 sal_Bool
IsVisible() const;
162 // -----------------------
163 // - AccessibleSlideView -
164 // -----------------------
166 class AccessibleSlideView
: public ::cppu::WeakImplHelper7
<
167 ::com::sun::star::lang::XUnoTunnel
,
168 ::com::sun::star::accessibility::XAccessible
,
169 ::com::sun::star::accessibility::XAccessibleEventBroadcaster
,
170 ::com::sun::star::accessibility::XAccessibleContext
,
171 ::com::sun::star::accessibility::XAccessibleComponent
,
172 ::com::sun::star::accessibility::XAccessibleSelection
,
173 ::com::sun::star::lang::XServiceInfo
>
177 static AccessibleSlideView
* getImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rxData
) throw();
180 SdDrawDocument
& rDoc
,
181 ::sd::SlideView
& rView
,
182 ::sd::Window
& rParentWindow
);
183 virtual ~AccessibleSlideView (void);
185 void FireAccessibleEvent( short nEventId
, const ::com::sun::star::uno::Any
& rOldValue
, const ::com::sun::star::uno::Any
& rNewValue
);
187 /** This method acts like a dispose call. It sends a disposing to all
188 of its listeners. It may be called twice.
190 void Destroyed (void);
192 SdDrawDocument
* GetDrawDocument() const { return mpDoc
; }
193 ::sd::SlideView
* GetSlideView() const { return mpView
; }
194 ::sd::Window
* GetParentWindow() const { return mpParentWindow
; }
196 void SetPageVisible( sal_uInt16 nPage
, sal_Bool bVisible
);
198 void FocusHasChanged( USHORT nOldFocusPage
, USHORT nNewFocusPage
);
202 ::osl::Mutex maMutex
;
203 ::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> > maSlidePageObjects
;
204 SdDrawDocument
* mpDoc
;
205 ::sd::SlideView
* mpView
;
206 ::sd::Window
* mpParentWindow
;
207 /// client id in the AccessibleEventNotifier queue
208 sal_uInt32 mnClientId
;
211 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
212 sal_Int32
ImplGetVisibleChildCount() const;
213 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> ImplGetVisibleChild( sal_Int32 nVisibleChild
) const;
216 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw( ::com::sun::star::uno::RuntimeException
);
219 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException
);
221 // XAccessibleEventBroadcaster
222 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
223 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
225 // XAccessibleContext
226 virtual sal_Int32 SAL_CALL
getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException
);
227 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
);
228 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException
);
229 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException
);
230 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException
);
231 virtual ::rtl::OUString SAL_CALL
getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException
);
232 virtual ::rtl::OUString SAL_CALL
getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException
);
233 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException
);
234 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException
);
235 virtual ::com::sun::star::lang::Locale SAL_CALL
getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException
, ::com::sun::star::uno::RuntimeException
);
237 // XAccessibleComponent
238 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
239 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
);
240 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
241 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
242 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
243 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
244 virtual void SAL_CALL
grabFocus( ) throw (::com::sun::star::uno::RuntimeException
);
246 virtual sal_Int32 SAL_CALL
getForeground (void)
247 throw (::com::sun::star::uno::RuntimeException
);
249 virtual sal_Int32 SAL_CALL
getBackground (void)
250 throw (::com::sun::star::uno::RuntimeException
);
252 // XAccessibleSelection
253 virtual void SAL_CALL
selectAccessibleChild( sal_Int32 nChildIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
254 virtual sal_Bool SAL_CALL
isAccessibleChildSelected( sal_Int32 nChildIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
255 virtual void SAL_CALL
clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException
);
256 virtual void SAL_CALL
selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException
);
257 virtual sal_Int32 SAL_CALL
getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException
);
258 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
259 virtual void SAL_CALL
deselectAccessibleChild( sal_Int32 nSelectedChildIndex
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
261 //===== XServiceInfo ====================================================
263 /** Returns an identifier for the implementation of this object.
265 virtual ::rtl::OUString SAL_CALL
266 getImplementationName (void)
267 throw (::com::sun::star::uno::RuntimeException
);
269 /** Return whether the specified service is supported by this class.
271 virtual sal_Bool SAL_CALL
272 supportsService (const ::rtl::OUString
& sServiceName
)
273 throw (::com::sun::star::uno::RuntimeException
);
275 /** Returns a list of all supported services.
277 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
278 getSupportedServiceNames (void)
279 throw (::com::sun::star::uno::RuntimeException
);