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: accdoc.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 ************************************************************************/
32 #ifndef _ACCCONTEXT_HXX
33 #include "acccontext.hxx"
35 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
36 #include <accselectionhelper.hxx>
41 * base class for SwAccessibleDocument (in this same header file) and
44 class SwAccessibleDocumentBase
: public SwAccessibleContext
46 ::com::sun::star::uno::Reference
<
47 ::com::sun::star::accessibility::XAccessible
> mxParent
;
49 Window
* mpChildWin
; // protected by solar mutext
51 using SwAccessibleFrame::SetVisArea
;
55 virtual ~SwAccessibleDocumentBase();
59 SwAccessibleDocumentBase( SwAccessibleMap
* pInitMap
);
63 virtual void AddChild( Window
*pWin
, sal_Bool bFireEvent
= sal_True
);
64 virtual void RemoveChild( Window
*pWin
);
66 //===== XAccessibleContext ==============================================
68 /// Return the number of currently visible children.
69 virtual sal_Int32 SAL_CALL
getAccessibleChildCount (void)
70 throw (::com::sun::star::uno::RuntimeException
);
72 /// Return the specified child or NULL if index is invalid.
73 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
74 getAccessibleChild (sal_Int32 nIndex
)
75 throw (::com::sun::star::uno::RuntimeException
,
76 ::com::sun::star::lang::IndexOutOfBoundsException
);
78 /// Return a reference to the parent.
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
80 getAccessibleParent (void)
81 throw (::com::sun::star::uno::RuntimeException
);
83 /// Return this objects index among the parents children.
84 virtual sal_Int32 SAL_CALL
85 getAccessibleIndexInParent (void)
86 throw (::com::sun::star::uno::RuntimeException
);
88 /// Return this object's description.
89 virtual ::rtl::OUString SAL_CALL
90 getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException
);
92 //===== XAccessibleComponent ==============================================
93 virtual sal_Bool SAL_CALL
containsPoint(
94 const ::com::sun::star::awt::Point
& aPoint
)
95 throw (::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::uno::Reference
<
98 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint(
99 const ::com::sun::star::awt::Point
& aPoint
)
100 throw (::com::sun::star::uno::RuntimeException
);
102 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds()
103 throw (::com::sun::star::uno::RuntimeException
);
105 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation()
106 throw (::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen()
109 throw (::com::sun::star::uno::RuntimeException
);
111 virtual ::com::sun::star::awt::Size SAL_CALL
getSize()
112 throw (::com::sun::star::uno::RuntimeException
);
118 * access to an accessible Writer document
120 class SwAccessibleDocument
: public SwAccessibleDocumentBase
,
121 public com::sun::star::accessibility::XAccessibleSelection
123 // Implementation for XAccessibleSelection interface
124 SwAccessibleSelectionHelper maSelectionHelper
;
128 // Set states for getAccessibleStateSet.
129 // This drived class additinaly sets MULTISELECTABLE(1)
130 virtual void GetStates( ::utl::AccessibleStateSetHelper
& rStateSet
);
132 virtual ~SwAccessibleDocument();
136 SwAccessibleDocument( SwAccessibleMap
* pInitMap
);
138 DECL_LINK( WindowChildEventListener
, VclSimpleEvent
* );
140 //===== XServiceInfo ====================================================
142 /** Returns an identifier for the implementation of this object.
144 virtual ::rtl::OUString SAL_CALL
145 getImplementationName (void)
146 throw (::com::sun::star::uno::RuntimeException
);
148 /** Return whether the specified service is supported by this class.
150 virtual sal_Bool SAL_CALL
151 supportsService (const ::rtl::OUString
& sServiceName
)
152 throw (::com::sun::star::uno::RuntimeException
);
154 /** Returns a list of all supported services. In this case that is just
155 the AccessibleContext service.
157 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
158 getSupportedServiceNames (void)
159 throw (::com::sun::star::uno::RuntimeException
);
161 //===== XInterface ======================================================
163 // XInterface is inherited through SwAcessibleContext and
164 // XAccessibleSelection. These methods are needed to avoid
167 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
168 const ::com::sun::star::uno::Type
& aType
)
169 throw (::com::sun::star::uno::RuntimeException
);
171 virtual void SAL_CALL
acquire( ) throw ()
172 { SwAccessibleContext::acquire(); };
174 virtual void SAL_CALL
release( ) throw ()
175 { SwAccessibleContext::release(); };
177 //====== XTypeProvider ====================================================
178 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
179 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
);
181 //===== XAccessibleSelection ============================================
183 virtual void SAL_CALL
selectAccessibleChild(
184 sal_Int32 nChildIndex
)
185 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
186 ::com::sun::star::uno::RuntimeException
);
188 virtual sal_Bool SAL_CALL
isAccessibleChildSelected(
189 sal_Int32 nChildIndex
)
190 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
191 ::com::sun::star::uno::RuntimeException
);
192 virtual void SAL_CALL
clearAccessibleSelection( )
193 throw ( ::com::sun::star::uno::RuntimeException
);
194 virtual void SAL_CALL
selectAllAccessibleChildren( )
195 throw ( ::com::sun::star::uno::RuntimeException
);
196 virtual sal_Int32 SAL_CALL
getSelectedAccessibleChildCount( )
197 throw ( ::com::sun::star::uno::RuntimeException
);
198 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getSelectedAccessibleChild(
199 sal_Int32 nSelectedChildIndex
)
200 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
201 ::com::sun::star::uno::RuntimeException
);
203 // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
204 virtual void SAL_CALL
deselectAccessibleChild(
205 sal_Int32 nChildIndex
)
206 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
207 ::com::sun::star::uno::RuntimeException
);
209 //====== thread safe C++ interface ========================================
211 // The object is not visible an longer and should be destroyed
212 virtual void Dispose( sal_Bool bRecursive
= sal_False
);