xref: /trunk/main/sw/source/core/access/accdoc.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
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     // overwrite the children methods
158     //-----IAccessibility2 Implementation 2009
159 
160     //=====  XServiceInfo  ====================================================
161 
162     /** Returns an identifier for the implementation of this object.
163     */
164     virtual ::rtl::OUString SAL_CALL
165         getImplementationName (void)
166         throw (::com::sun::star::uno::RuntimeException);
167 
168     /** Return whether the specified service is supported by this class.
169     */
170     virtual sal_Bool SAL_CALL
171         supportsService (const ::rtl::OUString& sServiceName)
172         throw (::com::sun::star::uno::RuntimeException);
173 
174     /** Returns a list of all supported services.  In this case that is just
175         the AccessibleContext service.
176     */
177     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
178         getSupportedServiceNames (void)
179         throw (::com::sun::star::uno::RuntimeException);
180 
181     //=====  XInterface  ======================================================
182 
183     // XInterface is inherited through SwAcessibleContext and
184     // XAccessibleSelection. These methods are needed to avoid
185     // ambigiouties.
186 
187     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
188         const ::com::sun::star::uno::Type& aType )
189         throw (::com::sun::star::uno::RuntimeException);
190 
191     virtual void SAL_CALL acquire(  ) throw ()
192         { SwAccessibleContext::acquire(); };
193 
194     virtual void SAL_CALL release(  ) throw ()
195         { SwAccessibleContext::release(); };
196 
197     //====== XTypeProvider ====================================================
198     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
199     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
200 
201     //=====  XAccessibleSelection  ============================================
202 
203     virtual void SAL_CALL selectAccessibleChild(
204         sal_Int32 nChildIndex )
205         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
206                 ::com::sun::star::uno::RuntimeException );
207 
208     virtual sal_Bool SAL_CALL isAccessibleChildSelected(
209         sal_Int32 nChildIndex )
210         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
211                 ::com::sun::star::uno::RuntimeException );
212     virtual void SAL_CALL clearAccessibleSelection(  )
213         throw ( ::com::sun::star::uno::RuntimeException );
214     virtual void SAL_CALL selectAllAccessibleChildren(  )
215         throw ( ::com::sun::star::uno::RuntimeException );
216     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  )
217         throw ( ::com::sun::star::uno::RuntimeException );
218     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
219         sal_Int32 nSelectedChildIndex )
220         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
221                 ::com::sun::star::uno::RuntimeException);
222 
223     // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
224     virtual void SAL_CALL deselectAccessibleChild(
225         sal_Int32 nChildIndex )
226         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
227                 ::com::sun::star::uno::RuntimeException );
228 
229     //IAccessibility2 Implementation 2009-----
230     virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
231         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
232     //====== thread safe C++ interface ========================================
233 
234     // The object is not visible an longer and should be destroyed
235     virtual void Dispose( sal_Bool bRecursive = sal_False );
236 
237     //=====  XAccessibleComponent  ============================================
238     sal_Int32 SAL_CALL getBackground()
239         throw (::com::sun::star::uno::RuntimeException);
240 
241     //=====  XAccessibleGetAccFlowTo  ============================================
242     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
243         SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
244         throw ( ::com::sun::star::uno::RuntimeException );
245     //-----IAccessibility2 Implementation 2009
246 };
247 
248 #endif
249 
250