xref: /AOO41X/main/sw/source/core/access/accdoc.hxx (revision 4d7c9de063a797b8b4f3d45e3561e82ad1f8ef1f)
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 #include <com/sun/star/document/XEventListener.hpp>
30 #include <accselectionhelper.hxx>
31 
32 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
33 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
34 #endif
35 
36 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
37 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
38 #endif
39 
40 class VclSimpleEvent;
41 
42 /**
43  * base class for SwAccessibleDocument (in this same header file) and
44  * SwAccessiblePreview
45  */
46 class SwAccessibleDocumentBase : public SwAccessibleContext
47 {
48     ::com::sun::star::uno::Reference<
49         ::com::sun::star::accessibility::XAccessible> mxParent;
50 
51     Window* mpChildWin; // protected by solar mutext
52 
53     using SwAccessibleFrame::SetVisArea;
54 
55 protected:
56 
57     virtual ~SwAccessibleDocumentBase();
58 
59 public:
60 
61     SwAccessibleDocumentBase( SwAccessibleMap* pInitMap );
62 
63     void SetVisArea();
64 
65     virtual void AddChild( Window *pWin, sal_Bool bFireEvent = sal_True );
66     virtual void RemoveChild( Window *pWin );
67 
68     //=====  XAccessibleContext  ==============================================
69 
70     /// Return the number of currently visible children.
71     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
72         throw (::com::sun::star::uno::RuntimeException);
73 
74     /// Return the specified child or NULL if index is invalid.
75     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
76         getAccessibleChild (sal_Int32 nIndex)
77         throw (::com::sun::star::uno::RuntimeException,
78                 ::com::sun::star::lang::IndexOutOfBoundsException);
79 
80     /// Return a reference to the parent.
81     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
82         getAccessibleParent (void)
83         throw (::com::sun::star::uno::RuntimeException);
84 
85     /// Return this objects index among the parents children.
86     virtual sal_Int32 SAL_CALL
87         getAccessibleIndexInParent (void)
88         throw (::com::sun::star::uno::RuntimeException);
89 
90     /// Return this object's description.
91     virtual ::rtl::OUString SAL_CALL
92         getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
93     virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
94 
95     //=====  XAccessibleComponent  ==============================================
96     virtual sal_Bool SAL_CALL containsPoint(
97             const ::com::sun::star::awt::Point& aPoint )
98         throw (::com::sun::star::uno::RuntimeException);
99 
100     virtual ::com::sun::star::uno::Reference<
101         ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
102                 const ::com::sun::star::awt::Point& aPoint )
103         throw (::com::sun::star::uno::RuntimeException);
104 
105     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
106         throw (::com::sun::star::uno::RuntimeException);
107 
108     virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
109         throw (::com::sun::star::uno::RuntimeException);
110 
111     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
112         throw (::com::sun::star::uno::RuntimeException);
113 
114     virtual ::com::sun::star::awt::Size SAL_CALL getSize()
115         throw (::com::sun::star::uno::RuntimeException);
116 };
117 
118 
119 
120 /**
121  * access to an accessible Writer document
122  */
123 class SwAccessibleDocument : public SwAccessibleDocumentBase,
124                              public com::sun::star::accessibility::XAccessibleSelection,
125                              public com::sun::star::document::XEventListener,
126                              public com::sun::star::accessibility::XAccessibleExtendedAttributes,
127                              public com::sun::star::accessibility::XAccessibleGetAccFlowTo
128 {
129     // Implementation for XAccessibleSelection interface
130     SwAccessibleSelectionHelper maSelectionHelper;
131 
132 protected:
133 
134     // Set states for getAccessibleStateSet.
135     // This drived class additinaly sets MULTISELECTABLE(1)
136     virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
137 
138     virtual ~SwAccessibleDocument();
139 
140 public:
141 
142     SwAccessibleDocument( SwAccessibleMap* pInitMap );
143 
144     DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
145     //=====  XEventListener====================================================
146     virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event )
147             throw (::com::sun::star::uno::RuntimeException);
148     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event )
149             throw (::com::sun::star::uno::RuntimeException);
150 
151     //=====  XServiceInfo  ====================================================
152 
153     /** Returns an identifier for the implementation of this object.
154     */
155     virtual ::rtl::OUString SAL_CALL
156         getImplementationName (void)
157         throw (::com::sun::star::uno::RuntimeException);
158 
159     /** Return whether the specified service is supported by this class.
160     */
161     virtual sal_Bool SAL_CALL
162         supportsService (const ::rtl::OUString& sServiceName)
163         throw (::com::sun::star::uno::RuntimeException);
164 
165     /** Returns a list of all supported services.  In this case that is just
166         the AccessibleContext service.
167     */
168     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
169         getSupportedServiceNames (void)
170         throw (::com::sun::star::uno::RuntimeException);
171 
172     //=====  XInterface  ======================================================
173 
174     // XInterface is inherited through SwAcessibleContext and
175     // XAccessibleSelection. These methods are needed to avoid
176     // ambigiouties.
177 
178     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
179         const ::com::sun::star::uno::Type& aType )
180         throw (::com::sun::star::uno::RuntimeException);
181 
acquire()182     virtual void SAL_CALL acquire(  ) throw ()
183         { SwAccessibleContext::acquire(); };
184 
release()185     virtual void SAL_CALL release(  ) throw ()
186         { SwAccessibleContext::release(); };
187 
188     //====== XTypeProvider ====================================================
189     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
190     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
191 
192     //=====  XAccessibleSelection  ============================================
193 
194     virtual void SAL_CALL selectAccessibleChild(
195         sal_Int32 nChildIndex )
196         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
197                 ::com::sun::star::uno::RuntimeException );
198 
199     virtual sal_Bool SAL_CALL isAccessibleChildSelected(
200         sal_Int32 nChildIndex )
201         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
202                 ::com::sun::star::uno::RuntimeException );
203     virtual void SAL_CALL clearAccessibleSelection(  )
204         throw ( ::com::sun::star::uno::RuntimeException );
205     virtual void SAL_CALL selectAllAccessibleChildren(  )
206         throw ( ::com::sun::star::uno::RuntimeException );
207     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  )
208         throw ( ::com::sun::star::uno::RuntimeException );
209     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
210         sal_Int32 nSelectedChildIndex )
211         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
212                 ::com::sun::star::uno::RuntimeException);
213 
214     // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
215     virtual void SAL_CALL deselectAccessibleChild(
216         sal_Int32 nChildIndex )
217         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
218                 ::com::sun::star::uno::RuntimeException );
219 
220     virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
221         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
222     //====== thread safe C++ interface ========================================
223 
224     // The object is not visible an longer and should be destroyed
225     virtual void Dispose( sal_Bool bRecursive = sal_False );
226 
227     //=====  XAccessibleComponent  ============================================
228     sal_Int32 SAL_CALL getBackground()
229         throw (::com::sun::star::uno::RuntimeException);
230 
231     //=====  XAccessibleGetAccFlowTo  ============================================
232     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
233         SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
234         throw ( ::com::sun::star::uno::RuntimeException );
235 };
236 
237 #endif
238 
239