xref: /aoo42x/main/sw/source/core/access/accdoc.hxx (revision b3486e44)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _ACCDOC_HXX
24 #define _ACCDOC_HXX
25 #ifndef _ACCCONTEXT_HXX
26 #include "acccontext.hxx"
27 #endif
28 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
29 //IAccessibility2 Implementation 2009-----
30 #include <com/sun/star/document/XEventListener.hpp>
31 #include <accselectionhelper.hxx>
32 
33 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
34 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
35 #endif
36 
37 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
38 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
39 #endif
40 //-----IAccessibility2 Implementation 2009
41 
42 class VclSimpleEvent;
43 
44 /**
45  * base class for SwAccessibleDocument (in this same header file) and
46  * SwAccessiblePreview
47  */
48 class SwAccessibleDocumentBase : public	SwAccessibleContext
49 {
50 	::com::sun::star::uno::Reference<
51         ::com::sun::star::accessibility::XAccessible> mxParent;
52 
53     Window* mpChildWin; // protected by solar mutext
54 
55     using SwAccessibleFrame::SetVisArea;
56 
57 protected:
58 
59 	virtual ~SwAccessibleDocumentBase();
60 
61 public:
62 
63     SwAccessibleDocumentBase( SwAccessibleMap* pInitMap );
64 
65 	void SetVisArea();
66 
67 	virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True );
68 	virtual void RemoveChild( Window *pWin );
69 
70 	//=====  XAccessibleContext  ==============================================
71 
72     ///	Return the number of currently visible children.
73     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
74         throw (::com::sun::star::uno::RuntimeException);
75 
76     ///	Return the specified child or NULL if index is invalid.
77     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
78     	getAccessibleChild (sal_Int32 nIndex)
79         throw (::com::sun::star::uno::RuntimeException,
80 				::com::sun::star::lang::IndexOutOfBoundsException);
81 
82     ///	Return a reference to the parent.
83 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
84     	getAccessibleParent (void)
85         throw (::com::sun::star::uno::RuntimeException);
86 
87     ///	Return this objects index among the parents children.
88 	virtual	sal_Int32 SAL_CALL
89     	getAccessibleIndexInParent (void)
90         throw (::com::sun::star::uno::RuntimeException);
91 
92     ///	Return this object's description.
93 	virtual ::rtl::OUString SAL_CALL
94     	getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
95 	//IAccessibility2 Implementation 2009-----
96 	virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
97 	//-----IAccessibility2 Implementation 2009
98 
99 	//=====  XAccessibleComponent  ==============================================
100     virtual sal_Bool SAL_CALL containsPoint(
101 			const ::com::sun::star::awt::Point& aPoint )
102 		throw (::com::sun::star::uno::RuntimeException);
103 
104     virtual ::com::sun::star::uno::Reference<
105 		::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
106 				const ::com::sun::star::awt::Point& aPoint )
107 		throw (::com::sun::star::uno::RuntimeException);
108 
109     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
110 		throw (::com::sun::star::uno::RuntimeException);
111 
112     virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
113 		throw (::com::sun::star::uno::RuntimeException);
114 
115     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
116 		throw (::com::sun::star::uno::RuntimeException);
117 
118     virtual ::com::sun::star::awt::Size SAL_CALL getSize()
119 		throw (::com::sun::star::uno::RuntimeException);
120 };
121 
122 
123 
124 /**
125  * access to an accessible Writer document
126  */
127 class SwAccessibleDocument : public	SwAccessibleDocumentBase,
128                              public com::sun::star::accessibility::XAccessibleSelection,
129 							 //IAccessibility2 Implementation 2009-----
130                              public com::sun::star::document::XEventListener,
131 							 public com::sun::star::accessibility::XAccessibleExtendedAttributes,
132 							 //-----IAccessibility2 Implementation 2009
133 							 public com::sun::star::accessibility::XAccessibleGetAccFlowTo
134 {
135     // Implementation for XAccessibleSelection interface
136     SwAccessibleSelectionHelper maSelectionHelper;
137 
138 protected:
139 
140 	// Set states for getAccessibleStateSet.
141 	// This drived class additinaly sets MULTISELECTABLE(1)
142 	virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
143 
144 	virtual ~SwAccessibleDocument();
145 
146 public:
147 
148     SwAccessibleDocument( SwAccessibleMap* pInitMap );
149 
150 	DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
151 	//IAccessibility2 Implementation 2009-----
152 	//=====  XEventListener====================================================
153 	virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event )
154 			throw (::com::sun::star::uno::RuntimeException);
155 	virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event )
156 			throw (::com::sun::star::uno::RuntimeException);
157 	//-----IAccessibility2 Implementation 2009
158 
159 	//=====  XServiceInfo  ====================================================
160 
161     /**	Returns an identifier for the implementation of this object.
162     */
163 	virtual ::rtl::OUString SAL_CALL
164     	getImplementationName (void)
165         throw (::com::sun::star::uno::RuntimeException);
166 
167     /**	Return whether the specified service is supported by this class.
168     */
169     virtual sal_Bool SAL_CALL
170     	supportsService (const ::rtl::OUString& sServiceName)
171         throw (::com::sun::star::uno::RuntimeException);
172 
173     /** Returns a list of all supported services.  In this case that is just
174     	the AccessibleContext service.
175     */
176 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
177     	getSupportedServiceNames (void)
178         throw (::com::sun::star::uno::RuntimeException);
179 
180 	//=====  XInterface  ======================================================
181 
182     // XInterface is inherited through SwAcessibleContext and
183     // XAccessibleSelection. These methods are needed to avoid
184     // ambigiouties.
185 
186     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
187         const ::com::sun::star::uno::Type& aType )
188         throw (::com::sun::star::uno::RuntimeException);
189 
190     virtual void SAL_CALL acquire(  ) throw ()
191         { SwAccessibleContext::acquire(); };
192 
193     virtual void SAL_CALL release(  ) throw ()
194         { SwAccessibleContext::release(); };
195 
196 	//====== XTypeProvider ====================================================
197 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
198     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
199 
200 	//=====  XAccessibleSelection  ============================================
201 
202     virtual void SAL_CALL selectAccessibleChild(
203         sal_Int32 nChildIndex )
204         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
205                 ::com::sun::star::uno::RuntimeException );
206 
207     virtual sal_Bool SAL_CALL isAccessibleChildSelected(
208         sal_Int32 nChildIndex )
209         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
210                 ::com::sun::star::uno::RuntimeException );
211     virtual void SAL_CALL clearAccessibleSelection(  )
212         throw ( ::com::sun::star::uno::RuntimeException );
213     virtual void SAL_CALL selectAllAccessibleChildren(  )
214         throw ( ::com::sun::star::uno::RuntimeException );
215     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  )
216         throw ( ::com::sun::star::uno::RuntimeException );
217     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
218         sal_Int32 nSelectedChildIndex )
219         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
220                 ::com::sun::star::uno::RuntimeException);
221 
222     // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
223     virtual void SAL_CALL deselectAccessibleChild(
224         sal_Int32 nChildIndex )
225         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
226                 ::com::sun::star::uno::RuntimeException );
227 
228 	//IAccessibility2 Implementation 2009-----
229     virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
230 		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
231 	//====== thread safe C++ interface ========================================
232 
233 	// The object is not visible an longer and should be destroyed
234 	virtual void Dispose( sal_Bool bRecursive = sal_False );
235 
236 	//=====  XAccessibleComponent  ============================================
237 	sal_Int32 SAL_CALL getBackground()
238 		throw (::com::sun::star::uno::RuntimeException);
239 
240 	//=====  XAccessibleGetAccFlowTo  ============================================
241 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
242 		SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
243 		throw ( ::com::sun::star::uno::RuntimeException );
244 	//-----IAccessibility2 Implementation 2009
245 };
246 
247 #endif
248 
249